diff --git a/core/src/main/java/org/apache/hop/core/BlockingListeningRowSet.java b/core/src/main/java/org/apache/hop/core/BlockingListeningRowSet.java index 3a7e89dce48..1e82c0be904 100644 --- a/core/src/main/java/org/apache/hop/core/BlockingListeningRowSet.java +++ b/core/src/main/java/org/apache/hop/core/BlockingListeningRowSet.java @@ -17,12 +17,11 @@ package org.apache.hop.core; -import org.apache.hop.core.row.IRowMeta; - import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.hop.core.row.IRowMeta; /** * Contains a buffer of rows. Getting rows from the buffer or putting rows in the buffer is @@ -134,7 +133,9 @@ public int size() { return queArray.size(); } - /** @return true if this row set is blocking. */ + /** + * @return true if this row set is blocking. + */ @Override public boolean isBlocking() { return blocking.get(); diff --git a/core/src/main/java/org/apache/hop/core/BlockingRowSet.java b/core/src/main/java/org/apache/hop/core/BlockingRowSet.java index 869630e58db..48ce9a7e87b 100644 --- a/core/src/main/java/org/apache/hop/core/BlockingRowSet.java +++ b/core/src/main/java/org/apache/hop/core/BlockingRowSet.java @@ -17,11 +17,10 @@ package org.apache.hop.core; -import org.apache.hop.core.row.IRowMeta; - import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; +import org.apache.hop.core.row.IRowMeta; /** * Contains a buffer of rows. Getting rows from the buffer or putting rows in the buffer is diff --git a/core/src/main/java/org/apache/hop/core/CheckResult.java b/core/src/main/java/org/apache/hop/core/CheckResult.java index 4308788bc85..093192e6b37 100644 --- a/core/src/main/java/org/apache/hop/core/CheckResult.java +++ b/core/src/main/java/org/apache/hop/core/CheckResult.java @@ -88,13 +88,17 @@ public String toString() { return sb.toString(); } - /** @return the errorCode */ + /** + * @return the errorCode + */ @Override public String getErrorCode() { return errorCode; } - /** @param errorCode the errorCode to set */ + /** + * @param errorCode the errorCode to set + */ @Override public void setErrorCode(String errorCode) { this.errorCode = errorCode; diff --git a/core/src/main/java/org/apache/hop/core/Condition.java b/core/src/main/java/org/apache/hop/core/Condition.java index 0e23db16c01..f2d0e288e0d 100644 --- a/core/src/main/java/org/apache/hop/core/Condition.java +++ b/core/src/main/java/org/apache/hop/core/Condition.java @@ -17,6 +17,13 @@ package org.apache.hop.core; +import static org.apache.hop.core.Condition.Function.EQUAL; +import static org.apache.hop.core.Condition.Function.NOT_NULL; +import static org.apache.hop.core.Condition.Function.NULL; +import static org.apache.hop.core.Condition.Function.TRUE; +import static org.apache.hop.core.Condition.Operator.AND; +import static org.apache.hop.core.Condition.Operator.NONE; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -41,13 +48,6 @@ import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; import org.w3c.dom.Node; -import static org.apache.hop.core.Condition.Function.EQUAL; -import static org.apache.hop.core.Condition.Function.NOT_NULL; -import static org.apache.hop.core.Condition.Function.NULL; -import static org.apache.hop.core.Condition.Function.TRUE; -import static org.apache.hop.core.Condition.Operator.AND; -import static org.apache.hop.core.Condition.Operator.NONE; - /** * This class describes a condition in a general meaning. * diff --git a/core/src/main/java/org/apache/hop/core/Counter.java b/core/src/main/java/org/apache/hop/core/Counter.java index ee25e79e948..8c6702ea446 100644 --- a/core/src/main/java/org/apache/hop/core/Counter.java +++ b/core/src/main/java/org/apache/hop/core/Counter.java @@ -59,47 +59,65 @@ public Counter(long start, long increment, long maximum) { this.maximum = maximum; } - /** @return Returns the counter. */ + /** + * @return Returns the counter. + */ public long getCounter() { return counterValue; } - /** @return Returns the increment. */ + /** + * @return Returns the increment. + */ public long getIncrement() { return increment; } - /** @return Returns the maximum. */ + /** + * @return Returns the maximum. + */ public long getMaximum() { return maximum; } - /** @return Returns the start. */ + /** + * @return Returns the start. + */ public long getStart() { return start; } - /** @return Returns the loop. */ + /** + * @return Returns the loop. + */ public boolean isLoop() { return loop; } - /** @param counter The counter to set. */ + /** + * @param counter The counter to set. + */ public void setCounter(long counter) { this.counterValue = counter; } - /** @param increment The increment to set. */ + /** + * @param increment The increment to set. + */ public void setIncrement(long increment) { this.increment = increment; } - /** @param loop The loop to set. */ + /** + * @param loop The loop to set. + */ public void setLoop(boolean loop) { this.loop = loop; } - /** @param maximum The maximum to set. */ + /** + * @param maximum The maximum to set. + */ public void setMaximum(long maximum) { this.maximum = maximum; } diff --git a/core/src/main/java/org/apache/hop/core/DbCache.java b/core/src/main/java/org/apache/hop/core/DbCache.java index 88672f15c87..5e71467b46a 100644 --- a/core/src/main/java/org/apache/hop/core/DbCache.java +++ b/core/src/main/java/org/apache/hop/core/DbCache.java @@ -17,13 +17,6 @@ package org.apache.hop.core; -import org.apache.hop.core.exception.HopEofException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.logging.LogChannel; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowMeta; - import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; @@ -32,6 +25,12 @@ import java.io.FileOutputStream; import java.util.Enumeration; import java.util.Hashtable; +import org.apache.hop.core.exception.HopEofException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.logging.LogChannel; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowMeta; /** * This class caches database queries so that the same query doesn't get called twice. Queries are diff --git a/core/src/main/java/org/apache/hop/core/DbCacheEntry.java b/core/src/main/java/org/apache/hop/core/DbCacheEntry.java index 92a2d7c3e36..3cc9292fed8 100644 --- a/core/src/main/java/org/apache/hop/core/DbCacheEntry.java +++ b/core/src/main/java/org/apache/hop/core/DbCacheEntry.java @@ -17,12 +17,11 @@ package org.apache.hop.core; -import org.apache.hop.core.exception.HopEofException; -import org.apache.hop.core.exception.HopFileException; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; +import org.apache.hop.core.exception.HopEofException; +import org.apache.hop.core.exception.HopFileException; /** * This class represents a single entry in a database cache. A single entry in this case usually diff --git a/core/src/main/java/org/apache/hop/core/HopAttribute.java b/core/src/main/java/org/apache/hop/core/HopAttribute.java index 9033b4069aa..f26e355159f 100644 --- a/core/src/main/java/org/apache/hop/core/HopAttribute.java +++ b/core/src/main/java/org/apache/hop/core/HopAttribute.java @@ -57,57 +57,77 @@ public void setKey(String key) { this.key = key; } - /** @return the xmlCode */ + /** + * @return the xmlCode + */ @Override public String getXmlCode() { return xmlCode; } - /** @param xmlCode the xmlCode to set */ + /** + * @param xmlCode the xmlCode to set + */ public void setXmlCode(String xmlCode) { this.xmlCode = xmlCode; } - /** @return the description */ + /** + * @return the description + */ @Override public String getDescription() { return description; } - /** @param description the description to set */ + /** + * @param description the description to set + */ public void setDescription(String description) { this.description = description; } - /** @return the tooltip */ + /** + * @return the tooltip + */ @Override public String getTooltip() { return tooltip; } - /** @param tooltip the tooltip to set */ + /** + * @param tooltip the tooltip to set + */ public void setTooltip(String tooltip) { this.tooltip = tooltip; } - /** @return the type */ + /** + * @return the type + */ @Override public int getType() { return type; } - /** @param type the type to set */ + /** + * @param type the type to set + */ public void setType(int type) { this.type = type; } - /** @return the parent */ + /** + * @return the parent + */ @Override public IHopAttribute getParent() { return parent; } - /** @param parent the parent to set */ + /** + * @param parent the parent to set + */ public void setParent(IHopAttribute parent) { this.parent = parent; } diff --git a/core/src/main/java/org/apache/hop/core/HopClientEnvironment.java b/core/src/main/java/org/apache/hop/core/HopClientEnvironment.java index d2fc216f245..3b612b0ef6a 100644 --- a/core/src/main/java/org/apache/hop/core/HopClientEnvironment.java +++ b/core/src/main/java/org/apache/hop/core/HopClientEnvironment.java @@ -17,6 +17,12 @@ package org.apache.hop.core; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.hop.core.database.DatabasePluginType; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -36,13 +42,6 @@ import org.apache.hop.core.vfs.HopVfs; import org.apache.hop.core.vfs.plugin.VfsPluginType; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * This singleton is responsible for initializing the Hop client environment and remembering if it * is initialized. More specifically it loads client plugins like value meta plugins and other core diff --git a/core/src/main/java/org/apache/hop/core/IAttributes.java b/core/src/main/java/org/apache/hop/core/IAttributes.java index 0e9d007b3a1..acc32137182 100644 --- a/core/src/main/java/org/apache/hop/core/IAttributes.java +++ b/core/src/main/java/org/apache/hop/core/IAttributes.java @@ -28,7 +28,9 @@ public interface IAttributes { */ void setAttributesMap(Map> attributesMap); - /** @return All attributes for all attribute groups in one single map. */ + /** + * @return All attributes for all attribute groups in one single map. + */ Map> getAttributesMap(); /** diff --git a/core/src/main/java/org/apache/hop/core/ICheckResult.java b/core/src/main/java/org/apache/hop/core/ICheckResult.java index ec7875b7375..180457cde6d 100644 --- a/core/src/main/java/org/apache/hop/core/ICheckResult.java +++ b/core/src/main/java/org/apache/hop/core/ICheckResult.java @@ -29,23 +29,35 @@ public interface ICheckResult { int TYPE_RESULT_ERROR = 4; - /** @return The type of the Check Result (0-4) */ + /** + * @return The type of the Check Result (0-4) + */ int getType(); - /** @return The internationalized type description */ + /** + * @return The internationalized type description + */ String getTypeDesc(); - /** @return The text of the check result. */ + /** + * @return The text of the check result. + */ String getText(); - /** @return The source of the check result */ + /** + * @return The source of the check result + */ ICheckResultSource getSourceInfo(); - /** @return String description of the check result */ + /** + * @return String description of the check result + */ @Override String toString(); - /** @return The component-specific result code. */ + /** + * @return The component-specific result code. + */ String getErrorCode(); /** diff --git a/core/src/main/java/org/apache/hop/core/ICheckResultSource.java b/core/src/main/java/org/apache/hop/core/ICheckResultSource.java index f0631f00e26..0890ebd7303 100644 --- a/core/src/main/java/org/apache/hop/core/ICheckResultSource.java +++ b/core/src/main/java/org/apache/hop/core/ICheckResultSource.java @@ -22,9 +22,13 @@ * CheckResult remark. */ public interface ICheckResultSource { - /** @return The name of the source generating the CheckResult */ + /** + * @return The name of the source generating the CheckResult + */ String getName(); - /** @return The description of the source generating the CheckResult */ + /** + * @return The description of the source generating the CheckResult + */ String getDescription(); } diff --git a/core/src/main/java/org/apache/hop/core/IHopAttribute.java b/core/src/main/java/org/apache/hop/core/IHopAttribute.java index 4e066fc7ef5..d0a4c3d8e5c 100644 --- a/core/src/main/java/org/apache/hop/core/IHopAttribute.java +++ b/core/src/main/java/org/apache/hop/core/IHopAttribute.java @@ -19,21 +19,33 @@ public interface IHopAttribute { - /** @return the key for this attribute */ + /** + * @return the key for this attribute + */ String getKey(); - /** @return the xmlCode */ + /** + * @return the xmlCode + */ String getXmlCode(); - /** @return the description */ + /** + * @return the description + */ String getDescription(); - /** @return the tooltip */ + /** + * @return the tooltip + */ String getTooltip(); - /** @return the type */ + /** + * @return the type + */ int getType(); - /** @return The parent interface. */ + /** + * @return The parent interface. + */ IHopAttribute getParent(); } diff --git a/core/src/main/java/org/apache/hop/core/IRowSet.java b/core/src/main/java/org/apache/hop/core/IRowSet.java index c9534413e3b..8572bd4d211 100644 --- a/core/src/main/java/org/apache/hop/core/IRowSet.java +++ b/core/src/main/java/org/apache/hop/core/IRowSet.java @@ -17,9 +17,8 @@ package org.apache.hop.core; -import org.apache.hop.core.row.IRowMeta; - import java.util.concurrent.TimeUnit; +import org.apache.hop.core.row.IRowMeta; public interface IRowSet { @@ -67,27 +66,41 @@ public interface IRowSet { */ Object[] getRowWait(long timeout, TimeUnit tu); - /** @return Set indication that there is no more input */ + /** + * @return Set indication that there is no more input + */ void setDone(); - /** @return Returns true if there is no more input and vice versa */ + /** + * @return Returns true if there is no more input and vice versa + */ boolean isDone(); - /** @return Returns the origin transform name. */ + /** + * @return Returns the origin transform name. + */ String getOriginTransformName(); - /** @return Returns the origin transform copy. */ + /** + * @return Returns the origin transform copy. + */ int getOriginTransformCopy(); - /** @return Returns the destination transform name. */ + /** + * @return Returns the destination transform name. + */ String getDestinationTransformName(); - /** @return Returns the destination transform copy. */ + /** + * @return Returns the destination transform copy. + */ int getDestinationTransformCopy(); String getName(); - /** @return Return the size (or max capacity) of the IRowSet */ + /** + * @return Return the size (or max capacity) of the IRowSet + */ int size(); /** @@ -96,19 +109,29 @@ public interface IRowSet { */ void setThreadNameFromToCopy(String from, int fromCopy, String to, int toCopy); - /** @return the rowMeta */ + /** + * @return the rowMeta + */ IRowMeta getRowMeta(); - /** @param rowMeta the rowMeta to set */ + /** + * @param rowMeta the rowMeta to set + */ void setRowMeta(IRowMeta rowMeta); - /** @return the targetHopServer */ + /** + * @return the targetHopServer + */ String getRemoteHopServerName(); - /** @param remoteHopServerName the remote hop server to set */ + /** + * @param remoteHopServerName the remote hop server to set + */ void setRemoteHopServerName(String remoteHopServerName); - /** @return true if this row set is blocking. */ + /** + * @return true if this row set is blocking. + */ boolean isBlocking(); /** Clear this rowset: remove all rows and remove the "done" flag. */ diff --git a/core/src/main/java/org/apache/hop/core/ObjectUsageCount.java b/core/src/main/java/org/apache/hop/core/ObjectUsageCount.java index 6851b59a8ba..188bf3bbf8f 100644 --- a/core/src/main/java/org/apache/hop/core/ObjectUsageCount.java +++ b/core/src/main/java/org/apache/hop/core/ObjectUsageCount.java @@ -71,22 +71,30 @@ public int increment() { return nrUses; } - /** @return the nrUses */ + /** + * @return the nrUses + */ public int getNrUses() { return nrUses; } - /** @param nrUses the nrUses to set */ + /** + * @param nrUses the nrUses to set + */ public void setNrUses(int nrUses) { this.nrUses = nrUses; } - /** @return the objectName */ + /** + * @return the objectName + */ public String getObjectName() { return objectName; } - /** @param objectName the objectName to set */ + /** + * @param objectName the objectName to set + */ public void setObjectName(String objectName) { this.objectName = objectName; } diff --git a/core/src/main/java/org/apache/hop/core/QueueRowSet.java b/core/src/main/java/org/apache/hop/core/QueueRowSet.java index 77ceb43c81e..3591858c445 100644 --- a/core/src/main/java/org/apache/hop/core/QueueRowSet.java +++ b/core/src/main/java/org/apache/hop/core/QueueRowSet.java @@ -17,10 +17,9 @@ package org.apache.hop.core; -import org.apache.hop.core.row.IRowMeta; - import java.util.LinkedList; import java.util.concurrent.TimeUnit; +import org.apache.hop.core.row.IRowMeta; /** * A simplified rowset for transforms for single threaded execution. This row set has no limited diff --git a/core/src/main/java/org/apache/hop/core/Result.java b/core/src/main/java/org/apache/hop/core/Result.java index b3e23b73c14..a34f91f0da1 100644 --- a/core/src/main/java/org/apache/hop/core/Result.java +++ b/core/src/main/java/org/apache/hop/core/Result.java @@ -18,19 +18,18 @@ package org.apache.hop.core; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Node; - import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Node; /** * Describes the result of the execution of a Pipeline or a Job. The information available includes diff --git a/core/src/main/java/org/apache/hop/core/ResultFile.java b/core/src/main/java/org/apache/hop/core/ResultFile.java index 1b0b0464d23..f50eeea5972 100644 --- a/core/src/main/java/org/apache/hop/core/ResultFile.java +++ b/core/src/main/java/org/apache/hop/core/ResultFile.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.Date; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopFileException; import org.apache.hop.core.row.value.ValueMetaDate; @@ -30,8 +31,6 @@ import org.apache.hop.metadata.api.IEnumHasCodeAndDescription; import org.w3c.dom.Node; -import java.util.Date; - /** * This is a result file: a file as a result of the execution of a action, a pipeline transform, * etc. diff --git a/core/src/main/java/org/apache/hop/core/RowMetaAndData.java b/core/src/main/java/org/apache/hop/core/RowMetaAndData.java index 6e79e927a8d..9462a3ba235 100644 --- a/core/src/main/java/org/apache/hop/core/RowMetaAndData.java +++ b/core/src/main/java/org/apache/hop/core/RowMetaAndData.java @@ -17,6 +17,8 @@ package org.apache.hop.core; +import java.math.BigDecimal; +import java.util.Date; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.injection.InjectionTypeConverter; @@ -27,9 +29,6 @@ import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.core.row.value.ValueMetaNone; -import java.math.BigDecimal; -import java.util.Date; - public class RowMetaAndData implements Cloneable { private IRowMeta rowMeta; @@ -70,22 +69,30 @@ public String toString() { } } - /** @return the data */ + /** + * @return the data + */ public Object[] getData() { return data; } - /** @param data the data to set */ + /** + * @param data the data to set + */ public void setData(Object[] data) { this.data = data; } - /** @return the rowMeta */ + /** + * @return the rowMeta + */ public IRowMeta getRowMeta() { return rowMeta; } - /** @param rowMeta the rowMeta to set */ + /** + * @param rowMeta the rowMeta to set + */ public void setRowMeta(IRowMeta rowMeta) { this.rowMeta = rowMeta; } diff --git a/core/src/main/java/org/apache/hop/core/SingleRowRowSet.java b/core/src/main/java/org/apache/hop/core/SingleRowRowSet.java index 9d9d95ef30b..6e47561c0eb 100644 --- a/core/src/main/java/org/apache/hop/core/SingleRowRowSet.java +++ b/core/src/main/java/org/apache/hop/core/SingleRowRowSet.java @@ -17,9 +17,8 @@ package org.apache.hop.core; -import org.apache.hop.core.row.IRowMeta; - import java.util.concurrent.TimeUnit; +import org.apache.hop.core.row.IRowMeta; /** * A simplified rowset for transforms that always only need to only have a single row on input... diff --git a/core/src/main/java/org/apache/hop/core/SourceToTargetMapping.java b/core/src/main/java/org/apache/hop/core/SourceToTargetMapping.java index 02b85e67153..3c7481dd6e9 100644 --- a/core/src/main/java/org/apache/hop/core/SourceToTargetMapping.java +++ b/core/src/main/java/org/apache/hop/core/SourceToTargetMapping.java @@ -32,22 +32,30 @@ public SourceToTargetMapping(int sourcePosition, int targetPosition) { this.targetPosition = targetPosition; } - /** @return Returns the sourcePosition. */ + /** + * @return Returns the sourcePosition. + */ public int getSourcePosition() { return sourcePosition; } - /** @param sourcePosition The sourcePosition to set. */ + /** + * @param sourcePosition The sourcePosition to set. + */ public void setSourcePosition(int sourcePosition) { this.sourcePosition = sourcePosition; } - /** @return Returns the targetPosition. */ + /** + * @return Returns the targetPosition. + */ public int getTargetPosition() { return targetPosition; } - /** @param targetPosition The targetPosition to set. */ + /** + * @param targetPosition The targetPosition to set. + */ public void setTargetPosition(int targetPosition) { this.targetPosition = targetPosition; } diff --git a/core/src/main/java/org/apache/hop/core/SwingUniversalImage.java b/core/src/main/java/org/apache/hop/core/SwingUniversalImage.java index 3b2435ed25f..0223b292f07 100644 --- a/core/src/main/java/org/apache/hop/core/SwingUniversalImage.java +++ b/core/src/main/java/org/apache/hop/core/SwingUniversalImage.java @@ -17,13 +17,12 @@ package org.apache.hop.core; -import org.apache.batik.ext.awt.RenderingHintsKeyExt; - import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.util.Map; import java.util.TreeMap; +import org.apache.batik.ext.awt.RenderingHintsKeyExt; /** * Universal image storage for Swing processing. It contains SVG or bitmap image depends on file and diff --git a/core/src/main/java/org/apache/hop/core/SwingUniversalImageSvg.java b/core/src/main/java/org/apache/hop/core/SwingUniversalImageSvg.java index 3850dd8835d..a3ed20d5352 100644 --- a/core/src/main/java/org/apache/hop/core/SwingUniversalImageSvg.java +++ b/core/src/main/java/org/apache/hop/core/SwingUniversalImageSvg.java @@ -17,6 +17,10 @@ package org.apache.hop.core; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.geom.Dimension2D; +import java.awt.image.BufferedImage; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.DocumentLoader; import org.apache.batik.bridge.GVTBuilder; @@ -24,11 +28,6 @@ import org.apache.batik.gvt.GraphicsNode; import org.apache.hop.core.svg.SvgImage; -import java.awt.Graphics2D; -import java.awt.geom.AffineTransform; -import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; - public class SwingUniversalImageSvg extends SwingUniversalImage { private final SvgImage svg; private final GraphicsNode svgGraphicsNode; diff --git a/core/src/main/java/org/apache/hop/core/TimedRow.java b/core/src/main/java/org/apache/hop/core/TimedRow.java index 0fb4f5eeb30..e35621bcb3b 100644 --- a/core/src/main/java/org/apache/hop/core/TimedRow.java +++ b/core/src/main/java/org/apache/hop/core/TimedRow.java @@ -33,7 +33,9 @@ public TimedRow(Date logDate, Object[] row) { this.row = row; } - /** @param row */ + /** + * @param row + */ public TimedRow(Object[] row) { this.logDate = new Date(); this.row = row; @@ -55,22 +57,30 @@ public String toString() { return str.toString(); } - /** @return the row */ + /** + * @return the row + */ public Object[] getRow() { return row; } - /** @param row the row to set */ + /** + * @param row the row to set + */ public void setRow(Object[] row) { this.row = row; } - /** @return the logDate */ + /** + * @return the logDate + */ public Date getLogDate() { return logDate; } - /** @param logDate the logDate to set */ + /** + * @param logDate the logDate to set + */ public void setLogDate(Date logDate) { this.logDate = logDate; } diff --git a/core/src/main/java/org/apache/hop/core/WriterOutputStream.java b/core/src/main/java/org/apache/hop/core/WriterOutputStream.java index dca3a00f588..07844c44af2 100644 --- a/core/src/main/java/org/apache/hop/core/WriterOutputStream.java +++ b/core/src/main/java/org/apache/hop/core/WriterOutputStream.java @@ -17,11 +17,10 @@ package org.apache.hop.core; -import org.apache.hop.core.util.Utils; - import java.io.IOException; import java.io.OutputStream; import java.io.Writer; +import org.apache.hop.core.util.Utils; /** This class provides a simple wrapper to disguise a Writer as an OutputStream. */ public class WriterOutputStream extends OutputStream { diff --git a/core/src/main/java/org/apache/hop/core/action/GuiContextAction.java b/core/src/main/java/org/apache/hop/core/action/GuiContextAction.java index bba7fb3b26c..6c32b1fcac3 100644 --- a/core/src/main/java/org/apache/hop/core/action/GuiContextAction.java +++ b/core/src/main/java/org/apache/hop/core/action/GuiContextAction.java @@ -17,13 +17,12 @@ package org.apache.hop.core.action; -import org.apache.hop.core.gui.plugin.action.GuiActionType; - import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.apache.hop.core.gui.plugin.action.GuiActionType; /** * This annotation indicated that the annotated method handles an action in a certain context (the diff --git a/core/src/main/java/org/apache/hop/core/config/ConfigFileSerializer.java b/core/src/main/java/org/apache/hop/core/config/ConfigFileSerializer.java index e7f816a3040..d8a98d832c4 100644 --- a/core/src/main/java/org/apache/hop/core/config/ConfigFileSerializer.java +++ b/core/src/main/java/org/apache/hop/core/config/ConfigFileSerializer.java @@ -19,16 +19,15 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.json.HopJson; -import org.apache.hop.core.vfs.HopVfs; - import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.json.HopJson; +import org.apache.hop.core.vfs.HopVfs; public class ConfigFileSerializer implements IHopConfigSerializer { @Override diff --git a/core/src/main/java/org/apache/hop/core/config/ConfigNoFileSerializer.java b/core/src/main/java/org/apache/hop/core/config/ConfigNoFileSerializer.java index 315e319e2a8..c7f9274e3cd 100644 --- a/core/src/main/java/org/apache/hop/core/config/ConfigNoFileSerializer.java +++ b/core/src/main/java/org/apache/hop/core/config/ConfigNoFileSerializer.java @@ -17,11 +17,10 @@ package org.apache.hop.core.config; -import org.apache.hop.core.exception.HopException; - import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.apache.hop.core.exception.HopException; public class ConfigNoFileSerializer implements IHopConfigSerializer { @Override diff --git a/core/src/main/java/org/apache/hop/core/config/DescribedVariablesConfigFile.java b/core/src/main/java/org/apache/hop/core/config/DescribedVariablesConfigFile.java index af96234f587..69e4976f082 100644 --- a/core/src/main/java/org/apache/hop/core/config/DescribedVariablesConfigFile.java +++ b/core/src/main/java/org/apache/hop/core/config/DescribedVariablesConfigFile.java @@ -38,7 +38,9 @@ public String getConfigFilename() { return configFilename; } - /** @param configFilename The configFilename to set */ + /** + * @param configFilename The configFilename to set + */ @Override public void setConfigFilename(String configFilename) { this.configFilename = configFilename; diff --git a/core/src/main/java/org/apache/hop/core/config/HopConfig.java b/core/src/main/java/org/apache/hop/core/config/HopConfig.java index dc697fa28c3..e8a1c737ac4 100644 --- a/core/src/main/java/org/apache/hop/core/config/HopConfig.java +++ b/core/src/main/java/org/apache/hop/core/config/HopConfig.java @@ -18,17 +18,16 @@ package org.apache.hop.core.config; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.hop.core.Const; -import org.apache.hop.core.config.plugin.ConfigFile; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.DescribedVariable; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import org.apache.hop.core.Const; +import org.apache.hop.core.config.plugin.ConfigFile; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.DescribedVariable; /** * This class keeps track of storing and retrieving all the configuration options in Hop. This @@ -202,7 +201,9 @@ public String getConfigFilename() { return configFilename; } - /** @param configFilename The configFilename to set */ + /** + * @param configFilename The configFilename to set + */ @Override public void setConfigFilename(String configFilename) { this.configFilename = configFilename; diff --git a/core/src/main/java/org/apache/hop/core/config/IConfigFile.java b/core/src/main/java/org/apache/hop/core/config/IConfigFile.java index f1253f2c45f..c7a0b68db74 100644 --- a/core/src/main/java/org/apache/hop/core/config/IConfigFile.java +++ b/core/src/main/java/org/apache/hop/core/config/IConfigFile.java @@ -17,9 +17,8 @@ package org.apache.hop.core.config; -import org.apache.hop.core.variables.DescribedVariable; - import java.util.List; +import org.apache.hop.core.variables.DescribedVariable; public interface IConfigFile { diff --git a/core/src/main/java/org/apache/hop/core/config/IHopConfigSerializer.java b/core/src/main/java/org/apache/hop/core/config/IHopConfigSerializer.java index 98506bfc5a4..f48f7be675e 100644 --- a/core/src/main/java/org/apache/hop/core/config/IHopConfigSerializer.java +++ b/core/src/main/java/org/apache/hop/core/config/IHopConfigSerializer.java @@ -17,9 +17,8 @@ package org.apache.hop.core.config; -import org.apache.hop.core.exception.HopException; - import java.util.Map; +import org.apache.hop.core.exception.HopException; public interface IHopConfigSerializer { diff --git a/core/src/main/java/org/apache/hop/core/config/IRestServicesProvider.java b/core/src/main/java/org/apache/hop/core/config/IRestServicesProvider.java index 91fa85deb43..d06a9a4e33d 100644 --- a/core/src/main/java/org/apache/hop/core/config/IRestServicesProvider.java +++ b/core/src/main/java/org/apache/hop/core/config/IRestServicesProvider.java @@ -21,8 +21,10 @@ import java.util.Properties; import org.apache.hop.metadata.api.IHasHopMetadataProvider; -/** This signals that the implementing class provides a Properties object. - * It also needs to be able to handle metadata providers so that plugins can add/remove providers. */ +/** + * This signals that the implementing class provides a Properties object. It also needs to be able + * to handle metadata providers so that plugins can add/remove providers. + */ public interface IRestServicesProvider { Properties getProperties(); diff --git a/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java b/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java index 4bd8220f788..d16578b42de 100644 --- a/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java +++ b/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java @@ -19,8 +19,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.config.ConfigFileSerializer; import org.apache.hop.core.config.ConfigNoFileSerializer; @@ -31,12 +35,6 @@ import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.variables.DescribedVariable; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public abstract class ConfigFile implements IConfigFile { public static final String HOP_VARIABLES_KEY = "variables"; @@ -108,7 +106,7 @@ public List getDescribedVariables() { for (Object dvObject : (List) variablesObject) { String dvJson = new Gson().toJson(dvObject); DescribedVariable describedVariable = - HopJson.newMapper().readValue(dvJson, DescribedVariable.class); + HopJson.newMapper().readValue(dvJson, DescribedVariable.class); variables.add(describedVariable); } } catch (Exception e) { @@ -174,7 +172,9 @@ public void setDescribedVariables(List describedVariables) { @Override public abstract String getConfigFilename(); - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ @Override public abstract void setConfigFilename(String filename); @@ -187,7 +187,9 @@ public Map getConfigMap() { return configMap; } - /** @param configMap The configMap to set */ + /** + * @param configMap The configMap to set + */ public void setConfigMap(Map configMap) { this.configMap = configMap; } @@ -201,7 +203,9 @@ public IHopConfigSerializer getSerializer() { return serializer; } - /** @param serializer The serializer to set */ + /** + * @param serializer The serializer to set + */ public void setSerializer(IHopConfigSerializer serializer) { this.serializer = serializer; } diff --git a/core/src/main/java/org/apache/hop/core/config/plugin/ConfigPluginType.java b/core/src/main/java/org/apache/hop/core/config/plugin/ConfigPluginType.java index 9066053ee28..d00ef7f1ea0 100644 --- a/core/src/main/java/org/apache/hop/core/config/plugin/ConfigPluginType.java +++ b/core/src/main/java/org/apache/hop/core/config/plugin/ConfigPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.config.plugin; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the transform plugin type. */ @PluginMainClassType(IConfigOptions.class) @PluginAnnotationType(ConfigPlugin.class) diff --git a/core/src/main/java/org/apache/hop/core/database/BaseDatabaseMeta.java b/core/src/main/java/org/apache/hop/core/database/BaseDatabaseMeta.java index dc27a3733cc..891f773d6c3 100644 --- a/core/src/main/java/org/apache/hop/core/database/BaseDatabaseMeta.java +++ b/core/src/main/java/org/apache/hop/core/database/BaseDatabaseMeta.java @@ -17,16 +17,6 @@ package org.apache.hop.core.database; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.gui.plugin.GuiElementType; -import org.apache.hop.core.gui.plugin.GuiWidgetElement; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -36,6 +26,15 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.gui.plugin.GuiElementType; +import org.apache.hop.core.gui.plugin.GuiWidgetElement; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.metadata.api.HopMetadataProperty; /** * This class contains the basic information on a database connection. It is not intended to be used @@ -1617,7 +1616,9 @@ public boolean isExasolVariant() { return false; } - /** @return true if the database is a DuckDb variant. */ + /** + * @return true if the database is a DuckDb variant. + */ public boolean isDuckDbVariant() { return false; } diff --git a/core/src/main/java/org/apache/hop/core/database/Catalog.java b/core/src/main/java/org/apache/hop/core/database/Catalog.java index 7f0b23b031e..ac9365da43d 100644 --- a/core/src/main/java/org/apache/hop/core/database/Catalog.java +++ b/core/src/main/java/org/apache/hop/core/database/Catalog.java @@ -17,9 +17,7 @@ package org.apache.hop.core.database; -/** - * Contains the information that's stored in a single catalog. - */ +/** Contains the information that's stored in a single catalog. */ public class Catalog { private String catalogName; private String[] items; @@ -33,22 +31,30 @@ public Catalog(String catalogName) { this(catalogName, new String[] {}); } - /** @return Returns the catalogName. */ + /** + * @return Returns the catalogName. + */ public String getCatalogName() { return catalogName; } - /** @param catalogName The catalogName to set. */ + /** + * @param catalogName The catalogName to set. + */ public void setCatalogName(String catalogName) { this.catalogName = catalogName; } - /** @return Returns the items. */ + /** + * @return Returns the items. + */ public String[] getItems() { return items; } - /** @param items The items to set. */ + /** + * @param items The items to set. + */ public void setItems(String[] items) { this.items = items; } diff --git a/core/src/main/java/org/apache/hop/core/database/Database.java b/core/src/main/java/org/apache/hop/core/database/Database.java index 5e71401f118..234bcbd81a8 100644 --- a/core/src/main/java/org/apache/hop/core/database/Database.java +++ b/core/src/main/java/org/apache/hop/core/database/Database.java @@ -17,6 +17,34 @@ package org.apache.hop.core.database; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.sql.BatchUpdateException; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Savepoint; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -66,35 +94,6 @@ import org.apache.hop.core.vfs.HopVfs; import org.apache.hop.i18n.BaseMessages; -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.sql.BatchUpdateException; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Savepoint; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - /** * Database handles the process of connecting to, reading from, writing to and updating databases. * The database specific parameters are defined in DatabaseInfo. @@ -471,9 +470,7 @@ private void connectUsingClass(String classname, String partitionId) throws HopD } } - /** - * close() and disconnect() are the same. - */ + /** close() and disconnect() are the same. */ @Override public synchronized void close() { disconnect(); diff --git a/core/src/main/java/org/apache/hop/core/database/DatabaseConnectionPoolParameter.java b/core/src/main/java/org/apache/hop/core/database/DatabaseConnectionPoolParameter.java index 9dfb6b4ac74..c8e30fd1852 100644 --- a/core/src/main/java/org/apache/hop/core/database/DatabaseConnectionPoolParameter.java +++ b/core/src/main/java/org/apache/hop/core/database/DatabaseConnectionPoolParameter.java @@ -17,14 +17,13 @@ package org.apache.hop.core.database; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.row.value.ValueMetaString; -import java.util.ArrayList; -import java.util.List; - public class DatabaseConnectionPoolParameter { private String parameter; private String defaultValue; @@ -45,32 +44,44 @@ public DatabaseConnectionPoolParameter( this.description = description; } - /** @return the defaultValue */ + /** + * @return the defaultValue + */ public String getDefaultValue() { return defaultValue; } - /** @param defaultValue the defaultValue to set */ + /** + * @param defaultValue the defaultValue to set + */ public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } - /** @return the description */ + /** + * @return the description + */ public String getDescription() { return description; } - /** @param description the description to set */ + /** + * @param description the description to set + */ public void setDescription(String description) { this.description = description; } - /** @return the parameter */ + /** + * @return the parameter + */ public String getParameter() { return parameter; } - /** @param parameter the parameter to set */ + /** + * @param parameter the parameter to set + */ public void setParameter(String parameter) { this.parameter = parameter; } diff --git a/core/src/main/java/org/apache/hop/core/database/DatabaseFactory.java b/core/src/main/java/org/apache/hop/core/database/DatabaseFactory.java index 8eb2d38f8e9..78115b071b6 100644 --- a/core/src/main/java/org/apache/hop/core/database/DatabaseFactory.java +++ b/core/src/main/java/org/apache/hop/core/database/DatabaseFactory.java @@ -75,24 +75,24 @@ public DatabaseTestResults getConnectionTestResults( return databaseTestResults; } - private StringBuilder appendConnectionInfo(IVariables variables, StringBuilder report, - Database db, DatabaseMeta databaseMeta) { + private StringBuilder appendConnectionInfo( + IVariables variables, StringBuilder report, Database db, DatabaseMeta databaseMeta) { // Check to see if the interface is of a type GenericDatabaseMeta, since it does not have // hostname and port fields - if ( "GENERIC".equals(databaseMeta.getPluginId()) ) { + if ("GENERIC".equals(databaseMeta.getPluginId())) { String customDriverClass = databaseMeta.getAttributes().get(NoneDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS); - append(report, "GenericDatabaseMeta.report.customUrl", - db.resolve(databaseMeta.getManualUrl())); + append( + report, "GenericDatabaseMeta.report.customUrl", db.resolve(databaseMeta.getManualUrl())); append(report, "GenericDatabaseMeta.report.customDriverClass", db.resolve(customDriverClass)); return report; } else { append(report, "DatabaseMeta.report.Hostname", db.resolve(databaseMeta.getHostname())); append(report, "DatabaseMeta.report.Port", db.resolve(databaseMeta.getPort())); - append(report, "DatabaseMeta.report.DatabaseName", - db.resolve(databaseMeta.getDatabaseName())); + append( + report, "DatabaseMeta.report.DatabaseName", db.resolve(databaseMeta.getDatabaseName())); String url = ""; try { diff --git a/core/src/main/java/org/apache/hop/core/database/DatabaseMeta.java b/core/src/main/java/org/apache/hop/core/database/DatabaseMeta.java index 11ce829f1d2..e243bf2f988 100644 --- a/core/src/main/java/org/apache/hop/core/database/DatabaseMeta.java +++ b/core/src/main/java/org/apache/hop/core/database/DatabaseMeta.java @@ -17,6 +17,17 @@ package org.apache.hop.core.database; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.RowMetaAndData; @@ -41,18 +52,6 @@ import org.apache.hop.metadata.api.IHopMetadata; import org.apache.hop.metadata.api.IHopMetadataProvider; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; - /** * This class defines the database specific parameters for a certain database type. It also provides * static information regarding a number of well known databases. @@ -187,7 +186,9 @@ public DatabaseMeta(DatabaseMeta databaseMeta) { replaceMeta(databaseMeta); } - /** @return the system dependend database interface for this database metadata definition */ + /** + * @return the system dependend database interface for this database metadata definition + */ public IDatabase getIDatabase() { return iDatabase; } @@ -319,12 +320,16 @@ public void setValues(DatabaseMeta info) { iDatabase = (IDatabase) info.iDatabase.clone(); } - /** @return The plugin ID of the database interface */ + /** + * @return The plugin ID of the database interface + */ public String getPluginId() { return iDatabase.getPluginId(); } - /** @return The name of the database plugin type */ + /** + * @return The name of the database plugin type + */ public String getPluginName() { return iDatabase.getPluginName(); } @@ -458,12 +463,16 @@ public void setPassword(String password) { iDatabase.setPassword(password); } - /** @param servername the Informix servername */ + /** + * @param servername the Informix servername + */ public void setServername(String servername) { iDatabase.setServername(servername); } - /** @return the Informix servername */ + /** + * @return the Informix servername + */ public String getServername() { return iDatabase.getServername(); } @@ -500,7 +509,9 @@ public void clearChanged() { iDatabase.setChanged(false); } - /** @return A manually entered URL which will be used over the internally generated one */ + /** + * @return A manually entered URL which will be used over the internally generated one + */ public String getManualUrl() { return iDatabase.getManualUrl(); } @@ -517,7 +528,9 @@ public String toString() { return getName(); } - /** @return The extra attributes for this database connection */ + /** + * @return The extra attributes for this database connection + */ public Map getAttributes() { return iDatabase.getAttributes(); } @@ -690,7 +703,9 @@ public String getExtraOptionValueSeparator() { return getIDatabase().getExtraOptionValueSeparator(); } - /** @return all the extra JDBC options, in their original form, for this specific database type */ + /** + * @return all the extra JDBC options, in their original form, for this specific database type + */ public Map getExtraOptionsMap() { Map optionsMap = new HashMap<>(); @@ -764,12 +779,16 @@ public boolean supportsSetLong() { return iDatabase.isSupportsSetLong(); } - /** @return true if the database supports schemas */ + /** + * @return true if the database supports schemas + */ public boolean supportsSchemas() { return iDatabase.isSupportsSchemas(); } - /** @return true if the database supports catalogs */ + /** + * @return true if the database supports catalogs + */ public boolean supportsCatalogs() { return iDatabase.isSupportsCatalogs(); } @@ -1040,7 +1059,8 @@ public String[] checkParameters() { remarks.add(BaseMessages.getString(PKG, "DatabaseMeta.BadConnectionName")); } - if (getIDatabase().isRequiresName() && getIDatabase().getManualUrl().isEmpty() + if (getIDatabase().isRequiresName() + && getIDatabase().getManualUrl().isEmpty() && (getDatabaseName() == null || getDatabaseName().length() == 0)) { remarks.add(BaseMessages.getString(PKG, "DatabaseMeta.BadDatabaseName")); } @@ -1166,22 +1186,30 @@ public String getModifyColumnStatement( return retval; } - /** @return an array of reserved words for the database type... */ + /** + * @return an array of reserved words for the database type... + */ public String[] getReservedWords() { return iDatabase.getReservedWords(); } - /** @return true if reserved words need to be double quoted ("password", "select", ...) */ + /** + * @return true if reserved words need to be double quoted ("password", "select", ...) + */ public boolean quoteReservedWords() { return iDatabase.isQuoteReservedWords(); } - /** @return The start quote sequence, mostly just double quote, but sometimes [, ... */ + /** + * @return The start quote sequence, mostly just double quote, but sometimes [, ... + */ public String getStartQuote() { return iDatabase.getStartQuote(); } - /** @return The end quote sequence, mostly just double quote, but sometimes ], ... */ + /** + * @return The end quote sequence, mostly just double quote, but sometimes ], ... + */ public String getEndQuote() { return iDatabase.getEndQuote(); } @@ -1377,17 +1405,23 @@ public int getNrReservedWords(IRowMeta fields) { return nrReservedWords; } - /** @return a list of types to get the available tables */ + /** + * @return a list of types to get the available tables + */ public String[] getTableTypes() { return iDatabase.getTableTypes(); } - /** @return a list of types to get the available views */ + /** + * @return a list of types to get the available views + */ public String[] getViewTypes() { return iDatabase.getViewTypes(); } - /** @return a list of types to get the available synonyms */ + /** + * @return a list of types to get the available synonyms + */ public String[] getSynonymTypes() { return iDatabase.getSynonymTypes(); } @@ -1400,17 +1434,23 @@ public boolean useSchemaNameForTableList() { return iDatabase.useSchemaNameForTableList(); } - /** @return true if the database supports views */ + /** + * @return true if the database supports views + */ public boolean supportsViews() { return iDatabase.isSupportsViews(); } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ public boolean supportsSynonyms() { return iDatabase.isSupportsSynonyms(); } - /** @return The SQL on this database to get a list of stored procedures. */ + /** + * @return The SQL on this database to get a list of stored procedures. + */ public String getSqlListOfProcedures() { return iDatabase.getSqlListOfProcedures(); } @@ -1451,7 +1491,9 @@ public String getSqlUnlockTables(String[] tableNames) { return iDatabase.getSqlUnlockTables(tableNames); } - /** @return a feature list for the chosen database type. */ + /** + * @return a feature list for the chosen database type. + */ public List getFeatureSummary(IVariables variables) { List list = new ArrayList<>(); RowMetaAndData r = null; @@ -1739,12 +1781,16 @@ public boolean supportsBatchUpdates() { return iDatabase.isSupportsBatchUpdates(); } - /** @return true if the database supports a boolean, bit, logical, ... datatype */ + /** + * @return true if the database supports a boolean, bit, logical, ... datatype + */ public boolean supportsBooleanDataType() { return iDatabase.isSupportsBooleanDataType(); } - /** @param b Set to true if the database supports a boolean, bit, logical, ... datatype */ + /** + * @param b Set to true if the database supports a boolean, bit, logical, ... datatype + */ public void setSupportsBooleanDataType(boolean b) { iDatabase.setSupportsBooleanDataType(b); } @@ -1764,12 +1810,16 @@ public void setSupportsTimestampDataType(boolean b) { iDatabase.setSupportsTimestampDataType(b); } - /** @return true if reserved words' case should be preserved */ + /** + * @return true if reserved words' case should be preserved + */ public boolean preserveReservedCase() { return iDatabase.isPreserveReservedCase(); } - /** @return true if reserved words' case should be preserved */ + /** + * @return true if reserved words' case should be preserved + */ public void setPreserveReservedCase(boolean b) { iDatabase.setPreserveReservedCase(b); } @@ -1786,7 +1836,9 @@ public void quoteReservedWords(IRowMeta fields) { } } - /** @return a map of all the extra URL options you want to set. */ + /** + * @return a map of all the extra URL options you want to set. + */ public Map getExtraOptions() { return iDatabase.getExtraOptions(); } @@ -1799,7 +1851,9 @@ public boolean supportsOptionsInURL() { return iDatabase.isSupportsOptionsInURL(); } - /** @return extra help text on the supported options on the selected database platform. */ + /** + * @return extra help text on the supported options on the selected database platform. + */ public String getExtraOptionsHelpText() { return iDatabase.getExtraOptionsHelpText(); } @@ -1812,12 +1866,16 @@ public boolean supportsGetBlob() { return iDatabase.isSupportsGetBlob(); } - /** @return The SQL to execute right after connecting */ + /** + * @return The SQL to execute right after connecting + */ public String getConnectSql() { return iDatabase.getConnectSql(); } - /** @param sql The SQL to execute right after connecting */ + /** + * @param sql The SQL to execute right after connecting + */ public void setConnectSql(String sql) { iDatabase.setConnectSql(sql); } @@ -1904,32 +1962,44 @@ public void setStreamingResults(boolean useStreaming) { iDatabase.setStreamingResults(useStreaming); } - /** @return true if all fields should always be quoted in db */ + /** + * @return true if all fields should always be quoted in db + */ public boolean isQuoteAllFields() { return iDatabase.isQuoteAllFields(); } - /** @param quoteAllFields true if all fields in DB should be quoted. */ + /** + * @param quoteAllFields true if all fields in DB should be quoted. + */ public void setQuoteAllFields(boolean quoteAllFields) { iDatabase.setQuoteAllFields(quoteAllFields); } - /** @return true if all identifiers should be forced to lower case */ + /** + * @return true if all identifiers should be forced to lower case + */ public boolean isForcingIdentifiersToLowerCase() { return iDatabase.isForcingIdentifiersToLowerCase(); } - /** @param forceLowerCase true if all identifiers should be forced to lower case */ + /** + * @param forceLowerCase true if all identifiers should be forced to lower case + */ public void setForcingIdentifiersToLowerCase(boolean forceLowerCase) { iDatabase.setForcingIdentifiersToLowerCase(forceLowerCase); } - /** @return true if all identifiers should be forced to upper case */ + /** + * @return true if all identifiers should be forced to upper case + */ public boolean isForcingIdentifiersToUpperCase() { return iDatabase.isForcingIdentifiersToUpperCase(); } - /** @param forceUpperCase true if all identifiers should be forced to upper case */ + /** + * @param forceUpperCase true if all identifiers should be forced to upper case + */ public void setForcingIdentifiersToUpperCase(boolean forceUpperCase) { iDatabase.setForcingIdentifiersToUpperCase(forceUpperCase); } @@ -1970,7 +2040,9 @@ public static int indexOfName(String[] databaseNames, String name) { return -1; } - /** @return the SQL Server instance */ + /** + * @return the SQL Server instance + */ public String getSqlServerInstance() { // This is also covered/persisted by JDBC option MS SQL Server / instancename / // We want to return @@ -1978,7 +2050,9 @@ public String getSqlServerInstance() { return getExtraOptions().get(getPluginId() + ".instance"); } - /** @param instanceName the SQL Server instance */ + /** + * @param instanceName the SQL Server instance + */ public void setSqlServerInstance(String instanceName) { // This is also covered/persisted by JDBC option MS SQL Server / instancename / // We want to return set @@ -2158,7 +2232,9 @@ public boolean isExplorable() { return iDatabase.isExplorable(); } - /** @return The SQL on this database to get a list of sequences. */ + /** + * @return The SQL on this database to get a list of sequences. + */ public String getSqlListOfSequences() { return iDatabase.getSqlListOfSequences(); } @@ -2167,7 +2243,9 @@ public String quoteSqlString(String string) { return iDatabase.quoteSqlString(string); } - /** @see IDatabase#generateColumnAlias(int, String) */ + /** + * @see IDatabase#generateColumnAlias(int, String) + */ public String generateColumnAlias(int columnIndex, String suggestedName) { return iDatabase.generateColumnAlias(columnIndex, suggestedName); } @@ -2205,7 +2283,9 @@ public String getSequenceNoMaxValueOption() { return iDatabase.getSequenceNoMaxValueOption(); } - /** @return true if the database supports autoGeneratedKeys */ + /** + * @return true if the database supports autoGeneratedKeys + */ public boolean supportsAutoGeneratedKeys() { return iDatabase.isSupportsAutoGeneratedKeys(); } diff --git a/core/src/main/java/org/apache/hop/core/database/DatabaseMetaInformation.java b/core/src/main/java/org/apache/hop/core/database/DatabaseMetaInformation.java index 8fd15ea155c..416a02ef6e8 100644 --- a/core/src/main/java/org/apache/hop/core/database/DatabaseMetaInformation.java +++ b/core/src/main/java/org/apache/hop/core/database/DatabaseMetaInformation.java @@ -17,14 +17,6 @@ package org.apache.hop.core.database; -import org.apache.hop.core.IProgressMonitor; -import org.apache.hop.core.ProgressNullMonitorListener; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.logging.ILoggingObject; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.i18n.BaseMessages; - import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.Statement; @@ -32,10 +24,15 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; +import org.apache.hop.core.IProgressMonitor; +import org.apache.hop.core.ProgressNullMonitorListener; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.logging.ILoggingObject; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.i18n.BaseMessages; -/** - * Contains the schema's, catalogs, tables, views, synonyms, etc we can find in the databases... - */ +/** Contains the schema's, catalogs, tables, views, synonyms, etc we can find in the databases... */ public class DatabaseMetaInformation { private static final Class PKG = Database.class; // For Translator @@ -64,28 +61,28 @@ public DatabaseMetaInformation(IVariables variables, DatabaseMeta databaseMeta) public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor) throws HopDatabaseException { if (monitor == null) { - monitor = new ProgressNullMonitorListener(); + monitor = new ProgressNullMonitorListener(); } monitor.beginTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingInfoFromDb"), 8); Database db = new Database(parentLoggingObject, variables, databaseMeta); try { - monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.ConnectingDb")); + monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.ConnectingDb")); db.connect(); monitor.worked(1); if (monitor.isCanceled()) { return; } - - monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingMetaData")); + + monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingMetaData")); DatabaseMetaData dbmd = db.getDatabaseMetaData(); monitor.worked(1); if (monitor.isCanceled()) { return; } - + // Get catalogs // monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingInfo")); @@ -160,7 +157,7 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor // Get schemas // - monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingSchemaInfo")); + monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingSchemaInfo")); if (databaseMeta.supportsSchemas() && dbmd.supportsSchemasInTableDefinitions()) { ArrayList schemaList = new ArrayList<>(); try { @@ -211,8 +208,10 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor if (!schema.getSchemaName().contains(".")) { schemaTablesResultSet = dbmd.getTables(null, schema.getSchemaName(), null, null); } else { - catalogName = schema.getSchemaName().substring(0, schema.getSchemaName().indexOf('.')); - schemaName = schema.getSchemaName().substring(schema.getSchemaName().indexOf('.') + 1); + catalogName = + schema.getSchemaName().substring(0, schema.getSchemaName().indexOf('.')); + schemaName = + schema.getSchemaName().substring(schema.getSchemaName().indexOf('.') + 1); schemaTablesResultSet = dbmd.getTables(catalogName, schemaName, null, null); } while (schemaTablesResultSet.next()) { @@ -234,7 +233,7 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor } schema.setItems(schemaTables.toArray(new String[schemaTables.size()])); - + if (monitor.isCanceled()) { return; } @@ -244,10 +243,15 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor // Ignore it to avoid excessive spamming } - // Sort the schemas by names - Collections.sort(schemaList, (s1, s2) -> {return s1.getSchemaName()==null ? -1:s1.getSchemaName().compareToIgnoreCase(s2.getSchemaName());}); - + Collections.sort( + schemaList, + (s1, s2) -> { + return s1.getSchemaName() == null + ? -1 + : s1.getSchemaName().compareToIgnoreCase(s2.getSchemaName()); + }); + // Save for later... setSchemas(schemaList.toArray(new Schema[schemaList.size()])); } @@ -258,7 +262,7 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor // Get tables // - monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingTables")); + monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingTables")); setTables(db.getTablenames(databaseMeta.supportsSchemas())); // legacy call setTableMap(db.getTableMap()); monitor.worked(1); @@ -280,7 +284,7 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor // Get synonyms // - monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingSynonyms")); + monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingSynonyms")); if (databaseMeta.supportsSynonyms()) { setSynonyms(db.getSynonyms(databaseMeta.supportsSchemas())); // legacy call setSynonymMap(db.getSynonymMap()); @@ -291,8 +295,8 @@ public void getData(ILoggingObject parentLoggingObject, IProgressMonitor monitor } // Get procedures - // - monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingProcedures")); + // + monitor.subTask(BaseMessages.getString(PKG, "DatabaseMeta.Info.GettingProcedures")); setProcedures(db.getProcedures()); monitor.worked(1); } catch (Exception e) { @@ -314,7 +318,9 @@ public String[] getTables() { return tables; } - /** @param tables The tables to set */ + /** + * @param tables The tables to set + */ public void setTables(String[] tables) { this.tables = tables; } @@ -328,7 +334,9 @@ public Map> getTableMap() { return tableMap; } - /** @param tableMap The tableMap to set */ + /** + * @param tableMap The tableMap to set + */ public void setTableMap(Map> tableMap) { this.tableMap = tableMap; } @@ -342,7 +350,9 @@ public String[] getViews() { return views; } - /** @param views The views to set */ + /** + * @param views The views to set + */ public void setViews(String[] views) { this.views = views; } @@ -356,7 +366,9 @@ public Map> getViewMap() { return viewMap; } - /** @param viewMap The viewMap to set */ + /** + * @param viewMap The viewMap to set + */ public void setViewMap(Map> viewMap) { this.viewMap = viewMap; } @@ -370,7 +382,9 @@ public String[] getSynonyms() { return synonyms; } - /** @param synonyms The synonyms to set */ + /** + * @param synonyms The synonyms to set + */ public void setSynonyms(String[] synonyms) { this.synonyms = synonyms; } @@ -384,7 +398,9 @@ public Map> getSynonymMap() { return synonymMap; } - /** @param synonymMap The synonymMap to set */ + /** + * @param synonymMap The synonymMap to set + */ public void setSynonymMap(Map> synonymMap) { this.synonymMap = synonymMap; } @@ -398,7 +414,9 @@ public Catalog[] getCatalogs() { return catalogs; } - /** @param catalogs The catalogs to set */ + /** + * @param catalogs The catalogs to set + */ public void setCatalogs(Catalog[] catalogs) { this.catalogs = catalogs; } @@ -412,7 +430,9 @@ public Schema[] getSchemas() { return schemas; } - /** @param schemas The schemas to set */ + /** + * @param schemas The schemas to set + */ public void setSchemas(Schema[] schemas) { this.schemas = schemas; } @@ -426,7 +446,9 @@ public String[] getProcedures() { return procedures; } - /** @param procedures The procedures to set */ + /** + * @param procedures The procedures to set + */ public void setProcedures(String[] procedures) { this.procedures = procedures; } @@ -440,7 +462,9 @@ public IVariables getVariables() { return variables; } - /** @param variables The variables to set */ + /** + * @param variables The variables to set + */ public void setVariables(IVariables variables) { this.variables = variables; } @@ -454,7 +478,9 @@ public DatabaseMeta getDatabaseMeta() { return databaseMeta; } - /** @param databaseMeta The databaseMeta to set */ + /** + * @param databaseMeta The databaseMeta to set + */ public void setDatabaseMeta(DatabaseMeta databaseMeta) { this.databaseMeta = databaseMeta; } diff --git a/core/src/main/java/org/apache/hop/core/database/DatabaseMetaPlugin.java b/core/src/main/java/org/apache/hop/core/database/DatabaseMetaPlugin.java index 4eb5262a14b..be6279ff34e 100644 --- a/core/src/main/java/org/apache/hop/core/database/DatabaseMetaPlugin.java +++ b/core/src/main/java/org/apache/hop/core/database/DatabaseMetaPlugin.java @@ -23,9 +23,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** - * This annotation signals to the plugin system that the class is a database metadata plugin. - */ +/** This annotation signals to the plugin system that the class is a database metadata plugin. */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @@ -35,6 +33,6 @@ String typeDescription(); String classLoaderGroup() default ""; - + String documentationUrl() default ""; } diff --git a/core/src/main/java/org/apache/hop/core/database/DatabasePluginType.java b/core/src/main/java/org/apache/hop/core/database/DatabasePluginType.java index 70e40543ac5..cfd8cdac8ab 100644 --- a/core/src/main/java/org/apache/hop/core/database/DatabasePluginType.java +++ b/core/src/main/java/org/apache/hop/core/database/DatabasePluginType.java @@ -22,21 +22,17 @@ import org.apache.hop.core.Const; import org.apache.hop.core.plugins.BasePluginType; -/** - * This class represents the transform plugin type. - */ +/** This class represents the transform plugin type. */ public class DatabasePluginType extends BasePluginType { private static DatabasePluginType pluginType; private DatabasePluginType() { super(DatabaseMetaPlugin.class, "DATABASE", "Database"); - String sharedJdbcFolders = Const.NVL( - System.getProperty(Const.HOP_SHARED_JDBC_FOLDERS), - "lib/jdbc" - ); + String sharedJdbcFolders = + Const.NVL(System.getProperty(Const.HOP_SHARED_JDBC_FOLDERS), "lib/jdbc"); if (StringUtils.isNotEmpty(sharedJdbcFolders)) { - for(String sharedJdbcFolder : sharedJdbcFolders.split(",")){ + for (String sharedJdbcFolder : sharedJdbcFolders.split(",")) { getExtraLibraryFolders().add(sharedJdbcFolder.trim()); } } diff --git a/core/src/main/java/org/apache/hop/core/database/IDatabase.java b/core/src/main/java/org/apache/hop/core/database/IDatabase.java index 677460c2571..9ae01ef2ed0 100644 --- a/core/src/main/java/org/apache/hop/core/database/IDatabase.java +++ b/core/src/main/java/org/apache/hop/core/database/IDatabase.java @@ -17,18 +17,17 @@ package org.apache.hop.core.database; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.metadata.api.HopMetadataObject; - import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.List; import java.util.Map; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.metadata.api.HopMetadataObject; /** * This interface describes the methods that a database connection needs to have in order to @@ -36,73 +35,119 @@ */ @HopMetadataObject(objectFactory = DatabaseMetaObjectFactory.class) public interface IDatabase extends Cloneable { - /** @return the plugin id of this database */ + /** + * @return the plugin id of this database + */ String getPluginId(); - /** @param pluginId set the plugin id of this plugin (after instantiation) */ + /** + * @param pluginId set the plugin id of this plugin (after instantiation) + */ void setPluginId(String pluginId); - /** @return the plugin name of this database, the same thing as the annotation typeDescription */ + /** + * @return the plugin name of this database, the same thing as the annotation typeDescription + */ String getPluginName(); - /** @param pluginName set the plugin name of this plugin (after instantiation) */ + /** + * @param pluginName set the plugin name of this plugin (after instantiation) + */ void setPluginName(String pluginName); - /** @return Returns the accessType. */ + /** + * @return Returns the accessType. + */ int getAccessType(); - /** @param accessType The accessType to set. */ + /** + * @param accessType The accessType to set. + */ void setAccessType(int accessType); - /** @return Returns the changed. */ + /** + * @return Returns the changed. + */ boolean isChanged(); - /** @param changed The changed to set. */ + /** + * @param changed The changed to set. + */ void setChanged(boolean changed); - /** @return Returns the databaseName. */ + /** + * @return Returns the databaseName. + */ String getDatabaseName(); - /** @param databaseName The databaseName to set. */ + /** + * @param databaseName The databaseName to set. + */ void setDatabaseName(String databaseName); - /** @return Returns the hostname. */ + /** + * @return Returns the hostname. + */ String getHostname(); - /** @param hostname The hostname to set. */ + /** + * @param hostname The hostname to set. + */ void setHostname(String hostname); - /** @return the username to log onto the database */ + /** + * @return the username to log onto the database + */ String getUsername(); - /** @param username Sets the username to log onto the database with. */ + /** + * @param username Sets the username to log onto the database with. + */ void setUsername(String username); - /** @return Returns the password. */ + /** + * @return Returns the password. + */ String getPassword(); - /** @param password The password to set. */ + /** + * @param password The password to set. + */ void setPassword(String password); - /** @return Returns the servername. */ + /** + * @return Returns the servername. + */ String getServername(); - /** @param servername The servername to set. */ + /** + * @param servername The servername to set. + */ void setServername(String servername); - /** @return the tablespace to store data in. (create table) */ + /** + * @return the tablespace to store data in. (create table) + */ String getDataTablespace(); - /** @param dataTablespace the tablespace to store data in */ + /** + * @param dataTablespace the tablespace to store data in + */ void setDataTablespace(String dataTablespace); - /** @return the tablespace to store indexes in */ + /** + * @return the tablespace to store indexes in + */ String getIndexTablespace(); - /** @param indexTablespace the tablespace to store indexes in */ + /** + * @param indexTablespace the tablespace to store indexes in + */ void setIndexTablespace(String indexTablespace); - /** @return The extra attributes for this database connection */ + /** + * @return The extra attributes for this database connection + */ Map getAttributes(); /** @@ -140,7 +185,9 @@ default String getAttribute(String attributeId, String defaultValue) { */ boolean isSupportsSetCharacterStream(); - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ boolean isSupportsAutoInc(); /* Returns weather or not the database supports a custom SQL statement to perform delete operations */ @@ -148,6 +195,7 @@ default String getAttribute(String attributeId, String defaultValue) { /* Returns weather or not the database supports a custom SQL statement to perform update operations */ boolean isSupportsCustomUpdateStmt(); + /** * Describe a Value as a field in the database. * @@ -174,10 +222,14 @@ String getFieldDefinition( */ int[] getAccessTypeList(); - /** @return the default database port number */ + /** + * @return the default database port number + */ int getDefaultDatabasePort(); - /** @return default extra Options */ + /** + * @return default extra Options + */ Map getDefaultOptions(); /** @@ -218,10 +270,11 @@ String getFieldDefinition( * @return the URL to use for connecting to the database. * @throws HopDatabaseException in case a configuration error is detected. */ - String getURL(String hostname, String port, String databaseName) - throws HopDatabaseException; + String getURL(String hostname, String port, String databaseName) throws HopDatabaseException; - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ boolean isSupportsSequences(); /** @@ -255,19 +308,29 @@ String getURL(String hostname, String port, String databaseName) */ boolean isFetchSizeSupported(); - /** @return true if the database supports transactions. */ + /** + * @return true if the database supports transactions. + */ boolean isSupportsTransactions(); - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ boolean isSupportsBitmapIndex(); - /** @return true if the database JDBC driver supports the setLong command */ + /** + * @return true if the database JDBC driver supports the setLong command + */ boolean isSupportsSetLong(); - /** @return true if the database supports schemas */ + /** + * @return true if the database supports schemas + */ boolean isSupportsSchemas(); - /** @return true if the database supports catalogs */ + /** + * @return true if the database supports catalogs + */ boolean isSupportsCatalogs(); /** @@ -283,19 +346,29 @@ String getURL(String hostname, String port, String databaseName) */ boolean isNeedsPlaceHolder(); - /** @return the function for Sum agrregate */ + /** + * @return the function for Sum agrregate + */ String getFunctionSum(); - /** @return the function for Average agrregate */ + /** + * @return the function for Average agrregate + */ String getFunctionAverage(); - /** @return the function for Minimum agrregate */ + /** + * @return the function for Minimum agrregate + */ String getFunctionMinimum(); - /** @return the function for Maximum agrregate */ + /** + * @return the function for Maximum agrregate + */ String getFunctionMaximum(); - /** @return the function for Count agrregate */ + /** + * @return the function for Count agrregate + */ String getFunctionCount(); /** @@ -389,16 +462,24 @@ String getModifyColumnStatement( */ Object clone(); - /** @return an array of reserved words for the database type... */ + /** + * @return an array of reserved words for the database type... + */ String[] getReservedWords(); - /** @return true if reserved words need to be double quoted ("password", "select", ...) */ + /** + * @return true if reserved words need to be double quoted ("password", "select", ...) + */ boolean isQuoteReservedWords(); - /** @return The start quote sequence, mostly just double quote, but sometimes [, ... */ + /** + * @return The start quote sequence, mostly just double quote, but sometimes [, ... + */ String getStartQuote(); - /** @return The end quote sequence, mostly just double quote, but sometimes ], ... */ + /** + * @return The end quote sequence, mostly just double quote, but sometimes ], ... + */ String getEndQuote(); /** @@ -412,7 +493,9 @@ String getModifyColumnStatement( */ String[] getViewTypes(); - /** @return a list of table types to retrieve synonyms for the database */ + /** + * @return a list of table types to retrieve synonyms for the database + */ String[] getSynonymTypes(); /** @@ -421,13 +504,19 @@ String getModifyColumnStatement( */ boolean useSchemaNameForTableList(); - /** @return true if the database supports views */ + /** + * @return true if the database supports views + */ boolean isSupportsViews(); - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ boolean isSupportsSynonyms(); - /** @return The SQL on this database to get a list of stored procedures. */ + /** + * @return The SQL on this database to get a list of stored procedures. + */ String getSqlListOfProcedures(); /** @@ -467,16 +556,24 @@ String getModifyColumnStatement( */ boolean isSupportsBatchUpdates(); - /** @return true if the database supports a boolean, bit, logical, ... datatype */ + /** + * @return true if the database supports a boolean, bit, logical, ... datatype + */ boolean isSupportsBooleanDataType(); - /** @param b Set to true if the database supports a boolean, bit, logical, ... datatype */ + /** + * @param b Set to true if the database supports a boolean, bit, logical, ... datatype + */ void setSupportsBooleanDataType(boolean b); - /** @return true if reserved words' case should be preserved */ + /** + * @return true if reserved words' case should be preserved + */ boolean isPreserveReservedCase(); - /** @param b Set to true if reserved words' case should be preserved */ + /** + * @param b Set to true if reserved words' case should be preserved + */ void setPreserveReservedCase(boolean b); /** @@ -512,7 +609,9 @@ String getModifyColumnStatement( */ String getExtraOptionValueSeparator(); - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ String getExtraOptionIndicator(); /** @@ -521,7 +620,9 @@ String getModifyColumnStatement( */ boolean isSupportsOptionsInURL(); - /** @return extra help text on the supported options on the selected database platform. */ + /** + * @return extra help text on the supported options on the selected database platform. + */ String getExtraOptionsHelpText(); /** @@ -530,10 +631,14 @@ String getModifyColumnStatement( */ boolean isSupportsGetBlob(); - /** @return The SQL to execute right after connecting */ + /** + * @return The SQL to execute right after connecting + */ String getConnectSql(); - /** @param sql The SQL to execute right after connecting */ + /** + * @param sql The SQL to execute right after connecting + */ void setConnectSql(String sql); /** @@ -567,22 +672,34 @@ String getModifyColumnStatement( */ void setStreamingResults(boolean useStreaming); - /** @return true if all fields should always be quoted in db */ + /** + * @return true if all fields should always be quoted in db + */ boolean isQuoteAllFields(); - /** @param quoteAllFields true if all fields in DB should be quoted. */ + /** + * @param quoteAllFields true if all fields in DB should be quoted. + */ void setQuoteAllFields(boolean quoteAllFields); - /** @return true if all identifiers should be forced to lower case */ + /** + * @return true if all identifiers should be forced to lower case + */ boolean isForcingIdentifiersToLowerCase(); - /** @param forceLowerCase true if all identifiers should be forced to lower case */ + /** + * @param forceLowerCase true if all identifiers should be forced to lower case + */ void setForcingIdentifiersToLowerCase(boolean forceLowerCase); - /** @return true if all identifiers should be forced to upper case */ + /** + * @return true if all identifiers should be forced to upper case + */ boolean isForcingIdentifiersToUpperCase(); - /** @param forceUpperCase true if all identifiers should be forced to upper case */ + /** + * @param forceUpperCase true if all identifiers should be forced to upper case + */ void setForcingIdentifiersToUpperCase(boolean forceUpperCase); /** @@ -613,10 +730,14 @@ String getModifyColumnStatement( */ String getDatabaseFactoryName(); - /** @return The preferred schema name of this database connection. */ + /** + * @return The preferred schema name of this database connection. + */ String getPreferredSchemaName(); - /** @param preferredSchemaName The preferred schema name of this database connection. */ + /** + * @param preferredSchemaName The preferred schema name of this database connection. + */ void setPreferredSchemaName(String preferredSchemaName); /** @@ -630,8 +751,7 @@ String getModifyColumnStatement( * @return * @throws HopDatabaseException */ - boolean hasIndex( - Database database, String schemaName, String tableName, String[] idxFields) + boolean hasIndex(Database database, String schemaName, String tableName, String[] idxFields) throws HopDatabaseException; /** @@ -672,13 +792,19 @@ boolean hasIndex( */ boolean isSystemTable(String tableName); - /** @return true if the database supports newlines in a SQL statements. */ + /** + * @return true if the database supports newlines in a SQL statements. + */ boolean isSupportsNewLinesInSql(); - /** @return the SQL to retrieve the list of schemas */ + /** + * @return the SQL to retrieve the list of schemas + */ String getSqlListOfSchemas(); - /** @return The maximum number of columns in a database, <=0 means: no known limit */ + /** + * @return The maximum number of columns in a database, <=0 means: no known limit + */ int getMaxColumnsInIndex(); /** @@ -703,7 +829,9 @@ String getSqlInsertAutoIncUnknownDimensionRow( */ boolean isExplorable(); - /** @return The SQL on this database to get a list of sequences. */ + /** + * @return The SQL on this database to get a list of sequences. + */ String getSqlListOfSequences(); /** @@ -762,40 +890,64 @@ String getSqlInsertAutoIncUnknownDimensionRow( */ boolean isPostgresVariant(); - /** @return true if the database is a Sybase variant. */ + /** + * @return true if the database is a Sybase variant. + */ boolean isSybaseVariant(); - /** @return true if the database is a SybaseIQ variant. */ + /** + * @return true if the database is a SybaseIQ variant. + */ boolean isSybaseIQVariant(); - /** @return true if the database is a neoview variant. */ + /** + * @return true if the database is a neoview variant. + */ boolean isNeoviewVariant(); - /** @return true if the database is a DuckDB variant. */ + /** + * @return true if the database is a DuckDB variant. + */ boolean isDuckDbVariant(); - /** @return true if the database is a DuckDB variant. */ + /** + * @return true if the database is a DuckDB variant. + */ boolean isExasolVariant(); - /** @return true if the database is an Informix variant. */ + /** + * @return true if the database is an Informix variant. + */ boolean isInformixVariant(); - /** @return true if the database is a MS SQL Server (native) variant. */ + /** + * @return true if the database is a MS SQL Server (native) variant. + */ boolean isMsSqlServerNativeVariant(); - /** @return true if the database is a MS SQL Server variant. */ + /** + * @return true if the database is a MS SQL Server variant. + */ boolean isMsSqlServerVariant(); - /** @return true if the database is an Oracle variant. */ + /** + * @return true if the database is an Oracle variant. + */ boolean isOracleVariant(); - /** @return true if the database is a Netezza variant. */ + /** + * @return true if the database is a Netezza variant. + */ boolean isNetezzaVariant(); - /** @return true if the database is a SQLite variant. */ + /** + * @return true if the database is a SQLite variant. + */ boolean isSqliteVariant(); - /** @return true if the database is a Terradata variant. */ + /** + * @return true if the database is a Terradata variant. + */ boolean isTeradataVariant(); /** @@ -871,6 +1023,7 @@ String getSqlValue(IValueMeta valueMeta, Object valueData, String dateFormat) /** * Get the DELETE statement for the current database given the table name + * * @param tableName * @return */ @@ -878,10 +1031,12 @@ String getSqlValue(IValueMeta valueMeta, Object valueData, String dateFormat) /** * Get the UPDATE statement for the current database given the table name + * * @param tableName * @return */ String getSqlUpdateStmt(String tableName); + /** * @return true if this database only supports metadata retrieval on a result set, never on a * statement (even if the statement has been executed) @@ -913,7 +1068,9 @@ String getSqlValue(IValueMeta valueMeta, Object valueData, String dateFormat) */ String getSequenceNoMaxValueOption(); - /** @return true if the database supports autoGeneratedKeys */ + /** + * @return true if the database supports autoGeneratedKeys + */ boolean isSupportsAutoGeneratedKeys(); /** @@ -948,7 +1105,9 @@ default SqlScriptParser createSqlScriptParser() { return new SqlScriptParser(true); } - /** @return true if database supports the standard table output transform */ + /** + * @return true if database supports the standard table output transform + */ default boolean supportsStandardTableOutput() { return true; } @@ -997,7 +1156,9 @@ default String getLegacyColumnName( void setPort(String port); - /** @return A manually entered URL which will be used over the internally generated one */ + /** + * @return A manually entered URL which will be used over the internally generated one + */ String getManualUrl(); /** @@ -1005,16 +1166,21 @@ default String getLegacyColumnName( */ void setManualUrl(String manualUrl); - /** @return true if the database name is a required parameter */ + /** + * @return true if the database name is a required parameter + */ boolean isRequiresName(); /** - * If the database requires it you can generate an additional clause before the 'fields' specification in an insert statement. - * For example, you might have INSERT INTO table1(field1, field2, field3) but you need to include a PARTITION clause. - * That's what you can do right here. If you make this method return PARTITION(field4) you will get INSERT INTO table1 PARTITION(field4) (field1, field2, field3). + * If the database requires it you can generate an additional clause before the 'fields' + * specification in an insert statement. For example, you might have INSERT INTO table1(field1, + * field2, field3) but you need to include a PARTITION clause. That's what you can do right here. + * If you make this method return PARTITION(field4) you will get INSERT INTO table1 + * PARTITION(field4) (field1, field2, field3). * * @param variables the variables to resolve with. - * @param schemaTable The schema-table name combination (Fully qualified table name) to generate the clause for. + * @param schemaTable The schema-table name combination (Fully qualified table name) to generate + * the clause for. */ String getSqlInsertClauseBeforeFields(IVariables variables, String schemaTable); } diff --git a/core/src/main/java/org/apache/hop/core/database/NoneDatabaseMeta.java b/core/src/main/java/org/apache/hop/core/database/NoneDatabaseMeta.java index d043812b2fe..5cfe8a58564 100644 --- a/core/src/main/java/org/apache/hop/core/database/NoneDatabaseMeta.java +++ b/core/src/main/java/org/apache/hop/core/database/NoneDatabaseMeta.java @@ -20,12 +20,17 @@ import org.apache.hop.core.exception.HopDatabaseException; import org.apache.hop.core.row.IValueMeta; -@DatabaseMetaPlugin(type = "NONE", typeDescription = "No connection type", documentationUrl = "/database/databases.html") +@DatabaseMetaPlugin( + type = "NONE", + typeDescription = "No connection type", + documentationUrl = "/database/databases.html") public class NoneDatabaseMeta extends BaseDatabaseMeta implements IDatabase { public static final String ATRRIBUTE_CUSTOM_DRIVER_CLASS = "CUSTOM_DRIVER_CLASS"; - /** @param driverClass The driverClass to set */ + /** + * @param driverClass The driverClass to set + */ public void setDriverClass(String driverClass) { getAttributes().put(ATRRIBUTE_CUSTOM_DRIVER_CLASS, driverClass); } diff --git a/core/src/main/java/org/apache/hop/core/database/PartitionDatabaseMeta.java b/core/src/main/java/org/apache/hop/core/database/PartitionDatabaseMeta.java index e25e86d8444..1e0414e14cc 100644 --- a/core/src/main/java/org/apache/hop/core/database/PartitionDatabaseMeta.java +++ b/core/src/main/java/org/apache/hop/core/database/PartitionDatabaseMeta.java @@ -17,9 +17,7 @@ package org.apache.hop.core.database; -/** - * Class to contain the information needed to parition (cluster): id, hostname, port, database - */ +/** Class to contain the information needed to parition (cluster): id, hostname, port, database */ public class PartitionDatabaseMeta { String partitionId; @@ -46,62 +44,86 @@ public PartitionDatabaseMeta(String partitionId, String hostname, String port, S this.databaseName = database; } - /** @return the partitionId */ + /** + * @return the partitionId + */ public String getPartitionId() { return partitionId; } - /** @param partitionId the partitionId to set */ + /** + * @param partitionId the partitionId to set + */ public void setPartitionId(String partitionId) { this.partitionId = partitionId; } - /** @return the database */ + /** + * @return the database + */ public String getDatabaseName() { return databaseName; } - /** @param database the database to set */ + /** + * @param database the database to set + */ public void setDatabaseName(String database) { this.databaseName = database; } - /** @return the hostname */ + /** + * @return the hostname + */ public String getHostname() { return hostname; } - /** @param hostname the hostname to set */ + /** + * @param hostname the hostname to set + */ public void setHostname(String hostname) { this.hostname = hostname; } - /** @return the port */ + /** + * @return the port + */ public String getPort() { return port; } - /** @param port the port to set */ + /** + * @param port the port to set + */ public void setPort(String port) { this.port = port; } - /** @return the password */ + /** + * @return the password + */ public String getPassword() { return password; } - /** @param password the password to set */ + /** + * @param password the password to set + */ public void setPassword(String password) { this.password = password; } - /** @return the username */ + /** + * @return the username + */ public String getUsername() { return username; } - /** @param username the username to set */ + /** + * @param username the username to set + */ public void setUsername(String username) { this.username = username; } diff --git a/core/src/main/java/org/apache/hop/core/database/Schema.java b/core/src/main/java/org/apache/hop/core/database/Schema.java index 166e891d423..0b1363443fb 100644 --- a/core/src/main/java/org/apache/hop/core/database/Schema.java +++ b/core/src/main/java/org/apache/hop/core/database/Schema.java @@ -17,9 +17,7 @@ package org.apache.hop.core.database; -/** - * Contains the information that's stored in a single schema. - */ +/** Contains the information that's stored in a single schema. */ public class Schema { private String schemaName; private String[] items; @@ -33,22 +31,30 @@ public Schema(String schemaName) { this(schemaName, new String[] {}); } - /** @return Returns the schemaName. */ + /** + * @return Returns the schemaName. + */ public String getSchemaName() { return schemaName; } - /** @param schemaName The catalogName to set. */ + /** + * @param schemaName The catalogName to set. + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } - /** @return Returns the items. */ + /** + * @return Returns the items. + */ public String[] getItems() { return items; } - /** @param items The items to set. */ + /** + * @param items The items to set. + */ public void setItems(String[] items) { this.items = items; } diff --git a/core/src/main/java/org/apache/hop/core/database/SqlScriptParser.java b/core/src/main/java/org/apache/hop/core/database/SqlScriptParser.java index 33cd7d952f7..31c33a96676 100644 --- a/core/src/main/java/org/apache/hop/core/database/SqlScriptParser.java +++ b/core/src/main/java/org/apache/hop/core/database/SqlScriptParser.java @@ -17,11 +17,10 @@ package org.apache.hop.core.database; -import org.apache.commons.lang.StringUtils; - import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.commons.lang.StringUtils; /** * This class represents a splitter of SQL script into separate statements. It respects the notion diff --git a/core/src/main/java/org/apache/hop/core/database/SqlScriptStatement.java b/core/src/main/java/org/apache/hop/core/database/SqlScriptStatement.java index f23af864214..fa637b63e90 100644 --- a/core/src/main/java/org/apache/hop/core/database/SqlScriptStatement.java +++ b/core/src/main/java/org/apache/hop/core/database/SqlScriptStatement.java @@ -45,72 +45,100 @@ public String toString() { return statement; } - /** @return the statement */ + /** + * @return the statement + */ public String getStatement() { return statement; } - /** @param statement the statement to set */ + /** + * @param statement the statement to set + */ public void setStatement(String statement) { this.statement = statement; } - /** @return the fromIndex */ + /** + * @return the fromIndex + */ public int getFromIndex() { return fromIndex; } - /** @param fromIndex the fromIndex to set */ + /** + * @param fromIndex the fromIndex to set + */ public void setFromIndex(int fromIndex) { this.fromIndex = fromIndex; } - /** @return the toIndex */ + /** + * @return the toIndex + */ public int getToIndex() { return toIndex; } - /** @param toIndex the toIndex to set */ + /** + * @param toIndex the toIndex to set + */ public void setToIndex(int toIndex) { this.toIndex = toIndex; } - /** @return the query */ + /** + * @return the query + */ public boolean isQuery() { return query; } - /** @param query the query to set */ + /** + * @param query the query to set + */ public void setQuery(boolean query) { this.query = query; } - /** @return the ok */ + /** + * @return the ok + */ public boolean isOk() { return ok; } - /** @param ok the ok to set */ + /** + * @param ok the ok to set + */ public void setOk(boolean ok) { this.ok = ok; } - /** @return the loggingText */ + /** + * @return the loggingText + */ public String getLoggingText() { return loggingText; } - /** @param loggingText the loggingText to set */ + /** + * @param loggingText the loggingText to set + */ public void setLoggingText(String loggingText) { this.loggingText = loggingText; } - /** @return the complete */ + /** + * @return the complete + */ public boolean isComplete() { return complete; } - /** @param complete the complete to set */ + /** + * @param complete the complete to set + */ public void setComplete(boolean complete) { this.complete = complete; } diff --git a/core/src/main/java/org/apache/hop/core/database/map/DatabaseConnectionMap.java b/core/src/main/java/org/apache/hop/core/database/map/DatabaseConnectionMap.java index bf4355d567c..fb596cf14c9 100644 --- a/core/src/main/java/org/apache/hop/core/database/map/DatabaseConnectionMap.java +++ b/core/src/main/java/org/apache/hop/core/database/map/DatabaseConnectionMap.java @@ -17,14 +17,13 @@ package org.apache.hop.core.database.map; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.util.Utils; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.util.Utils; /** * This class contains a map between on the one hand @@ -70,8 +69,7 @@ public void removeConnection(String connectionGroup, String partitionID, Databas map.remove(key); } - private String createEntryKey( - String connectionGroup, String partitionID, Database database) { + private String createEntryKey(String connectionGroup, String partitionID, Database database) { StringBuilder key = new StringBuilder(connectionGroup); key.append(':').append(database.getDatabaseMeta().getName()); diff --git a/core/src/main/java/org/apache/hop/core/encryption/HopTwoWayPasswordEncoder.java b/core/src/main/java/org/apache/hop/core/encryption/HopTwoWayPasswordEncoder.java index 9e789fe0215..5d445c2a4ae 100644 --- a/core/src/main/java/org/apache/hop/core/encryption/HopTwoWayPasswordEncoder.java +++ b/core/src/main/java/org/apache/hop/core/encryption/HopTwoWayPasswordEncoder.java @@ -18,15 +18,14 @@ package org.apache.hop.core.encryption; import com.google.common.annotations.VisibleForTesting; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.util.EnvUtil; import org.apache.hop.core.util.StringUtil; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - /** * This class handles basic encryption of passwords in Hop. Note that it's not really encryption, * it's more obfuscation. Passwords are difficult to read, not impossible. @@ -38,6 +37,7 @@ public class HopTwoWayPasswordEncoder implements ITwoWayPasswordEncoder { private static final int RADIX = 16; private String Seed; + /** * The word that is put before a password to indicate an encrypted form. If this word is not * present, the password is considered to be NOT encrypted diff --git a/core/src/main/java/org/apache/hop/core/encryption/ITwoWayPasswordEncoder.java b/core/src/main/java/org/apache/hop/core/encryption/ITwoWayPasswordEncoder.java index fc6fb82c24a..e0a7a0d4920 100644 --- a/core/src/main/java/org/apache/hop/core/encryption/ITwoWayPasswordEncoder.java +++ b/core/src/main/java/org/apache/hop/core/encryption/ITwoWayPasswordEncoder.java @@ -64,6 +64,8 @@ public interface ITwoWayPasswordEncoder { */ String decode(String encodedPassword); - /** @return The prefixes to the encoded passwords which this password encoder supports. */ + /** + * @return The prefixes to the encoded passwords which this password encoder supports. + */ String[] getPrefixes(); } diff --git a/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPlugin.java b/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPlugin.java index e0dc83452a4..635f8919f1c 100644 --- a/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPlugin.java +++ b/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPlugin.java @@ -41,7 +41,9 @@ String description() default ""; - /** @return True if a separate class loader is needed every time this class is instantiated */ + /** + * @return True if a separate class loader is needed every time this class is instantiated + */ boolean isSeparateClassLoaderNeeded() default false; String documentationUrl() default ""; diff --git a/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPluginType.java b/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPluginType.java index c9bc04d4131..73dbaaa68ed 100644 --- a/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPluginType.java +++ b/core/src/main/java/org/apache/hop/core/encryption/TwoWayPasswordEncoderPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.encryption; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the value meta plugin type. */ @PluginMainClassType(ITwoWayPasswordEncoder.class) @PluginAnnotationType(TwoWayPasswordEncoderPlugin.class) diff --git a/core/src/main/java/org/apache/hop/core/exception/HopConversionException.java b/core/src/main/java/org/apache/hop/core/exception/HopConversionException.java index 8f14f49d7dd..6ccb7d4eb52 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopConversionException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopConversionException.java @@ -17,9 +17,8 @@ package org.apache.hop.core.exception; -import org.apache.hop.core.row.IValueMeta; - import java.util.List; +import org.apache.hop.core.row.IValueMeta; public class HopConversionException extends HopException { @@ -52,32 +51,44 @@ public HopConversionException( this.rowData = rowData; } - /** @return the causes */ + /** + * @return the causes + */ public List getCauses() { return causes; } - /** @param causes the causes to set */ + /** + * @param causes the causes to set + */ public void setCauses(List causes) { this.causes = causes; } - /** @return the fields */ + /** + * @return the fields + */ public List getFields() { return fields; } - /** @param fields the fields to set */ + /** + * @param fields the fields to set + */ public void setFields(List fields) { this.fields = fields; } - /** @return the rowData */ + /** + * @return the rowData + */ public Object[] getRowData() { return rowData; } - /** @param rowData the rowData to set */ + /** + * @param rowData the rowData to set + */ public void setRowData(Object[] rowData) { this.rowData = rowData; } diff --git a/core/src/main/java/org/apache/hop/core/exception/HopDatabaseBatchException.java b/core/src/main/java/org/apache/hop/core/exception/HopDatabaseBatchException.java index 227ef9c46fa..6d743f033a2 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopDatabaseBatchException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopDatabaseBatchException.java @@ -65,12 +65,16 @@ public HopDatabaseBatchException(String message, Throwable cause) { super(message, cause); } - /** @return Returns the updateCounts. */ + /** + * @return Returns the updateCounts. + */ public int[] getUpdateCounts() { return updateCounts; } - /** @param updateCounts The updateCounts to set. */ + /** + * @param updateCounts The updateCounts to set. + */ public void setUpdateCounts(int[] updateCounts) { this.updateCounts = updateCounts; } diff --git a/core/src/main/java/org/apache/hop/core/exception/HopDatabaseException.java b/core/src/main/java/org/apache/hop/core/exception/HopDatabaseException.java index b4a24486909..80b13067356 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopDatabaseException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopDatabaseException.java @@ -17,9 +17,7 @@ package org.apache.hop.core.exception; -/** - * This exception is used by the Database class. - */ +/** This exception is used by the Database class. */ public class HopDatabaseException extends HopException { public static final long serialVersionUID = 0x8D8EA0264F7A1C0FL; diff --git a/core/src/main/java/org/apache/hop/core/exception/HopMissingPluginsException.java b/core/src/main/java/org/apache/hop/core/exception/HopMissingPluginsException.java index 7dc39453a1b..e1ac74d713f 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopMissingPluginsException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopMissingPluginsException.java @@ -17,13 +17,12 @@ package org.apache.hop.core.exception; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.plugins.IPluginType; import org.apache.hop.core.plugins.PluginRegistry; -import java.util.ArrayList; -import java.util.List; - /** This Exception is throws when an error occurs loading plugins. */ public class HopMissingPluginsException extends HopException { private static final long serialVersionUID = -3008319146447259788L; diff --git a/core/src/main/java/org/apache/hop/core/exception/HopPluginException.java b/core/src/main/java/org/apache/hop/core/exception/HopPluginException.java index a89a3eb8473..194376ed5d2 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopPluginException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopPluginException.java @@ -34,12 +34,16 @@ public HopPluginException(String message, Throwable cause) { super(message, cause); } - /** @param message */ + /** + * @param message + */ public HopPluginException(String message) { super(message); } - /** @param cause */ + /** + * @param cause + */ public HopPluginException(Throwable cause) { super(cause); } diff --git a/core/src/main/java/org/apache/hop/core/exception/HopPluginLoaderException.java b/core/src/main/java/org/apache/hop/core/exception/HopPluginLoaderException.java index 53ac97e99b2..29e10272524 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopPluginLoaderException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopPluginLoaderException.java @@ -72,7 +72,9 @@ public HopPluginLoaderException(String pluginId, String message, Throwable cause this.pluginId = pluginId; } - /** @return The ID of the missing plugin that caused this exception */ + /** + * @return The ID of the missing plugin that caused this exception + */ public String getPluginId() { return pluginId; } diff --git a/core/src/main/java/org/apache/hop/core/exception/HopPluginNotFoundException.java b/core/src/main/java/org/apache/hop/core/exception/HopPluginNotFoundException.java index 4d4138c85d8..3e0184428cb 100644 --- a/core/src/main/java/org/apache/hop/core/exception/HopPluginNotFoundException.java +++ b/core/src/main/java/org/apache/hop/core/exception/HopPluginNotFoundException.java @@ -30,7 +30,9 @@ public HopPluginNotFoundException(String message, Throwable cause) { super(message, cause); } - /** @param message */ + /** + * @param message + */ public HopPluginNotFoundException(String message) { super(message); } diff --git a/core/src/main/java/org/apache/hop/core/extension/ExtensionPointMap.java b/core/src/main/java/org/apache/hop/core/extension/ExtensionPointMap.java index 4b69e0c5667..22bd2bf02b5 100644 --- a/core/src/main/java/org/apache/hop/core/extension/ExtensionPointMap.java +++ b/core/src/main/java/org/apache/hop/core/extension/ExtensionPointMap.java @@ -20,6 +20,8 @@ import com.google.common.base.Suppliers; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; +import java.util.List; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -28,9 +30,6 @@ import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.core.variables.IVariables; -import java.util.List; -import java.util.concurrent.locks.ReentrantReadWriteLock; - /** This class maintains a map of IExtensionPoint object to its name. */ public class ExtensionPointMap { diff --git a/core/src/main/java/org/apache/hop/core/extension/ExtensionPointPluginType.java b/core/src/main/java/org/apache/hop/core/extension/ExtensionPointPluginType.java index 24bce8c027b..3cde14f2a1a 100644 --- a/core/src/main/java/org/apache/hop/core/extension/ExtensionPointPluginType.java +++ b/core/src/main/java/org/apache/hop/core/extension/ExtensionPointPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.extension; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the extension point plugin type. */ @PluginMainClassType(IExtensionPoint.class) @PluginAnnotationType(ExtensionPoint.class) diff --git a/core/src/main/java/org/apache/hop/core/fileinput/CharsetToolkit.java b/core/src/main/java/org/apache/hop/core/fileinput/CharsetToolkit.java index ae43e526b8b..21ef111f9cf 100644 --- a/core/src/main/java/org/apache/hop/core/fileinput/CharsetToolkit.java +++ b/core/src/main/java/org/apache/hop/core/fileinput/CharsetToolkit.java @@ -17,8 +17,6 @@ package org.apache.hop.core.fileinput; -import org.apache.commons.vfs2.FileObject; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -26,6 +24,7 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Collection; +import org.apache.commons.vfs2.FileObject; /** *

diff --git a/core/src/main/java/org/apache/hop/core/fileinput/FileInputList.java b/core/src/main/java/org/apache/hop/core/fileinput/FileInputList.java index 2c63403e840..a9a2d9c9ca9 100644 --- a/core/src/main/java/org/apache/hop/core/fileinput/FileInputList.java +++ b/core/src/main/java/org/apache/hop/core/fileinput/FileInputList.java @@ -17,6 +17,13 @@ package org.apache.hop.core.fileinput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -29,14 +36,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.vfs.HopVfs; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.regex.Pattern; - public class FileInputList { private final List files = new ArrayList<>(); private final List nonExistentFiles = new ArrayList<>(1); @@ -341,26 +340,26 @@ public static FileInputList createFolderList( // Find all folder names in this directory // if (directoryFileObject != null - && directoryFileObject.getType() == FileType.FOLDER) { // it's a directory + && directoryFileObject.getType() == FileType.FOLDER) { // it's a directory FileObject[] fileObjects = - directoryFileObject.findFiles( - new AllFileSelector() { - @Override - public boolean includeFile(FileSelectInfo info) { - // Never return the parent directory of a file list. - if (info.getDepth() == 0) { - return false; - } - - FileObject fileObject = info.getFile(); - try { - return fileObject != null && filter.isFileTypeAllowed(fileObject.getType()); - } catch (IOException ex) { - // Upon error don't process the file. - return false; - } - } - }); + directoryFileObject.findFiles( + new AllFileSelector() { + @Override + public boolean includeFile(FileSelectInfo info) { + // Never return the parent directory of a file list. + if (info.getDepth() == 0) { + return false; + } + + FileObject fileObject = info.getFile(); + try { + return fileObject != null && filter.isFileTypeAllowed(fileObject.getType()); + } catch (IOException ex) { + // Upon error don't process the file. + return false; + } + } + }); if (fileObjects != null) { for (FileObject fileObject : fileObjects) { if (fileObject.exists()) { diff --git a/core/src/main/java/org/apache/hop/core/fileinput/NonAccessibleFileObject.java b/core/src/main/java/org/apache/hop/core/fileinput/NonAccessibleFileObject.java index ffab83e06dd..01d543e3946 100644 --- a/core/src/main/java/org/apache/hop/core/fileinput/NonAccessibleFileObject.java +++ b/core/src/main/java/org/apache/hop/core/fileinput/NonAccessibleFileObject.java @@ -17,6 +17,10 @@ package org.apache.hop.core.fileinput; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Iterator; +import java.util.List; import org.apache.commons.lang.NotImplementedException; import org.apache.commons.vfs2.FileContent; import org.apache.commons.vfs2.FileName; @@ -28,11 +32,6 @@ import org.apache.commons.vfs2.NameScope; import org.apache.commons.vfs2.operations.FileOperations; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; -import java.util.List; - public class NonAccessibleFileObject implements FileObject { private final String fullyQualifiedName; @@ -89,8 +88,7 @@ public FileObject[] findFiles(FileSelector arg0) throws FileSystemException { } @Override - public void findFiles(FileSelector arg0, boolean arg1, List arg2) - throws FileSystemException { + public void findFiles(FileSelector arg0, boolean arg1, List arg2) throws FileSystemException { throw new NotImplementedException(); } diff --git a/core/src/main/java/org/apache/hop/core/gui/DPoint.java b/core/src/main/java/org/apache/hop/core/gui/DPoint.java index c8f67ff6225..9dd20fba6dc 100644 --- a/core/src/main/java/org/apache/hop/core/gui/DPoint.java +++ b/core/src/main/java/org/apache/hop/core/gui/DPoint.java @@ -17,9 +17,8 @@ package org.apache.hop.core.gui; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; /** A point but with double precision */ public class DPoint { diff --git a/core/src/main/java/org/apache/hop/core/gui/Point.java b/core/src/main/java/org/apache/hop/core/gui/Point.java index 7ea9ed129ed..e6f8c92ab01 100644 --- a/core/src/main/java/org/apache/hop/core/gui/Point.java +++ b/core/src/main/java/org/apache/hop/core/gui/Point.java @@ -17,14 +17,13 @@ package org.apache.hop.core.gui; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Point { public Point() { - this(0,0); + this(0, 0); } public Point(int x, int y) { @@ -67,7 +66,7 @@ public int hashCode() { @Override public String toString() { - return "Point("+x+","+y+")"; + return "Point(" + x + "," + y + ")"; } public DPoint toDouble() { diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiElements.java b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiElements.java index 9fb60d32e7b..2ba5693013a 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiElements.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiElements.java @@ -17,15 +17,14 @@ package org.apache.hop.core.gui.plugin; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.util.StringUtil; - import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.util.StringUtil; /** This represents a list of GUI elements under a certain heading or ID */ public class GuiElements extends BaseGuiElements implements Comparable { diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiPluginType.java b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiPluginType.java index f752a6a34d8..796e535da2a 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiPluginType.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiPluginType.java @@ -17,11 +17,10 @@ package org.apache.hop.core.gui.plugin; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; -import java.util.Map; - /** This class represents a plugin type for GUI elements like menus and toolbars. */ @PluginAnnotationType(GuiPlugin.class) public class GuiPluginType extends BasePluginType { diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiRegistry.java b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiRegistry.java index bab91b96641..5412124e614 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiRegistry.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiRegistry.java @@ -17,6 +17,15 @@ package org.apache.hop.core.gui.plugin; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.action.GuiContextActionFilter; @@ -37,16 +46,6 @@ import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarItemFilter; import org.apache.hop.core.util.TranslateUtil; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - /** * This singleton keeps track of the various GUI elements that are made plug-able by the developers. * For example, a general menu with a certain ID is added by someone and then other developers can @@ -63,6 +62,7 @@ public class GuiRegistry { * menu elements stored per ID. */ private Map> guiMenuMap; + private Map> guiToolbarMap; private Map> toolbarItemFiltersMap; @@ -394,16 +394,18 @@ public void addCompositeGuiWidgetElement( elements.add(child); } - /** Add a GUI element to the registry. + /** + * Add a GUI element to the registry. * * @param guiPluginClassName * @param method * @param guiTab * @param classLoader */ - public void addGuiTab(String guiPluginClassName, Method method, GuiTab guiTab, ClassLoader classLoader){ + public void addGuiTab( + String guiPluginClassName, Method method, GuiTab guiTab, ClassLoader classLoader) { List guiTabItemList = - guiTabsMap.computeIfAbsent(guiTab.parentId(), k -> new ArrayList<>()); + guiTabsMap.computeIfAbsent(guiTab.parentId(), k -> new ArrayList<>()); GuiTabItem guiTabItem = new GuiTabItem(guiPluginClassName, guiTab, method, classLoader); @@ -468,11 +470,11 @@ public void sortAllElements() { } } - public Map> getGuiTabsMap(){ + public Map> getGuiTabsMap() { return guiTabsMap; } - public List findGuiTabItems(String parent){ + public List findGuiTabItems(String parent) { List guiTabItems = guiTabsMap.get(parent); return guiTabItems; } @@ -820,7 +822,8 @@ public Map> getToolbarItemFiltersMap() { * * @param toolbarItemFiltersMap value of toolbarItemFiltersMap */ - public void setToolbarItemFiltersMap(Map> toolbarItemFiltersMap) { + public void setToolbarItemFiltersMap( + Map> toolbarItemFiltersMap) { this.toolbarItemFiltersMap = toolbarItemFiltersMap; } } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiWidgetElement.java b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiWidgetElement.java index 99a9bb68825..9e561705f9a 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/GuiWidgetElement.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/GuiWidgetElement.java @@ -17,14 +17,13 @@ package org.apache.hop.core.gui.plugin; -import org.apache.hop.core.gui.plugin.toolbar.EmptyTypeFilename; -import org.apache.hop.core.gui.plugin.toolbar.EmptyTypeMetadata; - import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.apache.hop.core.gui.plugin.toolbar.EmptyTypeFilename; +import org.apache.hop.core.gui.plugin.toolbar.EmptyTypeMetadata; /** * This annotation allows a method in a GuiPlugin to be identified as a contributor to the Hop UI @@ -76,19 +75,29 @@ */ String parentId() default ""; - /** @return True if the text element you define is a password with an asterisk mask */ + /** + * @return True if the text element you define is a password with an asterisk mask + */ boolean password() default false; - /** @return true if the widget supports variables */ + /** + * @return true if the widget supports variables + */ boolean variables() default true; - /** @return The setter method of the property if it's non-standard */ + /** + * @return The setter method of the property if it's non-standard + */ String setterMethod() default ""; - /** @return The getter method of the property if it's non-standard */ + /** + * @return The getter method of the property if it's non-standard + */ String getterMethod() default ""; - /** @return The method which returns a String[] to populate a combo box widget GUI element */ + /** + * @return The method which returns a String[] to populate a combo box widget GUI element + */ String comboValuesMethod() default ""; /** diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiAction.java b/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiAction.java index c8a03e028a5..cfa666ad84d 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiAction.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiAction.java @@ -161,7 +161,8 @@ private boolean matchesString(String string, String filter) { string = StringUtil.removeDiacriticalMarks(string); - if (EnvUtil.getSystemProperty(Const.HOP_CONTEXT_DIALOG_STRICT_SEARCH, "N").equalsIgnoreCase("Y")) { + if (EnvUtil.getSystemProperty(Const.HOP_CONTEXT_DIALOG_STRICT_SEARCH, "N") + .equalsIgnoreCase("Y")) { // Use strict matching of strings return string.equalsIgnoreCase(filter); } else { diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionFilter.java b/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionFilter.java index 1532cc78cd0..518240d3bec 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionFilter.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionFilter.java @@ -42,7 +42,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -56,7 +58,9 @@ public String getGuiPluginClassName() { return guiPluginClassName; } - /** @param guiPluginClassName The guiPluginClassName to set */ + /** + * @param guiPluginClassName The guiPluginClassName to set + */ public void setGuiPluginClassName(String guiPluginClassName) { this.guiPluginClassName = guiPluginClassName; } @@ -70,7 +74,9 @@ public String getGuiPluginMethodName() { return guiPluginMethodName; } - /** @param guiPluginMethodName The guiPluginMethodName to set */ + /** + * @param guiPluginMethodName The guiPluginMethodName to set + */ public void setGuiPluginMethodName(String guiPluginMethodName) { this.guiPluginMethodName = guiPluginMethodName; } @@ -84,7 +90,9 @@ public ClassLoader getClassLoader() { return classLoader; } - /** @param classLoader The classLoader to set */ + /** + * @param classLoader The classLoader to set + */ public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionLambdaBuilder.java b/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionLambdaBuilder.java index 8ff00b27676..9fc26f0840b 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionLambdaBuilder.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/action/GuiActionLambdaBuilder.java @@ -17,12 +17,11 @@ package org.apache.hop.core.gui.plugin.action; +import java.lang.reflect.Method; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.plugin.IGuiActionLambda; import org.apache.hop.core.gui.plugin.IGuiRefresher; -import java.lang.reflect.Method; - public class GuiActionLambdaBuilder { public GuiActionLambdaBuilder() {} diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallback.java b/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallback.java index 49c918a5956..1b4e47e4c47 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallback.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallback.java @@ -34,6 +34,8 @@ @Target({ElementType.METHOD}) public @interface GuiCallback { - /** @return The callback ID. This is defined by the calling entity */ + /** + * @return The callback ID. This is defined by the calling entity + */ String callbackId(); } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallbackMethod.java b/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallbackMethod.java index 39983f0ac35..47512dd25d6 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallbackMethod.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/callback/GuiCallbackMethod.java @@ -57,7 +57,9 @@ public String getCallbackId() { return callbackId; } - /** @param callbackId The callbackId to set */ + /** + * @param callbackId The callbackId to set + */ public void setCallbackId(String callbackId) { this.callbackId = callbackId; } @@ -71,7 +73,9 @@ public Class getSingletonClass() { return singletonClass; } - /** @param singletonClass The singletonClass to set */ + /** + * @param singletonClass The singletonClass to set + */ public void setSingletonClass(Class singletonClass) { this.singletonClass = singletonClass; } @@ -85,7 +89,9 @@ public Method getCallbackMethod() { return callbackMethod; } - /** @param callbackMethod The callbackMethod to set */ + /** + * @param callbackMethod The callbackMethod to set + */ public void setCallbackMethod(Method callbackMethod) { this.callbackMethod = callbackMethod; } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiKeyboardShortcut.java b/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiKeyboardShortcut.java index 57df17d1f1a..8b5e61dda73 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiKeyboardShortcut.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiKeyboardShortcut.java @@ -20,7 +20,6 @@ /** * This annotation allows a method in a GuiPlugin to be identified as a contributor to the Hop UI */ - import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiOsxKeyboardShortcut.java b/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiOsxKeyboardShortcut.java index 7fd70805e93..bbc0465e6b7 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiOsxKeyboardShortcut.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/key/GuiOsxKeyboardShortcut.java @@ -20,7 +20,6 @@ /** * This annotation allows a method in a GuiPlugin to be identified as a contributor to the Hop UI */ - import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/key/KeyboardShortcut.java b/core/src/main/java/org/apache/hop/core/gui/plugin/key/KeyboardShortcut.java index b8dd5ce6b17..23910dc5d16 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/key/KeyboardShortcut.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/key/KeyboardShortcut.java @@ -86,10 +86,10 @@ else if (keyCode == 127) { str.append("Delete"); } // Digit - else if ( (keyCode >= 48 && keyCode <= 57) || "+-/*".indexOf(keyCode)>=0) { + else if ((keyCode >= 48 && keyCode <= 57) || "+-/*".indexOf(keyCode) >= 0) { str.append(((char) keyCode)); } - + if ((keyCode & (1 << 24)) != 0) { switch (keyCode & (0xFFFF)) { case 1: @@ -181,7 +181,7 @@ else if ( (keyCode >= 48 && keyCode <= 57) || "+-/*".indexOf(keyCode)>=0) { break; } } - + return str.toString(); } @@ -216,7 +216,9 @@ public boolean isOsx() { return osx; } - /** @param osx The osx to set */ + /** + * @param osx The osx to set + */ public void setOsx(boolean osx) { this.osx = osx; } @@ -230,7 +232,9 @@ public boolean isAlt() { return alt; } - /** @param alt The alt to set */ + /** + * @param alt The alt to set + */ public void setAlt(boolean alt) { this.alt = alt; } @@ -244,7 +248,9 @@ public boolean isControl() { return control; } - /** @param control The control to set */ + /** + * @param control The control to set + */ public void setControl(boolean control) { this.control = control; } @@ -258,7 +264,9 @@ public boolean isShift() { return shift; } - /** @param shift The shift to set */ + /** + * @param shift The shift to set + */ public void setShift(boolean shift) { this.shift = shift; } @@ -272,7 +280,9 @@ public boolean isCommand() { return command; } - /** @param command The command to set */ + /** + * @param command The command to set + */ public void setCommand(boolean command) { this.command = command; } @@ -286,7 +296,9 @@ public int getKeyCode() { return keyCode; } - /** @param keyCode The keyCode to set */ + /** + * @param keyCode The keyCode to set + */ public void setKeyCode(int keyCode) { this.keyCode = keyCode; } @@ -300,7 +312,9 @@ public String getParentMethodName() { return parentMethodName; } - /** @param parentMethodName The parentMethodName to set */ + /** + * @param parentMethodName The parentMethodName to set + */ public void setParentMethodName(String parentMethodName) { this.parentMethodName = parentMethodName; } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuElement.java b/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuElement.java index 093fdd4e1d4..72b4eb286a3 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuElement.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuElement.java @@ -31,7 +31,9 @@ @Target({ElementType.FIELD, ElementType.METHOD}) public @interface GuiMenuElement { - /** @return The root to which this menu item belongs. For example see HopGui.ID_MAIN_MENU */ + /** + * @return The root to which this menu item belongs. For example see HopGui.ID_MAIN_MENU + */ String root(); /** diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuItem.java b/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuItem.java index fadfcb75ec6..d1dea5b1a81 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuItem.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/menu/GuiMenuItem.java @@ -17,10 +17,9 @@ package org.apache.hop.core.gui.plugin.menu; -import org.apache.hop.core.gui.plugin.BaseGuiElements; - import java.lang.reflect.Method; import java.util.Objects; +import org.apache.hop.core.gui.plugin.BaseGuiElements; /** This represents a list of GUI Menu elements under a certain heading or ID */ public class GuiMenuItem extends BaseGuiElements implements Comparable { @@ -118,7 +117,9 @@ public String getRoot() { return root; } - /** @param root The root to set */ + /** + * @param root The root to set + */ public void setRoot(String root) { this.root = root; } @@ -132,7 +133,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -146,7 +149,9 @@ public String getParentId() { return parentId; } - /** @param parentId The parentId to set */ + /** + * @param parentId The parentId to set + */ public void setParentId(String parentId) { this.parentId = parentId; } @@ -160,7 +165,9 @@ public String getLabel() { return label; } - /** @param label The label to set */ + /** + * @param label The label to set + */ public void setLabel(String label) { this.label = label; } @@ -174,7 +181,9 @@ public String getToolTip() { return toolTip; } - /** @param toolTip The toolTip to set */ + /** + * @param toolTip The toolTip to set + */ public void setToolTip(String toolTip) { this.toolTip = toolTip; } @@ -188,7 +197,9 @@ public GuiMenuElementType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(GuiMenuElementType type) { this.type = type; } @@ -202,7 +213,9 @@ public String getImage() { return image; } - /** @param image The image to set */ + /** + * @param image The image to set + */ public void setImage(String image) { this.image = image; } @@ -216,7 +229,9 @@ public String getDisabledImage() { return disabledImage; } - /** @param disabledImage The disabledImage to set */ + /** + * @param disabledImage The disabledImage to set + */ public void setDisabledImage(String disabledImage) { this.disabledImage = disabledImage; } @@ -230,7 +245,9 @@ public boolean isIgnored() { return ignored; } - /** @param ignored The ignored to set */ + /** + * @param ignored The ignored to set + */ public void setIgnored(boolean ignored) { this.ignored = ignored; } @@ -244,7 +261,9 @@ public boolean isAddingSeparator() { return addingSeparator; } - /** @param addingSeparator The addingSeparator to set */ + /** + * @param addingSeparator The addingSeparator to set + */ public void setAddingSeparator(boolean addingSeparator) { this.addingSeparator = addingSeparator; } @@ -258,7 +277,9 @@ public ClassLoader getClassLoader() { return classLoader; } - /** @param classLoader The classLoader to set */ + /** + * @param classLoader The classLoader to set + */ public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } @@ -272,7 +293,9 @@ public boolean isSingleTon() { return singleTon; } - /** @param singleTon The singleTon to set */ + /** + * @param singleTon The singleTon to set + */ public void setSingleTon(boolean singleTon) { this.singleTon = singleTon; } @@ -286,7 +309,9 @@ public String getListenerClassName() { return listenerClassName; } - /** @param listenerClassName The listenerClassName to set */ + /** + * @param listenerClassName The listenerClassName to set + */ public void setListenerClassName(String listenerClassName) { this.listenerClassName = listenerClassName; } @@ -300,7 +325,9 @@ public String getListenerMethod() { return listenerMethod; } - /** @param listenerMethod The listenerMethod to set */ + /** + * @param listenerMethod The listenerMethod to set + */ public void setListenerMethod(String listenerMethod) { this.listenerMethod = listenerMethod; } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTab.java b/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTab.java index 57e624e9eef..1bb1b0303d8 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTab.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTab.java @@ -24,19 +24,24 @@ import java.lang.annotation.Target; /** - * The method annotated with this class is going to receive a single CTabFolder argument when called. - * The class is simply going to be created with an empty constructor, once for every tab in every viewer. + * The method annotated with this class is going to receive a single CTabFolder argument when + * called. The class is simply going to be created with an empty constructor, once for every tab in + * every viewer. */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface GuiTab { - String type() default ""; - String id() default ""; - String parentId() default ""; - String description() default ""; - String targetClass() default ""; - int tabPosition() default 0; + String type() default ""; + String id() default ""; + + String parentId() default ""; + + String description() default ""; + + String targetClass() default ""; + + int tabPosition() default 0; } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTabItem.java b/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTabItem.java index f8c7a7b6d75..37a97416067 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTabItem.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/tab/GuiTabItem.java @@ -17,88 +17,88 @@ package org.apache.hop.core.gui.plugin.tab; -import org.apache.hop.core.gui.plugin.BaseGuiElements; - import java.lang.reflect.Method; +import org.apache.hop.core.gui.plugin.BaseGuiElements; -public class GuiTabItem extends BaseGuiElements implements Comparable{ - - private String id; - private String parent; - private String pluginClassName; - private GuiTab guiTab; - private String targetClass; - private Method method; - private ClassLoader classLoader; - - public GuiTabItem(String pluginClassName, GuiTab guiTab, Method tabMethod, ClassLoader classLoader){ - this.id = guiTab.id(); - this.parent = guiTab.parentId(); - this.pluginClassName = pluginClassName; - this.targetClass = guiTab.targetClass(); - this.guiTab = guiTab; - this.method = tabMethod; - this.classLoader = classLoader; - } - - public String getPluginClassName() { - return pluginClassName; - } - - public void setPluginClassName(String pluginClassName) { - this.pluginClassName = pluginClassName; - } - - public GuiTab getGuiTab() { - return guiTab; - } - - public void setGuiTab(GuiTab guiTab) { - this.guiTab = guiTab; - } - - public Method getMethod() { - return method; - } - - public void setMethod(Method method) { - this.method = method; - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - public void setClassLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - public String getTargetClass() { - return targetClass; - } - - public void setTargetClass(String targetClass) { - this.targetClass = targetClass; - } - - @Override - public int compareTo(GuiTabItem guiTabItem) { - return id.compareTo(guiTabItem.id); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } +public class GuiTabItem extends BaseGuiElements implements Comparable { + + private String id; + private String parent; + private String pluginClassName; + private GuiTab guiTab; + private String targetClass; + private Method method; + private ClassLoader classLoader; + + public GuiTabItem( + String pluginClassName, GuiTab guiTab, Method tabMethod, ClassLoader classLoader) { + this.id = guiTab.id(); + this.parent = guiTab.parentId(); + this.pluginClassName = pluginClassName; + this.targetClass = guiTab.targetClass(); + this.guiTab = guiTab; + this.method = tabMethod; + this.classLoader = classLoader; + } + + public String getPluginClassName() { + return pluginClassName; + } + + public void setPluginClassName(String pluginClassName) { + this.pluginClassName = pluginClassName; + } + + public GuiTab getGuiTab() { + return guiTab; + } + + public void setGuiTab(GuiTab guiTab) { + this.guiTab = guiTab; + } + + public Method getMethod() { + return method; + } + + public void setMethod(Method method) { + this.method = method; + } + + public ClassLoader getClassLoader() { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) { + this.classLoader = classLoader; + } + + public String getTargetClass() { + return targetClass; + } + + public void setTargetClass(String targetClass) { + this.targetClass = targetClass; + } + + @Override + public int compareTo(GuiTabItem guiTabItem) { + return id.compareTo(guiTabItem.id); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getParent() { + return parent; + } + + public void setParent(String parent) { + this.parent = parent; + } } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java index a5b661be94a..022b1fb9f41 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java @@ -31,7 +31,9 @@ @Target({ElementType.FIELD, ElementType.METHOD}) public @interface GuiToolbarElement { - /** @return The ID of the toolbar to which this element belongs */ + /** + * @return The ID of the toolbar to which this element belongs + */ String root(); /** @@ -74,19 +76,29 @@ */ String imageMethod() default ""; - /** @return True if the text element you define is a password with an asterisk mask */ + /** + * @return True if the text element you define is a password with an asterisk mask + */ boolean password() default false; - /** @return true if the widget supports variables */ + /** + * @return true if the widget supports variables + */ boolean variables() default true; - /** @return The getter method of the property if it's non-standard */ + /** + * @return The getter method of the property if it's non-standard + */ String getterMethod() default ""; - /** @return The setter method of the property if it's non-standard */ + /** + * @return The setter method of the property if it's non-standard + */ String setterMethod() default ""; - /** @return The method which returns a String[] to populate a combo box widget GUI element */ + /** + * @return The method which returns a String[] to populate a combo box widget GUI element + */ String comboValuesMethod() default ""; /** diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementFilter.java b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementFilter.java index 5020be8066a..9f09c9165b5 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementFilter.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementFilter.java @@ -24,9 +24,9 @@ import java.lang.annotation.Target; /** - * We need a way to only show certain toolbar items in certain situations. - * The static method that is annotated with this will receive the toolbar item ID and the GUI plugin object. - * In return, it will give back a boolean saying true: show the toolbar item or false: don't show it. + * We need a way to only show certain toolbar items in certain situations. The static method that is + * annotated with this will receive the toolbar item ID and the GUI plugin object. In return, it + * will give back a boolean saying true: show the toolbar item or false: don't show it. */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItem.java b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItem.java index b21cb4fd001..97d70c6e596 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItem.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItem.java @@ -17,10 +17,9 @@ package org.apache.hop.core.gui.plugin.toolbar; -import org.apache.hop.core.gui.plugin.BaseGuiElements; - import java.lang.reflect.Method; import java.util.Objects; +import org.apache.hop.core.gui.plugin.BaseGuiElements; /** This represents a list of GUI elements under a certain heading or ID */ public class GuiToolbarItem extends BaseGuiElements implements Comparable { @@ -129,7 +128,9 @@ public String getRoot() { return root; } - /** @param root The root to set */ + /** + * @param root The root to set + */ public void setRoot(String root) { this.root = root; } @@ -143,7 +144,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -157,7 +160,9 @@ public String getLabel() { return label; } - /** @param label The label to set */ + /** + * @param label The label to set + */ public void setLabel(String label) { this.label = label; } @@ -171,7 +176,9 @@ public String getToolTip() { return toolTip; } - /** @param toolTip The toolTip to set */ + /** + * @param toolTip The toolTip to set + */ public void setToolTip(String toolTip) { this.toolTip = toolTip; } @@ -185,7 +192,9 @@ public GuiToolbarElementType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(GuiToolbarElementType type) { this.type = type; } @@ -199,7 +208,9 @@ public String getImage() { return image; } - /** @param image The image to set */ + /** + * @param image The image to set + */ public void setImage(String image) { this.image = image; } @@ -231,7 +242,9 @@ public boolean isPassword() { return password; } - /** @param password The password to set */ + /** + * @param password The password to set + */ public void setPassword(boolean password) { this.password = password; } @@ -245,7 +258,9 @@ public String getGetComboValuesMethod() { return getComboValuesMethod; } - /** @param getComboValuesMethod The getComboValuesMethod to set */ + /** + * @param getComboValuesMethod The getComboValuesMethod to set + */ public void setGetComboValuesMethod(String getComboValuesMethod) { this.getComboValuesMethod = getComboValuesMethod; } @@ -259,7 +274,9 @@ public boolean isIgnored() { return ignored; } - /** @param ignored The ignored to set */ + /** + * @param ignored The ignored to set + */ public void setIgnored(boolean ignored) { this.ignored = ignored; } @@ -273,7 +290,9 @@ public boolean isAddingSeparator() { return addingSeparator; } - /** @param addingSeparator The addingSeparator to set */ + /** + * @param addingSeparator The addingSeparator to set + */ public void setAddingSeparator(boolean addingSeparator) { this.addingSeparator = addingSeparator; } @@ -287,7 +306,9 @@ public ClassLoader getClassLoader() { return classLoader; } - /** @param classLoader The classLoader to set */ + /** + * @param classLoader The classLoader to set + */ public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } @@ -301,7 +322,9 @@ public boolean isSingleTon() { return singleTon; } - /** @param singleTon The singleTon to set */ + /** + * @param singleTon The singleTon to set + */ public void setSingleTon(boolean singleTon) { this.singleTon = singleTon; } @@ -315,7 +338,9 @@ public String getListenerClass() { return listenerClass; } - /** @param listenerClass The listenerClass to set */ + /** + * @param listenerClass The listenerClass to set + */ public void setListenerClass(String listenerClass) { this.listenerClass = listenerClass; } @@ -329,7 +354,9 @@ public String getListenerMethod() { return listenerMethod; } - /** @param listenerMethod The listenerMethod to set */ + /** + * @param listenerMethod The listenerMethod to set + */ public void setListenerMethod(String listenerMethod) { this.listenerMethod = listenerMethod; } @@ -343,7 +370,9 @@ public int getExtraWidth() { return extraWidth; } - /** @param extraWidth The extraWidth to set */ + /** + * @param extraWidth The extraWidth to set + */ public void setExtraWidth(int extraWidth) { this.extraWidth = extraWidth; } @@ -357,7 +386,9 @@ public boolean isAlignRight() { return alignRight; } - /** @param alignRight The alignRight to set */ + /** + * @param alignRight The alignRight to set + */ public void setAlignRight(boolean alignRight) { this.alignRight = alignRight; } diff --git a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItemFilter.java b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItemFilter.java index 4caba9674ef..cda830e8189 100644 --- a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItemFilter.java +++ b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarItemFilter.java @@ -42,7 +42,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -56,7 +58,9 @@ public String getGuiPluginClassName() { return guiPluginClassName; } - /** @param guiPluginClassName The guiPluginClassName to set */ + /** + * @param guiPluginClassName The guiPluginClassName to set + */ public void setGuiPluginClassName(String guiPluginClassName) { this.guiPluginClassName = guiPluginClassName; } @@ -70,7 +74,9 @@ public String getGuiPluginMethodName() { return guiPluginMethodName; } - /** @param guiPluginMethodName The guiPluginMethodName to set */ + /** + * @param guiPluginMethodName The guiPluginMethodName to set + */ public void setGuiPluginMethodName(String guiPluginMethodName) { this.guiPluginMethodName = guiPluginMethodName; } @@ -84,7 +90,9 @@ public ClassLoader getClassLoader() { return classLoader; } - /** @param classLoader The classLoader to set */ + /** + * @param classLoader The classLoader to set + */ public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } diff --git a/core/src/main/java/org/apache/hop/core/hash/ByteArrayHashMap.java b/core/src/main/java/org/apache/hop/core/hash/ByteArrayHashMap.java index fdf5d8b7da9..bf474660189 100644 --- a/core/src/main/java/org/apache/hop/core/hash/ByteArrayHashMap.java +++ b/core/src/main/java/org/apache/hop/core/hash/ByteArrayHashMap.java @@ -17,15 +17,14 @@ package org.apache.hop.core.hash; -import org.apache.commons.collections4.map.AbstractHashedMap; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowMeta; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; +import org.apache.commons.collections4.map.AbstractHashedMap; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowMeta; public class ByteArrayHashMap extends AbstractHashedMap { private IRowMeta keyMeta; diff --git a/core/src/main/java/org/apache/hop/core/logging/DefaultLogLevel.java b/core/src/main/java/org/apache/hop/core/logging/DefaultLogLevel.java index 5f45c3d3294..cdd9bd69f90 100644 --- a/core/src/main/java/org/apache/hop/core/logging/DefaultLogLevel.java +++ b/core/src/main/java/org/apache/hop/core/logging/DefaultLogLevel.java @@ -34,13 +34,17 @@ private static DefaultLogLevel getInstance() { return defaultLogLevel; } - /** @return The default log level for this application */ + /** + * @return The default log level for this application + */ public static LogLevel getLogLevel() { DefaultLogLevel instance = getInstance(); return instance.logLevel; } - /** @param logLevel Set the default log level for this application */ + /** + * @param logLevel Set the default log level for this application + */ public static void setLogLevel(LogLevel logLevel) { DefaultLogLevel instance = getInstance(); instance.logLevel = logLevel; diff --git a/core/src/main/java/org/apache/hop/core/logging/FileLoggingEventListener.java b/core/src/main/java/org/apache/hop/core/logging/FileLoggingEventListener.java index 40409fd1cc5..f1fb9cea6bf 100644 --- a/core/src/main/java/org/apache/hop/core/logging/FileLoggingEventListener.java +++ b/core/src/main/java/org/apache/hop/core/logging/FileLoggingEventListener.java @@ -17,14 +17,13 @@ package org.apache.hop.core.logging; +import java.io.OutputStream; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.vfs.HopVfs; -import java.io.OutputStream; -import java.util.List; - public class FileLoggingEventListener implements IHopLoggingEventListener { private String filename; diff --git a/core/src/main/java/org/apache/hop/core/logging/HopLogLayout.java b/core/src/main/java/org/apache/hop/core/logging/HopLogLayout.java index 2c6675ca284..a0bbad9b7d4 100644 --- a/core/src/main/java/org/apache/hop/core/logging/HopLogLayout.java +++ b/core/src/main/java/org/apache/hop/core/logging/HopLogLayout.java @@ -17,10 +17,9 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.Const; - import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.hop.core.Const; public class HopLogLayout { private static final ThreadLocal LOCAL_SIMPLE_DATE_PARSER = diff --git a/core/src/main/java/org/apache/hop/core/logging/HopLogStore.java b/core/src/main/java/org/apache/hop/core/logging/HopLogStore.java index e436a786286..fde2ccde8b8 100644 --- a/core/src/main/java/org/apache/hop/core/logging/HopLogStore.java +++ b/core/src/main/java/org/apache/hop/core/logging/HopLogStore.java @@ -17,15 +17,14 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.Const; -import org.apache.hop.core.util.EnvUtil; - import java.io.PrintStream; import java.util.Date; import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.hop.core.Const; +import org.apache.hop.core.util.EnvUtil; public class HopLogStore { @@ -217,7 +216,7 @@ public static void discardLines(String parentLogChannelId, boolean includeGenera LoggingRegistry registry = LoggingRegistry.getInstance(); MetricsRegistry metricsRegistry = MetricsRegistry.getInstance(); List ids = registry.getLogChannelChildren(parentLogChannelId); - if (ids==null) { + if (ids == null) { return; } diff --git a/core/src/main/java/org/apache/hop/core/logging/ILogChannel.java b/core/src/main/java/org/apache/hop/core/logging/ILogChannel.java index 7c10bdcfbe9..558b4156289 100644 --- a/core/src/main/java/org/apache/hop/core/logging/ILogChannel.java +++ b/core/src/main/java/org/apache/hop/core/logging/ILogChannel.java @@ -19,17 +19,23 @@ public interface ILogChannel { - /** @return the id of the logging channel */ + /** + * @return the id of the logging channel + */ String getLogChannelId(); LogLevel getLogLevel(); void setLogLevel(LogLevel logLevel); - /** @return the containerObjectId */ + /** + * @return the containerObjectId + */ String getContainerObjectId(); - /** @param containerObjectId the containerObjectId to set */ + /** + * @param containerObjectId the containerObjectId to set + */ void setContainerObjectId(String containerObjectId); String getFilter(); @@ -84,7 +90,9 @@ public interface ILogChannel { */ void setForcingSeparateLogging(boolean forcingSeparateLogging); - /** @return True if the logging is forcibly separated out from even identical objects. */ + /** + * @return True if the logging is forcibly separated out from even identical objects. + */ boolean isForcingSeparateLogging(); /** diff --git a/core/src/main/java/org/apache/hop/core/logging/ILoggingObject.java b/core/src/main/java/org/apache/hop/core/logging/ILoggingObject.java index 8c39b571f1c..d615d08f0b0 100644 --- a/core/src/main/java/org/apache/hop/core/logging/ILoggingObject.java +++ b/core/src/main/java/org/apache/hop/core/logging/ILoggingObject.java @@ -107,6 +107,8 @@ public interface ILoggingObject { */ void setForcingSeparateLogging(boolean forcingSeparateLogging); - /** @return True if the logging is forcibly separated out from even identical objects. */ + /** + * @return True if the logging is forcibly separated out from even identical objects. + */ boolean isForcingSeparateLogging(); } diff --git a/core/src/main/java/org/apache/hop/core/logging/LogChannel.java b/core/src/main/java/org/apache/hop/core/logging/LogChannel.java index e6409f68381..243effbdf59 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LogChannel.java +++ b/core/src/main/java/org/apache/hop/core/logging/LogChannel.java @@ -17,16 +17,15 @@ package org.apache.hop.core.logging; +import java.util.Date; +import java.util.Map; +import java.util.Queue; import org.apache.hop.core.Const; import org.apache.hop.core.metrics.IMetricsSnapshot; import org.apache.hop.core.metrics.MetricsSnapshot; import org.apache.hop.core.metrics.MetricsSnapshotType; import org.apache.hop.core.util.Utils; -import java.util.Date; -import java.util.Map; -import java.util.Queue; - public class LogChannel implements ILogChannel { public static ILogChannel GENERAL = new LogChannel("General"); @@ -65,12 +64,15 @@ public LogChannel(Object subject, ILoggingObject parentObject) { this(subject, parentObject, false, false); } - public LogChannel(Object subject, ILoggingObject parentObject, boolean gatheringMetrics) { this(subject, parentObject, gatheringMetrics, false); } - public LogChannel(Object subject, ILoggingObject parentObject, boolean gatheringMetrics, boolean forceNewLoggingEntry) { + public LogChannel( + Object subject, + ILoggingObject parentObject, + boolean gatheringMetrics, + boolean forceNewLoggingEntry) { if (parentObject != null) { this.logLevel = parentObject.getLogLevel(); this.containerObjectId = parentObject.getContainerId(); @@ -80,7 +82,8 @@ public LogChannel(Object subject, ILoggingObject parentObject, boolean gathering } this.gatheringMetrics = gatheringMetrics; - logChannelId = LoggingRegistry.getInstance().registerLoggingSource(subject, forceNewLoggingEntry); + logChannelId = + LoggingRegistry.getInstance().registerLoggingSource(subject, forceNewLoggingEntry); } @Override @@ -253,25 +256,33 @@ public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; } - /** @return the containerObjectId */ + /** + * @return the containerObjectId + */ @Override public String getContainerObjectId() { return containerObjectId; } - /** @param containerObjectId the containerObjectId to set */ + /** + * @param containerObjectId the containerObjectId to set + */ @Override public void setContainerObjectId(String containerObjectId) { this.containerObjectId = containerObjectId; } - /** @return the gatheringMetrics */ + /** + * @return the gatheringMetrics + */ @Override public boolean isGatheringMetrics() { return gatheringMetrics; } - /** @param gatheringMetrics the gatheringMetrics to set */ + /** + * @param gatheringMetrics the gatheringMetrics to set + */ @Override public void setGatheringMetrics(boolean gatheringMetrics) { this.gatheringMetrics = gatheringMetrics; @@ -406,7 +417,9 @@ public boolean isSimplified() { return simplified; } - /** @param simplified The simplified to set */ + /** + * @param simplified The simplified to set + */ public void setSimplified(boolean simplified) { this.simplified = simplified; } diff --git a/core/src/main/java/org/apache/hop/core/logging/LogChannelFileWriterBuffer.java b/core/src/main/java/org/apache/hop/core/logging/LogChannelFileWriterBuffer.java index ef15681e4d3..c7859c2b73e 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LogChannelFileWriterBuffer.java +++ b/core/src/main/java/org/apache/hop/core/logging/LogChannelFileWriterBuffer.java @@ -17,11 +17,10 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.Const; - import java.util.Collections; import java.util.LinkedList; import java.util.List; +import org.apache.hop.core.Const; public class LogChannelFileWriterBuffer { diff --git a/core/src/main/java/org/apache/hop/core/logging/LogLevel.java b/core/src/main/java/org/apache/hop/core/logging/LogLevel.java index bf6d8706ea2..59a57aa0a81 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LogLevel.java +++ b/core/src/main/java/org/apache/hop/core/logging/LogLevel.java @@ -63,7 +63,7 @@ public String getCode() { public String getDescription() { return logLevelDescriptions[level]; } - + /** * Return the log level for a certain log level code * @@ -74,25 +74,26 @@ public String getDescription() { public static LogLevel getLogLevelForCode(String code) { return IEnumHasCode.lookupCode(LogLevel.class, code, LogLevel.BASIC); } - + /** * Return the log level for a certain log level code * * @param code the code to look for * @return the log level or BASIC if nothing matches. - */ + */ public static LogLevel lookupCode(final String code) { return IEnumHasCode.lookupCode(LogLevel.class, code, LogLevel.BASIC); } - + /** * Return the log level for a certain log level description * * @param description the description to look for * @return the log level or BASIC if nothing matches. - */ + */ public static LogLevel lookupDescription(final String description) { - return IEnumHasCodeAndDescription.lookupDescription(LogLevel.class, description, LogLevel.BASIC); + return IEnumHasCodeAndDescription.lookupDescription( + LogLevel.class, description, LogLevel.BASIC); } /** @@ -103,50 +104,67 @@ public boolean isVisible(LogLevel filterLogLevel) { return getLevel() <= filterLogLevel.getLevel(); } - /** @return true if this level is Error or lower */ + /** + * @return true if this level is Error or lower + */ public boolean isError() { return this == ERROR; } - /** @return True if this level is Minimal or lower (which is nothing) */ + /** + * @return True if this level is Minimal or lower (which is nothing) + */ public boolean isNothing() { return this.level >= NOTHING.level; } - /** @return True if this level is Minimal */ + /** + * @return True if this level is Minimal + */ public boolean isMinimal() { return this.level >= MINIMAL.level; } - /** @return True if this level is Basic */ + /** + * @return True if this level is Basic + */ public boolean isBasic() { return this.level >= BASIC.level; } - /** @return True if this level is Detailed */ + /** + * @return True if this level is Detailed + */ public boolean isDetailed() { return this.level >= DETAILED.level; } - /** @return True if this level is Debug */ + /** + * @return True if this level is Debug + */ public boolean isDebug() { return this.level >= DEBUG.level; } - /** @return True if this level is Row level */ + /** + * @return True if this level is Row level + */ public boolean isRowlevel() { return this.level >= ROWLEVEL.level; } - /** + /** * Return an array of log level descriptions, sorted by level (0==Nothing, 6=Row Level) + * * @return An array of log level descriptions */ public static String[] getLogLevelDescriptions() { return IEnumHasCodeAndDescription.getDescriptions(LogLevel.class); } - /** @return An array of log level codes, sorted by level (0==Nothing, 6=Row Level) */ + /** + * @return An array of log level codes, sorted by level (0==Nothing, 6=Row Level) + */ public static String[] logLogLevelCodes() { return IEnumHasCode.getCodes(LogLevel.class); } diff --git a/core/src/main/java/org/apache/hop/core/logging/LogMessage.java b/core/src/main/java/org/apache/hop/core/logging/LogMessage.java index 340f00e6097..fe4481dedfa 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LogMessage.java +++ b/core/src/main/java/org/apache/hop/core/logging/LogMessage.java @@ -17,15 +17,14 @@ package org.apache.hop.core.logging; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.util.StringUtil; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - public class LogMessage implements ILogMessage { private String logChannelId; private String message; @@ -92,7 +91,9 @@ private String getDetailedSubject(ILoggingObject loggingObject) { return subjects.size() > 1 ? formatDetailedSubject(subjects) : subjects.get(0); } - /** @param loggingObject */ + /** + * @param loggingObject + */ private List getSubjectTree(ILoggingObject loggingObject) { List subjects = new ArrayList<>(); while (loggingObject != null) { @@ -135,7 +136,9 @@ public LogLevel getLevel() { return level; } - /** @return The formatted message. */ + /** + * @return The formatted message. + */ @Override public String getMessage() { String formatted = message; @@ -162,19 +165,25 @@ public String getMessage() { return formatted; } - /** @return the subject */ + /** + * @return the subject + */ @Override public String getSubject() { return subject; } - /** @return the logChannelId */ + /** + * @return the logChannelId + */ @Override public String getLogChannelId() { return logChannelId; } - /** @return the arguments */ + /** + * @return the arguments + */ @Override public Object[] getArguments() { return arguments; @@ -199,7 +208,9 @@ public boolean isSimplified() { return simplified; } - /** @param simplified The simplified to set */ + /** + * @param simplified The simplified to set + */ public void setSimplified(boolean simplified) { this.simplified = simplified; } diff --git a/core/src/main/java/org/apache/hop/core/logging/LogTableField.java b/core/src/main/java/org/apache/hop/core/logging/LogTableField.java index 119bb4554ce..feba5cd1817 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LogTableField.java +++ b/core/src/main/java/org/apache/hop/core/logging/LogTableField.java @@ -121,157 +121,219 @@ public String toString() { return id; } - /** @return the enabled */ + /** + * @return the enabled + */ public boolean isEnabled() { return enabled; } - /** @param enabled the enabled to set */ + /** + * @param enabled the enabled to set + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } - /** @return the subject */ + /** + * @return the subject + */ public Object getSubject() { return subject; } - /** @param subject the subject to set */ + /** + * @param subject the subject to set + */ public void setSubject(Object subject) { this.subject = subject; } - /** @return the id */ + /** + * @return the id + */ public String getId() { return id; } - /** @return the fieldName */ + /** + * @return the fieldName + */ public String getFieldName() { return fieldName; } - /** @param fieldName the fieldName to set */ + /** + * @param fieldName the fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } - /** @return the description */ + /** + * @return the description + */ public String getDescription() { return description; } - /** @param description the description to set */ + /** + * @param description the description to set + */ public void setDescription(String description) { this.description = description; } - /** @return the dataType */ + /** + * @return the dataType + */ public int getDataType() { return dataType; } - /** @param dataType the dataType to set */ + /** + * @param dataType the dataType to set + */ public void setDataType(int dataType) { this.dataType = dataType; } - /** @return the length */ + /** + * @return the length + */ public int getLength() { return length; } - /** @param length the length to set */ + /** + * @param length the length to set + */ public void setLength(int length) { this.length = length; } - /** @return the subjectAllowed */ + /** + * @return the subjectAllowed + */ public boolean isSubjectAllowed() { return subjectAllowed; } - /** @param subjectAllowed the subjectAllowed to set */ + /** + * @param subjectAllowed the subjectAllowed to set + */ public void setSubjectAllowed(boolean subjectAllowed) { this.subjectAllowed = subjectAllowed; } - /** @return the key */ + /** + * @return the key + */ public boolean isKey() { return key; } - /** @param key the key to set */ + /** + * @param key the key to set + */ public void setKey(boolean key) { this.key = key; } - /** @return the logDateField */ + /** + * @return the logDateField + */ public boolean isLogDateField() { return logDateField; } - /** @param logDateField the logDateField to set */ + /** + * @param logDateField the logDateField to set + */ public void setLogDateField(boolean logDateField) { this.logDateField = logDateField; } - /** @return the name */ + /** + * @return the name + */ public String getName() { return name; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setName(String name) { this.name = name; } - /** @return the logField */ + /** + * @return the logField + */ public boolean isLogField() { return logField; } - /** @param logField the logField to set */ + /** + * @param logField the logField to set + */ public void setLogField(boolean logField) { this.logField = logField; } - /** @return the visible */ + /** + * @return the visible + */ public boolean isVisible() { return visible; } - /** @param visible the visible to set */ + /** + * @param visible the visible to set + */ public void setVisible(boolean visible) { this.visible = visible; } - /** @return the statusField */ + /** + * @return the statusField + */ public boolean isStatusField() { return statusField; } - /** @param statusField the statusField to set */ + /** + * @param statusField the statusField to set + */ public void setStatusField(boolean statusField) { this.statusField = statusField; } - /** @return the errorsField */ + /** + * @return the errorsField + */ public boolean isErrorsField() { return errorsField; } - /** @param errorsField the errorsField to set */ + /** + * @param errorsField the errorsField to set + */ public void setErrorsField(boolean errorsField) { this.errorsField = errorsField; } - /** @return the nameField */ + /** + * @return the nameField + */ public boolean isNameField() { return nameField; } - /** @param nameField the nameField to set */ + /** + * @param nameField the nameField to set + */ public void setNameField(boolean nameField) { this.nameField = nameField; } diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingBuffer.java b/core/src/main/java/org/apache/hop/core/logging/LoggingBuffer.java index eb3a49ce5fa..0b77fd14a26 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingBuffer.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingBuffer.java @@ -17,8 +17,6 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.Const; - import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -28,6 +26,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.hop.core.Const; /** This class keeps the last N lines in a buffer */ public class LoggingBuffer { @@ -190,7 +189,9 @@ public void clear() { } } - /** @return the maximum number of lines that this buffer contains, 0 or lower means: no limit */ + /** + * @return the maximum number of lines that this buffer contains, 0 or lower means: no limit + */ public int getMaxNrLines() { return bufferSize; } @@ -203,7 +204,9 @@ public void setMaxNrLines(int maxNrLines) { this.bufferSize = maxNrLines; } - /** @return the nrLines */ + /** + * @return the nrLines + */ public int getNrLines() { return buffer.size(); } diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingHierarchy.java b/core/src/main/java/org/apache/hop/core/logging/LoggingHierarchy.java index 81f244cf0c9..3207670915e 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingHierarchy.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingHierarchy.java @@ -22,22 +22,30 @@ public class LoggingHierarchy { private String rootChannelId; // from the xform or workflow private ILoggingObject loggingObject; - /** @return the rootChannelId */ + /** + * @return the rootChannelId + */ public String getRootChannelId() { return rootChannelId; } - /** @param rootChannelId the rootChannelId to set */ + /** + * @param rootChannelId the rootChannelId to set + */ public void setRootChannelId(String rootChannelId) { this.rootChannelId = rootChannelId; } - /** @return the loggingObject */ + /** + * @return the loggingObject + */ public ILoggingObject getLoggingObject() { return loggingObject; } - /** @param loggingObject the loggingObject to set */ + /** + * @param loggingObject the loggingObject to set + */ public void setLoggingObject(ILoggingObject loggingObject) { this.loggingObject = loggingObject; } diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingObject.java b/core/src/main/java/org/apache/hop/core/logging/LoggingObject.java index 65cecbf26c8..6f543811a83 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingObject.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingObject.java @@ -17,11 +17,10 @@ package org.apache.hop.core.logging; +import java.util.Date; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.util.Utils; -import java.util.Date; - public class LoggingObject implements ILoggingObject { private String logChannelId; @@ -204,68 +203,92 @@ private void getParentLoggingObject(Object parentObject) { parent = loggingObject; } - /** @return the name */ + /** + * @return the name + */ @Override public String getObjectName() { return objectName; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setObjectName(String name) { this.objectName = name; } - /** @return the filename */ + /** + * @return the filename + */ @Override public String getFilename() { return filename; } - /** @param filename the filename to set */ + /** + * @param filename the filename to set + */ public void setFilename(String filename) { this.filename = filename; } - /** @return the id */ + /** + * @return the id + */ @Override public String getLogChannelId() { return logChannelId; } - /** @param logChannelId the id to set */ + /** + * @param logChannelId the id to set + */ public void setLogChannelId(String logChannelId) { this.logChannelId = logChannelId; } - /** @return the parent */ + /** + * @return the parent + */ @Override public ILoggingObject getParent() { return parent; } - /** @param parent the parent to set */ + /** + * @param parent the parent to set + */ public void setParent(ILoggingObject parent) { this.parent = parent; } - /** @return the objectType */ + /** + * @return the objectType + */ @Override public LoggingObjectType getObjectType() { return objectType; } - /** @param objectType the objectType to set */ + /** + * @param objectType the objectType to set + */ public void setObjectType(LoggingObjectType objectType) { this.objectType = objectType; } - /** @return the copy */ + /** + * @return the copy + */ @Override public String getObjectCopy() { return objectCopy; } - /** @param objectCopy the copy to set */ + /** + * @param objectCopy the copy to set + */ public void setObjectCopy(String objectCopy) { this.objectCopy = objectCopy; } @@ -279,47 +302,63 @@ public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; } - /** @return the serverObjectId */ + /** + * @return the serverObjectId + */ @Override public String getContainerId() { return containerObjectId; } - /** @param serverObjectId the serverObjectId to set */ + /** + * @param serverObjectId the serverObjectId to set + */ public void setCarteObjectId(String serverObjectId) { this.containerObjectId = serverObjectId; } - /** @return the registrationDate */ + /** + * @return the registrationDate + */ @Override public Date getRegistrationDate() { return registrationDate; } - /** @param registrationDate the registrationDate to set */ + /** + * @param registrationDate the registrationDate to set + */ public void setRegistrationDate(Date registrationDate) { this.registrationDate = registrationDate; } - /** @return the gatheringMetrics */ + /** + * @return the gatheringMetrics + */ @Override public boolean isGatheringMetrics() { return gatheringMetrics; } - /** @param gatheringMetrics the gatheringMetrics to set */ + /** + * @param gatheringMetrics the gatheringMetrics to set + */ @Override public void setGatheringMetrics(boolean gatheringMetrics) { this.gatheringMetrics = gatheringMetrics; } - /** @return the forcingSeparateLogging */ + /** + * @return the forcingSeparateLogging + */ @Override public boolean isForcingSeparateLogging() { return forcingSeparateLogging; } - /** @param forcingSeparateLogging the forcingSeparateLogging to set */ + /** + * @param forcingSeparateLogging the forcingSeparateLogging to set + */ @Override public void setForcingSeparateLogging(boolean forcingSeparateLogging) { this.forcingSeparateLogging = forcingSeparateLogging; diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingPlugin.java b/core/src/main/java/org/apache/hop/core/logging/LoggingPlugin.java index a8876957fd7..6eb8570e24d 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingPlugin.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingPlugin.java @@ -31,7 +31,9 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface LoggingPlugin { - /** @return The ID of the logging plug-in */ + /** + * @return The ID of the logging plug-in + */ String id(); String classLoaderGroup() default ""; diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingPluginType.java b/core/src/main/java/org/apache/hop/core/logging/LoggingPluginType.java index ac8f7381bda..d05c7cfd719 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingPluginType.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingPluginType.java @@ -17,13 +17,12 @@ package org.apache.hop.core.logging; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; import org.apache.hop.core.util.Utils; -import java.util.Map; - /** This class represents the logging plugin type. */ @PluginMainClassType(ILoggingPlugin.class) @PluginAnnotationType(LoggingPlugin.class) diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingPrintStream.java b/core/src/main/java/org/apache/hop/core/logging/LoggingPrintStream.java index 6cf6789b045..7eb944406c1 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingPrintStream.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingPrintStream.java @@ -17,9 +17,8 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.Const; - import java.io.PrintStream; +import org.apache.hop.core.Const; public class LoggingPrintStream extends PrintStream { diff --git a/core/src/main/java/org/apache/hop/core/logging/LoggingRegistry.java b/core/src/main/java/org/apache/hop/core/logging/LoggingRegistry.java index f4e2d9a403a..e0319146695 100644 --- a/core/src/main/java/org/apache/hop/core/logging/LoggingRegistry.java +++ b/core/src/main/java/org/apache/hop/core/logging/LoggingRegistry.java @@ -17,9 +17,6 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.Const; -import org.apache.hop.core.util.EnvUtil; - import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -30,6 +27,8 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import org.apache.hop.core.Const; +import org.apache.hop.core.util.EnvUtil; public class LoggingRegistry { private static LoggingRegistry registry = new LoggingRegistry(); @@ -79,8 +78,8 @@ public String registerLoggingSource(Object object, boolean forceNewEntry) { String foundParentLogChannelId = foundParent.getLogChannelId(); String sourceParentLogChannelId = loggingSourceParent.getLogChannelId(); if (foundParentLogChannelId != null - && foundParentLogChannelId.equals(sourceParentLogChannelId) - && foundLogChannelId != null) { + && foundParentLogChannelId.equals(sourceParentLogChannelId) + && foundLogChannelId != null) { return foundLogChannelId; } } diff --git a/core/src/main/java/org/apache/hop/core/logging/MetricsRegistry.java b/core/src/main/java/org/apache/hop/core/logging/MetricsRegistry.java index 27e315446ef..a8b1bcd39e8 100644 --- a/core/src/main/java/org/apache/hop/core/logging/MetricsRegistry.java +++ b/core/src/main/java/org/apache/hop/core/logging/MetricsRegistry.java @@ -17,12 +17,11 @@ package org.apache.hop.core.logging; -import org.apache.hop.core.metrics.IMetricsSnapshot; - import java.util.Map; import java.util.Queue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; +import org.apache.hop.core.metrics.IMetricsSnapshot; /** * This singleton will capture all the metrics coming from the various log channels based on the log diff --git a/core/src/main/java/org/apache/hop/core/logging/SimpleLoggingObject.java b/core/src/main/java/org/apache/hop/core/logging/SimpleLoggingObject.java index 9cf7d95d1bc..0dda7343197 100644 --- a/core/src/main/java/org/apache/hop/core/logging/SimpleLoggingObject.java +++ b/core/src/main/java/org/apache/hop/core/logging/SimpleLoggingObject.java @@ -46,35 +46,47 @@ public SimpleLoggingObject( } } - /** @return the name */ + /** + * @return the name + */ @Override public String getObjectName() { return objectName; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setObjectName(String name) { this.objectName = name; } - /** @return the objectType */ + /** + * @return the objectType + */ @Override public LoggingObjectType getObjectType() { return objectType; } - /** @param objectType the objectType to set */ + /** + * @param objectType the objectType to set + */ public void setObjectType(LoggingObjectType objectType) { this.objectType = objectType; } - /** @return the parent */ + /** + * @return the parent + */ @Override public ILoggingObject getParent() { return parent; } - /** @param parent the parent to set */ + /** + * @param parent the parent to set + */ public void setParent(ILoggingObject parent) { this.parent = parent; } @@ -112,36 +124,48 @@ public void setContainerObjectId(String containerObjectId) { this.containerObjectId = containerObjectId; } - /** @return the registrationDate */ + /** + * @return the registrationDate + */ @Override public Date getRegistrationDate() { return registrationDate; } - /** @param registrationDate the registrationDate to set */ + /** + * @param registrationDate the registrationDate to set + */ public void setRegistrationDate(Date registrationDate) { this.registrationDate = registrationDate; } - /** @return the gatheringMetrics */ + /** + * @return the gatheringMetrics + */ @Override public boolean isGatheringMetrics() { return gatheringMetrics; } - /** @param gatheringMetrics the gatheringMetrics to set */ + /** + * @param gatheringMetrics the gatheringMetrics to set + */ @Override public void setGatheringMetrics(boolean gatheringMetrics) { this.gatheringMetrics = gatheringMetrics; } - /** @return the forcingSeparateLogging */ + /** + * @return the forcingSeparateLogging + */ @Override public boolean isForcingSeparateLogging() { return forcingSeparateLogging; } - /** @param forcingSeparateLogging the forcingSeparateLogging to set */ + /** + * @param forcingSeparateLogging the forcingSeparateLogging to set + */ @Override public void setForcingSeparateLogging(boolean forcingSeparateLogging) { this.forcingSeparateLogging = forcingSeparateLogging; diff --git a/core/src/main/java/org/apache/hop/core/logging/Slf4jLoggingEventListener.java b/core/src/main/java/org/apache/hop/core/logging/Slf4jLoggingEventListener.java index 3f97a88f765..7f9d27bc45d 100644 --- a/core/src/main/java/org/apache/hop/core/logging/Slf4jLoggingEventListener.java +++ b/core/src/main/java/org/apache/hop/core/logging/Slf4jLoggingEventListener.java @@ -17,14 +17,6 @@ package org.apache.hop.core.logging; -import com.google.common.annotations.VisibleForTesting; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.function.Function; - import static com.google.common.base.Preconditions.checkNotNull; import static org.apache.hop.core.logging.LoggingObjectType.ACTION; import static org.apache.hop.core.logging.LoggingObjectType.DATABASE; @@ -32,6 +24,13 @@ import static org.apache.hop.core.logging.LoggingObjectType.TRANSFORM; import static org.apache.hop.core.logging.LoggingObjectType.WORKFLOW; +import com.google.common.annotations.VisibleForTesting; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.function.Function; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class Slf4jLoggingEventListener implements IHopLoggingEventListener { @VisibleForTesting diff --git a/core/src/main/java/org/apache/hop/core/metrics/IMetricsSnapshot.java b/core/src/main/java/org/apache/hop/core/metrics/IMetricsSnapshot.java index afa68c8dd52..b76ed0227c0 100644 --- a/core/src/main/java/org/apache/hop/core/metrics/IMetricsSnapshot.java +++ b/core/src/main/java/org/apache/hop/core/metrics/IMetricsSnapshot.java @@ -17,13 +17,14 @@ package org.apache.hop.core.metrics; -import org.apache.hop.core.logging.IMetrics; - import java.util.Date; +import org.apache.hop.core.logging.IMetrics; public interface IMetricsSnapshot { - /** @return The metric that is being recorded, includes type, code and description */ + /** + * @return The metric that is being recorded, includes type, code and description + */ IMetrics getMetric(); Date getDate(); diff --git a/core/src/main/java/org/apache/hop/core/metrics/MetricsDuration.java b/core/src/main/java/org/apache/hop/core/metrics/MetricsDuration.java index 1854965c751..c846dcf0349 100644 --- a/core/src/main/java/org/apache/hop/core/metrics/MetricsDuration.java +++ b/core/src/main/java/org/apache/hop/core/metrics/MetricsDuration.java @@ -17,11 +17,10 @@ package org.apache.hop.core.metrics; +import java.util.Date; import org.apache.hop.core.util.StringUtil; import org.apache.hop.core.util.Utils; -import java.util.Date; - public class MetricsDuration { private Date date; private Date endDate; @@ -87,52 +86,72 @@ public String toString() { } } - /** @return the date */ + /** + * @return the date + */ public Date getDate() { return date; } - /** @param date the date to set */ + /** + * @param date the date to set + */ public void setDate(Date date) { this.date = date; } - /** @return the description */ + /** + * @return the description + */ public String getDescription() { return description; } - /** @param description the description to set */ + /** + * @param description the description to set + */ public void setDescription(String description) { this.description = description; } - /** @return the duration */ + /** + * @return the duration + */ public Long getDuration() { return duration; } - /** @param duration the duration to set */ + /** + * @param duration the duration to set + */ public void setDuration(Long duration) { this.duration = duration; } - /** @return the subject */ + /** + * @return the subject + */ public String getSubject() { return subject; } - /** @param subject the subject to set */ + /** + * @param subject the subject to set + */ public void setSubject(String subject) { this.subject = subject; } - /** @return the logChannelId */ + /** + * @return the logChannelId + */ public String getLogChannelId() { return logChannelId; } - /** @param logChannelId the logChannelId to set */ + /** + * @param logChannelId the logChannelId to set + */ public void setLogChannelId(String logChannelId) { this.logChannelId = logChannelId; } @@ -153,12 +172,16 @@ public void incrementCount() { } } - /** @return the endDate */ + /** + * @return the endDate + */ public Date getEndDate() { return endDate; } - /** @param endDate the endDate to set */ + /** + * @param endDate the endDate to set + */ public void setEndDate(Date endDate) { this.endDate = endDate; } diff --git a/core/src/main/java/org/apache/hop/core/metrics/MetricsSnapshot.java b/core/src/main/java/org/apache/hop/core/metrics/MetricsSnapshot.java index 3cb0bf7c345..253e11f8cf1 100644 --- a/core/src/main/java/org/apache/hop/core/metrics/MetricsSnapshot.java +++ b/core/src/main/java/org/apache/hop/core/metrics/MetricsSnapshot.java @@ -17,13 +17,12 @@ package org.apache.hop.core.metrics; +import java.util.Date; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.core.logging.IMetrics; import org.apache.hop.core.logging.LoggingRegistry; import org.apache.hop.core.util.StringUtil; -import java.util.Date; - public class MetricsSnapshot implements IMetricsSnapshot { private Date date; @@ -126,69 +125,93 @@ public String toString() { + type.toString(); } - /** @return the date */ + /** + * @return the date + */ @Override public Date getDate() { return date; } - /** @param date the date to set */ + /** + * @param date the date to set + */ @Override public void setDate(Date date) { this.date = date; } - /** @return the type */ + /** + * @return the type + */ public MetricsSnapshotType getType() { return type; } - /** @param type the type to set */ + /** + * @param type the type to set + */ public void setType(MetricsSnapshotType type) { this.type = type; } - /** @return the subject */ + /** + * @return the subject + */ @Override public String getSubject() { return subject; } - /** @param subject the subject to set */ + /** + * @param subject the subject to set + */ public void setSubject(String subject) { this.subject = subject; } - /** @return the value */ + /** + * @return the value + */ @Override public Long getValue() { return value; } - /** @param value the value to set */ + /** + * @param value the value to set + */ @Override public void setValue(Long value) { this.value = value; } - /** @return the logChannelId */ + /** + * @return the logChannelId + */ @Override public String getLogChannelId() { return logChannelId; } - /** @param logChannelId the logChannelId to set */ + /** + * @param logChannelId the logChannelId to set + */ public void setLogChannelId(String logChannelId) { this.logChannelId = logChannelId; } - /** @return the metric */ + /** + * @return the metric + */ @Override public IMetrics getMetric() { return metric; } - /** @param metric the metric to set */ + /** + * @param metric the metric to set + */ public void setMetric(IMetrics metric) { this.metric = metric; } diff --git a/core/src/main/java/org/apache/hop/core/metrics/MetricsUtil.java b/core/src/main/java/org/apache/hop/core/metrics/MetricsUtil.java index aa425042f9a..e7a793c42de 100644 --- a/core/src/main/java/org/apache/hop/core/metrics/MetricsUtil.java +++ b/core/src/main/java/org/apache/hop/core/metrics/MetricsUtil.java @@ -17,18 +17,17 @@ package org.apache.hop.core.metrics; -import org.apache.hop.core.logging.ILoggingObject; -import org.apache.hop.core.logging.IMetrics; -import org.apache.hop.core.logging.LoggingRegistry; -import org.apache.hop.core.logging.Metrics; -import org.apache.hop.core.logging.MetricsRegistry; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Queue; +import org.apache.hop.core.logging.ILoggingObject; +import org.apache.hop.core.logging.IMetrics; +import org.apache.hop.core.logging.LoggingRegistry; +import org.apache.hop.core.logging.Metrics; +import org.apache.hop.core.logging.MetricsRegistry; public class MetricsUtil { diff --git a/core/src/main/java/org/apache/hop/core/parameters/NamedParameters.java b/core/src/main/java/org/apache/hop/core/parameters/NamedParameters.java index 96f0da8d81a..3310273cd84 100644 --- a/core/src/main/java/org/apache/hop/core/parameters/NamedParameters.java +++ b/core/src/main/java/org/apache/hop/core/parameters/NamedParameters.java @@ -17,14 +17,13 @@ package org.apache.hop.core.parameters; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.variables.IVariables; - import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.variables.IVariables; /** This class is an implementation of INamedParameters. */ public class NamedParameters implements INamedParameters { diff --git a/core/src/main/java/org/apache/hop/core/plugins/IPluginType.java b/core/src/main/java/org/apache/hop/core/plugins/IPluginType.java index 3b5e80bd9c2..e22b3cbf673 100644 --- a/core/src/main/java/org/apache/hop/core/plugins/IPluginType.java +++ b/core/src/main/java/org/apache/hop/core/plugins/IPluginType.java @@ -17,11 +17,10 @@ package org.apache.hop.core.plugins; -import org.apache.hop.core.exception.HopPluginException; - import java.lang.annotation.Annotation; import java.net.URL; import java.util.List; +import org.apache.hop.core.exception.HopPluginException; /** * This interface describes a plugin type.
@@ -40,13 +39,19 @@ public interface IPluginType { */ void addObjectType(Class clz, String xmlNodeName); - /** @return The ID of this plugin type */ + /** + * @return The ID of this plugin type + */ String getId(); - /** @return The name of this plugin */ + /** + * @return The name of this plugin + */ String getName(); - /** @throws HopPluginException */ + /** + * @throws HopPluginException + */ void searchPlugins() throws HopPluginException; /** diff --git a/core/src/main/java/org/apache/hop/core/plugins/JarCache.java b/core/src/main/java/org/apache/hop/core/plugins/JarCache.java index 3c7aca75bd2..7535df3bbc5 100644 --- a/core/src/main/java/org/apache/hop/core/plugins/JarCache.java +++ b/core/src/main/java/org/apache/hop/core/plugins/JarCache.java @@ -17,14 +17,6 @@ package org.apache.hop.core.plugins; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.util.EnvUtil; -import org.apache.hop.core.variables.Variables; -import org.jboss.jandex.Index; -import org.jboss.jandex.IndexReader; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -39,6 +31,13 @@ import java.util.Set; import java.util.jar.JarFile; import java.util.zip.ZipEntry; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.util.EnvUtil; +import org.apache.hop.core.variables.Variables; +import org.jboss.jandex.Index; +import org.jboss.jandex.IndexReader; public class JarCache { diff --git a/core/src/main/java/org/apache/hop/core/plugins/PluginClassFile.java b/core/src/main/java/org/apache/hop/core/plugins/PluginClassFile.java index 745da931003..2ab8a9c6208 100644 --- a/core/src/main/java/org/apache/hop/core/plugins/PluginClassFile.java +++ b/core/src/main/java/org/apache/hop/core/plugins/PluginClassFile.java @@ -40,7 +40,9 @@ public String toString() { return jarFile.toString(); } - /** @return the jarFile */ + /** + * @return the jarFile + */ public URL getJarFile() { return jarFile; } diff --git a/core/src/main/java/org/apache/hop/core/plugins/PluginRegistry.java b/core/src/main/java/org/apache/hop/core/plugins/PluginRegistry.java index e0c58f2a497..6d888aa0fd1 100644 --- a/core/src/main/java/org/apache/hop/core/plugins/PluginRegistry.java +++ b/core/src/main/java/org/apache/hop/core/plugins/PluginRegistry.java @@ -17,21 +17,6 @@ package org.apache.hop.core.plugins; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopPluginClassMapException; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.logging.HopLogStore; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.logging.LogChannel; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowBuffer; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.util.EnvUtil; -import org.apache.hop.core.util.Utils; -import org.apache.hop.i18n.BaseMessages; - import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -55,6 +40,20 @@ import java.util.concurrent.Callable; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.stream.Collectors; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopPluginClassMapException; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.logging.HopLogStore; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.logging.LogChannel; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowBuffer; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.util.EnvUtil; +import org.apache.hop.core.util.Utils; +import org.apache.hop.i18n.BaseMessages; /** * This singleton provides access to all the plugins in the Hop universe.
@@ -93,7 +92,9 @@ public class PluginRegistry { /** Initialize the registry, keep private to keep this a singleton */ private PluginRegistry() {} - /** @return The one and only PluginRegistry instance */ + /** + * @return The one and only PluginRegistry instance + */ public static PluginRegistry getInstance() { return pluginRegistry; } @@ -201,7 +202,9 @@ public void registerPlugin(Class pluginType, IPlugin plug } } - /** @return An unmodifiable list of plugin types */ + /** + * @return An unmodifiable list of plugin types + */ public List> getPluginTypes() { lock.readLock().lock(); try { @@ -339,7 +342,8 @@ private HopURLClassLoader createClassLoader(IPlugin plugin) URL[] urls = new URL[jarFiles.size()]; for (int i = 0; i < jarFiles.size(); i++) { File jarFile = new File(jarFiles.get(i)); - urls[i] = new URL(URLDecoder.decode(jarFile.toURI().toURL().toString(), StandardCharsets.UTF_8)); + urls[i] = + new URL(URLDecoder.decode(jarFile.toURI().toURL().toString(), StandardCharsets.UTF_8)); } ClassLoader classLoader = getClass().getClassLoader(); String[] patterns = parentClassloaderPatternMap.get(plugin); @@ -361,7 +365,8 @@ private void addToClassLoader(IPlugin plugin, HopURLClassLoader ucl) for (String jarFile : plugin.getLibraries()) { File jarfile = new File(jarFile); - ucl.addURL(new URL(URLDecoder.decode(jarfile.toURI().toURL().toString(), StandardCharsets.UTF_8))); + ucl.addURL( + new URL(URLDecoder.decode(jarfile.toURI().toURL().toString(), StandardCharsets.UTF_8))); } } @@ -709,7 +714,9 @@ public IPlugin findPluginWithId(Class pluginType, String return getPlugin(pluginType, pluginId); } - /** @return a unique list of all the transform plugin package names */ + /** + * @return a unique list of all the transform plugin package names + */ public List getPluginPackages(Class pluginType) { Set list = new TreeSet<>(); for (IPlugin plugin : getPlugins(pluginType)) { diff --git a/core/src/main/java/org/apache/hop/core/plugins/SupplementalPlugin.java b/core/src/main/java/org/apache/hop/core/plugins/SupplementalPlugin.java index ec0dcae9b28..e1d6e03f82c 100644 --- a/core/src/main/java/org/apache/hop/core/plugins/SupplementalPlugin.java +++ b/core/src/main/java/org/apache/hop/core/plugins/SupplementalPlugin.java @@ -17,12 +17,11 @@ package org.apache.hop.core.plugins; -import org.apache.hop.core.exception.HopPluginException; - import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; +import org.apache.hop.core.exception.HopPluginException; /** * This is a holder of Plugin Class mappings which supplement those of the stock Plugin. diff --git a/core/src/main/java/org/apache/hop/core/row/IRowMeta.java b/core/src/main/java/org/apache/hop/core/row/IRowMeta.java index 4f4dc83622c..d61223b9fed 100644 --- a/core/src/main/java/org/apache/hop/core/row/IRowMeta.java +++ b/core/src/main/java/org/apache/hop/core/row/IRowMeta.java @@ -18,11 +18,6 @@ package org.apache.hop.core.row; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.exception.HopValueException; -import org.w3c.dom.Node; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -30,6 +25,10 @@ import java.net.SocketTimeoutException; import java.util.Date; import java.util.List; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.exception.HopValueException; +import org.w3c.dom.Node; /** * This interface provides methods to describe and manipulate a row's structure. The interface diff --git a/core/src/main/java/org/apache/hop/core/row/IValueMeta.java b/core/src/main/java/org/apache/hop/core/row/IValueMeta.java index 596d4e908dc..f394cb250b4 100644 --- a/core/src/main/java/org/apache/hop/core/row/IValueMeta.java +++ b/core/src/main/java/org/apache/hop/core/row/IValueMeta.java @@ -32,7 +32,6 @@ import java.util.Date; import java.util.Locale; import java.util.TimeZone; - import org.apache.hop.core.Const; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.IDatabase; diff --git a/core/src/main/java/org/apache/hop/core/row/IValueMetaConverter.java b/core/src/main/java/org/apache/hop/core/row/IValueMetaConverter.java index 991d9077457..eb493f9906c 100644 --- a/core/src/main/java/org/apache/hop/core/row/IValueMetaConverter.java +++ b/core/src/main/java/org/apache/hop/core/row/IValueMetaConverter.java @@ -16,9 +16,8 @@ */ package org.apache.hop.core.row; -import org.apache.hop.core.row.value.ValueMetaConversionException; - import java.text.SimpleDateFormat; +import org.apache.hop.core.row.value.ValueMetaConversionException; public interface IValueMetaConverter { /** diff --git a/core/src/main/java/org/apache/hop/core/row/RowBuffer.java b/core/src/main/java/org/apache/hop/core/row/RowBuffer.java index 4e3ecae2960..5e00b79b547 100644 --- a/core/src/main/java/org/apache/hop/core/row/RowBuffer.java +++ b/core/src/main/java/org/apache/hop/core/row/RowBuffer.java @@ -18,16 +18,15 @@ package org.apache.hop.core.row; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Node; - import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Node; /** This class contains a list of data rows as well as the IRowMeta to describe it. */ public class RowBuffer { @@ -123,7 +122,7 @@ public boolean isEmpty() { return buffer.isEmpty(); } - public void addRow(Object...row) { + public void addRow(Object... row) { buffer.add(row); } diff --git a/core/src/main/java/org/apache/hop/core/row/RowMeta.java b/core/src/main/java/org/apache/hop/core/row/RowMeta.java index baa7c541692..7d118e2072f 100644 --- a/core/src/main/java/org/apache/hop/core/row/RowMeta.java +++ b/core/src/main/java/org/apache/hop/core/row/RowMeta.java @@ -19,18 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.annotations.VisibleForTesting; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopEofException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.value.ValueMetaBase; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Node; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; @@ -48,6 +36,17 @@ import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopEofException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.value.ValueMetaBase; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Node; public class RowMeta implements IRowMeta { public static final String XML_META_TAG = "row-meta"; diff --git a/core/src/main/java/org/apache/hop/core/row/SpeedTest.java b/core/src/main/java/org/apache/hop/core/row/SpeedTest.java index 422f6d59f37..94b671828e4 100644 --- a/core/src/main/java/org/apache/hop/core/row/SpeedTest.java +++ b/core/src/main/java/org/apache/hop/core/row/SpeedTest.java @@ -17,6 +17,7 @@ package org.apache.hop.core.row; +import java.util.Date; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.value.ValueMetaBoolean; import org.apache.hop.core.row.value.ValueMetaDate; @@ -25,8 +26,6 @@ import org.apache.hop.core.row.value.ValueMetaString; import org.apache.hop.core.util.StringUtil; -import java.util.Date; - public class SpeedTest { private Object[] rowString10; private Object[] rowString100; diff --git a/core/src/main/java/org/apache/hop/core/row/ValueDataUtil.java b/core/src/main/java/org/apache/hop/core/row/ValueDataUtil.java index 8f6ea912916..578cfa47aa4 100644 --- a/core/src/main/java/org/apache/hop/core/row/ValueDataUtil.java +++ b/core/src/main/java/org/apache/hop/core/row/ValueDataUtil.java @@ -17,6 +17,18 @@ package org.apache.hop.core.row; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; +import java.security.MessageDigest; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.zip.Adler32; +import java.util.zip.CRC32; +import java.util.zip.CheckedInputStream; import org.apache.commons.codec.language.DoubleMetaphone; import org.apache.commons.codec.language.Metaphone; import org.apache.commons.codec.language.RefinedSoundex; @@ -37,19 +49,6 @@ import org.apache.hop.core.vfs.HopVfs; import org.apache.hop.core.xml.XmlCheck; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; -import java.security.MessageDigest; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; -import java.util.zip.Adler32; -import java.util.zip.CRC32; -import java.util.zip.CheckedInputStream; - public class ValueDataUtil { private static final Log log = LogFactory.getLog(ValueDataUtil.class); @@ -65,10 +64,12 @@ public class ValueDataUtil { * */ private static final String SYS_PROPERTY_ROUND_2_MODE = "ROUND_2_MODE"; + /** Value of system property ROUND_2_MODE Provides correct rounding */ private static final String SYS_PROPERTY_ROUND_2_MODE_DEFAULT_VALUE = "ROUND_HALF_CEILING"; private static final int ROUND_2_MODE_DEFAULT_VALUE = Const.ROUND_HALF_CEILING; + /** Value of system property ROUND_2_MODE Provides backward compatibility */ private static final String SYS_PROPERTY_ROUND_2_MODE_BACKWARD_COMPATIBILITY_VALUE = "ROUND_HALF_EVEN"; diff --git a/core/src/main/java/org/apache/hop/core/row/ValueMetaAndData.java b/core/src/main/java/org/apache/hop/core/row/ValueMetaAndData.java index e86af9f35e5..29527f6aeec 100644 --- a/core/src/main/java/org/apache/hop/core/row/ValueMetaAndData.java +++ b/core/src/main/java/org/apache/hop/core/row/ValueMetaAndData.java @@ -17,6 +17,8 @@ package org.apache.hop.core.row; +import java.math.BigDecimal; +import java.util.Date; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.value.ValueMetaBase; @@ -32,9 +34,6 @@ import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.math.BigDecimal; -import java.util.Date; - public class ValueMetaAndData { public static final String XML_TAG = "value"; diff --git a/core/src/main/java/org/apache/hop/core/row/ValueMetaDeserializer.java b/core/src/main/java/org/apache/hop/core/row/ValueMetaDeserializer.java index 36a81e051fa..5e96a9f0dd2 100644 --- a/core/src/main/java/org/apache/hop/core/row/ValueMetaDeserializer.java +++ b/core/src/main/java/org/apache/hop/core/row/ValueMetaDeserializer.java @@ -25,11 +25,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.apache.commons.lang3.LocaleUtils; -import org.apache.hop.core.row.value.ValueMetaFactory; - import java.io.IOException; import java.util.TimeZone; +import org.apache.commons.lang3.LocaleUtils; +import org.apache.hop.core.row.value.ValueMetaFactory; public class ValueMetaDeserializer extends JsonDeserializer { @Override diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaAvroRecord.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaAvroRecord.java index ead78164156..d9a95f15984 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaAvroRecord.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaAvroRecord.java @@ -17,6 +17,11 @@ package org.apache.hop.core.row.value; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.EOFException; +import java.io.IOException; +import java.net.SocketTimeoutException; import org.apache.avro.Schema; import org.apache.avro.generic.GenericData; import org.apache.avro.generic.GenericDatumReader; @@ -39,12 +44,6 @@ import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.EOFException; -import java.io.IOException; -import java.net.SocketTimeoutException; - @ValueMetaPlugin( id = "20", name = "Avro Record", diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java index 27f28faa52f..4394ca83f63 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBase.java @@ -18,28 +18,6 @@ package org.apache.hop.core.row.value; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.hop.core.Const; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopEofException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.logging.HopLogStore; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.ValueDataUtil; -import org.apache.hop.core.util.EnvUtil; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.metadata.api.HopMetadataProperty; -import org.apache.hop.metadata.api.IIntCodeConverter; -import org.json.simple.JSONObject; -import org.w3c.dom.Node; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; @@ -71,6 +49,27 @@ import java.util.Locale; import java.util.Objects; import java.util.TimeZone; +import org.apache.hop.core.Const; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopEofException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.logging.HopLogStore; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.ValueDataUtil; +import org.apache.hop.core.util.EnvUtil; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.xml.XmlHandler; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.metadata.api.HopMetadataProperty; +import org.apache.hop.metadata.api.IIntCodeConverter; +import org.json.simple.JSONObject; +import org.w3c.dom.Node; public class ValueMetaBase implements IValueMeta { @@ -1046,7 +1045,9 @@ protected synchronized String convertDateToCompatibleString(Date date) { return null; } // If a date format already exists use it otherwise use the compatible date format - return (getDateFormat() != null ? getDateFormat().format(date) : compatibleDateFormat.format(date)); + return (getDateFormat() != null + ? getDateFormat().format(date) + : compatibleDateFormat.format(date)); } public synchronized Date convertStringToDate(String string) throws HopValueException { diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBigNumber.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBigNumber.java index 3ea60ed845f..e71cd117f04 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBigNumber.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaBigNumber.java @@ -17,11 +17,10 @@ package org.apache.hop.core.row.value; +import java.math.BigDecimal; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IValueMeta; -import java.math.BigDecimal; - @ValueMetaPlugin( id = "6", name = "BigNumber", diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaConverter.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaConverter.java index 3e34b8ee9e7..345374284ba 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaConverter.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaConverter.java @@ -16,9 +16,6 @@ */ package org.apache.hop.core.row.value; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.IValueMetaConverter; - import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; @@ -28,6 +25,8 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.IValueMetaConverter; /** * This class is intended to facilitate any needed conversions of a IValueMeta field from one type diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaDate.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaDate.java index 0a6658d52dd..4b032674f9a 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaDate.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaDate.java @@ -17,11 +17,10 @@ package org.apache.hop.core.row.value; +import java.util.Date; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IValueMeta; -import java.util.Date; - @ValueMetaPlugin(id = "3", name = "Date", description = "Date", image = "images/date.svg") public class ValueMetaDate extends ValueMetaBase implements IValueMeta { diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaFactory.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaFactory.java index 05e7beb84c2..22a174a67b5 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaFactory.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaFactory.java @@ -17,6 +17,12 @@ package org.apache.hop.core.row.value; +import java.io.DataInputStream; +import java.io.EOFException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.exception.HopEofException; import org.apache.hop.core.exception.HopFileException; import org.apache.hop.core.exception.HopPluginException; @@ -25,13 +31,6 @@ import org.apache.hop.core.row.IValueMeta; import org.json.simple.JSONObject; -import java.io.DataInputStream; -import java.io.EOFException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** This class will hand out value meta objects from the plugin registry. */ public class ValueMetaFactory { @@ -219,7 +218,7 @@ public static IValueMeta guessValueMetaInterface(Object object) { public static IValueMeta loadValueMetaFromJson(JSONObject jValue) throws HopPluginException { String name = (String) jValue.get("name"); - long type = (long)jValue.get("type"); + long type = (long) jValue.get("type"); IValueMeta valueMeta = ValueMetaFactory.createValueMeta(name, (int) type); valueMeta.loadMetaFromJson(jValue); diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaInternetAddress.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaInternetAddress.java index faf911383c0..8bd828ef0a1 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaInternetAddress.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaInternetAddress.java @@ -17,15 +17,6 @@ package org.apache.hop.core.row.value; -import org.apache.hop.core.Const; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; - import java.math.BigDecimal; import java.math.BigInteger; import java.net.InetAddress; @@ -35,6 +26,14 @@ import java.sql.SQLException; import java.sql.Types; import java.util.Date; +import org.apache.hop.core.Const; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; @ValueMetaPlugin( id = "10", @@ -456,7 +455,7 @@ public Object convertData(IValueMeta meta2, Object data2) throws HopValueExcepti case TYPE_BIGNUMBER: return convertBigNumberToInternetAddress(meta2.getBigNumber(data2)); case TYPE_INET: - return ((ValueMetaInternetAddress) meta2).getInternetAddress(data2); + return ((ValueMetaInternetAddress) meta2).getInternetAddress(data2); default: throw new HopValueException( meta2.toStringMeta() + " : can't be converted to an Internet Address"); diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPlugin.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPlugin.java index 91d11004ce5..2de99dc53ae 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPlugin.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPlugin.java @@ -41,10 +41,14 @@ String description() default ""; - /** @return The image resource path */ + /** + * @return The image resource path + */ String image() default ""; - /** @return True if a separate class loader is needed every time this class is instantiated */ + /** + * @return True if a separate class loader is needed every time this class is instantiated + */ boolean isSeparateClassLoaderNeeded() default false; String documentationUrl() default ""; diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPluginType.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPluginType.java index 21665997ba7..5717e6b9c89 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPluginType.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaPluginType.java @@ -17,13 +17,12 @@ package org.apache.hop.core.row.value; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; import org.apache.hop.core.row.IValueMeta; -import java.util.Map; - /** This class represents the value meta plugin type. */ @PluginMainClassType(IValueMeta.class) @PluginAnnotationType(ValueMetaPlugin.class) diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaString.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaString.java index d8c86351ed9..8ca310c000e 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaString.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaString.java @@ -17,11 +17,10 @@ package org.apache.hop.core.row.value; +import java.util.Comparator; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IValueMeta; -import java.util.Comparator; - @ValueMetaPlugin(id = "2", name = "String", description = "String", image = "images/string.svg") public class ValueMetaString extends ValueMetaBase implements IValueMeta { diff --git a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaTimestamp.java b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaTimestamp.java index 52917a763fe..31f3546980b 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/ValueMetaTimestamp.java +++ b/core/src/main/java/org/apache/hop/core/row/value/ValueMetaTimestamp.java @@ -17,18 +17,6 @@ package org.apache.hop.core.row.value; -import org.apache.hop.core.Const; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopEofException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.timestamp.SimpleTimestampFormat; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; @@ -44,6 +32,17 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import org.apache.hop.core.Const; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopEofException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.timestamp.SimpleTimestampFormat; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; @ValueMetaPlugin( id = "9", diff --git a/core/src/main/java/org/apache/hop/core/row/value/timestamp/SimpleTimestampFormat.java b/core/src/main/java/org/apache/hop/core/row/value/timestamp/SimpleTimestampFormat.java index c941ea932ad..f2b8d284544 100644 --- a/core/src/main/java/org/apache/hop/core/row/value/timestamp/SimpleTimestampFormat.java +++ b/core/src/main/java/org/apache/hop/core/row/value/timestamp/SimpleTimestampFormat.java @@ -88,6 +88,7 @@ public class SimpleTimestampFormat extends SimpleDateFormat { /** Default format of the Timestamp object for sql. */ public static final String DEFAULT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSSSSSSSS"; + /** Fields for advantages of using locale version from JRE 1.7 and for JRE 1.6 compatibility */ private static Method getDefaultLocaleMethod; diff --git a/core/src/main/java/org/apache/hop/core/search/ISearchResult.java b/core/src/main/java/org/apache/hop/core/search/ISearchResult.java index 6757f0e4769..00e7b8def22 100644 --- a/core/src/main/java/org/apache/hop/core/search/ISearchResult.java +++ b/core/src/main/java/org/apache/hop/core/search/ISearchResult.java @@ -20,7 +20,9 @@ /** After searching this describes a match */ public interface ISearchResult { - /** @return The matching searchable */ + /** + * @return The matching searchable + */ ISearchable getMatchingSearchable(); String getMatchingString(); diff --git a/core/src/main/java/org/apache/hop/core/search/ISearchable.java b/core/src/main/java/org/apache/hop/core/search/ISearchable.java index 170b5791b38..d341d6f829f 100644 --- a/core/src/main/java/org/apache/hop/core/search/ISearchable.java +++ b/core/src/main/java/org/apache/hop/core/search/ISearchable.java @@ -33,7 +33,9 @@ public interface ISearchable { */ String getName(); - /** @return The type of searchable: pipeline, workflow, type of metadata object, ... */ + /** + * @return The type of searchable: pipeline, workflow, type of metadata object, ... + */ String getType(); /** @@ -43,7 +45,9 @@ public interface ISearchable { */ String getFilename(); - /** @return The object to search itself */ + /** + * @return The object to search itself + */ T getSearchableObject(); /** diff --git a/core/src/main/java/org/apache/hop/core/search/ISearchablesLocation.java b/core/src/main/java/org/apache/hop/core/search/ISearchablesLocation.java index 5c7183badb4..5baedb011f1 100644 --- a/core/src/main/java/org/apache/hop/core/search/ISearchablesLocation.java +++ b/core/src/main/java/org/apache/hop/core/search/ISearchablesLocation.java @@ -17,12 +17,11 @@ package org.apache.hop.core.search; +import java.util.Iterator; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.IHopMetadataProvider; -import java.util.Iterator; - /** A location where searchables can be found. */ public interface ISearchablesLocation { String getLocationDescription(); diff --git a/core/src/main/java/org/apache/hop/core/search/SearchQuery.java b/core/src/main/java/org/apache/hop/core/search/SearchQuery.java index 5a2a547e455..e066cfa59d8 100644 --- a/core/src/main/java/org/apache/hop/core/search/SearchQuery.java +++ b/core/src/main/java/org/apache/hop/core/search/SearchQuery.java @@ -65,7 +65,9 @@ public String getSearchString() { return searchString; } - /** @param searchString The searchString to set */ + /** + * @param searchString The searchString to set + */ public void setSearchString(String searchString) { this.searchString = searchString; } @@ -80,7 +82,9 @@ public boolean isCaseSensitive() { return caseSensitive; } - /** @param caseSensitive The caseSensitive to set */ + /** + * @param caseSensitive The caseSensitive to set + */ public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; } @@ -95,7 +99,9 @@ public boolean isRegEx() { return regEx; } - /** @param regEx The regEx to set */ + /** + * @param regEx The regEx to set + */ public void setRegEx(boolean regEx) { this.regEx = regEx; } diff --git a/core/src/main/java/org/apache/hop/core/search/SearchResult.java b/core/src/main/java/org/apache/hop/core/search/SearchResult.java index d6cd9c20973..0f19caf17b7 100644 --- a/core/src/main/java/org/apache/hop/core/search/SearchResult.java +++ b/core/src/main/java/org/apache/hop/core/search/SearchResult.java @@ -25,9 +25,12 @@ public class SearchResult implements ISearchResult { private String component; private String value; - public SearchResult( - ISearchable matchingSearchable, String matchingString, String description, String component, String value) { + ISearchable matchingSearchable, + String matchingString, + String description, + String component, + String value) { this.matchingSearchable = matchingSearchable; this.matchingString = matchingString; this.description = description; @@ -45,7 +48,9 @@ public ISearchable getMatchingSearchable() { return matchingSearchable; } - /** @param matchingSearchable The matchingSearchable to set */ + /** + * @param matchingSearchable The matchingSearchable to set + */ public void setMatchingSearchable(ISearchable matchingSearchable) { this.matchingSearchable = matchingSearchable; } @@ -60,7 +65,9 @@ public String getMatchingString() { return matchingString; } - /** @param matchingString The matchingString to set */ + /** + * @param matchingString The matchingString to set + */ public void setMatchingString(String matchingString) { this.matchingString = matchingString; } @@ -75,7 +82,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -90,7 +99,9 @@ public String getComponent() { return component; } - /** @param component The component to set */ + /** + * @param component The component to set + */ public void setComponent(String component) { this.component = component; } diff --git a/core/src/main/java/org/apache/hop/core/search/SearchableAnalyserPluginType.java b/core/src/main/java/org/apache/hop/core/search/SearchableAnalyserPluginType.java index 0e51011346d..63d6624f208 100644 --- a/core/src/main/java/org/apache/hop/core/search/SearchableAnalyserPluginType.java +++ b/core/src/main/java/org/apache/hop/core/search/SearchableAnalyserPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.search; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - @PluginMainClassType(ISearchableAnalyser.class) @PluginAnnotationType(SearchableAnalyserPlugin.class) public class SearchableAnalyserPluginType extends BasePluginType { diff --git a/core/src/main/java/org/apache/hop/core/spreadsheet/IKCell.java b/core/src/main/java/org/apache/hop/core/spreadsheet/IKCell.java index 85de22d3072..b36122b42e0 100644 --- a/core/src/main/java/org/apache/hop/core/spreadsheet/IKCell.java +++ b/core/src/main/java/org/apache/hop/core/spreadsheet/IKCell.java @@ -29,9 +29,13 @@ public interface IKCell { */ Object getValue(); - /** @return The content description of the cell */ + /** + * @return The content description of the cell + */ String getContents(); - /** @return The row number in the sheet. */ + /** + * @return The row number in the sheet. + */ int getRow(); } diff --git a/core/src/main/java/org/apache/hop/core/spreadsheet/IKSheet.java b/core/src/main/java/org/apache/hop/core/spreadsheet/IKSheet.java index 2d13f59741c..6f3dfcfbbcb 100644 --- a/core/src/main/java/org/apache/hop/core/spreadsheet/IKSheet.java +++ b/core/src/main/java/org/apache/hop/core/spreadsheet/IKSheet.java @@ -31,10 +31,14 @@ public interface IKSheet { */ IKCell[] getRow(int rownr); - /** @return The name of the cell */ + /** + * @return The name of the cell + */ String getName(); - /** @return The number of rows in the sheet */ + /** + * @return The number of rows in the sheet + */ int getRows(); /** diff --git a/core/src/main/java/org/apache/hop/core/spreadsheet/IKWorkbook.java b/core/src/main/java/org/apache/hop/core/spreadsheet/IKWorkbook.java index bedebbe576d..9ef03822939 100644 --- a/core/src/main/java/org/apache/hop/core/spreadsheet/IKWorkbook.java +++ b/core/src/main/java/org/apache/hop/core/spreadsheet/IKWorkbook.java @@ -26,14 +26,18 @@ public interface IKWorkbook extends AutoCloseable { */ IKSheet getSheet(String sheetName); - /** @return The array of sheet names in the workbook */ + /** + * @return The array of sheet names in the workbook + */ String[] getSheetNames(); /** Close the workbook file */ @Override void close(); - /** @return The number of sheets in the workbook */ + /** + * @return The number of sheets in the workbook + */ int getNumberOfSheets(); /** diff --git a/core/src/main/java/org/apache/hop/core/svg/HopSvgGraphics2D.java b/core/src/main/java/org/apache/hop/core/svg/HopSvgGraphics2D.java index 7f87b674fa0..3236b2e8625 100644 --- a/core/src/main/java/org/apache/hop/core/svg/HopSvgGraphics2D.java +++ b/core/src/main/java/org/apache/hop/core/svg/HopSvgGraphics2D.java @@ -17,6 +17,17 @@ package org.apache.hop.core.svg; +import static org.apache.batik.svggen.DOMGroupManager.DRAW; +import static org.apache.batik.svggen.DOMGroupManager.FILL; + +import java.awt.font.TextLayout; +import java.io.StringWriter; +import java.text.DecimalFormat; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import org.apache.batik.anim.dom.SVGDOMImplementation; import org.apache.batik.dom.GenericDOMImplementation; import org.apache.batik.svggen.DOMGroupManager; @@ -29,19 +40,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.awt.font.TextLayout; -import java.io.StringWriter; -import java.text.DecimalFormat; - -import static org.apache.batik.svggen.DOMGroupManager.DRAW; -import static org.apache.batik.svggen.DOMGroupManager.FILL; - public class HopSvgGraphics2D extends SVGGraphics2D { private static final String W3_URL = "http://www.w3.org/2000/xmlns/"; @@ -149,7 +147,8 @@ public void embedSvg( svgG.setAttributeNS(W3_URL, "xmlns:dc", "http://purl.org/dc/elements/1.1/"); svgG.setAttributeNS(W3_URL, "xmlns:cc", "http://creativecommons.org/ns#"); svgG.setAttributeNS(W3_URL, "xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - svgG.setAttributeNS(W3_URL, "xmlns:sodipodi", "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"); + svgG.setAttributeNS( + W3_URL, "xmlns:sodipodi", "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"); svgG.setAttributeNS(W3_URL, "xmlns:inkscape", "http://www.inkscape.org/namespaces/inkscape"); // Add all the elements from the SVG Image... diff --git a/core/src/main/java/org/apache/hop/core/svg/SvgCache.java b/core/src/main/java/org/apache/hop/core/svg/SvgCache.java index b2ddee0ad9d..03379b39dfb 100644 --- a/core/src/main/java/org/apache/hop/core/svg/SvgCache.java +++ b/core/src/main/java/org/apache/hop/core/svg/SvgCache.java @@ -17,6 +17,10 @@ package org.apache.hop.core.svg; +import java.awt.geom.Rectangle2D; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; import org.apache.batik.anim.dom.SAXSVGDocumentFactory; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.DocumentLoader; @@ -33,11 +37,6 @@ import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGSVGElement; -import java.awt.geom.Rectangle2D; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - public class SvgCache { private static SvgCache instance; diff --git a/core/src/main/java/org/apache/hop/core/svg/SvgCacheEntry.java b/core/src/main/java/org/apache/hop/core/svg/SvgCacheEntry.java index f2eec3b23f4..1168b29e63e 100644 --- a/core/src/main/java/org/apache/hop/core/svg/SvgCacheEntry.java +++ b/core/src/main/java/org/apache/hop/core/svg/SvgCacheEntry.java @@ -17,9 +17,8 @@ package org.apache.hop.core.svg; -import org.w3c.dom.svg.SVGDocument; - import java.util.Objects; +import org.w3c.dom.svg.SVGDocument; public class SvgCacheEntry { @@ -66,7 +65,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -80,7 +81,9 @@ public SVGDocument getSvgDocument() { return svgDocument; } - /** @param svgDocument The svgDocument to set */ + /** + * @param svgDocument The svgDocument to set + */ public void setSvgDocument(SVGDocument svgDocument) { this.svgDocument = svgDocument; } @@ -94,7 +97,9 @@ public float getWidth() { return width; } - /** @param width The width to set */ + /** + * @param width The width to set + */ public void setWidth(float width) { this.width = width; } @@ -108,7 +113,9 @@ public float getHeight() { return height; } - /** @param height The height to set */ + /** + * @param height The height to set + */ public void setHeight(float height) { this.height = height; } @@ -122,7 +129,9 @@ public int getX() { return x; } - /** @param x The x to set */ + /** + * @param x The x to set + */ public void setX(int x) { this.x = x; } @@ -136,7 +145,9 @@ public int getY() { return y; } - /** @param y The y to set */ + /** + * @param y The y to set + */ public void setY(int y) { this.y = y; } diff --git a/core/src/main/java/org/apache/hop/core/svg/SvgFile.java b/core/src/main/java/org/apache/hop/core/svg/SvgFile.java index a9043029e73..1bcb2f60281 100644 --- a/core/src/main/java/org/apache/hop/core/svg/SvgFile.java +++ b/core/src/main/java/org/apache/hop/core/svg/SvgFile.java @@ -54,7 +54,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -68,7 +70,9 @@ public ClassLoader getClassLoader() { return classLoader; } - /** @param classLoader The classLoader to set */ + /** + * @param classLoader The classLoader to set + */ public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } diff --git a/core/src/main/java/org/apache/hop/core/svg/SvgImage.java b/core/src/main/java/org/apache/hop/core/svg/SvgImage.java index eb825091e6d..c4e5ddf4ef5 100644 --- a/core/src/main/java/org/apache/hop/core/svg/SvgImage.java +++ b/core/src/main/java/org/apache/hop/core/svg/SvgImage.java @@ -17,16 +17,14 @@ package org.apache.hop.core.svg; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Document; - -import javax.xml.XMLConstants; +import java.io.StringWriter; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.io.StringWriter; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Document; /** Container for SVG image. */ public class SvgImage { diff --git a/core/src/main/java/org/apache/hop/core/svg/SvgSupport.java b/core/src/main/java/org/apache/hop/core/svg/SvgSupport.java index df79873707a..a4980e09c31 100644 --- a/core/src/main/java/org/apache/hop/core/svg/SvgSupport.java +++ b/core/src/main/java/org/apache/hop/core/svg/SvgSupport.java @@ -17,12 +17,11 @@ package org.apache.hop.core.svg; +import java.io.InputStream; import org.apache.batik.anim.dom.SAXSVGDocumentFactory; import org.apache.batik.util.XMLResourceDescriptor; import org.w3c.dom.Document; -import java.io.InputStream; - /** Class for base SVG images processing. */ public class SvgSupport { diff --git a/core/src/main/java/org/apache/hop/core/util/DateDetector.java b/core/src/main/java/org/apache/hop/core/util/DateDetector.java index 3f11e132514..a6088c30485 100644 --- a/core/src/main/java/org/apache/hop/core/util/DateDetector.java +++ b/core/src/main/java/org/apache/hop/core/util/DateDetector.java @@ -16,12 +16,11 @@ */ package org.apache.hop.core.util; -import org.apache.commons.collections4.BidiMap; -import org.apache.commons.collections4.bidimap.DualHashBidiMap; - import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.commons.collections4.BidiMap; +import org.apache.commons.collections4.bidimap.DualHashBidiMap; public class DateDetector { diff --git a/core/src/main/java/org/apache/hop/core/util/HttpClientManager.java b/core/src/main/java/org/apache/hop/core/util/HttpClientManager.java index 339f1343199..96d14d5ee27 100644 --- a/core/src/main/java/org/apache/hop/core/util/HttpClientManager.java +++ b/core/src/main/java/org/apache/hop/core/util/HttpClientManager.java @@ -17,6 +17,19 @@ package org.apache.hop.core.util; +import java.io.FileInputStream; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; import org.apache.hop.core.logging.ILogChannel; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; @@ -39,20 +52,6 @@ import org.apache.http.ssl.SSLContexts; import org.apache.http.ssl.TrustStrategy; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; -import java.io.FileInputStream; -import java.io.IOException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - /** * Single entry point for all {@link org.apache.http.client.HttpClient HttpClient instances} usages * in Hop projects. Contains {@link org.apache.http.impl.conn.PoolingHttpClientConnectionManager @@ -137,7 +136,7 @@ public void ignoreSsl(boolean ignoreSsl) { this.ignoreSsl = ignoreSsl; } - public void ignoreSsl(HttpClientBuilder httpClientBuilder){ + public void ignoreSsl(HttpClientBuilder httpClientBuilder) { TrustStrategy acceptingTrustStrategy = (cert, authType) -> true; SSLContext sslContext; try { @@ -146,8 +145,8 @@ public void ignoreSsl(HttpClientBuilder httpClientBuilder){ throw new RuntimeException(e); } - SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, - NoopHostnameVerifier.INSTANCE); + SSLConnectionSocketFactory sslsf = + new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE); Registry socketFactoryRegistry = RegistryBuilder.create() @@ -191,8 +190,15 @@ public CloseableHttpClient build() { } } - public static SSLContext getSslContextWithTrustStoreFile(FileInputStream trustFileStream, String trustStorePassword) throws NoSuchAlgorithmException, KeyStoreException, IOException, CertificateException, KeyManagementException { - TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + public static SSLContext getSslContextWithTrustStoreFile( + FileInputStream trustFileStream, String trustStorePassword) + throws NoSuchAlgorithmException, + KeyStoreException, + IOException, + CertificateException, + KeyManagementException { + TrustManagerFactory tmf = + TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); // Using null here initialises the TMF with the default trust store. tmf.init((KeyStore) null); @@ -225,53 +231,57 @@ public static SSLContext getSslContextWithTrustStoreFile(FileInputStream trustFi final X509TrustManager finalDefaultTm = defaultTm; final X509TrustManager finalTrustManager = trustManager; - X509TrustManager customTm = new X509TrustManager() { - @Override - public X509Certificate[] getAcceptedIssuers() { - return finalDefaultTm.getAcceptedIssuers(); - } + X509TrustManager customTm = + new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return finalDefaultTm.getAcceptedIssuers(); + } - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { - try { - finalTrustManager.checkServerTrusted(chain, authType); - } catch (CertificateException e) { - finalDefaultTm.checkServerTrusted(chain, authType); - } - } + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + try { + finalTrustManager.checkServerTrusted(chain, authType); + } catch (CertificateException e) { + finalDefaultTm.checkServerTrusted(chain, authType); + } + } - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { - finalDefaultTm.checkClientTrusted(chain, authType); - } - }; + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + finalDefaultTm.checkClientTrusted(chain, authType); + } + }; SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); - sslContext.init(null, new TrustManager[] { customTm }, null); + sslContext.init(null, new TrustManager[] {customTm}, null); return sslContext; } - public static SSLContext getTrustAllSslContext() throws NoSuchAlgorithmException, KeyManagementException { - TrustManager[] trustAllCerts = new TrustManager[] { - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(X509Certificate[] certs, String authType) { } + public static SSLContext getTrustAllSslContext() + throws NoSuchAlgorithmException, KeyManagementException { + TrustManager[] trustAllCerts = + new TrustManager[] { + new X509TrustManager() { + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return null; + } - public void checkServerTrusted(X509Certificate[] certs, String authType) { } + public void checkClientTrusted(X509Certificate[] certs, String authType) {} - } - }; + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } + }; SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); return sc; } - public static HostnameVerifier getHostnameVerifier(boolean isDebug, ILogChannel log){ + public static HostnameVerifier getHostnameVerifier(boolean isDebug, ILogChannel log) { return (hostname, session) -> { if (isDebug) { log.logDebug("Warning: URL Host: " + hostname + " vs. " + session.getPeerHost()); diff --git a/core/src/main/java/org/apache/hop/core/util/HttpClientUtil.java b/core/src/main/java/org/apache/hop/core/util/HttpClientUtil.java index d350fa1c233..2da12fc20f0 100644 --- a/core/src/main/java/org/apache/hop/core/util/HttpClientUtil.java +++ b/core/src/main/java/org/apache/hop/core/util/HttpClientUtil.java @@ -17,6 +17,11 @@ package org.apache.hop.core.util; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLDecoder; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; @@ -30,12 +35,6 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.util.EntityUtils; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLDecoder; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - /** * Utility class contained useful methods while working with {@link * org.apache.http.client.HttpClient HttpClient} diff --git a/core/src/main/java/org/apache/hop/core/util/SingletonUtil.java b/core/src/main/java/org/apache/hop/core/util/SingletonUtil.java index 1860f9967d5..e16ce2096b4 100644 --- a/core/src/main/java/org/apache/hop/core/util/SingletonUtil.java +++ b/core/src/main/java/org/apache/hop/core/util/SingletonUtil.java @@ -16,14 +16,13 @@ */ package org.apache.hop.core.util; +import java.lang.reflect.Method; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.plugin.GuiPluginType; import org.apache.hop.core.plugins.IPlugin; import org.apache.hop.core.plugins.PluginRegistry; -import java.lang.reflect.Method; -import java.util.List; - public class SingletonUtil { public static final List getValuesList( String guiPluginId, String singletonClassName, String methodName) throws HopException { diff --git a/core/src/main/java/org/apache/hop/core/util/SocketUtil.java b/core/src/main/java/org/apache/hop/core/util/SocketUtil.java index 4468ee3a808..342f350a9d9 100644 --- a/core/src/main/java/org/apache/hop/core/util/SocketUtil.java +++ b/core/src/main/java/org/apache/hop/core/util/SocketUtil.java @@ -16,10 +16,9 @@ */ package org.apache.hop.core.util; -import org.apache.hop.core.exception.HopException; - import java.net.InetSocketAddress; import java.net.Socket; +import org.apache.hop.core.exception.HopException; /** Utility class for socket related methods */ public class SocketUtil { diff --git a/core/src/main/java/org/apache/hop/core/util/SortedFileOutputStream.java b/core/src/main/java/org/apache/hop/core/util/SortedFileOutputStream.java index 4e0d6377dcc..c7779674659 100644 --- a/core/src/main/java/org/apache/hop/core/util/SortedFileOutputStream.java +++ b/core/src/main/java/org/apache/hop/core/util/SortedFileOutputStream.java @@ -17,14 +17,13 @@ package org.apache.hop.core.util; -import org.apache.hop.core.logging.ILogChannel; - import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Collections; import java.util.Vector; +import org.apache.hop.core.logging.ILogChannel; public class SortedFileOutputStream extends FileOutputStream { /** Internal buffer to catch output. Before really writing output, the properties get sorted. */ diff --git a/core/src/main/java/org/apache/hop/core/util/StorageUnitConverter.java b/core/src/main/java/org/apache/hop/core/util/StorageUnitConverter.java index ee4576ba573..aa2a57483a6 100644 --- a/core/src/main/java/org/apache/hop/core/util/StorageUnitConverter.java +++ b/core/src/main/java/org/apache/hop/core/util/StorageUnitConverter.java @@ -18,13 +18,12 @@ package org.apache.hop.core.util; -import org.apache.commons.io.FileUtils; - import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.io.FileUtils; public class StorageUnitConverter { diff --git a/core/src/main/java/org/apache/hop/core/util/StreamLogger.java b/core/src/main/java/org/apache/hop/core/util/StreamLogger.java index 9535daf3d72..d3d7eee30c6 100644 --- a/core/src/main/java/org/apache/hop/core/util/StreamLogger.java +++ b/core/src/main/java/org/apache/hop/core/util/StreamLogger.java @@ -17,13 +17,12 @@ package org.apache.hop.core.util; -import org.apache.hop.core.Const; -import org.apache.hop.core.logging.ILogChannel; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import org.apache.hop.core.Const; +import org.apache.hop.core.logging.ILogChannel; public class StreamLogger implements Runnable { private InputStream is; diff --git a/core/src/main/java/org/apache/hop/core/util/StringEvaluationResult.java b/core/src/main/java/org/apache/hop/core/util/StringEvaluationResult.java index df659f40c0c..00bfe1821ff 100644 --- a/core/src/main/java/org/apache/hop/core/util/StringEvaluationResult.java +++ b/core/src/main/java/org/apache/hop/core/util/StringEvaluationResult.java @@ -49,42 +49,58 @@ public String toString() { : conversionMeta.isDate() ? conversionMeta.getConversionMask() : ""); } - /** @return the conversionMeta */ + /** + * @return the conversionMeta + */ public IValueMeta getConversionMeta() { return conversionMeta; } - /** @param conversionMeta the conversionMeta to set */ + /** + * @param conversionMeta the conversionMeta to set + */ public void setConversionMeta(IValueMeta conversionMeta) { this.conversionMeta = conversionMeta; } - /** @return the min */ + /** + * @return the min + */ public Object getMin() { return min; } - /** @param min the min to set */ + /** + * @param min the min to set + */ public void setMin(Object min) { this.min = min; } - /** @return the max */ + /** + * @return the max + */ public Object getMax() { return max; } - /** @param max the max to set */ + /** + * @param max the max to set + */ public void setMax(Object max) { this.max = max; } - /** @return The number of null values encountered */ + /** + * @return The number of null values encountered + */ public int getNrNull() { return nrNull; } - /** @param nrNull Set the number of null values to set */ + /** + * @param nrNull Set the number of null values to set + */ public void setNrNull(int nrNull) { this.nrNull = nrNull; } @@ -104,22 +120,30 @@ public void incrementFailures() { nrFailures++; } - /** @return the nrSuccesses */ + /** + * @return the nrSuccesses + */ public int getNrSuccesses() { return nrSuccesses; } - /** @param nrSuccesses the nrSuccesses to set */ + /** + * @param nrSuccesses the nrSuccesses to set + */ public void setNrSuccesses(int nrSuccesses) { this.nrSuccesses = nrSuccesses; } - /** @return the nrFailures */ + /** + * @return the nrFailures + */ public int getNrFailures() { return nrFailures; } - /** @param nrFailures the nrFailures to set */ + /** + * @param nrFailures the nrFailures to set + */ public void setNrFailures(int nrFailures) { this.nrFailures = nrFailures; } diff --git a/core/src/main/java/org/apache/hop/core/util/StringEvaluator.java b/core/src/main/java/org/apache/hop/core/util/StringEvaluator.java index 89649b0a05a..199a4a607a8 100644 --- a/core/src/main/java/org/apache/hop/core/util/StringEvaluator.java +++ b/core/src/main/java/org/apache/hop/core/util/StringEvaluator.java @@ -17,18 +17,6 @@ package org.apache.hop.core.util; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; - import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.ParseException; @@ -41,6 +29,17 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; /** * This class evaluates strings and extracts a data type. It allows you to criteria after which the @@ -520,7 +519,9 @@ protected static int determinePrecision(String numericFormat) { } } - /** @return The distinct set of string values */ + /** + * @return The distinct set of string values + */ public Set getValues() { return values; } @@ -540,12 +541,16 @@ public List getStringEvaluationResults() { return result; } - /** @return the number of values analyzed */ + /** + * @return the number of values analyzed + */ public int getCount() { return count; } - /** @return The maximum string length encountered */ + /** + * @return The maximum string length encountered + */ public int getMaxLength() { return maxLength; } diff --git a/core/src/main/java/org/apache/hop/core/util/StringUtil.java b/core/src/main/java/org/apache/hop/core/util/StringUtil.java index 1cb41f4e13a..7725f540bc3 100644 --- a/core/src/main/java/org/apache/hop/core/util/StringUtil.java +++ b/core/src/main/java/org/apache/hop/core/util/StringUtil.java @@ -17,10 +17,6 @@ package org.apache.hop.core.util; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IRowMeta; - import java.text.DateFormat; import java.text.Normalizer; import java.text.SimpleDateFormat; @@ -30,6 +26,9 @@ import java.util.List; import java.util.Map; import java.util.Random; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IRowMeta; /** A collection of utilities to manipulate strings. */ public class StringUtil { diff --git a/core/src/main/java/org/apache/hop/core/util/Utils.java b/core/src/main/java/org/apache/hop/core/util/Utils.java index 27b99394d3b..0cd5f15ea70 100644 --- a/core/src/main/java/org/apache/hop/core/util/Utils.java +++ b/core/src/main/java/org/apache/hop/core/util/Utils.java @@ -17,15 +17,14 @@ package org.apache.hop.core.util; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.hop.core.encryption.Encr; -import org.apache.hop.core.variables.IVariables; - import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.apache.hop.core.encryption.Encr; +import org.apache.hop.core.variables.IVariables; public class Utils { diff --git a/core/src/main/java/org/apache/hop/core/variables/DescribedVariable.java b/core/src/main/java/org/apache/hop/core/variables/DescribedVariable.java index d7f85215919..6f4e56d550e 100644 --- a/core/src/main/java/org/apache/hop/core/variables/DescribedVariable.java +++ b/core/src/main/java/org/apache/hop/core/variables/DescribedVariable.java @@ -17,9 +17,8 @@ package org.apache.hop.core.variables; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DescribedVariable { @@ -69,7 +68,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -83,7 +84,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } @@ -97,7 +100,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/core/src/main/java/org/apache/hop/core/variables/IVariables.java b/core/src/main/java/org/apache/hop/core/variables/IVariables.java index e07fadb1c93..01cf067d6d5 100644 --- a/core/src/main/java/org/apache/hop/core/variables/IVariables.java +++ b/core/src/main/java/org/apache/hop/core/variables/IVariables.java @@ -17,11 +17,10 @@ package org.apache.hop.core.variables; +import java.util.Map; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; -import java.util.Map; - /** Interface to implement variable sensitive objects. */ public interface IVariables { /** diff --git a/core/src/main/java/org/apache/hop/core/variables/Variable.java b/core/src/main/java/org/apache/hop/core/variables/Variable.java index db540093aca..99fcbe4de11 100644 --- a/core/src/main/java/org/apache/hop/core/variables/Variable.java +++ b/core/src/main/java/org/apache/hop/core/variables/Variable.java @@ -24,8 +24,8 @@ import java.lang.annotation.Target; /** - * Static final field annotated with "Variable" are automatically - * recognized and registered as a described variable. + * Static final field annotated with "Variable" are automatically recognized and registered as a + * described variable. */ @Documented @Retention(RetentionPolicy.RUNTIME) @@ -33,8 +33,10 @@ public @interface Variable { /** The default value */ String value() default ""; + /** The description of the variable, can be translated i18n::key */ String description() default ""; + /** The scope of variable defines how a specific variable is accessible and propagated */ VariableScope scope() default VariableScope.ENGINE; } diff --git a/core/src/main/java/org/apache/hop/core/variables/VariableRegistry.java b/core/src/main/java/org/apache/hop/core/variables/VariableRegistry.java index fd4e070967b..a28e1eb5d90 100644 --- a/core/src/main/java/org/apache/hop/core/variables/VariableRegistry.java +++ b/core/src/main/java/org/apache/hop/core/variables/VariableRegistry.java @@ -17,19 +17,6 @@ package org.apache.hop.core.variables; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.LogChannel; -import org.apache.hop.core.plugins.HopURLClassLoader; -import org.apache.hop.core.plugins.JarCache; -import org.apache.hop.core.util.TranslateUtil; -import org.apache.hop.core.xml.XmlHandler; -import org.jboss.jandex.AnnotationInstance; -import org.jboss.jandex.FieldInfo; -import org.jboss.jandex.IndexView; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - import java.io.File; import java.lang.reflect.Field; import java.net.MalformedURLException; @@ -43,17 +30,27 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.LogChannel; +import org.apache.hop.core.plugins.HopURLClassLoader; +import org.apache.hop.core.plugins.JarCache; +import org.apache.hop.core.util.TranslateUtil; +import org.apache.hop.core.xml.XmlHandler; +import org.jboss.jandex.AnnotationInstance; +import org.jboss.jandex.FieldInfo; +import org.jboss.jandex.IndexView; +import org.w3c.dom.Document; +import org.w3c.dom.Node; -/** - * This singleton provides access to all the described variables in the Hop universe. - */ +/** This singleton provides access to all the described variables in the Hop universe. */ public class VariableRegistry { private static VariableRegistry instance; - + private final Map> variableScopes; private final List deprecatedNames; - + private VariableRegistry() { variableScopes = new EnumMap<>(VariableScope.class); variableScopes.put(VariableScope.SYSTEM, new ArrayList<>()); @@ -67,14 +64,14 @@ public static VariableRegistry getInstance() { } /** - * Search described variables with the @Variable annotation - * and detect deprecated variables with the @Deprecated annotation. + * Search described variables with the @Variable annotation + * and detect deprecated variables with the @Deprecated annotation. */ public static void init() throws HopException { instance = new VariableRegistry(); - - // Search variable with the @Variable annotations + + // Search variable with the @Variable annotations try { JarCache cache = JarCache.getInstance(); @@ -90,37 +87,41 @@ public static void init() throws HopException { for (File jarFile : cache.getPluginJars()) { IndexView index = cache.getIndex(jarFile); for (AnnotationInstance info : index.getAnnotations(Variable.class)) { - register(jarFile, info.target().asField()); + register(jarFile, info.target().asField()); } } } catch (Exception e) { LogChannel.GENERAL.logDetailed("Unable to find variable definitions", e); } } - + protected static void register(File jarFile, FieldInfo fieldInfo) - throws ClassNotFoundException, SecurityException, NoSuchFieldException, MalformedURLException { - URLClassLoader urlClassLoader = createUrlClassLoader(jarFile.toURI().toURL(), FieldInfo.class.getClassLoader()); + throws ClassNotFoundException, + SecurityException, + NoSuchFieldException, + MalformedURLException { + URLClassLoader urlClassLoader = + createUrlClassLoader(jarFile.toURI().toURL(), FieldInfo.class.getClassLoader()); Class clazz = urlClassLoader.loadClass(fieldInfo.declaringClass().name().toString()); Field field = clazz.getDeclaredField(fieldInfo.name()); - + // Register described variable with annotation Variable variable = field.getAnnotation(Variable.class); String description = TranslateUtil.translate(variable.description(), clazz); - DescribedVariable describedVariable = new DescribedVariable(field.getName(), variable.value(), description); - List list = instance.variableScopes.get(variable.scope()); - if ( list!=null ) { + DescribedVariable describedVariable = + new DescribedVariable(field.getName(), variable.value(), description); + List list = instance.variableScopes.get(variable.scope()); + if (list != null) { list.add(describedVariable); } - - // Keep list of described variables with @Deprecated annotation + + // Keep list of described variables with @Deprecated annotation Deprecated deprecated = field.getAnnotation(Deprecated.class); - if ( deprecated!=null ) { + if (deprecated != null) { instance.deprecatedNames.add(field.getName()); } } - - + protected static URLClassLoader createUrlClassLoader(URL jarFileUrl, ClassLoader classLoader) { List urls = new ArrayList<>(); @@ -167,10 +168,7 @@ protected static URLClassLoader createUrlClassLoader(URL jarFileUrl, ClassLoader } } catch (Exception e) { LogChannel.GENERAL.logError( - "Unexpected error searching for variable in file '" - + jarFileUrl - + "'", - e); + "Unexpected error searching for variable in file '" + jarFileUrl + "'", e); } urls.add(jarFileUrl); @@ -207,7 +205,7 @@ public Set getVariableNames() { * Gets described variable names in the specified scopes * * @return list of described variable names - */ + */ public Set getVariableNames(final VariableScope... scopes) { Set names = new TreeSet<>(); for (VariableScope scope : scopes) { @@ -217,7 +215,7 @@ public Set getVariableNames(final VariableScope... scopes) { } return names; } - + /** * Gets all described variables * @@ -226,14 +224,14 @@ public Set getVariableNames(final VariableScope... scopes) { public List getDescribedVariables() { return getDescribedVariables(VariableScope.values()); } - + /** * Gets described variables in the specified scopes * * @return list of described variables - */ + */ public List getDescribedVariables(final VariableScope... scopes) { - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (VariableScope scope : scopes) { for (DescribedVariable variable : variableScopes.get(scope)) { list.add(variable); @@ -241,15 +239,13 @@ public List getDescribedVariables(final VariableScope... scop } return list; } - + /** * Gets deprecated variable names. - * - * Deprecated variables will be detected with the @Deprecated annotation. * + *

Deprecated variables will be detected with the @Deprecated annotation. */ public List getDeprecatedVariableNames() { return deprecatedNames; } - } diff --git a/core/src/main/java/org/apache/hop/core/variables/Variables.java b/core/src/main/java/org/apache/hop/core/variables/Variables.java index b1506182c9b..c20d78a61fc 100644 --- a/core/src/main/java/org/apache/hop/core/variables/Variables.java +++ b/core/src/main/java/org/apache/hop/core/variables/Variables.java @@ -17,6 +17,12 @@ package org.apache.hop.core.variables; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.exception.HopValueException; @@ -25,13 +31,6 @@ import org.apache.hop.core.util.StringUtil; import org.apache.hop.core.util.Utils; -import java.util.Collections; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Set; - /** This class is an implementation of IVariables */ public class Variables implements IVariables { private Map properties; @@ -188,7 +187,7 @@ public void setVariables(Map map) { if (initialized) { // variables are already initialized if (map != null) { - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { if (!Utils.isEmpty(entry.getKey())) { properties.put(entry.getKey(), Const.NVL(entry.getValue(), "")); } @@ -199,7 +198,7 @@ public void setVariables(Map map) { // We have our own personal copy, so changes afterwards // to the input properties don't affect us. injection = new Hashtable<>(); - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { if (!Utils.isEmpty(entry.getKey())) { injection.put(entry.getKey(), Const.NVL(entry.getValue(), "")); } diff --git a/core/src/main/java/org/apache/hop/core/vfs/HopVfs.java b/core/src/main/java/org/apache/hop/core/vfs/HopVfs.java index ec597865ce7..4852f7d0622 100644 --- a/core/src/main/java/org/apache/hop/core/vfs/HopVfs.java +++ b/core/src/main/java/org/apache/hop/core/vfs/HopVfs.java @@ -17,6 +17,17 @@ package org.apache.hop.core.vfs; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.CacheStrategy; import org.apache.commons.vfs2.FileContent; @@ -38,18 +49,6 @@ import org.apache.hop.core.vfs.plugin.VfsPluginType; import org.apache.hop.i18n.BaseMessages; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.locks.ReentrantReadWriteLock; - public class HopVfs { private static final Class PKG = HopVfs.class; // For Translator diff --git a/core/src/main/java/org/apache/hop/core/vfs/plugin/VfsPluginType.java b/core/src/main/java/org/apache/hop/core/vfs/plugin/VfsPluginType.java index cc6fca4619e..2704cbc1038 100644 --- a/core/src/main/java/org/apache/hop/core/vfs/plugin/VfsPluginType.java +++ b/core/src/main/java/org/apache/hop/core/vfs/plugin/VfsPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.vfs.plugin; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the transform plugin type. */ @PluginMainClassType(IVfs.class) @PluginAnnotationType(VfsPlugin.class) diff --git a/core/src/main/java/org/apache/hop/core/xml/XMlHandlerCacheEntry.java b/core/src/main/java/org/apache/hop/core/xml/XMlHandlerCacheEntry.java index c3bbe1e6c29..d87c9ad36e8 100644 --- a/core/src/main/java/org/apache/hop/core/xml/XMlHandlerCacheEntry.java +++ b/core/src/main/java/org/apache/hop/core/xml/XMlHandlerCacheEntry.java @@ -33,22 +33,30 @@ public XMlHandlerCacheEntry(Node parentNode, String tag) { this.tag = tag; } - /** @return Returns the parentNode. */ + /** + * @return Returns the parentNode. + */ public Node getParentNode() { return parentNode; } - /** @param parentNode The parentNode to set. */ + /** + * @param parentNode The parentNode to set. + */ public void setParentNode(Node parentNode) { this.parentNode = parentNode; } - /** @return Returns the tag. */ + /** + * @return Returns the tag. + */ public String getTag() { return tag; } - /** @param tag The tag to set. */ + /** + * @param tag The tag to set. + */ public void setTag(String tag) { this.tag = tag; } diff --git a/core/src/main/java/org/apache/hop/core/xml/XmlCheck.java b/core/src/main/java/org/apache/hop/core/xml/XmlCheck.java index b867482e850..017e2e9baf2 100644 --- a/core/src/main/java/org/apache/hop/core/xml/XmlCheck.java +++ b/core/src/main/java/org/apache/hop/core/xml/XmlCheck.java @@ -17,14 +17,13 @@ package org.apache.hop.core.xml; +import java.io.InputStream; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopException; import org.xml.sax.helpers.DefaultHandler; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import java.io.InputStream; - public class XmlCheck { public static class XMLTreeHandler extends DefaultHandler {} diff --git a/core/src/main/java/org/apache/hop/core/xml/XmlFormatter.java b/core/src/main/java/org/apache/hop/core/xml/XmlFormatter.java index d7e690a4831..cb60072053a 100644 --- a/core/src/main/java/org/apache/hop/core/xml/XmlFormatter.java +++ b/core/src/main/java/org/apache/hop/core/xml/XmlFormatter.java @@ -16,16 +16,16 @@ */ package org.apache.hop.core.xml; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; /** * XML formatting for better VCS diff. diff --git a/core/src/main/java/org/apache/hop/core/xml/XmlHandler.java b/core/src/main/java/org/apache/hop/core/xml/XmlHandler.java index 3b8b0cabd34..23f1f33b314 100644 --- a/core/src/main/java/org/apache/hop/core/xml/XmlHandler.java +++ b/core/src/main/java/org/apache/hop/core/xml/XmlHandler.java @@ -17,36 +17,6 @@ package org.apache.hop.core.xml; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.Const; -import org.apache.hop.core.IHopAttribute; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopXmlException; -import org.apache.hop.core.row.value.timestamp.SimpleTimestampFormat; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.vfs.HopVfs; -import org.owasp.encoder.Encode; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; @@ -68,6 +38,35 @@ import java.util.List; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.Const; +import org.apache.hop.core.IHopAttribute; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopXmlException; +import org.apache.hop.core.row.value.timestamp.SimpleTimestampFormat; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.vfs.HopVfs; +import org.owasp.encoder.Encode; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; /** * This class contains a number of (static) methods to facilitate the retrieval of information from @@ -736,9 +735,9 @@ public static DocumentBuilder createDocumentBuilder( public static TransformerFactory createSecureTransformerFactory() { TransformerFactory transformerFactory = TransformerFactory.newInstance(); try { - transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); - transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); - } catch(IllegalArgumentException e) { + transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); + transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); + } catch (IllegalArgumentException e) { // Ignore this: the library doesn't support these features. // We don't need to disable them. } diff --git a/core/src/main/java/org/apache/hop/core/xml/XmlHandlerCache.java b/core/src/main/java/org/apache/hop/core/xml/XmlHandlerCache.java index 4d8fa1a2754..0bae923c5b4 100644 --- a/core/src/main/java/org/apache/hop/core/xml/XmlHandlerCache.java +++ b/core/src/main/java/org/apache/hop/core/xml/XmlHandlerCache.java @@ -81,7 +81,9 @@ public int getLastChildNr(XMlHandlerCacheEntry entry) { return -1; } - /** @return the number of cache hits for your statistical pleasure. */ + /** + * @return the number of cache hits for your statistical pleasure. + */ public int getCacheHits() { return cacheHits.get(); } diff --git a/core/src/main/java/org/apache/hop/core/xml/XmlParserFactoryProducer.java b/core/src/main/java/org/apache/hop/core/xml/XmlParserFactoryProducer.java index b4c0b536d9f..9accbbbb651 100644 --- a/core/src/main/java/org/apache/hop/core/xml/XmlParserFactoryProducer.java +++ b/core/src/main/java/org/apache/hop/core/xml/XmlParserFactoryProducer.java @@ -17,13 +17,12 @@ package org.apache.hop.core.xml; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; - import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; public class XmlParserFactoryProducer { private XmlParserFactoryProducer() { diff --git a/core/src/main/java/org/apache/hop/i18n/GlobalMessageUtil.java b/core/src/main/java/org/apache/hop/i18n/GlobalMessageUtil.java index 11481c45d85..1c7dd10d6e5 100644 --- a/core/src/main/java/org/apache/hop/i18n/GlobalMessageUtil.java +++ b/core/src/main/java/org/apache/hop/i18n/GlobalMessageUtil.java @@ -18,10 +18,6 @@ package org.apache.hop.i18n; import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; - import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -36,6 +32,9 @@ import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; public class GlobalMessageUtil { diff --git a/core/src/main/java/org/apache/hop/i18n/LanguageChoice.java b/core/src/main/java/org/apache/hop/i18n/LanguageChoice.java index 47beb9a3cf8..0c91a3588c4 100644 --- a/core/src/main/java/org/apache/hop/i18n/LanguageChoice.java +++ b/core/src/main/java/org/apache/hop/i18n/LanguageChoice.java @@ -17,13 +17,12 @@ package org.apache.hop.i18n; +import java.util.Locale; import org.apache.hop.core.Const; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.util.EnvUtil; import org.apache.hop.core.util.StringUtil; -import java.util.Locale; - public class LanguageChoice { private static final String STRING_DEFAULT_LOCALE = "LocaleDefault"; @@ -58,12 +57,16 @@ public static final LanguageChoice getInstance() { return choice; } - /** @return Returns the defaultLocale. */ + /** + * @return Returns the defaultLocale. + */ public Locale getDefaultLocale() { return defaultLocale; } - /** @param defaultLocale The defaultLocale to set. */ + /** + * @param defaultLocale The defaultLocale to set. + */ public void setDefaultLocale(Locale defaultLocale) { this.defaultLocale = defaultLocale; HopConfig.getInstance().saveOption(STRING_DEFAULT_LOCALE, defaultLocale.toString()); diff --git a/core/src/main/java/org/apache/hop/laf/LafFactory.java b/core/src/main/java/org/apache/hop/laf/LafFactory.java index 1bf122d30cb..33d4cd0f767 100644 --- a/core/src/main/java/org/apache/hop/laf/LafFactory.java +++ b/core/src/main/java/org/apache/hop/laf/LafFactory.java @@ -17,12 +17,11 @@ package org.apache.hop.laf; +import java.util.HashMap; import org.apache.hop.core.Const; import org.apache.hop.i18n.IMessageHandler; import org.apache.hop.i18n.LafMessageHandler; -import java.util.HashMap; - /** * the LafFactory provides a mechanism whereby @see IHandler s can be dynamically replaced to enable * user driven replacement of dynamic resolvers whether ImageHandlers, MessageHandlers, or other @@ -43,7 +42,7 @@ public class LafFactory { static { handlerRef.put(IMessageHandler.class.getName(), _defMessageHandler); handlerRef.put(IPropertyHandler.class.getName(), _defPropertyHandler); - if (Const.isOSX()){ + if (Const.isOSX()) { handlerRef.put(IMessageHandler.class.getName(), RemoveAltKeyMessageHandler.class); } } diff --git a/core/src/main/java/org/apache/hop/laf/OverlayPropertyHandler.java b/core/src/main/java/org/apache/hop/laf/OverlayPropertyHandler.java index e3e7c62d166..62c85f7d0f2 100644 --- a/core/src/main/java/org/apache/hop/laf/OverlayPropertyHandler.java +++ b/core/src/main/java/org/apache/hop/laf/OverlayPropertyHandler.java @@ -17,14 +17,13 @@ package org.apache.hop.laf; -import org.apache.hop.core.Const; - import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import java.util.LinkedList; +import org.apache.hop.core.Const; public class OverlayPropertyHandler implements IPropertyHandler { protected static final String propFile = "ui/laf.properties"; diff --git a/core/src/main/java/org/apache/hop/laf/RemoveAltKeyMessageHandler.java b/core/src/main/java/org/apache/hop/laf/RemoveAltKeyMessageHandler.java index 498d7535c76..2f4cde83b83 100644 --- a/core/src/main/java/org/apache/hop/laf/RemoveAltKeyMessageHandler.java +++ b/core/src/main/java/org/apache/hop/laf/RemoveAltKeyMessageHandler.java @@ -17,11 +17,10 @@ package org.apache.hop.laf; -import org.apache.hop.i18n.IMessageHandler; -import org.apache.hop.i18n.LafMessageHandler; - import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.hop.i18n.IMessageHandler; +import org.apache.hop.i18n.LafMessageHandler; class RemoveAltKeyMessageHandler implements IMessageHandler { private final IMessageHandler defMessageHandler; @@ -60,8 +59,8 @@ private String trimAltKey(String value) { Matcher matcher = altKeyPattern.matcher(value); if (matcher.find()) { value = value.substring(0, matcher.start()); - if (matcher.group(1) != null){ - value += matcher.group(1); + if (matcher.group(1) != null) { + value += matcher.group(1); } } return value; diff --git a/core/src/main/java/org/apache/hop/metadata/api/HopMetadataBase.java b/core/src/main/java/org/apache/hop/metadata/api/HopMetadataBase.java index 66cd09a02a1..be5b982eafa 100644 --- a/core/src/main/java/org/apache/hop/metadata/api/HopMetadataBase.java +++ b/core/src/main/java/org/apache/hop/metadata/api/HopMetadataBase.java @@ -18,7 +18,6 @@ package org.apache.hop.metadata.api; import com.fasterxml.jackson.annotation.JsonIgnore; - import java.util.Objects; public class HopMetadataBase implements IHopMetadata { diff --git a/core/src/main/java/org/apache/hop/metadata/api/HopMetadataObject.java b/core/src/main/java/org/apache/hop/metadata/api/HopMetadataObject.java index db09cfdafd8..eec6c59c5a7 100644 --- a/core/src/main/java/org/apache/hop/metadata/api/HopMetadataObject.java +++ b/core/src/main/java/org/apache/hop/metadata/api/HopMetadataObject.java @@ -1,4 +1,5 @@ package org.apache.hop.metadata.api; + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/core/src/main/java/org/apache/hop/metadata/api/HopMetadataWrapper.java b/core/src/main/java/org/apache/hop/metadata/api/HopMetadataWrapper.java index e16c9fb2d22..f413cda0daf 100644 --- a/core/src/main/java/org/apache/hop/metadata/api/HopMetadataWrapper.java +++ b/core/src/main/java/org/apache/hop/metadata/api/HopMetadataWrapper.java @@ -1,4 +1,5 @@ package org.apache.hop.metadata.api; + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataProvider.java b/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataProvider.java index 14e0e0d3022..4cf7d123f46 100644 --- a/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataProvider.java +++ b/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataProvider.java @@ -17,11 +17,10 @@ package org.apache.hop.metadata.api; +import java.util.List; import org.apache.hop.core.encryption.ITwoWayPasswordEncoder; import org.apache.hop.core.exception.HopException; -import java.util.List; - public interface IHopMetadataProvider { String getDescription(); @@ -29,7 +28,9 @@ public interface IHopMetadataProvider { IHopMetadataSerializer getSerializer(Class managedClass) throws HopException; - /** @return The password encoder/decoder used in the serializers for password encoding */ + /** + * @return The password encoder/decoder used in the serializers for password encoding + */ ITwoWayPasswordEncoder getTwoWayPasswordEncoder(); /** diff --git a/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataSerializer.java b/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataSerializer.java index 6b918b235fa..f8e3560b518 100644 --- a/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataSerializer.java +++ b/core/src/main/java/org/apache/hop/metadata/api/IHopMetadataSerializer.java @@ -17,9 +17,8 @@ package org.apache.hop.metadata.api; -import org.apache.hop.core.exception.HopException; - import java.util.List; +import org.apache.hop.core.exception.HopException; /** * This metadata interface describes how an object T can be serialized and analyzed. @@ -28,7 +27,9 @@ */ public interface IHopMetadataSerializer { - /** @return A description of the serialized metadata (type) */ + /** + * @return A description of the serialized metadata (type) + */ String getDescription(); /** @@ -75,7 +76,9 @@ public interface IHopMetadataSerializer { */ boolean exists(String name) throws HopException; - /** @return The class of the objects which are saved and loaded. */ + /** + * @return The class of the objects which are saved and loaded. + */ Class getManagedClass(); /** diff --git a/core/src/main/java/org/apache/hop/metadata/api/IIntCodeConverter.java b/core/src/main/java/org/apache/hop/metadata/api/IIntCodeConverter.java index 8034b7b72c0..d088332b6b5 100644 --- a/core/src/main/java/org/apache/hop/metadata/api/IIntCodeConverter.java +++ b/core/src/main/java/org/apache/hop/metadata/api/IIntCodeConverter.java @@ -19,8 +19,8 @@ package org.apache.hop.metadata.api; /** - * The class that implements this interface can convert between an integer and a code string. This is - * used to convert from old-style integer codes to their string code equivalent. We can use it + * The class that implements this interface can convert between an integer and a code string. This + * is used to convert from old-style integer codes to their string code equivalent. We can use it * primarily to convert from the integer ID of value metadata to the String form of the data type. */ public interface IIntCodeConverter { diff --git a/core/src/main/java/org/apache/hop/metadata/plugin/MetadataPluginType.java b/core/src/main/java/org/apache/hop/metadata/plugin/MetadataPluginType.java index d6a5fd4ed98..0624c1e2ca7 100644 --- a/core/src/main/java/org/apache/hop/metadata/plugin/MetadataPluginType.java +++ b/core/src/main/java/org/apache/hop/metadata/plugin/MetadataPluginType.java @@ -17,6 +17,7 @@ package org.apache.hop.metadata.plugin; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; @@ -24,8 +25,6 @@ import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.Map; - /** This class defines how Hop Metadata plugins are loaded */ @PluginMainClassType(IHopMetadata.class) @PluginAnnotationType(HopMetadata.class) diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/BaseMetadataProvider.java b/core/src/main/java/org/apache/hop/metadata/serializer/BaseMetadataProvider.java index 5979138e1f3..8dab58efdbf 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/BaseMetadataProvider.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/BaseMetadataProvider.java @@ -17,6 +17,8 @@ package org.apache.hop.metadata.serializer; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.IPlugin; import org.apache.hop.core.plugins.PluginRegistry; @@ -24,9 +26,6 @@ import org.apache.hop.metadata.api.IHopMetadata; import org.apache.hop.metadata.plugin.MetadataPluginType; -import java.util.ArrayList; -import java.util.List; - public class BaseMetadataProvider { // The variables which get inherited by all loaded objects which implement IVariables @@ -97,7 +96,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataParser.java b/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataParser.java index 5e479b5c692..08e7f334c42 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataParser.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataParser.java @@ -19,6 +19,14 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.encryption.ITwoWayPasswordEncoder; import org.apache.hop.core.exception.HopException; @@ -32,15 +40,6 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import java.lang.reflect.Field; -import java.lang.reflect.ParameterizedType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class JsonMetadataParser { private Class managedClass; diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataProvider.java b/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataProvider.java index e06f811e4a5..bce2f9c8216 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataProvider.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/json/JsonMetadataProvider.java @@ -115,7 +115,9 @@ public ITwoWayPasswordEncoder getTwoWayPasswordEncoder() { return twoWayPasswordEncoder; } - /** @param twoWayPasswordEncoder The twoWayPasswordEncoder to set */ + /** + * @param twoWayPasswordEncoder The twoWayPasswordEncoder to set + */ public void setTwoWayPasswordEncoder(ITwoWayPasswordEncoder twoWayPasswordEncoder) { this.twoWayPasswordEncoder = twoWayPasswordEncoder; } @@ -129,7 +131,9 @@ public String getBaseFolder() { return baseFolder; } - /** @param baseFolder The baseFolder to set */ + /** + * @param baseFolder The baseFolder to set + */ public void setBaseFolder(String baseFolder) { this.baseFolder = baseFolder; setDescription(calculateDescription()); diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataProvider.java b/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataProvider.java index 3212a19bae9..7d22235aee2 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataProvider.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataProvider.java @@ -17,6 +17,8 @@ package org.apache.hop.metadata.serializer.memory; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.HopTwoWayPasswordEncoder; import org.apache.hop.core.encryption.ITwoWayPasswordEncoder; @@ -29,9 +31,6 @@ import org.apache.hop.metadata.api.IHopMetadataSerializer; import org.apache.hop.metadata.serializer.BaseMetadataProvider; -import java.util.HashMap; -import java.util.Map; - public class MemoryMetadataProvider extends BaseMetadataProvider implements IHopMetadataProvider { public static final String DEFAULT_DESCRIPTION = "In memory metadata"; @@ -88,12 +87,16 @@ public Map> getSerializerMap() { return serializerMap; } - /** @param serializerMap The serializerMap to set */ + /** + * @param serializerMap The serializerMap to set + */ public void setSerializerMap(Map> serializerMap) { this.serializerMap = serializerMap; } - /** @param twoWayPasswordEncoder The twoWayPasswordEncoder to set */ + /** + * @param twoWayPasswordEncoder The twoWayPasswordEncoder to set + */ public void setTwoWayPasswordEncoder(ITwoWayPasswordEncoder twoWayPasswordEncoder) { this.twoWayPasswordEncoder = twoWayPasswordEncoder; } diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataSerializer.java b/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataSerializer.java index d34656ae2a5..fc19e939f87 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataSerializer.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/memory/MemoryMetadataSerializer.java @@ -17,17 +17,16 @@ package org.apache.hop.metadata.serializer.memory; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.IHopMetadata; import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.metadata.api.IHopMetadataSerializer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MemoryMetadataSerializer implements IHopMetadataSerializer { private final IVariables variables; @@ -125,7 +124,9 @@ public IHopMetadataProvider getMetadataProvider() { return metadataProvider; } - /** @param metadataProvider The metadataProvider to set */ + /** + * @param metadataProvider The metadataProvider to set + */ public void setMetadataProvider(IHopMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; } @@ -140,7 +141,9 @@ public Class getManagedClass() { return managedClass; } - /** @param managedClass The managedClass to set */ + /** + * @param managedClass The managedClass to set + */ public void setManagedClass(Class managedClass) { this.managedClass = managedClass; } @@ -154,7 +157,9 @@ public Map getObjectMap() { return objectMap; } - /** @param objectMap The objectMap to set */ + /** + * @param objectMap The objectMap to set + */ public void setObjectMap(Map objectMap) { this.objectMap = objectMap; } @@ -178,7 +183,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProvider.java b/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProvider.java index 350dbab650d..61e21e92723 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProvider.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProvider.java @@ -17,6 +17,11 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.ListIterator; +import java.util.Set; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.ITwoWayPasswordEncoder; import org.apache.hop.core.exception.HopException; @@ -27,12 +32,6 @@ import org.apache.hop.metadata.api.IHopMetadataSerializer; import org.apache.hop.metadata.serializer.BaseMetadataProvider; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; - /** * This metadata provider delegates for a standard provider but also reads information from others */ @@ -71,7 +70,7 @@ public MultiMetadataProvider(IVariables variables, IHopMetadataProvider... metad } private String calculateDescription() { - String descr = "Multi Metadata Provider with "+providers.size()+" providers"; + String descr = "Multi Metadata Provider with " + providers.size() + " providers"; for (int i = 0; i < providers.size(); i++) { IHopMetadataProvider provider = providers.get(i); if (i == 0) { diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializer.java b/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializer.java index 45ec247f3db..635c2f84d21 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializer.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializer.java @@ -18,6 +18,11 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.ListIterator; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; @@ -25,12 +30,6 @@ import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.metadata.api.IHopMetadataSerializer; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; - public class MultiMetadataSerializer implements IHopMetadataSerializer { protected MultiMetadataProvider multiProvider; @@ -155,7 +154,8 @@ public boolean exists(String name) throws HopException { @Override public List loadAll() throws HopException { Set set = new HashSet<>(); - // The methods add and addAll for a hash-set only do something if an element doesn't already exist. + // The methods add and addAll for a hash-set only do something if an element doesn't already + // exist. // So we need to loop over the providers in reverse. // List providers = multiProvider.getProviders(); diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/xml/MetadataPropertyKeyFunction.java b/core/src/main/java/org/apache/hop/metadata/serializer/xml/MetadataPropertyKeyFunction.java index 630fcbea2ba..b0b9716e338 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/xml/MetadataPropertyKeyFunction.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/xml/MetadataPropertyKeyFunction.java @@ -18,11 +18,10 @@ package org.apache.hop.metadata.serializer.xml; -import org.apache.hop.core.Const; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.lang.reflect.Field; import java.util.function.Function; +import org.apache.hop.core.Const; +import org.apache.hop.metadata.api.HopMetadataProperty; public class MetadataPropertyKeyFunction implements Function { @Override diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java b/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java index 5787205595a..434081519eb 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java @@ -17,6 +17,12 @@ package org.apache.hop.metadata.serializer.xml; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; @@ -35,13 +41,6 @@ import org.apache.hop.metadata.util.ReflectionUtil; import org.w3c.dom.Node; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - public class XmlMetadataUtil { /** * This method looks at the fields in the class of the provided object. It then sees which fields diff --git a/core/src/main/java/org/apache/hop/metadata/util/HopMetadataUtil.java b/core/src/main/java/org/apache/hop/metadata/util/HopMetadataUtil.java index ad4eeb83467..3f33a82c770 100644 --- a/core/src/main/java/org/apache/hop/metadata/util/HopMetadataUtil.java +++ b/core/src/main/java/org/apache/hop/metadata/util/HopMetadataUtil.java @@ -17,6 +17,9 @@ package org.apache.hop.metadata.util; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; @@ -27,10 +30,6 @@ import org.apache.hop.metadata.serializer.json.JsonMetadataProvider; import org.apache.hop.metadata.serializer.multi.MultiMetadataProvider; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class HopMetadataUtil { public static final MultiMetadataProvider getStandardHopMetadataProvider(IVariables variables) { diff --git a/core/src/main/java/org/apache/hop/metadata/util/ReflectionUtil.java b/core/src/main/java/org/apache/hop/metadata/util/ReflectionUtil.java index a28f0123e43..f8d7c744b82 100644 --- a/core/src/main/java/org/apache/hop/metadata/util/ReflectionUtil.java +++ b/core/src/main/java/org/apache/hop/metadata/util/ReflectionUtil.java @@ -17,8 +17,6 @@ package org.apache.hop.metadata.util; -import org.apache.hop.core.exception.HopException; - import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; @@ -28,6 +26,7 @@ import java.util.List; import java.util.Set; import java.util.function.Function; +import org.apache.hop.core.exception.HopException; public class ReflectionUtil { /** myAttribute ==> setMyAttribute */ @@ -97,18 +96,20 @@ public static final List findAllFields(Class clazz) { *

This means that it's possible to inherit from other classes during serialization. * * @param clazz The class to investigate. - * @param sortFunction the function to extract the key to sort on. If the function returns null the field is not included. + * @param sortFunction the function to extract the key to sort on. If the function returns null + * the field is not included. * @param * @return A sorted list of fields. */ - public static final List findAllFields(Class clazz, Function sortFunction) { + public static final List findAllFields( + Class clazz, Function sortFunction) { Set fieldsSet = new HashSet<>(); // Find the fields from the root class // for (Field classField : clazz.getDeclaredFields()) { String keyField = sortFunction.apply(classField); - if (keyField!=null) { + if (keyField != null) { fieldsSet.add(classField); } } @@ -118,7 +119,7 @@ public static final List findAllFields(Class clazz, Function) null)); - assertTrue(Utils.isEmpty(new ArrayList<>())); - assertFalse(Utils.isEmpty(Arrays.asList("test", 1))); - } - - @Test - public void testIsEmptyStringBuffer() { - assertTrue(Utils.isEmpty((StringBuffer) null)); - assertTrue(Utils.isEmpty(new StringBuffer(""))); - assertFalse(Utils.isEmpty(new StringBuffer("test"))); - } - - @Test - public void testIsEmptyStringBuilder() { - assertTrue(Utils.isEmpty((StringBuilder) null)); - assertTrue(Utils.isEmpty(new StringBuilder(""))); - assertFalse(Utils.isEmpty(new StringBuilder("test"))); - } - - @Test - public void testResolvePassword() { - String password = "password"; - // is supposed the password stays the same - assertSame( - password, Utils.resolvePassword(Variables.getADefaultVariableSpace(), password).intern()); - } - - @Test - public void testResolvePasswordEncrypted() { - String decPassword = "password"; - // is supposed encrypted with Encr.bat util - String encPassword = "Encrypted 2be98afc86aa7f2e4bb18bd63c99dbdde"; - assertSame( - decPassword, - Utils.resolvePassword(Variables.getADefaultVariableSpace(), encPassword).intern()); - } - - @Test - public void testResolvePasswordNull() { - String password = null; - // null is valid input parameter - assertSame(password, Utils.resolvePassword(Variables.getADefaultVariableSpace(), password)); - } - - @Test - public void testResolvePasswordVariable() { - String passwordKey = "PASS_VAR"; - String passwordVar = "${" + passwordKey + "}"; - String passwordValue = "password"; - Variables vars = new Variables(); - vars.setVariable(passwordKey, passwordValue); - // resolvePassword gets variable - assertSame(passwordValue, Utils.resolvePassword(vars, passwordVar).intern()); - } - - @Test - public void testNormalizeArraysMethods() { - String[] s1 = new String[] {"one"}; - String[] s2 = new String[] {"one", "two"}; - String[] s3 = new String[] {"one", "two", "three"}; - long[] l1 = new long[] {1}; - long[] l2 = new long[] {1, 2}; - long[] l3 = new long[] {1, 2, 3}; - short[] sh1 = new short[] {1}; - short[] sh2 = new short[] {1, 2}; - short[] sh3 = new short[] {1, 2, 3}; - boolean[] b1 = new boolean[] {true}; - boolean[] b2 = new boolean[] {true, false}; - boolean[] b3 = new boolean[] {true, false, true}; - int[] i1 = new int[] {1}; - int[] i2 = new int[] {1, 2}; - int[] i3 = new int[] {1, 3}; - - String[][] newS = Utils.normalizeArrays(3, s1, s2); - assertEquals(2, newS.length); - assertEquals(3, newS[0].length); - assertEquals(3, newS[1].length); - newS = Utils.normalizeArrays(3, s1, null); - assertEquals(2, newS.length); - assertEquals(3, newS[0].length); - assertEquals(3, newS[1].length); - newS = Utils.normalizeArrays(2, s2); - assertEquals(1, newS.length); - assertEquals(2, newS[0].length); - assertArrayEquals(newS[0], s2); - assertTrue(newS[0] == s2); // If arrays are equal sized, it should return original object - - long[][] newL = Utils.normalizeArrays(3, l1, l2); - assertEquals(2, newL.length); - assertEquals(3, newL[0].length); - assertEquals(3, newL[1].length); - newL = Utils.normalizeArrays(3, l1, null); - assertEquals(2, newL.length); - assertEquals(3, newL[0].length); - assertEquals(3, newL[1].length); - newL = Utils.normalizeArrays(2, l2); - assertEquals(1, newL.length); - assertEquals(2, newL[0].length); - assertArrayEquals(newL[0], l2); - assertTrue(newL[0] == l2); // If arrays are equal sized, it should return original object - - short[][] newSh = Utils.normalizeArrays(3, sh1, sh2); - assertEquals(2, newSh.length); - assertEquals(3, newSh[0].length); - assertEquals(3, newSh[1].length); - newSh = Utils.normalizeArrays(3, sh1, null); - assertEquals(2, newSh.length); - assertEquals(3, newSh[0].length); - assertEquals(3, newSh[1].length); - newSh = Utils.normalizeArrays(2, sh2); - assertEquals(1, newSh.length); - assertEquals(2, newSh[0].length); - assertArrayEquals(newSh[0], sh2); - assertTrue(newSh[0] == sh2); // If arrays are equal sized, it should return original object - - boolean[][] newB = Utils.normalizeArrays(3, b1, b2); - assertEquals(2, newB.length); - assertEquals(3, newB[0].length); - assertEquals(3, newB[1].length); - newB = Utils.normalizeArrays(3, b1, null); - assertEquals(2, newB.length); - assertEquals(3, newB[0].length); - assertEquals(3, newB[1].length); - newB = Utils.normalizeArrays(2, b2); - assertEquals(1, newB.length); - assertEquals(2, newB[0].length); - assertTrue(newB[0] == b2); // If arrays are equal sized, it should return original object - - int[][] newI = Utils.normalizeArrays(3, i1, i2); - assertEquals(2, newI.length); - assertEquals(3, newI[0].length); - assertEquals(3, newI[1].length); - newI = Utils.normalizeArrays(3, i1, null); - assertEquals(2, newI.length); - assertEquals(3, newI[0].length); - assertEquals(3, newI[1].length); - newI = Utils.normalizeArrays(2, i2); - assertEquals(1, newI.length); - assertEquals(2, newI[0].length); - assertArrayEquals(newI[0], i2); - assertTrue(newI[0] == i2); // If arrays are equal sized, it should return original object - } - - @Test - public void testDamerauLevenshteinDistance() throws Exception { - int distance = Utils.getDamerauLevenshteinDistance("Hello", "Hallow"); - assertEquals(2, distance); - distance = Utils.getDamerauLevenshteinDistance("Green", "Grean"); - assertEquals(1, distance); - distance = Utils.getDamerauLevenshteinDistance("Poker", "Powker"); - assertEquals(1, distance); - distance = Utils.getDamerauLevenshteinDistance("Kettle", "Apache Hop"); - assertEquals(9, distance); - distance = Utils.getDamerauLevenshteinDistance("A quick brown fox", "A lazy dog"); - assertEquals(13, distance); - distance = Utils.getDamerauLevenshteinDistance(null, "A string with length 23"); - assertEquals(23, distance); - distance = Utils.getDamerauLevenshteinDistance("String length 16", null); - assertEquals(16, distance); - distance = Utils.getDamerauLevenshteinDistance(null, null); - assertEquals(0, distance); - distance = Utils.getDamerauLevenshteinDistance("", "A string with length 23"); - assertEquals(23, distance); - distance = Utils.getDamerauLevenshteinDistance("String length 16", ""); - assertEquals(16, distance); - distance = Utils.getDamerauLevenshteinDistance("", ""); - assertEquals(0, distance); - } -} +/* + * 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 org.apache.hop.core.util; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +public class UtilsTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + HopClientEnvironment.init(); + } + + @Test + public void testIsEmpty() { + assertTrue(Utils.isEmpty((String) null)); + assertTrue(Utils.isEmpty("")); + assertFalse(Utils.isEmpty("test")); + } + + @Test + public void testIsEmptyStringArray() { + assertTrue(Utils.isEmpty((String[]) null)); + assertTrue(Utils.isEmpty(new String[] {})); + assertFalse(Utils.isEmpty(new String[] {"test"})); + } + + @Test + public void testIsEmptyObjectArray() { + assertTrue(Utils.isEmpty((Object[]) null)); + assertTrue(Utils.isEmpty(new Object[] {})); + assertFalse(Utils.isEmpty(new Object[] {"test"})); + } + + @Test + public void testIsEmptyList() { + assertTrue(Utils.isEmpty((List) null)); + assertTrue(Utils.isEmpty(new ArrayList<>())); + assertFalse(Utils.isEmpty(Arrays.asList("test", 1))); + } + + @Test + public void testIsEmptyStringBuffer() { + assertTrue(Utils.isEmpty((StringBuffer) null)); + assertTrue(Utils.isEmpty(new StringBuffer(""))); + assertFalse(Utils.isEmpty(new StringBuffer("test"))); + } + + @Test + public void testIsEmptyStringBuilder() { + assertTrue(Utils.isEmpty((StringBuilder) null)); + assertTrue(Utils.isEmpty(new StringBuilder(""))); + assertFalse(Utils.isEmpty(new StringBuilder("test"))); + } + + @Test + public void testResolvePassword() { + String password = "password"; + // is supposed the password stays the same + assertSame( + password, Utils.resolvePassword(Variables.getADefaultVariableSpace(), password).intern()); + } + + @Test + public void testResolvePasswordEncrypted() { + String decPassword = "password"; + // is supposed encrypted with Encr.bat util + String encPassword = "Encrypted 2be98afc86aa7f2e4bb18bd63c99dbdde"; + assertSame( + decPassword, + Utils.resolvePassword(Variables.getADefaultVariableSpace(), encPassword).intern()); + } + + @Test + public void testResolvePasswordNull() { + String password = null; + // null is valid input parameter + assertSame(password, Utils.resolvePassword(Variables.getADefaultVariableSpace(), password)); + } + + @Test + public void testResolvePasswordVariable() { + String passwordKey = "PASS_VAR"; + String passwordVar = "${" + passwordKey + "}"; + String passwordValue = "password"; + Variables vars = new Variables(); + vars.setVariable(passwordKey, passwordValue); + // resolvePassword gets variable + assertSame(passwordValue, Utils.resolvePassword(vars, passwordVar).intern()); + } + + @Test + public void testNormalizeArraysMethods() { + String[] s1 = new String[] {"one"}; + String[] s2 = new String[] {"one", "two"}; + String[] s3 = new String[] {"one", "two", "three"}; + long[] l1 = new long[] {1}; + long[] l2 = new long[] {1, 2}; + long[] l3 = new long[] {1, 2, 3}; + short[] sh1 = new short[] {1}; + short[] sh2 = new short[] {1, 2}; + short[] sh3 = new short[] {1, 2, 3}; + boolean[] b1 = new boolean[] {true}; + boolean[] b2 = new boolean[] {true, false}; + boolean[] b3 = new boolean[] {true, false, true}; + int[] i1 = new int[] {1}; + int[] i2 = new int[] {1, 2}; + int[] i3 = new int[] {1, 3}; + + String[][] newS = Utils.normalizeArrays(3, s1, s2); + assertEquals(2, newS.length); + assertEquals(3, newS[0].length); + assertEquals(3, newS[1].length); + newS = Utils.normalizeArrays(3, s1, null); + assertEquals(2, newS.length); + assertEquals(3, newS[0].length); + assertEquals(3, newS[1].length); + newS = Utils.normalizeArrays(2, s2); + assertEquals(1, newS.length); + assertEquals(2, newS[0].length); + assertArrayEquals(newS[0], s2); + assertTrue(newS[0] == s2); // If arrays are equal sized, it should return original object + + long[][] newL = Utils.normalizeArrays(3, l1, l2); + assertEquals(2, newL.length); + assertEquals(3, newL[0].length); + assertEquals(3, newL[1].length); + newL = Utils.normalizeArrays(3, l1, null); + assertEquals(2, newL.length); + assertEquals(3, newL[0].length); + assertEquals(3, newL[1].length); + newL = Utils.normalizeArrays(2, l2); + assertEquals(1, newL.length); + assertEquals(2, newL[0].length); + assertArrayEquals(newL[0], l2); + assertTrue(newL[0] == l2); // If arrays are equal sized, it should return original object + + short[][] newSh = Utils.normalizeArrays(3, sh1, sh2); + assertEquals(2, newSh.length); + assertEquals(3, newSh[0].length); + assertEquals(3, newSh[1].length); + newSh = Utils.normalizeArrays(3, sh1, null); + assertEquals(2, newSh.length); + assertEquals(3, newSh[0].length); + assertEquals(3, newSh[1].length); + newSh = Utils.normalizeArrays(2, sh2); + assertEquals(1, newSh.length); + assertEquals(2, newSh[0].length); + assertArrayEquals(newSh[0], sh2); + assertTrue(newSh[0] == sh2); // If arrays are equal sized, it should return original object + + boolean[][] newB = Utils.normalizeArrays(3, b1, b2); + assertEquals(2, newB.length); + assertEquals(3, newB[0].length); + assertEquals(3, newB[1].length); + newB = Utils.normalizeArrays(3, b1, null); + assertEquals(2, newB.length); + assertEquals(3, newB[0].length); + assertEquals(3, newB[1].length); + newB = Utils.normalizeArrays(2, b2); + assertEquals(1, newB.length); + assertEquals(2, newB[0].length); + assertTrue(newB[0] == b2); // If arrays are equal sized, it should return original object + + int[][] newI = Utils.normalizeArrays(3, i1, i2); + assertEquals(2, newI.length); + assertEquals(3, newI[0].length); + assertEquals(3, newI[1].length); + newI = Utils.normalizeArrays(3, i1, null); + assertEquals(2, newI.length); + assertEquals(3, newI[0].length); + assertEquals(3, newI[1].length); + newI = Utils.normalizeArrays(2, i2); + assertEquals(1, newI.length); + assertEquals(2, newI[0].length); + assertArrayEquals(newI[0], i2); + assertTrue(newI[0] == i2); // If arrays are equal sized, it should return original object + } + + @Test + public void testDamerauLevenshteinDistance() throws Exception { + int distance = Utils.getDamerauLevenshteinDistance("Hello", "Hallow"); + assertEquals(2, distance); + distance = Utils.getDamerauLevenshteinDistance("Green", "Grean"); + assertEquals(1, distance); + distance = Utils.getDamerauLevenshteinDistance("Poker", "Powker"); + assertEquals(1, distance); + distance = Utils.getDamerauLevenshteinDistance("Kettle", "Apache Hop"); + assertEquals(9, distance); + distance = Utils.getDamerauLevenshteinDistance("A quick brown fox", "A lazy dog"); + assertEquals(13, distance); + distance = Utils.getDamerauLevenshteinDistance(null, "A string with length 23"); + assertEquals(23, distance); + distance = Utils.getDamerauLevenshteinDistance("String length 16", null); + assertEquals(16, distance); + distance = Utils.getDamerauLevenshteinDistance(null, null); + assertEquals(0, distance); + distance = Utils.getDamerauLevenshteinDistance("", "A string with length 23"); + assertEquals(23, distance); + distance = Utils.getDamerauLevenshteinDistance("String length 16", ""); + assertEquals(16, distance); + distance = Utils.getDamerauLevenshteinDistance("", ""); + assertEquals(0, distance); + } +} diff --git a/core/src/test/java/org/apache/hop/core/variables/VariableRegistryTest.java b/core/src/test/java/org/apache/hop/core/variables/VariableRegistryTest.java index d93bb6147b0..bf2ddc9e7d4 100644 --- a/core/src/test/java/org/apache/hop/core/variables/VariableRegistryTest.java +++ b/core/src/test/java/org/apache/hop/core/variables/VariableRegistryTest.java @@ -17,25 +17,26 @@ package org.apache.hop.core.variables; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.Const; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class VariableRegistryTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - + @Test public void testInit() throws Exception { VariableRegistry.init(); - + VariableRegistry registry = VariableRegistry.getInstance(); - DescribedVariable describedVariable = registry.findDescribedVariable(Const.HOP_PASSWORD_ENCODER_PLUGIN); + DescribedVariable describedVariable = + registry.findDescribedVariable(Const.HOP_PASSWORD_ENCODER_PLUGIN); assertNotNull(describedVariable); boolean actual = Boolean.valueOf(describedVariable.getValue()); diff --git a/core/src/test/java/org/apache/hop/core/variables/VariablesTest.java b/core/src/test/java/org/apache/hop/core/variables/VariablesTest.java index 4275f08993b..fd1cb84191d 100644 --- a/core/src/test/java/org/apache/hop/core/variables/VariablesTest.java +++ b/core/src/test/java/org/apache/hop/core/variables/VariablesTest.java @@ -17,20 +17,6 @@ package org.apache.hop.core.variables; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.core.row.value.ValueMetaString; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -42,6 +28,19 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.core.row.value.ValueMetaString; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + /** * Variables tests. * diff --git a/core/src/test/java/org/apache/hop/core/vfs/HopVfsTest.java b/core/src/test/java/org/apache/hop/core/vfs/HopVfsTest.java index ccff766d20c..6c70bb5897a 100644 --- a/core/src/test/java/org/apache/hop/core/vfs/HopVfsTest.java +++ b/core/src/test/java/org/apache/hop/core/vfs/HopVfsTest.java @@ -17,15 +17,14 @@ package org.apache.hop.core.vfs; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.exception.HopFileException; -import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.io.OutputStream; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.exception.HopFileException; +import org.junit.Test; public class HopVfsTest { diff --git a/core/src/test/java/org/apache/hop/core/xml/XmlCheckTest.java b/core/src/test/java/org/apache/hop/core/xml/XmlCheckTest.java index b1b424f8fcb..cd9d80bbf69 100644 --- a/core/src/test/java/org/apache/hop/core/xml/XmlCheckTest.java +++ b/core/src/test/java/org/apache/hop/core/xml/XmlCheckTest.java @@ -17,11 +17,10 @@ package org.apache.hop.core.xml; +import java.io.ByteArrayInputStream; import org.apache.hop.core.exception.HopException; import org.junit.Test; -import java.io.ByteArrayInputStream; - public class XmlCheckTest { @Test(expected = HopException.class) diff --git a/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java b/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java index 0430d768348..05caf9644ee 100644 --- a/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java +++ b/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java @@ -16,15 +16,14 @@ */ package org.apache.hop.core.xml; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; + +import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.custommonkey.xmlunit.XMLUnit; import org.junit.BeforeClass; import org.junit.Test; -import java.io.InputStream; - -import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; - public class XmlFormatterTest { @BeforeClass diff --git a/core/src/test/java/org/apache/hop/core/xml/XmlHandlerUnitTest.java b/core/src/test/java/org/apache/hop/core/xml/XmlHandlerUnitTest.java index 004533fd6a1..f7cdc47f626 100644 --- a/core/src/test/java/org/apache/hop/core/xml/XmlHandlerUnitTest.java +++ b/core/src/test/java/org/apache/hop/core/xml/XmlHandlerUnitTest.java @@ -17,16 +17,10 @@ package org.apache.hop.core.xml; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopXmlException; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.ClassRule; -import org.junit.Test; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.SAXParseException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; -import javax.xml.parsers.DocumentBuilder; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -34,14 +28,22 @@ import java.math.BigDecimal; import java.util.Calendar; import java.util.GregorianCalendar; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import javax.xml.parsers.DocumentBuilder; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopXmlException; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.ClassRule; +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.SAXParseException; public class XmlHandlerUnitTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - /** @see */ + + /** + * @see + */ private static final String MALICIOUS_XML = "\n" + " getInterests() { return interests; } - /** @param interests The interests to set */ + /** + * @param interests The interests to set + */ public void setInterests(List interests) { this.interests = interests; } @@ -174,7 +183,9 @@ public Map getAttributes() { return attributes; } - /** @param attributes The attributes to set */ + /** + * @param attributes The attributes to set + */ public void setAttributes(Map attributes) { this.attributes = attributes; } @@ -188,7 +199,9 @@ public Occupation getOccupation() { return occupation; } - /** @param occupation The occupation to set */ + /** + * @param occupation The occupation to set + */ public void setOccupation(Occupation occupation) { this.occupation = occupation; } diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Cooking.java b/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Cooking.java index 64c5b2813f0..7a6cbbd007a 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Cooking.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Cooking.java @@ -17,9 +17,8 @@ package org.apache.hop.metadata.serializer.json.person.interest; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Cooking implements IInterest { @@ -66,7 +65,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -81,7 +82,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -95,7 +98,9 @@ public InterestType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(InterestType type) { this.type = type; } diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Music.java b/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Music.java index f5b665b678a..95700f1a26d 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Music.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Music.java @@ -17,9 +17,8 @@ package org.apache.hop.metadata.serializer.json.person.interest; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Music implements IInterest { @@ -66,7 +65,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -81,7 +82,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -95,7 +98,9 @@ public InterestType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(InterestType type) { this.type = type; } diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Running.java b/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Running.java index ce0b5823701..71f72545ffb 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Running.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/json/person/interest/Running.java @@ -17,9 +17,8 @@ package org.apache.hop.metadata.serializer.json.person.interest; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Running implements IInterest { @HopMetadataProperty private InterestType type; @@ -65,7 +64,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -80,7 +81,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -94,7 +97,9 @@ public InterestType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(InterestType type) { this.type = type; } diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataTestBase.java b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataTestBase.java index 4dcc573bb17..ca4d5995327 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataTestBase.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataTestBase.java @@ -18,6 +18,9 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import junit.framework.TestCase; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.encryption.HopTwoWayPasswordEncoder; @@ -31,10 +34,6 @@ import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; import org.junit.Ignore; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - @Ignore public class MetadataTestBase extends TestCase { protected MultiMetadataProvider multiMetadataProvider; diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType1.java b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType1.java index b65b7799fbf..3c337c97725 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType1.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType1.java @@ -18,13 +18,12 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.Objects; import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.HopMetadataBase; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.Objects; - @HopMetadata( key = "type-1", name = "type 1", @@ -71,7 +70,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -85,7 +86,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType2.java b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType2.java index ec4cc3288b6..877cbac5bde 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType2.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MetadataType2.java @@ -18,13 +18,12 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.Objects; import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.HopMetadataBase; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.Objects; - @HopMetadata( key = "type-2", name = "type 2", @@ -71,7 +70,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -85,7 +86,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProviderTest.java b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProviderTest.java index 83a6a9fdadd..e5499823d18 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProviderTest.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataProviderTest.java @@ -18,6 +18,7 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.List; import org.apache.hop.core.encryption.HopTwoWayPasswordEncoder; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.Variables; @@ -25,14 +26,13 @@ import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; -import java.util.List; - public class MultiMetadataProviderTest extends MetadataTestBase { public void testGetDescription() { String description = multiMetadataProvider.getDescription(); assertNotNull(description); - assertEquals("Multi Metadata Provider with 3 providers: Provider1, Provider2, Provider3", description); + assertEquals( + "Multi Metadata Provider with 3 providers: Provider1, Provider2, Provider3", description); } public void testGetMetadataClasses() { diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializerTest.java b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializerTest.java index 83d05ef50b7..c9915ccccf0 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializerTest.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/multi/MultiMetadataSerializerTest.java @@ -18,11 +18,10 @@ package org.apache.hop.metadata.serializer.multi; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.IHopMetadataSerializer; -import java.util.List; - public class MultiMetadataSerializerTest extends MetadataTestBase { protected MetadataType1 object1; diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtilTest.java b/core/src/test/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtilTest.java index 7c29c796ea0..991cd51b3d0 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtilTest.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtilTest.java @@ -17,6 +17,7 @@ package org.apache.hop.metadata.serializer.xml; +import java.util.Arrays; import junit.framework.TestCase; import org.apache.hop.core.Const; import org.apache.hop.core.xml.XmlHandler; @@ -27,8 +28,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.Arrays; - public class XmlMetadataUtilTest extends TestCase { @Test diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Field.java b/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Field.java index 9a952f5f2aa..ba2b83d09d8 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Field.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Field.java @@ -17,12 +17,11 @@ package org.apache.hop.metadata.serializer.xml.classes; +import java.util.Objects; import org.apache.commons.lang.StringUtils; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IIntCodeConverter; -import java.util.Objects; - public class Field { @HopMetadataProperty String name; diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Info.java b/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Info.java index 4f6c23da193..b609ec0da28 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Info.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/Info.java @@ -24,8 +24,7 @@ public class Info { @HopMetadataProperty private String a; @HopMetadataProperty private String b; - public Info() { - } + public Info() {} public Info(String a, String b) { this.a = a; diff --git a/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/MetaData.java b/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/MetaData.java index d9e8bf5ec9d..6086e906aa1 100644 --- a/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/MetaData.java +++ b/core/src/test/java/org/apache/hop/metadata/serializer/xml/classes/MetaData.java @@ -17,10 +17,9 @@ package org.apache.hop.metadata.serializer.xml.classes; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; public class MetaData { @@ -41,7 +40,10 @@ public class MetaData { @HopMetadataProperty(key = "test_enum") private TestEnum testEnum; - /** The "inline" annotation property puts the metadata not in a separate element in the metadata (XML) */ + /** + * The "inline" annotation property puts the metadata not in a separate element in the metadata + * (XML) + */ @HopMetadataProperty(inline = true) private Info info; @@ -59,7 +61,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -73,7 +77,9 @@ public String getSeparator() { return separator; } - /** @param separator The separator to set */ + /** + * @param separator The separator to set + */ public void setSeparator(String separator) { this.separator = separator; } @@ -87,7 +93,9 @@ public String getGroup() { return group; } - /** @param group The group to set */ + /** + * @param group The group to set + */ public void setGroup(String group) { this.group = group; } @@ -101,7 +109,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } @@ -115,7 +125,9 @@ public List getValues() { return values; } - /** @param values The values to set */ + /** + * @param values The values to set + */ public void setValues(List values) { this.values = values; } @@ -129,7 +141,9 @@ public TestEnum getTestEnum() { return testEnum; } - /** @param testEnum The testEnum to set */ + /** + * @param testEnum The testEnum to set + */ public void setTestEnum(TestEnum testEnum) { this.testEnum = testEnum; } diff --git a/core/src/test/java/org/apache/hop/server/HttpUtilTest.java b/core/src/test/java/org/apache/hop/server/HttpUtilTest.java index 339f95154dc..132a2c01618 100644 --- a/core/src/test/java/org/apache/hop/server/HttpUtilTest.java +++ b/core/src/test/java/org/apache/hop/server/HttpUtilTest.java @@ -17,13 +17,6 @@ package org.apache.hop.server; -import junit.framework.Assert; -import org.apache.commons.codec.binary.Base64; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.ClassRule; -import org.junit.Test; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; @@ -32,6 +25,12 @@ import java.nio.charset.CharsetEncoder; import java.security.NoSuchAlgorithmException; import java.util.zip.GZIPOutputStream; +import junit.framework.Assert; +import org.apache.commons.codec.binary.Base64; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.ClassRule; +import org.junit.Test; public class HttpUtilTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/core/src/test/java/org/apache/hop/server/ServerConnectionManagerTest.java b/core/src/test/java/org/apache/hop/server/ServerConnectionManagerTest.java index d31e871f669..8c1dfbf1ffa 100644 --- a/core/src/test/java/org/apache/hop/server/ServerConnectionManagerTest.java +++ b/core/src/test/java/org/apache/hop/server/ServerConnectionManagerTest.java @@ -17,14 +17,13 @@ package org.apache.hop.server; -import org.junit.Before; -import org.junit.Test; - -import javax.net.ssl.SSLContext; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import javax.net.ssl.SSLContext; +import org.junit.Before; +import org.junit.Test; + public class ServerConnectionManagerTest { private SSLContext defaultContext; diff --git a/engine-beam/src/main/java/org/apache/hop/beam/core/BeamHop.java b/engine-beam/src/main/java/org/apache/hop/beam/core/BeamHop.java index 05a3337d4c4..bd64181ce62 100644 --- a/engine-beam/src/main/java/org/apache/hop/beam/core/BeamHop.java +++ b/engine-beam/src/main/java/org/apache/hop/beam/core/BeamHop.java @@ -18,6 +18,9 @@ package org.apache.hop.beam.core; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.annotations.Transform; @@ -38,10 +41,6 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - public class BeamHop { private static final Logger LOG = LoggerFactory.getLogger(BeamHop.class); @@ -50,8 +49,7 @@ public static final boolean isInitialized() { return HopEnvironment.isInitialized(); } - public static final void init() - throws HopException { + public static final void init() throws HopException { synchronized (PluginRegistry.getInstance()) { // Don't create hop config files everywhere... // @@ -104,16 +102,16 @@ public static IPlugin getTransformPluginForClass(Class public static Node getTransformXmlNode(TransformMeta transformMeta) throws HopException { String xml = transformMeta.getXml(); Node transformNode = - XmlHandler.getSubNode(XmlHandler.loadXmlString(xml), TransformMeta.XML_TAG); + XmlHandler.getSubNode(XmlHandler.loadXmlString(xml), TransformMeta.XML_TAG); return transformNode; } public static void loadTransformMetadata( - ITransformMeta meta, - TransformMeta transformMeta, - IHopMetadataProvider metadataProvider, - PipelineMeta pipelineMeta) - throws HopException { + ITransformMeta meta, + TransformMeta transformMeta, + IHopMetadataProvider metadataProvider, + PipelineMeta pipelineMeta) + throws HopException { meta.loadXml(getTransformXmlNode(transformMeta), metadataProvider); meta.searchInfoAndTargetTransforms(pipelineMeta.getTransforms()); } diff --git a/engine-beam/src/main/java/org/apache/hop/beam/core/HopRow.java b/engine-beam/src/main/java/org/apache/hop/beam/core/HopRow.java index e9d367b0e2c..dc3d1cae8de 100644 --- a/engine-beam/src/main/java/org/apache/hop/beam/core/HopRow.java +++ b/engine-beam/src/main/java/org/apache/hop/beam/core/HopRow.java @@ -34,7 +34,7 @@ public HopRow(Object[] row) { } public HopRow(Object[] row, int optionalSize) { - assert optionalSize<=row.length : "optionalSize needs to be <= row length"; + assert optionalSize <= row.length : "optionalSize needs to be <= row length"; this.row = row; this.optionalSize = optionalSize; } @@ -74,11 +74,13 @@ public boolean equals(Object obj) { } /** - * This only addresses the actual filled in items in the object array, not any possible trailing null values. + * This only addresses the actual filled in items in the object array, not any possible trailing + * null values. + * * @return the populated (actual) length of the row (optionalSize<=row.length). */ public int length() { - return optionalSize<0 ? ( row==null ? 0 : row.length ) : optionalSize; + return optionalSize < 0 ? (row == null ? 0 : row.length) : optionalSize; } @Override @@ -99,7 +101,7 @@ public boolean isNotEmpty() { if (row == null) { return false; } - if (row.length==0) { + if (row.length == 0) { return false; } for (int i = 0; i < row.length; i++) { @@ -119,7 +121,9 @@ public Object[] getRow() { return row; } - /** @param row The row to set */ + /** + * @param row The row to set + */ public void setRow(Object[] row) { this.row = row; } diff --git a/engine-beam/src/main/java/org/apache/hop/beam/core/fn/HopKeyValueFn.java b/engine-beam/src/main/java/org/apache/hop/beam/core/fn/HopKeyValueFn.java index e9aab53d7a5..719f06fb3ba 100644 --- a/engine-beam/src/main/java/org/apache/hop/beam/core/fn/HopKeyValueFn.java +++ b/engine-beam/src/main/java/org/apache/hop/beam/core/fn/HopKeyValueFn.java @@ -51,10 +51,7 @@ public class HopKeyValueFn extends DoFn> { public HopKeyValueFn() {} public HopKeyValueFn( - String inputRowMetaJson, - String[] keyFields, - String[] valueFields, - String counterName) { + String inputRowMetaJson, String[] keyFields, String[] valueFields, String counterName) { this.inputRowMetaJson = inputRowMetaJson; this.keyFields = keyFields; this.valueFields = valueFields; @@ -158,7 +155,9 @@ public String getInputRowMetaJson() { return inputRowMetaJson; } - /** @param inputRowMetaJson The inputRowMetaJson to set */ + /** + * @param inputRowMetaJson The inputRowMetaJson to set + */ public void setInputRowMetaJson(String inputRowMetaJson) { this.inputRowMetaJson = inputRowMetaJson; } @@ -172,7 +171,9 @@ public String[] getKeyFields() { return keyFields; } - /** @param keyFields The keyFields to set */ + /** + * @param keyFields The keyFields to set + */ public void setKeyFields(String[] keyFields) { this.keyFields = keyFields; } @@ -186,7 +187,9 @@ public String[] getValueFields() { return valueFields; } - /** @param valueFields The valueFields to set */ + /** + * @param valueFields The valueFields to set + */ public void setValueFields(String[] valueFields) { this.valueFields = valueFields; } diff --git a/engine-beam/src/main/java/org/apache/hop/beam/pipeline/IBeamPipelineTransformHandler.java b/engine-beam/src/main/java/org/apache/hop/beam/pipeline/IBeamPipelineTransformHandler.java index c9c2f40929a..53e9c8f8432 100644 --- a/engine-beam/src/main/java/org/apache/hop/beam/pipeline/IBeamPipelineTransformHandler.java +++ b/engine-beam/src/main/java/org/apache/hop/beam/pipeline/IBeamPipelineTransformHandler.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.pipeline; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.values.PCollection; import org.apache.hop.beam.core.HopRow; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - public interface IBeamPipelineTransformHandler { boolean isInput(); diff --git a/engine/src/main/java/org/apache/hop/IExecutionConfiguration.java b/engine/src/main/java/org/apache/hop/IExecutionConfiguration.java index 85e971944f3..3c7e6cb99e2 100644 --- a/engine/src/main/java/org/apache/hop/IExecutionConfiguration.java +++ b/engine/src/main/java/org/apache/hop/IExecutionConfiguration.java @@ -17,13 +17,12 @@ package org.apache.hop; +import java.util.Map; import org.apache.hop.core.Result; import org.apache.hop.core.logging.LogLevel; import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.xml.IXml; -import java.util.Map; - public interface IExecutionConfiguration extends Cloneable, IXml { Object clone(); diff --git a/engine/src/main/java/org/apache/hop/base/AbstractMeta.java b/engine/src/main/java/org/apache/hop/base/AbstractMeta.java index 8a902458f57..cda48db4b6d 100644 --- a/engine/src/main/java/org/apache/hop/base/AbstractMeta.java +++ b/engine/src/main/java/org/apache/hop/base/AbstractMeta.java @@ -282,7 +282,7 @@ public DatabaseMeta findDatabase(String name) { /** * Find a database connection by it's name - * + * * @param name The database name to look for * @param variables IVariables to use to resolve possible database name * @return The database connection or null if nothing was found. @@ -293,10 +293,10 @@ public DatabaseMeta findDatabase(String name, IVariables variables) { /** * Find a database connection by it's name - * + * * @param name The database name to look for * @param variables IVariables to use to resolve possible database name - * @param haltOnMissingMeta Raise an exception in case connection is missing + * @param haltOnMissingMeta Raise an exception in case connection is missing * @returnThe database connection or null if nothing was found. */ public DatabaseMeta findDatabase(String name, IVariables variables, boolean haltOnMissingMeta) { diff --git a/engine/src/main/java/org/apache/hop/base/BaseHopMeta.java b/engine/src/main/java/org/apache/hop/base/BaseHopMeta.java index 9307f949e2f..d850d9064d7 100644 --- a/engine/src/main/java/org/apache/hop/base/BaseHopMeta.java +++ b/engine/src/main/java/org/apache/hop/base/BaseHopMeta.java @@ -27,7 +27,7 @@ public abstract class BaseHopMeta { public static final String XML_FROM_TAG = "from"; public static final String XML_TO_TAG = "to"; public static final String XML_ENABLED_TAG = "enabled"; - + public boolean split = false; protected T from; protected T to; @@ -91,12 +91,15 @@ public boolean isSplit() { return split; } - /** @param split The split to set */ + /** + * @param split The split to set + */ public void setSplit(boolean split) { this.split = split; } - - protected boolean getTagValueAsBoolean(final Node node, final String tag, final boolean defaultValue) { + + protected boolean getTagValueAsBoolean( + final Node node, final String tag, final boolean defaultValue) { String value = XmlHandler.getTagValue(node, tag); if (value == null) { return defaultValue; diff --git a/engine/src/main/java/org/apache/hop/config/HopConfig.java b/engine/src/main/java/org/apache/hop/config/HopConfig.java index 108421f3411..c68dd68e26f 100644 --- a/engine/src/main/java/org/apache/hop/config/HopConfig.java +++ b/engine/src/main/java/org/apache/hop/config/HopConfig.java @@ -17,6 +17,9 @@ package org.apache.hop.config; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; @@ -44,160 +47,158 @@ import picocli.CommandLine.Option; import picocli.CommandLine.ParameterException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Command(versionProvider = HopVersionProvider.class) public class HopConfig implements Runnable, IHasHopMetadataProvider { - @Option( - names = {"-h", "--help"}, - usageHelp = true, - description = "Displays this help message and quits.") - private boolean helpRequested; - - @Option(names = {"-v", "--version"}, - versionHelp = true, - description = "Print version information and exit") - private boolean versionRequested; - - @Option( - names = {"-l", "--level"}, - description = "The debug level, one of NOTHING, ERROR, MINIMAL, BASIC, DETAILED, DEBUG, ROWLEVEL") - private String level; - - private CommandLine cmd; - private IVariables variables; - private MultiMetadataProvider metadataProvider; - - @Override - public void run() { - try { - variables = Variables.getADefaultVariableSpace(); - - LogChannel log = new LogChannel("hop-config"); - log.setSimplified(true); - log.setLogLevel(determineLogLevel()); - log.logDetailed("Start of Hop Config"); - - buildMetadataProvider(); - - boolean actionTaken = false; - - Map mixins = cmd.getMixins(); - for (String key : mixins.keySet()) { - Object mixin = mixins.get(key); - if (mixin instanceof IConfigOptions) { - IConfigOptions configOptions = (IConfigOptions) mixin; - - actionTaken = configOptions.handleOption(log, this, variables) || actionTaken; - } - } - - if (!actionTaken) { - cmd.usage(System.out); - } - - } catch (Exception e) { - throw new ExecutionException(cmd, "There was an error handling options", e); - } - } - - private LogLevel determineLogLevel() { - return LogLevel.getLogLevelForCode(variables.resolve(level)); - } - - private void buildMetadataProvider() throws HopException { - List providers = new ArrayList<>(); - String folder = variables.getVariable(Const.HOP_METADATA_FOLDER); - if (StringUtils.isEmpty(folder)) { - providers.add(new JsonMetadataProvider()); - } else { - ITwoWayPasswordEncoder passwordEncoder = Encr.getEncoder(); - if (passwordEncoder == null) { - passwordEncoder = new HopTwoWayPasswordEncoder(); - } - providers.add(new JsonMetadataProvider(passwordEncoder, folder, variables)); + @Option( + names = {"-h", "--help"}, + usageHelp = true, + description = "Displays this help message and quits.") + private boolean helpRequested; + + @Option( + names = {"-v", "--version"}, + versionHelp = true, + description = "Print version information and exit") + private boolean versionRequested; + + @Option( + names = {"-l", "--level"}, + description = + "The debug level, one of NOTHING, ERROR, MINIMAL, BASIC, DETAILED, DEBUG, ROWLEVEL") + private String level; + + private CommandLine cmd; + private IVariables variables; + private MultiMetadataProvider metadataProvider; + + @Override + public void run() { + try { + variables = Variables.getADefaultVariableSpace(); + + LogChannel log = new LogChannel("hop-config"); + log.setSimplified(true); + log.setLogLevel(determineLogLevel()); + log.logDetailed("Start of Hop Config"); + + buildMetadataProvider(); + + boolean actionTaken = false; + + Map mixins = cmd.getMixins(); + for (String key : mixins.keySet()) { + Object mixin = mixins.get(key); + if (mixin instanceof IConfigOptions) { + IConfigOptions configOptions = (IConfigOptions) mixin; + + actionTaken = configOptions.handleOption(log, this, variables) || actionTaken; } - metadataProvider = new MultiMetadataProvider(Encr.getEncoder(), providers, variables); - } + } - /** - * Gets cmd - * - * @return value of cmd - */ - public CommandLine getCmd() { - return cmd; - } + if (!actionTaken) { + cmd.usage(System.out); + } - /** - * @param cmd The cmd to set - */ - public void setCmd(CommandLine cmd) { - this.cmd = cmd; + } catch (Exception e) { + throw new ExecutionException(cmd, "There was an error handling options", e); } - - /** - * Gets metadataProvider - * - * @return value of metadataProvider - */ - @Override - public MultiMetadataProvider getMetadataProvider() { - return metadataProvider; - } - - /** - * @param metadataProvider The metadataProvider to set - */ - @Override - public void setMetadataProvider(MultiMetadataProvider metadataProvider) { - this.metadataProvider = metadataProvider; + } + + private LogLevel determineLogLevel() { + return LogLevel.getLogLevelForCode(variables.resolve(level)); + } + + private void buildMetadataProvider() throws HopException { + List providers = new ArrayList<>(); + String folder = variables.getVariable(Const.HOP_METADATA_FOLDER); + if (StringUtils.isEmpty(folder)) { + providers.add(new JsonMetadataProvider()); + } else { + ITwoWayPasswordEncoder passwordEncoder = Encr.getEncoder(); + if (passwordEncoder == null) { + passwordEncoder = new HopTwoWayPasswordEncoder(); + } + providers.add(new JsonMetadataProvider(passwordEncoder, folder, variables)); } - - public static void main(String[] args) { - - HopConfig hopConfig = new HopConfig(); - - try { - HopEnvironment.init(); - - CommandLine cmd = new CommandLine(hopConfig); - List configPlugins = PluginRegistry.getInstance().getPlugins(ConfigPluginType.class); - for (IPlugin configPlugin : configPlugins) { - // Load only the plugins of the "config" category - if (ConfigPlugin.CATEGORY_CONFIG.equals(configPlugin.getCategory())) { - IConfigOptions configOptions = - PluginRegistry.getInstance().loadClass(configPlugin, IConfigOptions.class); - cmd.addMixin(configPlugin.getIds()[0], configOptions); - } - } - - hopConfig.setCmd(cmd); - CommandLine.ParseResult parseResult = cmd.parseArgs(args); - if (CommandLine.printHelpIfRequested(parseResult)) { - System.exit(1); - } else { - hopConfig.run(); - System.exit(0); - } - } catch (ParameterException e) { - System.err.println(e.getMessage()); - hopConfig.cmd.usage(System.err); - e.getCommandLine().usage(System.err); - System.exit(9); - } catch (ExecutionException e) { - System.err.println("Error found during execution!"); - System.err.println(Const.getStackTracker(e)); - - System.exit(1); - } catch (Exception e) { - System.err.println("General error found, something went horribly wrong!"); - System.err.println(Const.getStackTracker(e)); - - System.exit(2); + metadataProvider = new MultiMetadataProvider(Encr.getEncoder(), providers, variables); + } + + /** + * Gets cmd + * + * @return value of cmd + */ + public CommandLine getCmd() { + return cmd; + } + + /** + * @param cmd The cmd to set + */ + public void setCmd(CommandLine cmd) { + this.cmd = cmd; + } + + /** + * Gets metadataProvider + * + * @return value of metadataProvider + */ + @Override + public MultiMetadataProvider getMetadataProvider() { + return metadataProvider; + } + + /** + * @param metadataProvider The metadataProvider to set + */ + @Override + public void setMetadataProvider(MultiMetadataProvider metadataProvider) { + this.metadataProvider = metadataProvider; + } + + public static void main(String[] args) { + + HopConfig hopConfig = new HopConfig(); + + try { + HopEnvironment.init(); + + CommandLine cmd = new CommandLine(hopConfig); + List configPlugins = PluginRegistry.getInstance().getPlugins(ConfigPluginType.class); + for (IPlugin configPlugin : configPlugins) { + // Load only the plugins of the "config" category + if (ConfigPlugin.CATEGORY_CONFIG.equals(configPlugin.getCategory())) { + IConfigOptions configOptions = + PluginRegistry.getInstance().loadClass(configPlugin, IConfigOptions.class); + cmd.addMixin(configPlugin.getIds()[0], configOptions); } + } + + hopConfig.setCmd(cmd); + CommandLine.ParseResult parseResult = cmd.parseArgs(args); + if (CommandLine.printHelpIfRequested(parseResult)) { + System.exit(1); + } else { + hopConfig.run(); + System.exit(0); + } + } catch (ParameterException e) { + System.err.println(e.getMessage()); + hopConfig.cmd.usage(System.err); + e.getCommandLine().usage(System.err); + System.exit(9); + } catch (ExecutionException e) { + System.err.println("Error found during execution!"); + System.err.println(Const.getStackTracker(e)); + + System.exit(1); + } catch (Exception e) { + System.err.println("General error found, something went horribly wrong!"); + System.err.println(Const.getStackTracker(e)); + + System.exit(2); } + } } diff --git a/engine/src/main/java/org/apache/hop/core/ConcurrentMapProperties.java b/engine/src/main/java/org/apache/hop/core/ConcurrentMapProperties.java index e7d4772fc80..8f2ecd3a560 100644 --- a/engine/src/main/java/org/apache/hop/core/ConcurrentMapProperties.java +++ b/engine/src/main/java/org/apache/hop/core/ConcurrentMapProperties.java @@ -16,8 +16,6 @@ */ package org.apache.hop.core; -import org.apache.commons.collections4.IteratorUtils; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -37,6 +35,7 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; +import org.apache.commons.collections4.IteratorUtils; /** Thread Safe version of Java Properties class. */ public class ConcurrentMapProperties extends Properties { diff --git a/engine/src/main/java/org/apache/hop/core/HopEnvironment.java b/engine/src/main/java/org/apache/hop/core/HopEnvironment.java index 1f63cd51889..38b2c31251d 100644 --- a/engine/src/main/java/org/apache/hop/core/HopEnvironment.java +++ b/engine/src/main/java/org/apache/hop/core/HopEnvironment.java @@ -18,6 +18,10 @@ package org.apache.hop.core; import com.google.common.util.concurrent.SettableFuture; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.auth.AuthenticationConsumerPluginType; import org.apache.hop.core.auth.AuthenticationProviderPluginType; @@ -46,11 +50,6 @@ import org.apache.hop.pipeline.transform.RowDistributionPluginType; import org.apache.hop.workflow.engine.WorkflowEnginePluginType; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Future; -import java.util.concurrent.atomic.AtomicReference; - /** * The HopEnvironment class contains settings and properties for all of Hop. Initialization of the * environment is done by calling the init() method, which reads in properties file(s), registers diff --git a/engine/src/main/java/org/apache/hop/core/HopVersionProvider.java b/engine/src/main/java/org/apache/hop/core/HopVersionProvider.java index 88ad99c855d..8c63d0f6cf9 100644 --- a/engine/src/main/java/org/apache/hop/core/HopVersionProvider.java +++ b/engine/src/main/java/org/apache/hop/core/HopVersionProvider.java @@ -19,8 +19,11 @@ import picocli.CommandLine.IVersionProvider; public class HopVersionProvider implements IVersionProvider { - private static final String[] VERSION = {HopEnvironment.class.getPackage().getImplementationVersion()}; + private static final String[] VERSION = { + HopEnvironment.class.getPackage().getImplementationVersion() + }; + public String[] getVersion() { return VERSION; } -} \ No newline at end of file +} diff --git a/engine/src/main/java/org/apache/hop/core/HttpProtocol.java b/engine/src/main/java/org/apache/hop/core/HttpProtocol.java index c19d330fc23..65902c41fb7 100644 --- a/engine/src/main/java/org/apache/hop/core/HttpProtocol.java +++ b/engine/src/main/java/org/apache/hop/core/HttpProtocol.java @@ -17,6 +17,8 @@ package org.apache.hop.core; +import java.io.IOException; +import java.io.InputStreamReader; import org.apache.hop.core.util.HttpClientManager; import org.apache.hop.core.util.Utils; import org.apache.http.HttpResponse; @@ -25,9 +27,6 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; -import java.io.IOException; -import java.io.InputStreamReader; - /** * HTTP * @@ -44,7 +43,9 @@ public class HttpProtocol { "accept", "accept-charset", "cache-control", "content-type" }; - /** @return array of HTTP request headers */ + /** + * @return array of HTTP request headers + */ public static String[] getRequestHeaders() { return requestHeaders; } diff --git a/engine/src/main/java/org/apache/hop/core/IEngineMeta.java b/engine/src/main/java/org/apache/hop/core/IEngineMeta.java index 1c76b07338e..6e5012b1ef1 100644 --- a/engine/src/main/java/org/apache/hop/core/IEngineMeta.java +++ b/engine/src/main/java/org/apache/hop/core/IEngineMeta.java @@ -17,12 +17,11 @@ package org.apache.hop.core; +import java.util.Date; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.xml.IXml; -import java.util.Date; - public interface IEngineMeta { /** @@ -139,9 +138,13 @@ public interface IEngineMeta { */ void setInternalHopVariables(IVariables variables); - /** @return true if the name is derived from the filename */ + /** + * @return true if the name is derived from the filename + */ boolean isNameSynchronizedWithFilename(); - /** @param nameSynchronizedWithFilename Set to true if the name is derived from the filename */ + /** + * @param nameSynchronizedWithFilename Set to true if the name is derived from the filename + */ void setNameSynchronizedWithFilename(boolean nameSynchronizedWithFilename); } diff --git a/engine/src/main/java/org/apache/hop/core/IProvidesModelerMeta.java b/engine/src/main/java/org/apache/hop/core/IProvidesModelerMeta.java index 264b2ba2f62..710ad16faad 100644 --- a/engine/src/main/java/org/apache/hop/core/IProvidesModelerMeta.java +++ b/engine/src/main/java/org/apache/hop/core/IProvidesModelerMeta.java @@ -17,13 +17,11 @@ package org.apache.hop.core; +import java.util.List; import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.variables.IVariables; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public interface IProvidesModelerMeta extends IProvidesDatabaseConnectionInformation { IRowMeta getRowMeta(IVariables variables, ITransformData transformData); diff --git a/engine/src/main/java/org/apache/hop/core/annotations/HopServerServlet.java b/engine/src/main/java/org/apache/hop/core/annotations/HopServerServlet.java index 694832702db..701e7148c9f 100644 --- a/engine/src/main/java/org/apache/hop/core/annotations/HopServerServlet.java +++ b/engine/src/main/java/org/apache/hop/core/annotations/HopServerServlet.java @@ -42,7 +42,9 @@ String description() default ""; - /** @return True if a separate class loader is needed every time this class is instantiated */ + /** + * @return True if a separate class loader is needed every time this class is instantiated + */ boolean isSeparateClassLoaderNeeded() default false; String classLoaderGroup() default ""; diff --git a/engine/src/main/java/org/apache/hop/core/attributes/AttributesUtil.java b/engine/src/main/java/org/apache/hop/core/attributes/AttributesUtil.java index aaa9419b0e5..1335ce59cd2 100644 --- a/engine/src/main/java/org/apache/hop/core/attributes/AttributesUtil.java +++ b/engine/src/main/java/org/apache/hop/core/attributes/AttributesUtil.java @@ -17,15 +17,14 @@ package org.apache.hop.core.attributes; -import org.apache.hop.core.Const; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Node; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.core.Const; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Node; public class AttributesUtil { diff --git a/engine/src/main/java/org/apache/hop/core/attributes/metastore/AttributesInterfaceEntry.java b/engine/src/main/java/org/apache/hop/core/attributes/metastore/AttributesInterfaceEntry.java index a84d90c6673..714ece82838 100644 --- a/engine/src/main/java/org/apache/hop/core/attributes/metastore/AttributesInterfaceEntry.java +++ b/engine/src/main/java/org/apache/hop/core/attributes/metastore/AttributesInterfaceEntry.java @@ -18,7 +18,6 @@ package org.apache.hop.core.attributes.metastore; import com.fasterxml.jackson.annotation.JsonIgnore; - import java.io.IOException; interface AttributesInterfaceEntry { diff --git a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPlugin.java b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPlugin.java index 4eb3597611f..34be5502bd4 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPlugin.java +++ b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPlugin.java @@ -37,7 +37,9 @@ String description() default "Authentication Consumer Plugin"; - /** @return True if a separate class loader is needed every time this class is instantiated */ + /** + * @return True if a separate class loader is needed every time this class is instantiated + */ boolean isSeparateClassLoaderNeeded() default false; String documentationUrl() default ""; diff --git a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPluginType.java b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPluginType.java index c1e94d5455b..b0ded870379 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPluginType.java +++ b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationConsumerPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.auth; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the authentication plugin type. */ @PluginMainClassType(IAuthenticationConsumerType.class) @PluginAnnotationType(AuthenticationConsumerPlugin.class) diff --git a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPlugin.java b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPlugin.java index a80e7b44cff..eb6f0860ad7 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPlugin.java +++ b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPlugin.java @@ -37,7 +37,9 @@ String description() default "Authentication Plugin"; - /** @return True if a separate class loader is needed every time this class is instantiated */ + /** + * @return True if a separate class loader is needed every time this class is instantiated + */ boolean isSeparateClassLoaderNeeded() default false; String documentationUrl() default ""; diff --git a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPluginType.java b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPluginType.java index 43da7c44765..b994379591d 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPluginType.java +++ b/engine/src/main/java/org/apache/hop/core/auth/AuthenticationProviderPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.auth; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the authentication plugin type. */ @PluginMainClassType(IAuthenticationProviderType.class) @PluginAnnotationType(AuthenticationProviderPlugin.class) diff --git a/engine/src/main/java/org/apache/hop/core/auth/core/AuthenticationManager.java b/engine/src/main/java/org/apache/hop/core/auth/core/AuthenticationManager.java index 2f1df840d62..1aef41092b3 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/core/AuthenticationManager.java +++ b/engine/src/main/java/org/apache/hop/core/auth/core/AuthenticationManager.java @@ -17,16 +17,15 @@ package org.apache.hop.core.auth.core; -import org.apache.hop.core.auth.core.impl.DefaultAuthenticationConsumerFactory; -import org.apache.hop.core.auth.core.impl.DefaultAuthenticationPerformerFactory; -import org.apache.hop.i18n.BaseMessages; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.apache.hop.core.auth.core.impl.DefaultAuthenticationConsumerFactory; +import org.apache.hop.core.auth.core.impl.DefaultAuthenticationPerformerFactory; +import org.apache.hop.i18n.BaseMessages; public class AuthenticationManager { private static final Class PKG = AuthenticationManager.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/core/auth/core/impl/ClassloaderBridgingAuthenticationPerformer.java b/engine/src/main/java/org/apache/hop/core/auth/core/impl/ClassloaderBridgingAuthenticationPerformer.java index a2ae6035cf3..c37bf6cf538 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/core/impl/ClassloaderBridgingAuthenticationPerformer.java +++ b/engine/src/main/java/org/apache/hop/core/auth/core/impl/ClassloaderBridgingAuthenticationPerformer.java @@ -17,6 +17,7 @@ package org.apache.hop.core.auth.core.impl; +import java.lang.reflect.Proxy; import org.apache.hop.core.auth.core.AuthenticationConsumerInvocationHandler; import org.apache.hop.core.auth.core.AuthenticationConsumptionException; import org.apache.hop.core.auth.core.IAuthenticationConsumer; @@ -24,8 +25,6 @@ import org.apache.hop.core.auth.core.IAuthenticationPerformer; import org.apache.hop.core.auth.core.IAuthenticationProvider; -import java.lang.reflect.Proxy; - public class ClassloaderBridgingAuthenticationPerformer implements IAuthenticationPerformer { private final IAuthenticationProvider provider; diff --git a/engine/src/main/java/org/apache/hop/core/auth/core/impl/DefaultAuthenticationConsumerFactory.java b/engine/src/main/java/org/apache/hop/core/auth/core/impl/DefaultAuthenticationConsumerFactory.java index 6eb37d9ff21..dcf934ddae1 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/core/impl/DefaultAuthenticationConsumerFactory.java +++ b/engine/src/main/java/org/apache/hop/core/auth/core/impl/DefaultAuthenticationConsumerFactory.java @@ -17,14 +17,13 @@ package org.apache.hop.core.auth.core.impl; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import org.apache.hop.core.auth.core.AuthenticationFactoryException; import org.apache.hop.core.auth.core.IAuthenticationConsumer; import org.apache.hop.core.auth.core.IAuthenticationConsumerFactory; import org.apache.hop.i18n.BaseMessages; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - public class DefaultAuthenticationConsumerFactory implements IAuthenticationConsumerFactory { private static final Class PKG = DefaultAuthenticationConsumerFactory.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/core/auth/kerberos/KerberosUtil.java b/engine/src/main/java/org/apache/hop/core/auth/kerberos/KerberosUtil.java index 0f61e3f6abc..fa8d2cfe2cc 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/kerberos/KerberosUtil.java +++ b/engine/src/main/java/org/apache/hop/core/auth/kerberos/KerberosUtil.java @@ -18,7 +18,10 @@ package org.apache.hop.core.auth.kerberos; import com.sun.security.auth.module.Krb5LoginModule; - +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; @@ -30,10 +33,6 @@ import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; public class KerberosUtil { /** A Login Configuration that is pre-configured based on our static configuration. */ diff --git a/engine/src/main/java/org/apache/hop/core/auth/kerberos/LoginContextInvocationHandler.java b/engine/src/main/java/org/apache/hop/core/auth/kerberos/LoginContextInvocationHandler.java index f2f40320380..4eee2c1f52b 100644 --- a/engine/src/main/java/org/apache/hop/core/auth/kerberos/LoginContextInvocationHandler.java +++ b/engine/src/main/java/org/apache/hop/core/auth/kerberos/LoginContextInvocationHandler.java @@ -17,10 +17,6 @@ package org.apache.hop.core.auth.kerberos; -import org.apache.commons.lang.ClassUtils; - -import javax.security.auth.Subject; -import javax.security.auth.login.LoginContext; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -30,6 +26,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import javax.security.auth.Subject; +import javax.security.auth.login.LoginContext; +import org.apache.commons.lang.ClassUtils; public class LoginContextInvocationHandler implements InvocationHandler { private final T delegate; diff --git a/engine/src/main/java/org/apache/hop/core/changed/ChangedFlag.java b/engine/src/main/java/org/apache/hop/core/changed/ChangedFlag.java index c3ad4eea8b9..9e34586fd17 100644 --- a/engine/src/main/java/org/apache/hop/core/changed/ChangedFlag.java +++ b/engine/src/main/java/org/apache/hop/core/changed/ChangedFlag.java @@ -18,7 +18,6 @@ package org.apache.hop.core.changed; import com.fasterxml.jackson.annotation.JsonIgnore; - import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; diff --git a/engine/src/main/java/org/apache/hop/core/compress/CompressionPlugin.java b/engine/src/main/java/org/apache/hop/core/compress/CompressionPlugin.java index 73ddc7cbc53..7466f4861f7 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/CompressionPlugin.java +++ b/engine/src/main/java/org/apache/hop/core/compress/CompressionPlugin.java @@ -35,7 +35,9 @@ String description() default "Compression Plugin"; - /** @return True if a separate class loader is needed every time this class is instantiated */ + /** + * @return True if a separate class loader is needed every time this class is instantiated + */ boolean isSeparateClassLoaderNeeded() default false; String documentationUrl() default ""; diff --git a/engine/src/main/java/org/apache/hop/core/compress/CompressionPluginType.java b/engine/src/main/java/org/apache/hop/core/compress/CompressionPluginType.java index e45109e6522..2d642c38dbc 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/CompressionPluginType.java +++ b/engine/src/main/java/org/apache/hop/core/compress/CompressionPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the compression plugin type. */ @PluginMainClassType(ICompressionProvider.class) @PluginAnnotationType(CompressionPlugin.class) diff --git a/engine/src/main/java/org/apache/hop/core/compress/CompressionProviderFactory.java b/engine/src/main/java/org/apache/hop/core/compress/CompressionProviderFactory.java index 5c4ba4746f1..f7e08bea499 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/CompressionProviderFactory.java +++ b/engine/src/main/java/org/apache/hop/core/compress/CompressionProviderFactory.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress; -import org.apache.hop.core.plugins.IPlugin; -import org.apache.hop.core.plugins.PluginRegistry; - import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.apache.hop.core.plugins.IPlugin; +import org.apache.hop.core.plugins.PluginRegistry; public class CompressionProviderFactory implements ICompressionProviderFactory { diff --git a/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStream.java b/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStream.java index 54970aa28ee..b7693c40c3e 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStream.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.gzip; -import org.apache.hop.core.compress.CompressionInputStream; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; +import org.apache.hop.core.compress.CompressionInputStream; +import org.apache.hop.core.compress.ICompressionProvider; public class GzipCompressionInputStream extends CompressionInputStream { diff --git a/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStream.java b/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStream.java index 70dc096654e..1f7b21590f8 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStream.java @@ -17,13 +17,12 @@ package org.apache.hop.core.compress.gzip; -import org.apache.hop.core.compress.CompressionOutputStream; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.OutputStream; import java.util.zip.GZIPOutputStream; import java.util.zip.ZipOutputStream; +import org.apache.hop.core.compress.CompressionOutputStream; +import org.apache.hop.core.compress.ICompressionProvider; public class GzipCompressionOutputStream extends CompressionOutputStream { diff --git a/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionProvider.java b/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionProvider.java index fe5d52dd0c3..d4ca9d234c9 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionProvider.java +++ b/engine/src/main/java/org/apache/hop/core/compress/gzip/GzipCompressionProvider.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.gzip; -import org.apache.hop.core.compress.CompressionPlugin; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import org.apache.hop.core.compress.CompressionPlugin; +import org.apache.hop.core.compress.ICompressionProvider; @CompressionPlugin(id = "GZIP", name = "GZip", description = "GZIP compression") public class GzipCompressionProvider implements ICompressionProvider { diff --git a/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionInputStream.java b/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionInputStream.java index bfae12bb929..0f7f9325932 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionInputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionInputStream.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.hadoopsnappy; -import org.apache.hop.core.compress.CompressionInputStream; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; +import org.apache.hop.core.compress.CompressionInputStream; +import org.apache.hop.core.compress.ICompressionProvider; public class HadoopSnappyCompressionInputStream extends CompressionInputStream { diff --git a/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionOutputStream.java b/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionOutputStream.java index 177ac901684..babe271a028 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionOutputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionOutputStream.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.hadoopsnappy; -import org.apache.hop.core.compress.CompressionOutputStream; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Method; +import org.apache.hop.core.compress.CompressionOutputStream; +import org.apache.hop.core.compress.ICompressionProvider; public class HadoopSnappyCompressionOutputStream extends CompressionOutputStream { diff --git a/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionProvider.java b/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionProvider.java index 452f2568164..cd8ef4bf3ab 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionProvider.java +++ b/engine/src/main/java/org/apache/hop/core/compress/hadoopsnappy/HadoopSnappyCompressionProvider.java @@ -17,13 +17,12 @@ package org.apache.hop.core.compress.hadoopsnappy; -import org.apache.hop.core.compress.CompressionPlugin; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Method; +import org.apache.hop.core.compress.CompressionPlugin; +import org.apache.hop.core.compress.ICompressionProvider; @CompressionPlugin( id = "HADOOPSNAPPY", diff --git a/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStream.java b/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStream.java index 522a2dd09c0..786c58085ef 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStream.java @@ -17,13 +17,12 @@ package org.apache.hop.core.compress.snappy; +import java.io.IOException; +import java.io.InputStream; import org.apache.hop.core.compress.CompressionInputStream; import org.apache.hop.core.compress.ICompressionProvider; import org.xerial.snappy.SnappyInputStream; -import java.io.IOException; -import java.io.InputStream; - public class SnappyCompressionInputStream extends CompressionInputStream { public SnappyCompressionInputStream(InputStream in, ICompressionProvider provider) diff --git a/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStream.java b/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStream.java index c617f9dccda..be455093e0c 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStream.java @@ -17,13 +17,12 @@ package org.apache.hop.core.compress.snappy; +import java.io.IOException; +import java.io.OutputStream; import org.apache.hop.core.compress.CompressionOutputStream; import org.apache.hop.core.compress.ICompressionProvider; import org.xerial.snappy.SnappyOutputStream; -import java.io.IOException; -import java.io.OutputStream; - public class SnappyCompressionOutputStream extends CompressionOutputStream { public SnappyCompressionOutputStream(OutputStream out, ICompressionProvider provider) diff --git a/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionProvider.java b/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionProvider.java index 9be41a34873..d153695af63 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionProvider.java +++ b/engine/src/main/java/org/apache/hop/core/compress/snappy/SnappyCompressionProvider.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.snappy; -import org.apache.hop.core.compress.CompressionPlugin; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import org.apache.hop.core.compress.CompressionPlugin; +import org.apache.hop.core.compress.ICompressionProvider; @CompressionPlugin(id = "SNAPPY", name = "Snappy", description = "Snappy compression") public class SnappyCompressionProvider implements ICompressionProvider { diff --git a/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionInputStream.java b/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionInputStream.java index d28d4ffd685..c32ad61a35d 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionInputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionInputStream.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.zip; -import org.apache.hop.core.compress.CompressionInputStream; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipInputStream; +import org.apache.hop.core.compress.CompressionInputStream; +import org.apache.hop.core.compress.ICompressionProvider; public class ZipCompressionInputStream extends CompressionInputStream { diff --git a/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStream.java b/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStream.java index 05eeb27dea4..ae9008c0de2 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStream.java +++ b/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStream.java @@ -17,15 +17,14 @@ package org.apache.hop.core.compress.zip; -import org.apache.hop.core.Const; -import org.apache.hop.core.compress.CompressionOutputStream; -import org.apache.hop.core.compress.ICompressionProvider; -import org.apache.hop.core.util.Utils; - import java.io.IOException; import java.io.OutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import org.apache.hop.core.Const; +import org.apache.hop.core.compress.CompressionOutputStream; +import org.apache.hop.core.compress.ICompressionProvider; +import org.apache.hop.core.util.Utils; public class ZipCompressionOutputStream extends CompressionOutputStream { diff --git a/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionProvider.java b/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionProvider.java index 5622a44ae5d..d19a276f5fa 100644 --- a/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionProvider.java +++ b/engine/src/main/java/org/apache/hop/core/compress/zip/ZipCompressionProvider.java @@ -17,12 +17,11 @@ package org.apache.hop.core.compress.zip; -import org.apache.hop.core.compress.CompressionPlugin; -import org.apache.hop.core.compress.ICompressionProvider; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import org.apache.hop.core.compress.CompressionPlugin; +import org.apache.hop.core.compress.ICompressionProvider; @CompressionPlugin(id = "Zip", name = "Zip", description = "ZIP compression") public class ZipCompressionProvider implements ICompressionProvider { diff --git a/engine/src/main/java/org/apache/hop/core/file/EncodingType.java b/engine/src/main/java/org/apache/hop/core/file/EncodingType.java index 0171f1d572b..adf1807bf1b 100644 --- a/engine/src/main/java/org/apache/hop/core/file/EncodingType.java +++ b/engine/src/main/java/org/apache/hop/core/file/EncodingType.java @@ -17,9 +17,8 @@ package org.apache.hop.core.file; -import org.apache.hop.core.util.Utils; - import java.io.UnsupportedEncodingException; +import org.apache.hop.core.util.Utils; public enum EncodingType { SINGLE(1, 0, '\r', '\n'), diff --git a/engine/src/main/java/org/apache/hop/core/file/IInputFileMeta.java b/engine/src/main/java/org/apache/hop/core/file/IInputFileMeta.java index 3967bdc2b7f..644c73ab545 100644 --- a/engine/src/main/java/org/apache/hop/core/file/IInputFileMeta.java +++ b/engine/src/main/java/org/apache/hop/core/file/IInputFileMeta.java @@ -23,7 +23,7 @@ /** * @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +@Deprecated(since = "2.0") public interface IInputFileMeta extends ITransformMeta { TextFileInputField[] getInputFields(); diff --git a/engine/src/main/java/org/apache/hop/core/file/TextFileInputField.java b/engine/src/main/java/org/apache/hop/core/file/TextFileInputField.java index 440152dd34d..1614f440863 100644 --- a/engine/src/main/java/org/apache/hop/core/file/TextFileInputField.java +++ b/engine/src/main/java/org/apache/hop/core/file/TextFileInputField.java @@ -17,6 +17,12 @@ package org.apache.hop.core.file; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; import org.apache.hop.core.Const; import org.apache.hop.core.gui.ITextFileInputField; import org.apache.hop.core.injection.Injection; @@ -25,13 +31,6 @@ import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.core.row.value.ValueMetaString; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - /** Describes a single field in a text file */ public class TextFileInputField implements Cloneable, ITextFileInputField { diff --git a/engine/src/main/java/org/apache/hop/core/gui/AreaOwner.java b/engine/src/main/java/org/apache/hop/core/gui/AreaOwner.java index 56a982613cf..cc776dcdc3d 100644 --- a/engine/src/main/java/org/apache/hop/core/gui/AreaOwner.java +++ b/engine/src/main/java/org/apache/hop/core/gui/AreaOwner.java @@ -30,25 +30,34 @@ public class AreaOwner { public enum AreaType { /** The note pad area. */ NOTE(true), - + /** The transformation partitioning area. */ - TRANSFORM_PARTITIONING(false), + TRANSFORM_PARTITIONING(false), /** The transformation icon area. */ TRANSFORM_ICON(true), /** The transformation name area. */ TRANSFORM_NAME(true), - /** The transformation decoration information icon in the top left-hand corner indicates that it has a description. */ + /** + * The transformation decoration information icon in the top left-hand corner indicates that it + * has a description. + */ TRANSFORM_INFO_ICON(true), - /** The transformation decoration failure icon area in top right corner to indicate an execution error. */ + /** + * The transformation decoration failure icon area in top right corner to indicate an execution + * error. + */ TRANSFORM_FAILURE_ICON(false), /** The transformation decoration area for the number of execution copies. */ - TRANSFORM_COPIES_TEXT(true), - /** TODO: Not used yet */ + TRANSFORM_COPIES_TEXT(true), + /** TODO: Not used yet */ TRANSFORM_DATA_SERVICE(false), - /** The transformation decoration data icon in the bottom right-hand corner to indicate that there are available output rows. */ + /** + * The transformation decoration data icon in the bottom right-hand corner to indicate that + * there are available output rows. + */ TRANSFORM_OUTPUT_DATA(true), /** The pipeline hop decoration */ - TRANSFORM_TARGET_HOP_ICON(true), + TRANSFORM_TARGET_HOP_ICON(true), /** TODO: ? */ TRANSFORM_TARGET_HOP_ICON_OPTION(false), @@ -65,44 +74,55 @@ public enum AreaType { HOP_COPY_ICON(true), /** The pipeline hop decoration icon for error handling. */ HOP_ERROR_ICON(true), - /** The pipeline hop decoration icon indicates that additional information is being sent to a transformation. */ + /** + * The pipeline hop decoration icon indicates that additional information is being sent to a + * transformation. + */ HOP_INFO_ICON(true), /** TODO: ? */ HOP_INFO_TRANSFORM_COPIES_ERROR(false), /** TODO: ? */ HOP_INFO_TRANSFORMS_PARTITIONED(false), - - /** The workflow hop decoration icon indicates the condition of the following action: true/false/unconditional. */ + + /** + * The workflow hop decoration icon indicates the condition of the following action: + * true/false/unconditional. + */ WORKFLOW_HOP_ICON(true), /** The workflow hop decoration icon for parallel execution. */ WORKFLOW_HOP_PARALLEL_ICON(true), - + /** The action icon area. */ ACTION_ICON(true), /** The action name area. */ ACTION_NAME(true), - /** The action decoration information icon in the top left-hand corner that indicates that it has a description. */ + /** + * The action decoration information icon in the top left-hand corner that indicates that it has + * a description. + */ ACTION_INFO_ICON(true), - /** The action decoration busy icon at the top right that indicates that it is currently running. */ + /** + * The action decoration busy icon at the top right that indicates that it is currently running. + */ ACTION_BUSY(false), /** The action decoration success icon in top right corner to indicate an execution success. */ ACTION_RESULT_SUCCESS(true), /** The action decoration failure icon in top right corner to indicate an execution error. */ ACTION_RESULT_FAILURE(true), - /** TODO: Not used yet */ + /** TODO: Not used yet */ ACTION_RESULT_CHECKPOINT(true), /** For custom row distribution plugin icon */ ROW_DISTRIBUTION_ICON(false), - + /** A custom area for plugins. */ CUSTOM(true); - + private final boolean hover; - + AreaType(boolean hover) { this.hover = hover; - } + } public boolean isSupportHover() { return hover; @@ -132,7 +152,7 @@ public AreaOwner( Object owner) { super(); this.areaType = areaType; - this.area = new Rectangle((int)(x - offset.x), (int)(y - offset.y), width, height); + this.area = new Rectangle((int) (x - offset.x), (int) (y - offset.y), width, height); this.parent = parent; this.owner = owner; } @@ -196,42 +216,58 @@ public static synchronized AreaOwner getVisibleAreaOwner( return null; } - /** @return the area */ + /** + * @return the area + */ public Rectangle getArea() { return area; } - /** @param area the area to set */ + /** + * @param area the area to set + */ public void setArea(Rectangle area) { this.area = area; } - /** @return the owner */ + /** + * @return the owner + */ public Object getOwner() { return owner; } - /** @param owner the owner to set */ + /** + * @param owner the owner to set + */ public void setOwner(Object owner) { this.owner = owner; } - /** @return the parent */ + /** + * @return the parent + */ public Object getParent() { return parent; } - /** @param parent the parent to set */ + /** + * @param parent the parent to set + */ public void setParent(Object parent) { this.parent = parent; } - /** @return the areaType */ + /** + * @return the areaType + */ public AreaType getAreaType() { return areaType; } - /** @param areaType the areaType to set */ + /** + * @param areaType the areaType to set + */ public void setAreaType(AreaType areaType) { this.areaType = areaType; } diff --git a/engine/src/main/java/org/apache/hop/core/gui/SnapAllignDistribute.java b/engine/src/main/java/org/apache/hop/core/gui/SnapAllignDistribute.java index 54739d63464..6978cd2f73c 100644 --- a/engine/src/main/java/org/apache/hop/core/gui/SnapAllignDistribute.java +++ b/engine/src/main/java/org/apache/hop/core/gui/SnapAllignDistribute.java @@ -17,9 +17,8 @@ package org.apache.hop.core.gui; -import org.apache.hop.core.IAddUndoPosition; - import java.util.List; +import org.apache.hop.core.IAddUndoPosition; public class SnapAllignDistribute { private List elements; diff --git a/engine/src/main/java/org/apache/hop/core/gui/SvgGc.java b/engine/src/main/java/org/apache/hop/core/gui/SvgGc.java index 2acad71b300..f120d1596fd 100644 --- a/engine/src/main/java/org/apache/hop/core/gui/SvgGc.java +++ b/engine/src/main/java/org/apache/hop/core/gui/SvgGc.java @@ -17,6 +17,18 @@ package org.apache.hop.core.gui; +import java.awt.AlphaComposite; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Polygon; +import java.awt.RenderingHints; +import java.awt.Stroke; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopPluginException; @@ -35,19 +47,6 @@ import org.w3c.dom.NodeList; import org.w3c.dom.svg.SVGDocument; -import java.awt.AlphaComposite; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Polygon; -import java.awt.RenderingHints; -import java.awt.Stroke; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.util.HashMap; -import java.util.Map; - public class SvgGc implements IGc { private static SvgFile imageLocked; diff --git a/engine/src/main/java/org/apache/hop/core/gui/SwingGUIResource.java b/engine/src/main/java/org/apache/hop/core/gui/SwingGUIResource.java index ccf8afd819a..71ac4901da9 100644 --- a/engine/src/main/java/org/apache/hop/core/gui/SwingGUIResource.java +++ b/engine/src/main/java/org/apache/hop/core/gui/SwingGUIResource.java @@ -17,6 +17,11 @@ package org.apache.hop.core.gui; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.io.IOUtils; import org.apache.hop.core.SwingUniversalImageSvg; import org.apache.hop.core.exception.HopException; @@ -29,12 +34,6 @@ import org.apache.hop.core.svg.SvgImage; import org.apache.hop.core.svg.SvgSupport; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - public class SwingGUIResource { private static ILogChannel log = LogChannel.GENERAL; diff --git a/engine/src/main/java/org/apache/hop/core/gui/WorkflowTracker.java b/engine/src/main/java/org/apache/hop/core/gui/WorkflowTracker.java index 12aa5008c80..88b6062ba2b 100644 --- a/engine/src/main/java/org/apache/hop/core/gui/WorkflowTracker.java +++ b/engine/src/main/java/org/apache/hop/core/gui/WorkflowTracker.java @@ -17,17 +17,16 @@ package org.apache.hop.core.gui; -import org.apache.hop.core.Const; -import org.apache.hop.core.util.EnvUtil; -import org.apache.hop.workflow.ActionResult; -import org.apache.hop.workflow.WorkflowMeta; -import org.apache.hop.workflow.action.ActionMeta; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.apache.hop.core.Const; +import org.apache.hop.core.util.EnvUtil; +import org.apache.hop.workflow.ActionResult; +import org.apache.hop.workflow.WorkflowMeta; +import org.apache.hop.workflow.action.ActionMeta; /** Responsible for tracking the execution of a workflow as a hierarchy. */ public class WorkflowTracker { @@ -51,7 +50,9 @@ public class WorkflowTracker { private final ReentrantReadWriteLock lock; - /** @param workflowMeta the workflow metadata to keep track of (with maximum 5000 children) */ + /** + * @param workflowMeta the workflow metadata to keep track of (with maximum 5000 children) + */ public WorkflowTracker(T workflowMeta) { this( workflowMeta, @@ -142,7 +143,9 @@ public List getWorkflowTrackers() { } } - /** @param workflowTrackers The workflowTrackers to set. */ + /** + * @param workflowTrackers The workflowTrackers to set. + */ public void setWorkflowTrackers(List workflowTrackers) { lock.writeLock().lock(); try { @@ -153,12 +156,16 @@ public void setWorkflowTrackers(List workflowTrackers) { } } - /** @return Returns the result. */ + /** + * @return Returns the result. + */ public ActionResult getActionResult() { return result; } - /** @param result The result to set. */ + /** + * @param result The result to set. + */ public void setActionResult(ActionResult result) { this.result = result; } @@ -200,12 +207,16 @@ public WorkflowTracker findWorkflowTracker(ActionMeta actionMeta) { return null; } - /** @return Returns the parentWorkflowTracker. */ + /** + * @return Returns the parentWorkflowTracker. + */ public WorkflowTracker getParentWorkflowTracker() { return parentWorkflowTracker; } - /** @param parentWorkflowTracker The parentWorkflowTracker to set. */ + /** + * @param parentWorkflowTracker The parentWorkflowTracker to set. + */ public void setParentWorkflowTracker(WorkflowTracker parentWorkflowTracker) { this.parentWorkflowTracker = parentWorkflowTracker; } @@ -225,32 +236,44 @@ public int getTotalNumberOfItems() { } } - /** @return the workflowFilename */ + /** + * @return the workflowFilename + */ public String getWorfkflowFilename() { return workflowFilename; } - /** @param workflowFilename the workflowFilename to set */ + /** + * @param workflowFilename the workflowFilename to set + */ public void setWorkflowFilename(String workflowFilename) { this.workflowFilename = workflowFilename; } - /** @return the workflowName */ + /** + * @return the workflowName + */ public String getWorkflowName() { return workflowName; } - /** @param workflowName the workflowName to set */ + /** + * @param workflowName the workflowName to set + */ public void setWorkflowName(String workflowName) { this.workflowName = workflowName; } - /** @return the maxChildren */ + /** + * @return the maxChildren + */ public int getMaxChildren() { return maxChildren; } - /** @param maxChildren the maxChildren to set */ + /** + * @param maxChildren the maxChildren to set + */ public void setMaxChildren(int maxChildren) { this.maxChildren = maxChildren; } diff --git a/engine/src/main/java/org/apache/hop/core/injection/bean/BeanInjectionInfo.java b/engine/src/main/java/org/apache/hop/core/injection/bean/BeanInjectionInfo.java index 486e9075b30..9af90e74f1d 100644 --- a/engine/src/main/java/org/apache/hop/core/injection/bean/BeanInjectionInfo.java +++ b/engine/src/main/java/org/apache/hop/core/injection/bean/BeanInjectionInfo.java @@ -17,16 +17,6 @@ package org.apache.hop.core.injection.bean; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.injection.Injection; -import org.apache.hop.core.injection.InjectionSupported; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.logging.LogChannel; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.metadata.api.HopMetadataProperty; -import org.apache.hop.metadata.api.IStringObjectConverter; -import org.apache.hop.metadata.util.ReflectionUtil; - import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -40,6 +30,15 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.injection.Injection; +import org.apache.hop.core.injection.InjectionSupported; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.logging.LogChannel; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.metadata.api.HopMetadataProperty; +import org.apache.hop.metadata.api.IStringObjectConverter; +import org.apache.hop.metadata.util.ReflectionUtil; /** Storage for bean annotations info for Metadata Injection and Load/Save. */ public class BeanInjectionInfo { diff --git a/engine/src/main/java/org/apache/hop/core/injection/bean/BeanLevelInfo.java b/engine/src/main/java/org/apache/hop/core/injection/bean/BeanLevelInfo.java index 50ef9af90ac..20de08ca91d 100644 --- a/engine/src/main/java/org/apache/hop/core/injection/bean/BeanLevelInfo.java +++ b/engine/src/main/java/org/apache/hop/core/injection/bean/BeanLevelInfo.java @@ -17,12 +17,6 @@ package org.apache.hop.core.injection.bean; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.injection.Injection; -import org.apache.hop.core.injection.InjectionDeep; -import org.apache.hop.core.injection.InjectionTypeConverter; -import org.apache.hop.metadata.api.IStringObjectConverter; - import java.lang.reflect.Field; import java.lang.reflect.GenericArrayType; import java.lang.reflect.Method; @@ -35,6 +29,11 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.injection.Injection; +import org.apache.hop.core.injection.InjectionDeep; +import org.apache.hop.core.injection.InjectionTypeConverter; +import org.apache.hop.metadata.api.IStringObjectConverter; /** Storage for one transform on the bean deep level. */ public class BeanLevelInfo { @@ -46,23 +45,30 @@ public enum DIMENSION { /** Parent transform or null for root. */ public BeanLevelInfo parent; + /** Class for transform from field or methods. */ public Class leafClass; + /** Field of transform, or null if bean has getter/setter. */ public Field field; + /** Getter and setter. */ public Method getter; public Method setter; + /** Dimension of level. */ public DIMENSION dim = DIMENSION.NONE; + /** Values converter. */ public InjectionTypeConverter converter; + /** Convert Strings (XML, JSON, ...) to the target object */ public IStringObjectConverter stringObjectConverter; /** False if source empty value shouldn't affect on target field. */ public boolean convertEmpty; + /** Name on the path : prefix + key usually. */ public String nameKey; diff --git a/engine/src/main/java/org/apache/hop/core/listeners/ContentChangedAdapter.java b/engine/src/main/java/org/apache/hop/core/listeners/ContentChangedAdapter.java index 5a452dc116f..c69d6aa8b70 100644 --- a/engine/src/main/java/org/apache/hop/core/listeners/ContentChangedAdapter.java +++ b/engine/src/main/java/org/apache/hop/core/listeners/ContentChangedAdapter.java @@ -17,7 +17,9 @@ package org.apache.hop.core.listeners; -/** @see IContentChangedListener */ +/** + * @see IContentChangedListener + */ public class ContentChangedAdapter implements IContentChangedListener { @Override public void contentChanged(Object parentObject) {} diff --git a/engine/src/main/java/org/apache/hop/core/listeners/impl/EntryCurrentDirectoryChangedListener.java b/engine/src/main/java/org/apache/hop/core/listeners/impl/EntryCurrentDirectoryChangedListener.java index 6727091a0a0..708752648d0 100644 --- a/engine/src/main/java/org/apache/hop/core/listeners/impl/EntryCurrentDirectoryChangedListener.java +++ b/engine/src/main/java/org/apache/hop/core/listeners/impl/EntryCurrentDirectoryChangedListener.java @@ -18,14 +18,13 @@ package org.apache.hop.core.listeners.impl; import com.google.common.base.Objects; +import java.util.function.Consumer; +import java.util.function.Supplier; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.listeners.ICurrentDirectoryChangedListener; import org.apache.hop.core.variables.Variables; -import java.util.function.Consumer; -import java.util.function.Supplier; - /** Updates directory references referencing {@link Const#INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER} */ public class EntryCurrentDirectoryChangedListener implements ICurrentDirectoryChangedListener { diff --git a/engine/src/main/java/org/apache/hop/core/logging/LogChannelFileWriter.java b/engine/src/main/java/org/apache/hop/core/logging/LogChannelFileWriter.java index 82dc1c23e85..e2785079b04 100644 --- a/engine/src/main/java/org/apache/hop/core/logging/LogChannelFileWriter.java +++ b/engine/src/main/java/org/apache/hop/core/logging/LogChannelFileWriter.java @@ -17,13 +17,12 @@ package org.apache.hop.core.logging; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.vfs.HopVfs; - import java.io.IOException; import java.io.OutputStream; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.vfs.HopVfs; /** * This class takes care of polling the central log store for new log messages belonging to a @@ -161,42 +160,58 @@ public HopException getException() { return exception; } - /** @return the logChannelId */ + /** + * @return the logChannelId + */ public String getLogChannelId() { return logChannelId; } - /** @param logChannelId the logChannelId to set */ + /** + * @param logChannelId the logChannelId to set + */ public void setLogChannelId(String logChannelId) { this.logChannelId = logChannelId; } - /** @return the logFile */ + /** + * @return the logFile + */ public FileObject getLogFile() { return logFile; } - /** @param logFile the logFile to set */ + /** + * @param logFile the logFile to set + */ public void setLogFile(FileObject logFile) { this.logFile = logFile; } - /** @return the appending */ + /** + * @return the appending + */ public boolean isAppending() { return appending; } - /** @param appending the appending to set */ + /** + * @param appending the appending to set + */ public void setAppending(boolean appending) { this.appending = appending; } - /** @return the pollingInterval */ + /** + * @return the pollingInterval + */ public int getPollingInterval() { return pollingInterval; } - /** @param pollingInterval the pollingInterval to set */ + /** + * @param pollingInterval the pollingInterval to set + */ public void setPollingInterval(int pollingInterval) { this.pollingInterval = pollingInterval; } diff --git a/engine/src/main/java/org/apache/hop/core/logging/LoggingMetric.java b/engine/src/main/java/org/apache/hop/core/logging/LoggingMetric.java index 1937642d210..25b2392d0f8 100644 --- a/engine/src/main/java/org/apache/hop/core/logging/LoggingMetric.java +++ b/engine/src/main/java/org/apache/hop/core/logging/LoggingMetric.java @@ -36,22 +36,30 @@ public LoggingMetric(long batchId, IMetricsSnapshot snapshot) { this.snapshot = snapshot; } - /** @return the batchId */ + /** + * @return the batchId + */ public long getBatchId() { return batchId; } - /** @param batchId the batchId to set */ + /** + * @param batchId the batchId to set + */ public void setBatchId(long batchId) { this.batchId = batchId; } - /** @return the snapshot */ + /** + * @return the snapshot + */ public IMetricsSnapshot getSnapshot() { return snapshot; } - /** @param snapshot the snapshot to set */ + /** + * @param snapshot the snapshot to set + */ public void setSnapshot(IMetricsSnapshot snapshot) { this.snapshot = snapshot; } diff --git a/engine/src/main/java/org/apache/hop/core/metadata/SerializableMetadataProvider.java b/engine/src/main/java/org/apache/hop/core/metadata/SerializableMetadataProvider.java index cd8e6c8b18a..748da6b49f8 100644 --- a/engine/src/main/java/org/apache/hop/core/metadata/SerializableMetadataProvider.java +++ b/engine/src/main/java/org/apache/hop/core/metadata/SerializableMetadataProvider.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonToken; +import java.io.ByteArrayInputStream; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadata; @@ -31,8 +32,6 @@ import org.json.simple.JSONObject; import org.json.simple.parser.ParseException; -import java.io.ByteArrayInputStream; - /** * This metadata implementation is an in-memory metadata which serializes using JSON. In other * words, JSON is read into memory as a MetaStore and then you can ask to serialize that information @@ -50,7 +49,7 @@ public SerializableMetadataProvider() { * @param source the source store to copy over */ public SerializableMetadataProvider(IHopMetadataProvider source) throws HopException { - this.description = "Serializable metadata provider (source is "+source.getDescription()+")"; + this.description = "Serializable metadata provider (source is " + source.getDescription() + ")"; // What is the list of available classes? // diff --git a/engine/src/main/java/org/apache/hop/core/plugins/HopServerPluginType.java b/engine/src/main/java/org/apache/hop/core/plugins/HopServerPluginType.java index ae6633e5bfd..fb66824b8c3 100644 --- a/engine/src/main/java/org/apache/hop/core/plugins/HopServerPluginType.java +++ b/engine/src/main/java/org/apache/hop/core/plugins/HopServerPluginType.java @@ -17,11 +17,10 @@ package org.apache.hop.core.plugins; +import java.util.Map; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.www.IHopServerPlugin; -import java.util.Map; - /** This class represents the carte plugin type. */ @PluginMainClassType(IHopServerPlugin.class) @PluginAnnotationType(HopServerServlet.class) diff --git a/engine/src/main/java/org/apache/hop/core/plugins/PartitionerPluginType.java b/engine/src/main/java/org/apache/hop/core/plugins/PartitionerPluginType.java index 3c4599c256a..18f1133c65b 100644 --- a/engine/src/main/java/org/apache/hop/core/plugins/PartitionerPluginType.java +++ b/engine/src/main/java/org/apache/hop/core/plugins/PartitionerPluginType.java @@ -17,11 +17,10 @@ package org.apache.hop.core.plugins; +import java.util.Map; import org.apache.hop.core.annotations.PartitionerPlugin; import org.apache.hop.pipeline.IPartitioner; -import java.util.Map; - /** This is the partitioner plugin type. */ @PluginMainClassType(IPartitioner.class) @PluginAnnotationType(PartitionerPlugin.class) diff --git a/engine/src/main/java/org/apache/hop/core/plugins/TransformPluginType.java b/engine/src/main/java/org/apache/hop/core/plugins/TransformPluginType.java index 1cc2ebbfde5..5c17caca019 100644 --- a/engine/src/main/java/org/apache/hop/core/plugins/TransformPluginType.java +++ b/engine/src/main/java/org/apache/hop/core/plugins/TransformPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.core.plugins; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; import org.apache.hop.pipeline.transform.ITransformMeta; -import java.util.Map; - /** This class represents the transform plugin type. */ @PluginMainClassType(ITransformMeta.class) @PluginAnnotationType(Transform.class) diff --git a/engine/src/main/java/org/apache/hop/core/reflection/StringSearchResult.java b/engine/src/main/java/org/apache/hop/core/reflection/StringSearchResult.java index 04c3dda084f..9dd073450e5 100644 --- a/engine/src/main/java/org/apache/hop/core/reflection/StringSearchResult.java +++ b/engine/src/main/java/org/apache/hop/core/reflection/StringSearchResult.java @@ -86,22 +86,30 @@ public String toString() { return sb.toString(); } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } - /** @return the grandParentObject */ + /** + * @return the grandParentObject + */ public Object getGrandParentObject() { return grandParentObject; } - /** @param grandParentObject the grandParentObject to set */ + /** + * @param grandParentObject the grandParentObject to set + */ public void setGrandParentObject(Object grandParentObject) { this.grandParentObject = grandParentObject; } diff --git a/engine/src/main/java/org/apache/hop/core/search/BaseSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/BaseSearchableAnalyser.java index b7bbc32b160..75349e8a49b 100644 --- a/engine/src/main/java/org/apache/hop/core/search/BaseSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/BaseSearchableAnalyser.java @@ -17,13 +17,12 @@ package org.apache.hop.core.search; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.reflection.StringSearchResult; import org.apache.hop.core.reflection.StringSearcher; -import java.util.ArrayList; -import java.util.List; - public abstract class BaseSearchableAnalyser { protected void matchProperty( @@ -36,13 +35,21 @@ protected void matchProperty( if (searchQuery.matches(propertyName)) { searchResults.add( new SearchResult( - parent, propertyName, "matching property name: " + propertyName, component, propertyValue)); + parent, + propertyName, + "matching property name: " + propertyName, + component, + propertyValue)); } if (StringUtils.isNotEmpty(propertyValue)) { if (searchQuery.matches(propertyValue)) { searchResults.add( new SearchResult( - parent, propertyValue, "matching property value: " + propertyValue, component, propertyValue)); + parent, + propertyValue, + "matching property value: " + propertyValue, + component, + propertyValue)); } } } @@ -65,17 +72,17 @@ protected void matchObjectFields( stringSearchResult.getFieldName(), descriptionPrefix + " : " + stringSearchResult.getFieldName(), component, - stringSearchResult.getString())); + stringSearchResult.getString())); } String resultString = stringSearchResult.getString(); - if (resultString!=null && searchQuery.matches(resultString)) { + if (resultString != null && searchQuery.matches(resultString)) { searchResults.add( new SearchResult( searchable, stringSearchResult.getString(), descriptionPrefix + " : " + stringSearchResult.getFieldName(), component, - stringSearchResult.getString())); + stringSearchResult.getString())); } } } diff --git a/engine/src/main/java/org/apache/hop/core/search/DatabaseMetaSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/DatabaseMetaSearchableAnalyser.java index 93ae7c5cc6a..54eadac48c6 100644 --- a/engine/src/main/java/org/apache/hop/core/search/DatabaseMetaSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/DatabaseMetaSearchableAnalyser.java @@ -17,10 +17,9 @@ package org.apache.hop.core.search; -import org.apache.hop.core.database.DatabaseMeta; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.database.DatabaseMeta; @SearchableAnalyserPlugin( id = "DatabaseMetaSearchableAnalyser", diff --git a/engine/src/main/java/org/apache/hop/core/search/DescribedVariableSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/DescribedVariableSearchableAnalyser.java index 0fde3cc8a17..37a1a17ddec 100644 --- a/engine/src/main/java/org/apache/hop/core/search/DescribedVariableSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/DescribedVariableSearchableAnalyser.java @@ -17,10 +17,9 @@ package org.apache.hop.core.search; -import org.apache.hop.core.variables.DescribedVariable; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.variables.DescribedVariable; @SearchableAnalyserPlugin( id = "DescribedVariableSearchableAnalyser", diff --git a/engine/src/main/java/org/apache/hop/core/search/HopServerSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/HopServerSearchableAnalyser.java index e40d6a0da73..09414b6d605 100644 --- a/engine/src/main/java/org/apache/hop/core/search/HopServerSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/HopServerSearchableAnalyser.java @@ -17,10 +17,9 @@ package org.apache.hop.core.search; -import org.apache.hop.server.HopServer; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.server.HopServer; @SearchableAnalyserPlugin( id = "HopServerSearchableAnalyser", diff --git a/engine/src/main/java/org/apache/hop/core/search/PartitionSchemaSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/PartitionSchemaSearchableAnalyser.java index 6aaedfb6fdf..254c1fdf52b 100644 --- a/engine/src/main/java/org/apache/hop/core/search/PartitionSchemaSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/PartitionSchemaSearchableAnalyser.java @@ -17,10 +17,9 @@ package org.apache.hop.core.search; -import org.apache.hop.partition.PartitionSchema; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.partition.PartitionSchema; @SearchableAnalyserPlugin( id = "PartitionSchemaSearchableAnalyser", diff --git a/engine/src/main/java/org/apache/hop/core/search/PipelineRunConfigurationSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/PipelineRunConfigurationSearchableAnalyser.java index caa9e0fe94b..1afc4021cd5 100644 --- a/engine/src/main/java/org/apache/hop/core/search/PipelineRunConfigurationSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/PipelineRunConfigurationSearchableAnalyser.java @@ -17,11 +17,10 @@ package org.apache.hop.core.search; -import org.apache.hop.core.variables.DescribedVariable; -import org.apache.hop.pipeline.config.PipelineRunConfiguration; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.variables.DescribedVariable; +import org.apache.hop.pipeline.config.PipelineRunConfiguration; @SearchableAnalyserPlugin( id = "PipelineRunConfigurationSearchableAnalyser", diff --git a/engine/src/main/java/org/apache/hop/core/search/WorkflowRunConfigurationSearchableAnalyser.java b/engine/src/main/java/org/apache/hop/core/search/WorkflowRunConfigurationSearchableAnalyser.java index a23f0f150b8..c2d95059490 100644 --- a/engine/src/main/java/org/apache/hop/core/search/WorkflowRunConfigurationSearchableAnalyser.java +++ b/engine/src/main/java/org/apache/hop/core/search/WorkflowRunConfigurationSearchableAnalyser.java @@ -17,10 +17,9 @@ package org.apache.hop.core.search; -import org.apache.hop.workflow.config.WorkflowRunConfiguration; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.workflow.config.WorkflowRunConfiguration; @SearchableAnalyserPlugin( id = "WorkflowRunConfigurationSearchableAnalyser", diff --git a/engine/src/main/java/org/apache/hop/core/truststore/CustomSocketFactory.java b/engine/src/main/java/org/apache/hop/core/truststore/CustomSocketFactory.java index 1f9971fcd16..ffeca79f016 100644 --- a/engine/src/main/java/org/apache/hop/core/truststore/CustomSocketFactory.java +++ b/engine/src/main/java/org/apache/hop/core/truststore/CustomSocketFactory.java @@ -16,19 +16,18 @@ */ package org.apache.hop.core.truststore; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.util.Utils; -import org.apache.hop.i18n.BaseMessages; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.NoSuchAlgorithmException; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.util.Utils; +import org.apache.hop.i18n.BaseMessages; public class CustomSocketFactory extends SSLSocketFactory { diff --git a/engine/src/main/java/org/apache/hop/core/truststore/HopTrustManager.java b/engine/src/main/java/org/apache/hop/core/truststore/HopTrustManager.java index 392b75304f2..6d02583641f 100644 --- a/engine/src/main/java/org/apache/hop/core/truststore/HopTrustManager.java +++ b/engine/src/main/java/org/apache/hop/core/truststore/HopTrustManager.java @@ -16,18 +16,17 @@ */ package org.apache.hop.core.truststore; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.vfs.HopVfs; -import org.apache.hop.i18n.BaseMessages; - -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; import java.io.InputStream; import java.security.KeyStore; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.vfs.HopVfs; +import org.apache.hop.i18n.BaseMessages; /** * This is a wrapper around a standard X509TrustManager. It's just initialized in a specific way for diff --git a/engine/src/main/java/org/apache/hop/core/truststore/TrustAlwaysManager.java b/engine/src/main/java/org/apache/hop/core/truststore/TrustAlwaysManager.java index fffde92ecb8..15fd231c962 100644 --- a/engine/src/main/java/org/apache/hop/core/truststore/TrustAlwaysManager.java +++ b/engine/src/main/java/org/apache/hop/core/truststore/TrustAlwaysManager.java @@ -16,8 +16,8 @@ */ package org.apache.hop.core.truststore; -import javax.net.ssl.X509TrustManager; import java.security.cert.X509Certificate; +import javax.net.ssl.X509TrustManager; public class TrustAlwaysManager implements X509TrustManager { @Override diff --git a/engine/src/main/java/org/apache/hop/core/util/AbstractTransformMeta.java b/engine/src/main/java/org/apache/hop/core/util/AbstractTransformMeta.java index 64df75f6939..8bb2665fb7b 100644 --- a/engine/src/main/java/org/apache/hop/core/util/AbstractTransformMeta.java +++ b/engine/src/main/java/org/apache/hop/core/util/AbstractTransformMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.core.util; +import java.util.List; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; @@ -30,11 +33,8 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.w3c.dom.Node; -import java.util.List; -import java.util.prefs.BackingStoreException; -import java.util.prefs.Preferences; - -public abstract class AbstractTransformMeta

extends BaseTransformMeta { +public abstract class AbstractTransformMeta
+ extends BaseTransformMeta { private static final String CONNECTION_NAME = "connection"; @@ -51,12 +51,16 @@ public AbstractTransformMeta() { this.connectionName = this.propertyFactory.createString(CONNECTION_NAME); } - /** @return the propertyFactory */ + /** + * @return the propertyFactory + */ public PluginPropertyFactory getPropertyFactory() { return this.propertyFactory; } - /** @return the properties */ + /** + * @return the properties + */ public KeyValueSet getProperties() { return this.propertyFactory.getProperties(); } @@ -87,7 +91,9 @@ public void loadXml( initDbMeta(databaseMeta); } - /** @param databaseList A list of available DatabaseMeta in this pipeline. */ + /** + * @param databaseList A list of available DatabaseMeta in this pipeline. + */ private void initDbMeta(final List databaseList) { if (!StringUtils.isEmpty(this.connectionName.getValue())) { this.dbMeta = DatabaseMeta.findDatabase(databaseList, this.connectionName.getValue()); @@ -104,22 +110,30 @@ public String getXml() throws HopException { return PluginPropertyHandler.toXml(this.getProperties()); } - /** @return the connectionName */ + /** + * @return the connectionName + */ public StringPluginProperty getConnectionName() { return this.connectionName; } - /** @param connectionName the connectionName to set */ + /** + * @param connectionName the connectionName to set + */ public void setConnectionName(final StringPluginProperty connectionName) { this.connectionName = connectionName; } - /** @return the dbMeta */ + /** + * @return the dbMeta + */ public DatabaseMeta getDbMeta() { return this.dbMeta; } - /** @param dbMeta the dbMeta to set */ + /** + * @param dbMeta the dbMeta to set + */ public void setDbMeta(final DatabaseMeta dbMeta) { this.dbMeta = dbMeta; } diff --git a/engine/src/main/java/org/apache/hop/core/util/AddClosureArrayList.java b/engine/src/main/java/org/apache/hop/core/util/AddClosureArrayList.java index c325014cd95..0818834f69d 100644 --- a/engine/src/main/java/org/apache/hop/core/util/AddClosureArrayList.java +++ b/engine/src/main/java/org/apache/hop/core/util/AddClosureArrayList.java @@ -17,11 +17,12 @@ package org.apache.hop.core.util; -import org.apache.commons.collections4.Closure; - import java.util.ArrayList; +import org.apache.commons.collections4.Closure; -/** @param type. */ +/** + * @param type. + */ public class AddClosureArrayList extends ArrayList implements Closure { /** Serial version UID. */ diff --git a/engine/src/main/java/org/apache/hop/core/util/Assert.java b/engine/src/main/java/org/apache/hop/core/util/Assert.java index a923cad589b..acff20750f1 100644 --- a/engine/src/main/java/org/apache/hop/core/util/Assert.java +++ b/engine/src/main/java/org/apache/hop/core/util/Assert.java @@ -17,12 +17,11 @@ package org.apache.hop.core.util; -import org.apache.commons.collections4.Predicate; -import org.apache.commons.lang.StringUtils; - import java.text.MessageFormat; import java.util.Collection; import java.util.Map; +import org.apache.commons.collections4.Predicate; +import org.apache.commons.lang.StringUtils; public final class Assert { // NOPMD diff --git a/engine/src/main/java/org/apache/hop/core/util/BooleanPluginProperty.java b/engine/src/main/java/org/apache/hop/core/util/BooleanPluginProperty.java index 0cc1de78352..bfaa1ee52e7 100644 --- a/engine/src/main/java/org/apache/hop/core/util/BooleanPluginProperty.java +++ b/engine/src/main/java/org/apache/hop/core/util/BooleanPluginProperty.java @@ -17,11 +17,10 @@ package org.apache.hop.core.util; +import java.util.prefs.Preferences; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.prefs.Preferences; - public class BooleanPluginProperty extends KeyValue implements IPluginProperty { /** Serial version UID. */ diff --git a/engine/src/main/java/org/apache/hop/core/util/CollectionPredicates.java b/engine/src/main/java/org/apache/hop/core/util/CollectionPredicates.java index a13d84e4641..eb146dbef03 100644 --- a/engine/src/main/java/org/apache/hop/core/util/CollectionPredicates.java +++ b/engine/src/main/java/org/apache/hop/core/util/CollectionPredicates.java @@ -17,10 +17,9 @@ package org.apache.hop.core.util; -import org.apache.commons.collections4.Predicate; - import java.util.Collection; import java.util.Map; +import org.apache.commons.collections4.Predicate; public final class CollectionPredicates { // NOPMD diff --git a/engine/src/main/java/org/apache/hop/core/util/ConfigurableStreamLogger.java b/engine/src/main/java/org/apache/hop/core/util/ConfigurableStreamLogger.java index 1c55ffbb082..2f2459599af 100644 --- a/engine/src/main/java/org/apache/hop/core/util/ConfigurableStreamLogger.java +++ b/engine/src/main/java/org/apache/hop/core/util/ConfigurableStreamLogger.java @@ -17,14 +17,13 @@ package org.apache.hop.core.util; -import org.apache.hop.core.Const; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.logging.LogLevel; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import org.apache.hop.core.Const; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.logging.LogLevel; /** Provides the ability to specify the desired logLevel on which the StreamLogger should write. */ public class ConfigurableStreamLogger implements Runnable { diff --git a/engine/src/main/java/org/apache/hop/core/util/FileUtil.java b/engine/src/main/java/org/apache/hop/core/util/FileUtil.java index 6d718ab4e43..9ac2aaae3e6 100644 --- a/engine/src/main/java/org/apache/hop/core/util/FileUtil.java +++ b/engine/src/main/java/org/apache/hop/core/util/FileUtil.java @@ -17,13 +17,12 @@ package org.apache.hop.core.util; +import java.io.File; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.vfs.HopVfs; import org.apache.hop.i18n.BaseMessages; -import java.io.File; - public class FileUtil { public static boolean createParentFolder( Class PKG, String filename, boolean createParentFolder, ILogChannel log) { diff --git a/engine/src/main/java/org/apache/hop/core/util/IPluginProperty.java b/engine/src/main/java/org/apache/hop/core/util/IPluginProperty.java index 09790e2a7cd..bd71d66ba64 100644 --- a/engine/src/main/java/org/apache/hop/core/util/IPluginProperty.java +++ b/engine/src/main/java/org/apache/hop/core/util/IPluginProperty.java @@ -17,9 +17,8 @@ package org.apache.hop.core.util; -import org.w3c.dom.Node; - import java.util.prefs.Preferences; +import org.w3c.dom.Node; public interface IPluginProperty { @@ -38,18 +37,28 @@ public interface IPluginProperty { /** The true value. */ String BOOLEAN_STRING_TRUE = "Y"; - /** @return true if value not null or 'false'. */ + /** + * @return true if value not null or 'false'. + */ boolean evaluate(); - /** @param node preferences node */ + /** + * @param node preferences node + */ void saveToPreferences(final Preferences node); - /** @param node preferences node. */ + /** + * @param node preferences node. + */ void readFromPreferences(final Preferences node); - /** @param builder builder to append to. */ + /** + * @param builder builder to append to. + */ void appendXml(final StringBuilder builder); - /** @param node the node. */ + /** + * @param node the node. + */ void loadXml(final Node node); } diff --git a/engine/src/main/java/org/apache/hop/core/util/IntegerPluginProperty.java b/engine/src/main/java/org/apache/hop/core/util/IntegerPluginProperty.java index 7b67e2b449e..cdd395e2972 100644 --- a/engine/src/main/java/org/apache/hop/core/util/IntegerPluginProperty.java +++ b/engine/src/main/java/org/apache/hop/core/util/IntegerPluginProperty.java @@ -17,11 +17,10 @@ package org.apache.hop.core.util; +import java.util.prefs.Preferences; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.prefs.Preferences; - public class IntegerPluginProperty extends KeyValue implements IPluginProperty { /** Serial version UID. */ diff --git a/engine/src/main/java/org/apache/hop/core/util/JavaScriptUtils.java b/engine/src/main/java/org/apache/hop/core/util/JavaScriptUtils.java index ccc75d90b01..e834519b489 100644 --- a/engine/src/main/java/org/apache/hop/core/util/JavaScriptUtils.java +++ b/engine/src/main/java/org/apache/hop/core/util/JavaScriptUtils.java @@ -1,186 +1,185 @@ -/* - * 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 org.apache.hop.core.util; - -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.xml.XmlHandler; -import org.mozilla.javascript.Context; - -import java.math.BigDecimal; -import java.util.Date; - -/** - * This class contains common code from {@linkplain - * org.apache.hop.pipeline.transforms.script.Script} and {@linkplain - * org.apache.hop.pipeline.transforms .scriptvalues_mod.ScriptValuesMod} classes - */ -public class JavaScriptUtils { - - public static Object convertFromJs(Object value, int type, String fieldName) - throws HopValueException { - String classType = value.getClass().getName(); - switch (type) { - case IValueMeta.TYPE_NUMBER: - return jsToNumber(value, classType); - - case IValueMeta.TYPE_INTEGER: - return jsToInteger(value, value.getClass()); - - case IValueMeta.TYPE_STRING: - return jsToString(value, classType); - - case IValueMeta.TYPE_DATE: - return jsToDate(value, classType); - - case IValueMeta.TYPE_BOOLEAN: - return value; - - case IValueMeta.TYPE_BIGNUMBER: - return jsToBigNumber(value, classType); - - case IValueMeta.TYPE_BINARY: - { - return Context.jsToJava(value, byte[].class); - } - case IValueMeta.TYPE_NONE: - { - throw new RuntimeException( - "No data output data type was specified for new field [" + fieldName + "]"); - } - default: - return Context.jsToJava(value, Object.class); - } - } - - public static Number jsToNumber(Object value, String classType) { - if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { - return null; - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject")) { - try { - return (Double) Context.jsToJava(value, Double.class); - } catch (Exception e) { - String string = Context.toString(value); - return Double.parseDouble(Const.trim(string)); - } - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeNumber")) { - Number nb = Context.toNumber(value); - return nb.doubleValue(); - } else { - Number nb = (Number) value; - return nb.doubleValue(); - } - } - - public static Long jsToInteger(Object value, Class clazz) { - if (Number.class.isAssignableFrom(clazz)) { - return ((Number) value).longValue(); - } else { - String classType = clazz.getName(); - if (classType.equalsIgnoreCase("java.lang.String")) { - return (Long.valueOf((String) value)); - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { - return null; - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeNumber")) { - Number nb = Context.toNumber(value); - return nb.longValue(); - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject")) { - // Is it a Value? - // - try { - return (Long) Context.jsToJava(value, Long.class); - } catch (Exception e2) { - String string = Context.toString(value); - return Long.parseLong(Const.trim(string)); - } - } else { - return Long.parseLong(value.toString()); - } - } - } - - public static String jsToString(Object value, String classType) { - // convert to a string should work in most cases... - return Context.toString(value); - } - - public static Date jsToDate(Object value, String classType) throws HopValueException { - double dbl; - if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { - return null; - } else { - if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeDate")) { - dbl = Context.toNumber(value); - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject") - || classType.equalsIgnoreCase("java.util.Date")) { - // Is it a java Date() class ? - try { - Date dat = (Date) Context.jsToJava(value, java.util.Date.class); - dbl = dat.getTime(); - } catch (Exception e) { - try { - String string = Context.toString(value); - return XmlHandler.stringToDate(string); - } catch (Exception e3) { - throw new HopValueException("Can't convert a string to a date"); - } - } - } else if (classType.equalsIgnoreCase("java.lang.Double")) { - dbl = (Double) value; - } else { - String string = (String) Context.jsToJava(value, String.class); - dbl = Double.parseDouble(string); - } - long lng = Math.round(dbl); - return new Date(lng); - } - } - - public static BigDecimal jsToBigNumber(Object value, String classType) { - if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { - return null; - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeNumber")) { - Number nb = Context.toNumber(value); - return BigDecimal.valueOf(nb.doubleValue()); - } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject")) { - // Is it a BigDecimal class ? - try { - return (BigDecimal) Context.jsToJava(value, BigDecimal.class); - } catch (Exception e) { - String string = (String) Context.jsToJava(value, String.class); - return new BigDecimal(string); - } - } else if (classType.equalsIgnoreCase("java.lang.Byte")) { - return BigDecimal.valueOf(((Byte) value).longValue()); - } else if (classType.equalsIgnoreCase("java.lang.Short")) { - return BigDecimal.valueOf(((Short) value).longValue()); - } else if (classType.equalsIgnoreCase("java.lang.Integer")) { - return BigDecimal.valueOf(((Integer) value).longValue()); - } else if (classType.equalsIgnoreCase("java.lang.Long")) { - return BigDecimal.valueOf(((Long) value).longValue()); - } else if (classType.equalsIgnoreCase("java.lang.Double")) { - return BigDecimal.valueOf(((Double) value).doubleValue()); - } else if (classType.equalsIgnoreCase("java.lang.String")) { - return BigDecimal.valueOf((new Long((String) value)).longValue()); - } else { - throw new RuntimeException( - "JavaScript conversion to BigNumber not implemented for " + classType); - } - } -} +/* + * 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 org.apache.hop.core.util; + +import java.math.BigDecimal; +import java.util.Date; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.xml.XmlHandler; +import org.mozilla.javascript.Context; + +/** + * This class contains common code from {@linkplain + * org.apache.hop.pipeline.transforms.script.Script} and {@linkplain + * org.apache.hop.pipeline.transforms .scriptvalues_mod.ScriptValuesMod} classes + */ +public class JavaScriptUtils { + + public static Object convertFromJs(Object value, int type, String fieldName) + throws HopValueException { + String classType = value.getClass().getName(); + switch (type) { + case IValueMeta.TYPE_NUMBER: + return jsToNumber(value, classType); + + case IValueMeta.TYPE_INTEGER: + return jsToInteger(value, value.getClass()); + + case IValueMeta.TYPE_STRING: + return jsToString(value, classType); + + case IValueMeta.TYPE_DATE: + return jsToDate(value, classType); + + case IValueMeta.TYPE_BOOLEAN: + return value; + + case IValueMeta.TYPE_BIGNUMBER: + return jsToBigNumber(value, classType); + + case IValueMeta.TYPE_BINARY: + { + return Context.jsToJava(value, byte[].class); + } + case IValueMeta.TYPE_NONE: + { + throw new RuntimeException( + "No data output data type was specified for new field [" + fieldName + "]"); + } + default: + return Context.jsToJava(value, Object.class); + } + } + + public static Number jsToNumber(Object value, String classType) { + if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { + return null; + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject")) { + try { + return (Double) Context.jsToJava(value, Double.class); + } catch (Exception e) { + String string = Context.toString(value); + return Double.parseDouble(Const.trim(string)); + } + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeNumber")) { + Number nb = Context.toNumber(value); + return nb.doubleValue(); + } else { + Number nb = (Number) value; + return nb.doubleValue(); + } + } + + public static Long jsToInteger(Object value, Class clazz) { + if (Number.class.isAssignableFrom(clazz)) { + return ((Number) value).longValue(); + } else { + String classType = clazz.getName(); + if (classType.equalsIgnoreCase("java.lang.String")) { + return (Long.valueOf((String) value)); + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { + return null; + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeNumber")) { + Number nb = Context.toNumber(value); + return nb.longValue(); + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject")) { + // Is it a Value? + // + try { + return (Long) Context.jsToJava(value, Long.class); + } catch (Exception e2) { + String string = Context.toString(value); + return Long.parseLong(Const.trim(string)); + } + } else { + return Long.parseLong(value.toString()); + } + } + } + + public static String jsToString(Object value, String classType) { + // convert to a string should work in most cases... + return Context.toString(value); + } + + public static Date jsToDate(Object value, String classType) throws HopValueException { + double dbl; + if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { + return null; + } else { + if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeDate")) { + dbl = Context.toNumber(value); + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject") + || classType.equalsIgnoreCase("java.util.Date")) { + // Is it a java Date() class ? + try { + Date dat = (Date) Context.jsToJava(value, java.util.Date.class); + dbl = dat.getTime(); + } catch (Exception e) { + try { + String string = Context.toString(value); + return XmlHandler.stringToDate(string); + } catch (Exception e3) { + throw new HopValueException("Can't convert a string to a date"); + } + } + } else if (classType.equalsIgnoreCase("java.lang.Double")) { + dbl = (Double) value; + } else { + String string = (String) Context.jsToJava(value, String.class); + dbl = Double.parseDouble(string); + } + long lng = Math.round(dbl); + return new Date(lng); + } + } + + public static BigDecimal jsToBigNumber(Object value, String classType) { + if (classType.equalsIgnoreCase("org.mozilla.javascript.Undefined")) { + return null; + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeNumber")) { + Number nb = Context.toNumber(value); + return BigDecimal.valueOf(nb.doubleValue()); + } else if (classType.equalsIgnoreCase("org.mozilla.javascript.NativeJavaObject")) { + // Is it a BigDecimal class ? + try { + return (BigDecimal) Context.jsToJava(value, BigDecimal.class); + } catch (Exception e) { + String string = (String) Context.jsToJava(value, String.class); + return new BigDecimal(string); + } + } else if (classType.equalsIgnoreCase("java.lang.Byte")) { + return BigDecimal.valueOf(((Byte) value).longValue()); + } else if (classType.equalsIgnoreCase("java.lang.Short")) { + return BigDecimal.valueOf(((Short) value).longValue()); + } else if (classType.equalsIgnoreCase("java.lang.Integer")) { + return BigDecimal.valueOf(((Integer) value).longValue()); + } else if (classType.equalsIgnoreCase("java.lang.Long")) { + return BigDecimal.valueOf(((Long) value).longValue()); + } else if (classType.equalsIgnoreCase("java.lang.Double")) { + return BigDecimal.valueOf(((Double) value).doubleValue()); + } else if (classType.equalsIgnoreCase("java.lang.String")) { + return BigDecimal.valueOf((new Long((String) value)).longValue()); + } else { + throw new RuntimeException( + "JavaScript conversion to BigNumber not implemented for " + classType); + } + } +} diff --git a/engine/src/main/java/org/apache/hop/core/util/KeyValue.java b/engine/src/main/java/org/apache/hop/core/util/KeyValue.java index 3a58e0a1728..1497ca3a15d 100644 --- a/engine/src/main/java/org/apache/hop/core/util/KeyValue.java +++ b/engine/src/main/java/org/apache/hop/core/util/KeyValue.java @@ -17,13 +17,14 @@ package org.apache.hop.core.util; -import org.apache.commons.lang.StringUtils; - import java.io.Serializable; import java.util.Arrays; import java.util.List; +import org.apache.commons.lang.StringUtils; -/** @param type of value */ +/** + * @param type of value + */ public class KeyValue implements Serializable { /** The default true values. */ @@ -84,17 +85,23 @@ public static final void assertKey(final String lowerKey) throws IllegalArgument } } - /** @return the key, never null. */ + /** + * @return the key, never null. + */ public String getKey() { return this.key; } - /** @return the value */ + /** + * @return the value + */ public T getValue() { return this.value; } - /** @param value the value to set */ + /** + * @param value the value to set + */ public void setValue(final T value) { this.value = value; } @@ -108,7 +115,9 @@ public KeyValue value(final T newValue) { return this; } - /** @return value. */ + /** + * @return value. + */ public T value() { return this.value; } @@ -169,7 +178,9 @@ public Boolean booleanValue(final Boolean defaultValue) { return returnValue; } - /** @return string value or null if value is null. */ + /** + * @return string value or null if value is null. + */ public String stringValue() { if (this.value == null) { return null; diff --git a/engine/src/main/java/org/apache/hop/core/util/KeyValueFactory.java b/engine/src/main/java/org/apache/hop/core/util/KeyValueFactory.java index f58d8318ee9..71f898d947f 100644 --- a/engine/src/main/java/org/apache/hop/core/util/KeyValueFactory.java +++ b/engine/src/main/java/org/apache/hop/core/util/KeyValueFactory.java @@ -17,13 +17,14 @@ package org.apache.hop.core.util; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; -/** @param type of key value. */ +/** + * @param type of key value. + */ public class KeyValueFactory { /** Default instance for ... */ @@ -70,7 +71,9 @@ public KeyValueFactory(final T defaultValue) { this.defaultValue = defaultValue; } - /** @return the defaultValue */ + /** + * @return the defaultValue + */ public T getDefaultValue() { return this.defaultValue; } diff --git a/engine/src/main/java/org/apache/hop/core/util/KeyValueSet.java b/engine/src/main/java/org/apache/hop/core/util/KeyValueSet.java index d72e6feff46..dc69a864d00 100644 --- a/engine/src/main/java/org/apache/hop/core/util/KeyValueSet.java +++ b/engine/src/main/java/org/apache/hop/core/util/KeyValueSet.java @@ -17,19 +17,18 @@ package org.apache.hop.core.util; -import org.apache.commons.collections4.Closure; -import org.apache.commons.collections4.Predicate; -import org.apache.commons.collections4.functors.TruePredicate; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; +import org.apache.commons.collections4.Closure; +import org.apache.commons.collections4.Predicate; +import org.apache.commons.collections4.functors.TruePredicate; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; public class KeyValueSet implements Iterable>, Serializable { @@ -98,17 +97,23 @@ public KeyValue getRequired(final String key) { return keyValue; } - /** @return keys. */ + /** + * @return keys. + */ public List keys() { return new ArrayList<>(this.entries.keySet()); } - /** @return key values/entries. */ + /** + * @return key values/entries. + */ public List> keyValues() { return new ArrayList<>(this.entries.values()); } - /** @return values. */ + /** + * @return values. + */ public List values() { final List result = new ArrayList<>(); for (KeyValue keyValue : this.entries.values()) { @@ -117,7 +122,9 @@ public List values() { return result; } - /** @return entries as map. */ + /** + * @return entries as map. + */ public Map toMap() { final Map map = new TreeMap<>(); for (KeyValue keyValue : this.entries.values()) { @@ -175,12 +182,16 @@ public boolean containsKey(final String key) { return this.entries.containsKey(key); } - /** @return size. */ + /** + * @return size. + */ public int size() { return this.entries.size(); } - /** @return true if empty. */ + /** + * @return true if empty. + */ public boolean isEmpty() { return this.entries.isEmpty(); } @@ -195,7 +206,9 @@ public KeyValueSet clear() { return this; } - /** @return string representation. */ + /** + * @return string representation. + */ public String toMultiLineString() { final ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); for (KeyValue keyValue : this.entries.values()) { diff --git a/engine/src/main/java/org/apache/hop/core/util/PluginMessages.java b/engine/src/main/java/org/apache/hop/core/util/PluginMessages.java index 741ba6a90d5..8ded7c8286f 100644 --- a/engine/src/main/java/org/apache/hop/core/util/PluginMessages.java +++ b/engine/src/main/java/org/apache/hop/core/util/PluginMessages.java @@ -17,12 +17,11 @@ package org.apache.hop.core.util; +import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.apache.hop.i18n.BaseMessages; -import java.util.concurrent.ConcurrentHashMap; - /** * Simple utility for messages. Usage: * [...] @@ -70,12 +69,16 @@ public static PluginMessages getMessages(final Class someClassInPackage) private final String packageName; - /** @param packageName package name to set. */ + /** + * @param packageName package name to set. + */ private PluginMessages(final String packageName) { this.packageName = packageName; } - /** @return the packageName */ + /** + * @return the packageName + */ public String getPackageName() { return this.packageName; } diff --git a/engine/src/main/java/org/apache/hop/core/util/PluginPropertyFactory.java b/engine/src/main/java/org/apache/hop/core/util/PluginPropertyFactory.java index 1c9d99bcae9..e56b11681cf 100644 --- a/engine/src/main/java/org/apache/hop/core/util/PluginPropertyFactory.java +++ b/engine/src/main/java/org/apache/hop/core/util/PluginPropertyFactory.java @@ -32,7 +32,9 @@ public PluginPropertyFactory(final KeyValueSet properties) throws IllegalArgumen this.properties = properties; } - /** @return the properties */ + /** + * @return the properties + */ public KeyValueSet getProperties() { return this.properties; } diff --git a/engine/src/main/java/org/apache/hop/core/util/PluginPropertyHandler.java b/engine/src/main/java/org/apache/hop/core/util/PluginPropertyHandler.java index 7456bc9b8a0..2982cf0796f 100644 --- a/engine/src/main/java/org/apache/hop/core/util/PluginPropertyHandler.java +++ b/engine/src/main/java/org/apache/hop/core/util/PluginPropertyHandler.java @@ -17,13 +17,12 @@ package org.apache.hop.core.util; +import java.util.prefs.Preferences; import org.apache.commons.collections4.Closure; import org.apache.commons.collections4.FunctorException; import org.apache.hop.core.exception.HopException; import org.w3c.dom.Node; -import java.util.prefs.Preferences; - public final class PluginPropertyHandler { public abstract static class AbstractHandler implements Closure { @@ -78,7 +77,9 @@ protected void handle(final IPluginProperty property) { property.appendXml(this.builder); } - /** @return XML string. */ + /** + * @return XML string. + */ public String getXml() { return this.builder.toString(); } diff --git a/engine/src/main/java/org/apache/hop/core/util/StringListPluginProperty.java b/engine/src/main/java/org/apache/hop/core/util/StringListPluginProperty.java index 8f1294035fd..871dbed44d3 100644 --- a/engine/src/main/java/org/apache/hop/core/util/StringListPluginProperty.java +++ b/engine/src/main/java/org/apache/hop/core/util/StringListPluginProperty.java @@ -17,14 +17,13 @@ package org.apache.hop.core.util; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Node; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.prefs.Preferences; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Node; public class StringListPluginProperty extends KeyValue> implements IPluginProperty, Iterable { @@ -38,7 +37,9 @@ public class StringListPluginProperty extends KeyValue> /** The separator character. */ public static final char SEPARATOR_CHAR = ','; - /** @param key key to use. */ + /** + * @param key key to use. + */ public StringListPluginProperty(final String key) { super(key, new ArrayList<>()); } @@ -106,7 +107,9 @@ public void saveToPreferences(final Preferences node) { node.put(this.getKey(), asString(this.getValue())); } - /** @param values values to set, no validation. */ + /** + * @param values values to set, no validation. + */ public void setValues(final String... values) { if (this.getValue() == null) { this.setValue(new ArrayList<>()); @@ -127,7 +130,9 @@ public Iterator iterator() throws IllegalStateException { return this.getValue().iterator(); } - /** @return true if list is empty . */ + /** + * @return true if list is empty . + */ public boolean isEmpty() { this.assertValueNotNull(); return this.getValue().isEmpty(); diff --git a/engine/src/main/java/org/apache/hop/core/util/StringPluginProperty.java b/engine/src/main/java/org/apache/hop/core/util/StringPluginProperty.java index 6f12d1f685c..74b592fe0a1 100644 --- a/engine/src/main/java/org/apache/hop/core/util/StringPluginProperty.java +++ b/engine/src/main/java/org/apache/hop/core/util/StringPluginProperty.java @@ -17,12 +17,11 @@ package org.apache.hop.core.util; +import java.util.prefs.Preferences; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.prefs.Preferences; - public class StringPluginProperty extends KeyValue implements IPluginProperty { /** Serial version UID. */ diff --git a/engine/src/main/java/org/apache/hop/core/util/SwingSvgImageUtil.java b/engine/src/main/java/org/apache/hop/core/util/SwingSvgImageUtil.java index 78f16dc1850..7d94945fb6b 100644 --- a/engine/src/main/java/org/apache/hop/core/util/SwingSvgImageUtil.java +++ b/engine/src/main/java/org/apache/hop/core/util/SwingSvgImageUtil.java @@ -17,6 +17,9 @@ package org.apache.hop.core.util; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; @@ -27,10 +30,6 @@ import org.apache.hop.core.svg.SvgSupport; import org.apache.hop.core.vfs.HopVfs; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - /** * Class for loading images from SVG, PNG, or other bitmap formats. * diff --git a/engine/src/main/java/org/apache/hop/core/util/TypeFieldDefinition.java b/engine/src/main/java/org/apache/hop/core/util/TypeFieldDefinition.java index df8396f1e6a..1fffde41bdb 100644 --- a/engine/src/main/java/org/apache/hop/core/util/TypeFieldDefinition.java +++ b/engine/src/main/java/org/apache/hop/core/util/TypeFieldDefinition.java @@ -33,22 +33,30 @@ public TypeFieldDefinition(int type, String fieldName) { this.fieldName = fieldName; } - /** @return the type */ + /** + * @return the type + */ public int getType() { return type; } - /** @param type the type to set */ + /** + * @param type the type to set + */ public void setType(int type) { this.type = type; } - /** @return the fieldName */ + /** + * @return the fieldName + */ public String getFieldName() { return fieldName; } - /** @param fieldName the fieldName to set */ + /** + * @param fieldName the fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } diff --git a/engine/src/main/java/org/apache/hop/execution/Execution.java b/engine/src/main/java/org/apache/hop/execution/Execution.java index 7b18c670518..aeb1e1ddbea 100644 --- a/engine/src/main/java/org/apache/hop/execution/Execution.java +++ b/engine/src/main/java/org/apache/hop/execution/Execution.java @@ -18,11 +18,10 @@ package org.apache.hop.execution; -import org.apache.hop.core.logging.LogLevel; - import java.util.Date; import java.util.HashMap; import java.util.Map; +import org.apache.hop.core.logging.LogLevel; /** * This is all the static information we have about an execution. It contains no status information diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionBuilder.java b/engine/src/main/java/org/apache/hop/execution/ExecutionBuilder.java index 101e891df67..74cefa2c9eb 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionBuilder.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionBuilder.java @@ -18,6 +18,11 @@ package org.apache.hop.execution; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.LogLevel; import org.apache.hop.core.metadata.SerializableMetadataProvider; @@ -33,12 +38,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - public final class ExecutionBuilder { public String name; public String filename; diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionData.java b/engine/src/main/java/org/apache/hop/execution/ExecutionData.java index 1e68de3044d..33776c8a126 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionData.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionData.java @@ -21,11 +21,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowBuffer; -import org.apache.hop.core.row.RowMeta; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; @@ -41,6 +36,10 @@ import java.util.Objects; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowBuffer; +import org.apache.hop.core.row.RowMeta; /** * This class contains execution data in the form of rows of data. These rows are collected for a @@ -166,7 +165,7 @@ public String getRowsBinaryGzipBase64Encoded() throws IOException, HopFileExcept if (rowMeta == null) { // no information received yet, an empty buffer - rowMeta=new RowMeta(); + rowMeta = new RowMeta(); } // Write the metadata @@ -175,7 +174,7 @@ public String getRowsBinaryGzipBase64Encoded() throws IOException, HopFileExcept synchronized (buffer.getBuffer()) { List rows = buffer.getBuffer(); - if (rows==null) { + if (rows == null) { // Empty buffer rows = Collections.emptyList(); } diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionDataBuilder.java b/engine/src/main/java/org/apache/hop/execution/ExecutionDataBuilder.java index 95352f99f3c..cf9561a6e6c 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionDataBuilder.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionDataBuilder.java @@ -18,6 +18,11 @@ package org.apache.hop.execution; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.ResultFile; @@ -34,12 +39,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public final class ExecutionDataBuilder { public static final String ALL_TRANSFORMS = "all-transforms"; public static final String KEY_RESULT = "result"; diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionDataSetMetaDeserializer.java b/engine/src/main/java/org/apache/hop/execution/ExecutionDataSetMetaDeserializer.java index f816e5bfd0d..8f310a23c15 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionDataSetMetaDeserializer.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionDataSetMetaDeserializer.java @@ -23,12 +23,11 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.hop.core.json.HopJson; - import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.apache.hop.core.json.HopJson; public class ExecutionDataSetMetaDeserializer extends JsonDeserializer> { diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionMetricsType.java b/engine/src/main/java/org/apache/hop/execution/ExecutionMetricsType.java index e6c1b303fb3..eb1984620ba 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionMetricsType.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionMetricsType.java @@ -19,13 +19,13 @@ package org.apache.hop.execution; public enum ExecutionMetricsType { - Input, - Output, - Read, - Written, - Updated, - Rejected, - Errors, - BufferSizeInput, - BufferSizeOutput, + Input, + Output, + Read, + Written, + Updated, + Rejected, + Errors, + BufferSizeInput, + BufferSizeOutput, } diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionState.java b/engine/src/main/java/org/apache/hop/execution/ExecutionState.java index 90bdce3de3f..70b518787d0 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionState.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionState.java @@ -31,6 +31,7 @@ public class ExecutionState { /** The type of execution to update */ private ExecutionType executionType; + /** * The unique ID of the parent executor. If this is an action or transform update, this is the ID * of that executor. diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionStateBuilder.java b/engine/src/main/java/org/apache/hop/execution/ExecutionStateBuilder.java index 493d875456c..efd7b8c47a9 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionStateBuilder.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionStateBuilder.java @@ -120,7 +120,6 @@ public static ExecutionStateBuilder fromExecutor( addMetric(componentMetrics, engineMetrics, component, Pipeline.METRIC_BUFFER_OUT); builder.addMetrics(componentMetrics); - } } diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionStateComponentMetrics.java b/engine/src/main/java/org/apache/hop/execution/ExecutionStateComponentMetrics.java index fd988803d17..2b7dfd05573 100644 --- a/engine/src/main/java/org/apache/hop/execution/ExecutionStateComponentMetrics.java +++ b/engine/src/main/java/org/apache/hop/execution/ExecutionStateComponentMetrics.java @@ -23,77 +23,78 @@ import java.util.Map; public class ExecutionStateComponentMetrics { - private String componentName; - private String componentCopy; - private Map metrics; + private String componentName; + private String componentCopy; + private Map metrics; - public ExecutionStateComponentMetrics() { - metrics = Collections.synchronizedMap(new HashMap<>()); - } + public ExecutionStateComponentMetrics() { + metrics = Collections.synchronizedMap(new HashMap<>()); + } - public ExecutionStateComponentMetrics(String componentName, String componentCopy) { - this(); - this.componentName = componentName; - this.componentCopy = componentCopy; - } + public ExecutionStateComponentMetrics(String componentName, String componentCopy) { + this(); + this.componentName = componentName; + this.componentCopy = componentCopy; + } - public ExecutionStateComponentMetrics(String componentName, String componentCopy, Map metrics) { - this.componentName = componentName; - this.componentCopy = componentCopy; - this.metrics = metrics; - } + public ExecutionStateComponentMetrics( + String componentName, String componentCopy, Map metrics) { + this.componentName = componentName; + this.componentCopy = componentCopy; + this.metrics = metrics; + } - /** - * Gets componentName - * - * @return value of componentName - */ - public String getComponentName() { - return componentName; - } + /** + * Gets componentName + * + * @return value of componentName + */ + public String getComponentName() { + return componentName; + } - /** - * Sets componentName - * - * @param componentName value of componentName - */ - public void setComponentName(String componentName) { - this.componentName = componentName; - } + /** + * Sets componentName + * + * @param componentName value of componentName + */ + public void setComponentName(String componentName) { + this.componentName = componentName; + } - /** - * Gets componentCopy - * - * @return value of componentCopy - */ - public String getComponentCopy() { - return componentCopy; - } + /** + * Gets componentCopy + * + * @return value of componentCopy + */ + public String getComponentCopy() { + return componentCopy; + } - /** - * Sets componentCopy - * - * @param componentCopy value of componentCopy - */ - public void setComponentCopy(String componentCopy) { - this.componentCopy = componentCopy; - } + /** + * Sets componentCopy + * + * @param componentCopy value of componentCopy + */ + public void setComponentCopy(String componentCopy) { + this.componentCopy = componentCopy; + } - /** - * Gets metrics - * - * @return value of metrics - */ - public Map getMetrics() { - return metrics; - } + /** + * Gets metrics + * + * @return value of metrics + */ + public Map getMetrics() { + return metrics; + } - /** - * Sets metrics - * - * @param metrics value of metrics - */ - public void setMetrics(Map metrics) { - this.metrics = metrics; - } + /** + * Sets metrics + * + * @param metrics value of metrics + */ + public void setMetrics(Map metrics) { + this.metrics = metrics; + } } diff --git a/engine/src/main/java/org/apache/hop/execution/IExecutionInfoLocation.java b/engine/src/main/java/org/apache/hop/execution/IExecutionInfoLocation.java index 475a6b492ce..aca1a8ffb38 100644 --- a/engine/src/main/java/org/apache/hop/execution/IExecutionInfoLocation.java +++ b/engine/src/main/java/org/apache/hop/execution/IExecutionInfoLocation.java @@ -105,15 +105,14 @@ public interface IExecutionInfoLocation extends Cloneable { * @return The state of the execution or null if not found * @throws HopException In case there was a problem reading the state */ - ExecutionState getExecutionState(String executionId, boolean includeLogging) - throws HopException; + ExecutionState getExecutionState(String executionId, boolean includeLogging) throws HopException; /** * Load the logging text of an execution state separately. * * @param executionId The id of the execution to look for. - * @param sizeLimit The maximum amount of characters to load from the logging text. - * Set the limit to <=0 if you want to load everything up to a global limit of usually 20MB. + * @param sizeLimit The maximum amount of characters to load from the logging text. Set the limit + * to <=0 if you want to load everything up to a global limit of usually 20MB. * @return The complete logging text * @throws HopException */ diff --git a/engine/src/main/java/org/apache/hop/execution/IExecutionMatcher.java b/engine/src/main/java/org/apache/hop/execution/IExecutionMatcher.java index 7de4a932232..82e05d4a109 100644 --- a/engine/src/main/java/org/apache/hop/execution/IExecutionMatcher.java +++ b/engine/src/main/java/org/apache/hop/execution/IExecutionMatcher.java @@ -19,5 +19,5 @@ package org.apache.hop.execution; public interface IExecutionMatcher { - boolean matches(Execution execution); + boolean matches(Execution execution); } diff --git a/engine/src/main/java/org/apache/hop/execution/local/FileExecutionInfoLocation.java b/engine/src/main/java/org/apache/hop/execution/local/FileExecutionInfoLocation.java index 15c7d6b2447..149c3991b02 100644 --- a/engine/src/main/java/org/apache/hop/execution/local/FileExecutionInfoLocation.java +++ b/engine/src/main/java/org/apache/hop/execution/local/FileExecutionInfoLocation.java @@ -31,7 +31,6 @@ import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSelector; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.FileTypeSelector; import org.apache.hop.core.exception.HopException; @@ -275,7 +274,7 @@ public String getExecutionStateLoggingText(String executionId, int sizeLimit) // We don't load the logging for performance and to avoid an infinite loop. // ExecutionState state = getExecutionState(executionId, false); - if (state==null) { + if (state == null) { return null; } return getExecutionStateLoggingText(state, sizeLimit); diff --git a/engine/src/main/java/org/apache/hop/execution/plugin/ExecutionInfoLocationPluginType.java b/engine/src/main/java/org/apache/hop/execution/plugin/ExecutionInfoLocationPluginType.java index 66d95bf7eeb..cbd388ec0a8 100644 --- a/engine/src/main/java/org/apache/hop/execution/plugin/ExecutionInfoLocationPluginType.java +++ b/engine/src/main/java/org/apache/hop/execution/plugin/ExecutionInfoLocationPluginType.java @@ -27,7 +27,10 @@ public class ExecutionInfoLocationPluginType extends BasePluginType { private ExecutionInfoLocationPluginType() { - super(ExecutionInfoLocationPlugin.class, "EXECUTION_INFO_LOCATIONS", "Execution Information Locations"); + super( + ExecutionInfoLocationPlugin.class, + "EXECUTION_INFO_LOCATIONS", + "Execution Information Locations"); } private static ExecutionInfoLocationPluginType pluginType; @@ -53,5 +56,4 @@ protected String extractID(ExecutionInfoLocationPlugin annotation) { protected String extractName(ExecutionInfoLocationPlugin annotation) { return annotation.name(); } - } diff --git a/engine/src/main/java/org/apache/hop/execution/profiling/ExecutionDataProfile.java b/engine/src/main/java/org/apache/hop/execution/profiling/ExecutionDataProfile.java index c4cf15ce759..75f18d65a33 100644 --- a/engine/src/main/java/org/apache/hop/execution/profiling/ExecutionDataProfile.java +++ b/engine/src/main/java/org/apache/hop/execution/profiling/ExecutionDataProfile.java @@ -18,15 +18,14 @@ package org.apache.hop.execution.profiling; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.execution.sampler.IExecutionDataSampler; import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.HopMetadataBase; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - /** * This data profile makes it easy to specify what kind of information you want to capture about the * output of a transform during its execution. diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSampleInformation.java b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSampleInformation.java index fa87efbd8e7..ef9fa388e8c 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSampleInformation.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSampleInformation.java @@ -18,31 +18,29 @@ package org.apache.hop.execution.sampler; -/** - * Provides some extra information about a set of sample rows - */ +/** Provides some extra information about a set of sample rows */ public class ExecutionDataSampleInformation { - private String description; + private String description; - public ExecutionDataSampleInformation(String description) { - this.description = description; - } + public ExecutionDataSampleInformation(String description) { + this.description = description; + } - /** - * Gets description - * - * @return value of description - */ - public String getDescription() { - return description; - } + /** + * Gets description + * + * @return value of description + */ + public String getDescription() { + return description; + } - /** - * Sets description - * - * @param description value of description - */ - public void setDescription(String description) { - this.description = description; - } + /** + * Sets description + * + * @param description value of description + */ + public void setDescription(String description) { + this.description = description; + } } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerMeta.java b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerMeta.java index 0c59edf274d..680f735d9fc 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerMeta.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerMeta.java @@ -56,7 +56,7 @@ public String toString() { if (StringUtils.isEmpty(copyNr)) { return transformName; } else { - return transformName+"."+copyNr; + return transformName + "." + copyNr; } } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerPluginType.java b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerPluginType.java index 2be6ba1a084..d33f30a3455 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerPluginType.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerPluginType.java @@ -26,8 +26,10 @@ public class ExecutionDataSamplerPluginType extends BasePluginType { private ExecutionDataSamplerPluginType() { - super(ExecutionDataSamplerPlugin.class, "EXECUTION_DATA_SAMPLER_LOCATIONS", - "Execution Data Sampler Locations"); + super( + ExecutionDataSamplerPlugin.class, + "EXECUTION_DATA_SAMPLER_LOCATIONS", + "Execution Data Sampler Locations"); } private static ExecutionDataSamplerPluginType pluginType; @@ -53,5 +55,4 @@ protected String extractID(ExecutionDataSamplerPlugin annotation) { protected String extractName(ExecutionDataSamplerPlugin annotation) { return annotation.name(); } - } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerStoreBase.java b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerStoreBase.java index 136e3fea4f0..ac8ed1d00e5 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerStoreBase.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/ExecutionDataSamplerStoreBase.java @@ -18,6 +18,9 @@ package org.apache.hop.execution.sampler; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -25,10 +28,6 @@ import org.apache.hop.pipeline.transform.IRowListener; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public abstract class ExecutionDataSamplerStoreBase implements IExecutionDataSamplerStore { protected ExecutionDataSamplerMeta samplerMeta; diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSampler.java b/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSampler.java index 9d68bbc2c92..748526350b2 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSampler.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSampler.java @@ -28,8 +28,7 @@ /** This describes methods for sampling data from */ @HopMetadataObject(objectFactory = IExecutionDataSampler.ExecutionDataSamplerObjectFactory.class) -public interface IExecutionDataSampler - extends Cloneable { +public interface IExecutionDataSampler extends Cloneable { String getPluginId(); @@ -58,8 +57,7 @@ public interface IExecutionDataSampler * @param rowMeta The row metadata * @param row The row data itself */ - void sampleRow( - Store samplerStore, IStream.StreamType streamType, IRowMeta rowMeta, Object[] row) + void sampleRow(Store samplerStore, IStream.StreamType streamType, IRowMeta rowMeta, Object[] row) throws HopException; /** diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSamplerStore.java b/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSamplerStore.java index 578f111d322..3ed3af8ca1e 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSamplerStore.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/IExecutionDataSamplerStore.java @@ -18,40 +18,43 @@ package org.apache.hop.execution.sampler; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowBuffer; import org.apache.hop.core.variables.IVariables; import org.apache.hop.execution.ExecutionDataSetMeta; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.Map; - public interface IExecutionDataSamplerStore { - /** - * Initializes this sampler store - * @param variables The variables to resolve with - * @param inputRowMeta Transform input row metadata - * @param outputRowMeta Transform output row metadata - */ - void init(IVariables variables, IRowMeta inputRowMeta, IRowMeta outputRowMeta); - - /** - * Create a row listener to attach to a transform - * @return The row listener for this store. - */ - IRowListener createRowListener(IExecutionDataSampler dataSampler); - - /** - * Return a map of keys and rows of data. Every key represents a different type of sampling data. - * - * @return The samples map for the sampler store - */ - Map getSamples(); - - /** - * Get some extra information about the data samples. - * @return The metadata map where for every key more information (description) is given about the sampled data. - */ - Map getSamplesMetadata(); + /** + * Initializes this sampler store + * + * @param variables The variables to resolve with + * @param inputRowMeta Transform input row metadata + * @param outputRowMeta Transform output row metadata + */ + void init(IVariables variables, IRowMeta inputRowMeta, IRowMeta outputRowMeta); + + /** + * Create a row listener to attach to a transform + * + * @return The row listener for this store. + */ + IRowListener createRowListener(IExecutionDataSampler dataSampler); + + /** + * Return a map of keys and rows of data. Every key represents a different type of sampling data. + * + * @return The samples map for the sampler store + */ + Map getSamples(); + + /** + * Get some extra information about the data samples. + * + * @return The metadata map where for every key more information (description) is given about the + * sampled data. + */ + Map getSamplesMetadata(); } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/ExecutionDataSamplerBase.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/ExecutionDataSamplerBase.java index e55e9ef4e6a..ba36dd01728 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/ExecutionDataSamplerBase.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/ExecutionDataSamplerBase.java @@ -18,6 +18,7 @@ package org.apache.hop.execution.sampler.plugins; +import java.util.Objects; import org.apache.hop.core.gui.plugin.GuiElementType; import org.apache.hop.core.gui.plugin.GuiWidgetElement; import org.apache.hop.execution.profiling.ExecutionDataProfile; @@ -26,8 +27,6 @@ import org.apache.hop.execution.sampler.IExecutionDataSamplerStore; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public abstract class ExecutionDataSamplerBase implements IExecutionDataSampler { diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSampler.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSampler.java index 2ad47b7470d..f1363c73a86 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSampler.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSampler.java @@ -18,6 +18,8 @@ package org.apache.hop.execution.sampler.plugins.dataprof; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.plugin.GuiElementType; import org.apache.hop.core.gui.plugin.GuiPlugin; @@ -33,9 +35,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.HashMap; -import java.util.Map; - @GuiPlugin @ExecutionDataSamplerPlugin( id = "BasicDataProfilingRowsExecutionDataSampler", @@ -187,8 +186,8 @@ public void sampleRow( return; } - // By default, we only do data profiling on the end-points of a pipeline, the last transforms. - // + // By default, we only do data profiling on the end-points of a pipeline, the last transforms. + // if (onlyProfilingLastTransforms && !store.getSamplerMeta().isLastTransform()) { return; } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSamplerStore.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSamplerStore.java index 16d9a6c4a0e..5948e5900b1 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSamplerStore.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/dataprof/BasicDataProfilingDataSamplerStore.java @@ -18,6 +18,10 @@ package org.apache.hop.execution.sampler.plugins.dataprof; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; @@ -33,11 +37,6 @@ import org.apache.hop.execution.sampler.plugins.dataprof.BasicDataProfilingDataSampler.ProfilingType; import org.apache.hop.i18n.BaseMessages; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class BasicDataProfilingDataSamplerStore extends ExecutionDataSamplerStoreBase implements IExecutionDataSamplerStore { diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSampler.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSampler.java index d0c6c53b4e8..07aab426a6d 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSampler.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSampler.java @@ -18,6 +18,7 @@ package org.apache.hop.execution.sampler.plugins.first; +import java.util.List; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.execution.sampler.ExecutionDataSamplerMeta; @@ -26,15 +27,13 @@ import org.apache.hop.execution.sampler.plugins.ExecutionDataSamplerBase; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.List; - @GuiPlugin @ExecutionDataSamplerPlugin( id = "FirstRowsExecutionDataSampler", name = "First output rows", description = "Samples the first rows of a transform output") public class FirstRowsExecutionDataSampler - extends ExecutionDataSamplerBase + extends ExecutionDataSamplerBase implements IExecutionDataSampler { private static final Class PKG = FirstRowsExecutionDataSampler.class; // For Translator @@ -55,7 +54,8 @@ public FirstRowsExecutionDataSampler clone() { } @Override - public FirstRowsExecutionDataSamplerStore createSamplerStore(ExecutionDataSamplerMeta samplerMeta) { + public FirstRowsExecutionDataSamplerStore createSamplerStore( + ExecutionDataSamplerMeta samplerMeta) { return new FirstRowsExecutionDataSamplerStore(this, samplerMeta); } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSamplerStore.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSamplerStore.java index 5f0d93d86d4..c1502e9703c 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSamplerStore.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/first/FirstRowsExecutionDataSamplerStore.java @@ -18,6 +18,8 @@ package org.apache.hop.execution.sampler.plugins.first; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowBuffer; @@ -27,19 +29,16 @@ import org.apache.hop.execution.sampler.ExecutionDataSamplerStoreBase; import org.apache.hop.execution.sampler.IExecutionDataSamplerStore; -import java.util.List; -import java.util.Map; - /** A class meant to contain transform execution sampling data */ public class FirstRowsExecutionDataSamplerStore - extends ExecutionDataSamplerStoreBase - implements IExecutionDataSamplerStore { + extends ExecutionDataSamplerStoreBase + implements IExecutionDataSamplerStore { public static final String EXECUTION_DATA_SAMPLE_FIRST_OUTPUT = "FirstOutput"; private FirstRowsExecutionDataSampler dataSampler; public FirstRowsExecutionDataSamplerStore( - FirstRowsExecutionDataSampler dataSampler, + FirstRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta, IRowMeta rowMeta, List rows, @@ -53,7 +52,7 @@ public FirstRowsExecutionDataSamplerStore( } public FirstRowsExecutionDataSamplerStore( - FirstRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta) { + FirstRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta) { this(dataSampler, samplerMeta, null, null, 0); } @@ -71,30 +70,26 @@ public void init(IVariables variables, IRowMeta inputRowMeta, IRowMeta outputRow @Override public Map getSamples() { return Map.of( - getKeyForStore(EXECUTION_DATA_SAMPLE_FIRST_OUTPUT, samplerMeta), - new RowBuffer(rowMeta, rows)); + getKeyForStore(EXECUTION_DATA_SAMPLE_FIRST_OUTPUT, samplerMeta), + new RowBuffer(rowMeta, rows)); } + @Override public Map getSamplesMetadata() { String setKey = getKeyForStore(EXECUTION_DATA_SAMPLE_FIRST_OUTPUT, samplerMeta); String description = - "First rows of " - + getSamplerMeta().getTransformName() - + "." - + getSamplerMeta().getCopyNr(); - ExecutionDataSetMeta meta = new ExecutionDataSetMeta( + "First rows of " + getSamplerMeta().getTransformName() + "." + getSamplerMeta().getCopyNr(); + ExecutionDataSetMeta meta = + new ExecutionDataSetMeta( setKey, samplerMeta.getLogChannelId(), samplerMeta.getTransformName(), samplerMeta.getCopyNr(), - description - ); + description); return Map.of(setKey, meta); } - - /** * Gets dataSampler * @@ -112,5 +107,4 @@ public FirstRowsExecutionDataSampler getDataSampler() { public void setDataSampler(FirstRowsExecutionDataSampler dataSampler) { this.dataSampler = dataSampler; } - } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSampler.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSampler.java index cd3341cd6ee..a8ad852cfe4 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSampler.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSampler.java @@ -18,6 +18,7 @@ package org.apache.hop.execution.sampler.plugins.last; +import java.util.List; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.execution.sampler.ExecutionDataSamplerMeta; @@ -26,16 +27,14 @@ import org.apache.hop.execution.sampler.plugins.ExecutionDataSamplerBase; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.List; - @GuiPlugin @ExecutionDataSamplerPlugin( id = "LastRowsExecutionDataSampler", name = "Last output rows", description = "Samples the last rows of a transform output") public class LastRowsExecutionDataSampler - extends ExecutionDataSamplerBase -implements IExecutionDataSampler { + extends ExecutionDataSamplerBase + implements IExecutionDataSampler { private static final Class PKG = LastRowsExecutionDataSampler.class; // For Translator public LastRowsExecutionDataSampler() { @@ -55,13 +54,14 @@ public LastRowsExecutionDataSampler clone() { } @Override - public LastRowsExecutionDataSamplerStore createSamplerStore(ExecutionDataSamplerMeta samplerMeta) { + public LastRowsExecutionDataSamplerStore createSamplerStore( + ExecutionDataSamplerMeta samplerMeta) { return new LastRowsExecutionDataSamplerStore(this, samplerMeta); } @Override public void sampleRow( - LastRowsExecutionDataSamplerStore samplerStore, + LastRowsExecutionDataSamplerStore samplerStore, IStream.StreamType streamType, IRowMeta rowMeta, Object[] row) { diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSamplerStore.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSamplerStore.java index 64320f0c515..dfc95a61d9e 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSamplerStore.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/last/LastRowsExecutionDataSamplerStore.java @@ -18,6 +18,10 @@ package org.apache.hop.execution.sampler.plugins.last; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowBuffer; @@ -27,21 +31,16 @@ import org.apache.hop.execution.sampler.ExecutionDataSamplerStoreBase; import org.apache.hop.execution.sampler.IExecutionDataSamplerStore; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - /** A class meant to contain transform execution sampling data */ public class LastRowsExecutionDataSamplerStore - extends ExecutionDataSamplerStoreBase - implements IExecutionDataSamplerStore { + extends ExecutionDataSamplerStoreBase + implements IExecutionDataSamplerStore { public static final String EXECUTION_DATA_SAMPLE_LAST_OUTPUT = "LastOutput"; private LastRowsExecutionDataSampler dataSampler; public LastRowsExecutionDataSamplerStore( - LastRowsExecutionDataSampler dataSampler, + LastRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta, IRowMeta rowMeta, List rows, @@ -51,7 +50,7 @@ public LastRowsExecutionDataSamplerStore( } public LastRowsExecutionDataSamplerStore( - LastRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta) { + LastRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta) { this(dataSampler, samplerMeta, null, null, 0); } @@ -69,25 +68,22 @@ public void init(IVariables variables, IRowMeta inputRowMeta, IRowMeta outputRow @Override public Map getSamples() { return Map.of( - getKeyForStore(EXECUTION_DATA_SAMPLE_LAST_OUTPUT, samplerMeta), - new RowBuffer(rowMeta, rows)); + getKeyForStore(EXECUTION_DATA_SAMPLE_LAST_OUTPUT, samplerMeta), + new RowBuffer(rowMeta, rows)); } @Override public Map getSamplesMetadata() { String setKey = getKeyForStore(EXECUTION_DATA_SAMPLE_LAST_OUTPUT, samplerMeta); String description = - "Last rows of " - + getSamplerMeta().getTransformName() - + "." - + getSamplerMeta().getCopyNr(); - ExecutionDataSetMeta meta = new ExecutionDataSetMeta( + "Last rows of " + getSamplerMeta().getTransformName() + "." + getSamplerMeta().getCopyNr(); + ExecutionDataSetMeta meta = + new ExecutionDataSetMeta( setKey, samplerMeta.getLogChannelId(), samplerMeta.getTransformName(), samplerMeta.getCopyNr(), - description - ); + description); return Map.of(setKey, meta); } diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSampler.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSampler.java index 041fa8b78ef..85343e01b0a 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSampler.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSampler.java @@ -18,6 +18,8 @@ package org.apache.hop.execution.sampler.plugins.random; +import java.util.List; +import java.util.Random; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.execution.sampler.ExecutionDataSamplerMeta; @@ -26,9 +28,6 @@ import org.apache.hop.execution.sampler.plugins.ExecutionDataSamplerBase; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.List; -import java.util.Random; - @GuiPlugin @ExecutionDataSamplerPlugin( id = "RandomRowsExecutionDataSampler", @@ -57,13 +56,14 @@ public RandomRowsExecutionDataSampler clone() { private final Random random = new Random(); @Override - public RandomRowsExecutionDataSamplerStore createSamplerStore(ExecutionDataSamplerMeta samplerMeta) { + public RandomRowsExecutionDataSamplerStore createSamplerStore( + ExecutionDataSamplerMeta samplerMeta) { return new RandomRowsExecutionDataSamplerStore(this, samplerMeta); } @Override public void sampleRow( - RandomRowsExecutionDataSamplerStore samplerStore, + RandomRowsExecutionDataSamplerStore samplerStore, IStream.StreamType streamType, IRowMeta rowMeta, Object[] row) { diff --git a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSamplerStore.java b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSamplerStore.java index 8224266bcd9..dee29d49401 100644 --- a/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSamplerStore.java +++ b/engine/src/main/java/org/apache/hop/execution/sampler/plugins/random/RandomRowsExecutionDataSamplerStore.java @@ -18,6 +18,8 @@ package org.apache.hop.execution.sampler.plugins.random; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowBuffer; @@ -27,19 +29,16 @@ import org.apache.hop.execution.sampler.ExecutionDataSamplerStoreBase; import org.apache.hop.execution.sampler.IExecutionDataSamplerStore; -import java.util.List; -import java.util.Map; - /** A class meant to contain transform execution sampling data */ public class RandomRowsExecutionDataSamplerStore - extends ExecutionDataSamplerStoreBase - implements IExecutionDataSamplerStore { + extends ExecutionDataSamplerStoreBase + implements IExecutionDataSamplerStore { public static final String EXECUTION_DATA_SAMPLE_RANDOM_OUTPUT = "RandomOutput"; private RandomRowsExecutionDataSampler dataSampler; public RandomRowsExecutionDataSamplerStore( - RandomRowsExecutionDataSampler dataSampler, + RandomRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta, IRowMeta rowMeta, List rows, @@ -49,7 +48,7 @@ public RandomRowsExecutionDataSamplerStore( } public RandomRowsExecutionDataSamplerStore( - RandomRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta) { + RandomRowsExecutionDataSampler dataSampler, ExecutionDataSamplerMeta samplerMeta) { this(dataSampler, samplerMeta, null, null, 0); } @@ -67,30 +66,29 @@ public RandomRowsExecutionDataSamplerStore getStore() { @Override public Map getSamples() { return Map.of( - getKeyForStore(EXECUTION_DATA_SAMPLE_RANDOM_OUTPUT, samplerMeta), - new RowBuffer(rowMeta, rows)); + getKeyForStore(EXECUTION_DATA_SAMPLE_RANDOM_OUTPUT, samplerMeta), + new RowBuffer(rowMeta, rows)); } @Override public Map getSamplesMetadata() { String setKey = getKeyForStore(EXECUTION_DATA_SAMPLE_RANDOM_OUTPUT, samplerMeta); String description = - "Random rows of " - + getSamplerMeta().getTransformName() - + "." - + getSamplerMeta().getCopyNr(); - ExecutionDataSetMeta meta = new ExecutionDataSetMeta( + "Random rows of " + + getSamplerMeta().getTransformName() + + "." + + getSamplerMeta().getCopyNr(); + ExecutionDataSetMeta meta = + new ExecutionDataSetMeta( setKey, samplerMeta.getLogChannelId(), samplerMeta.getTransformName(), samplerMeta.getCopyNr(), - description - ); + description); return Map.of(setKey, meta); } - /** * Gets dataSampler * diff --git a/engine/src/main/java/org/apache/hop/history/AuditEvent.java b/engine/src/main/java/org/apache/hop/history/AuditEvent.java index 33bfb2ea1ef..20f2393f1a8 100644 --- a/engine/src/main/java/org/apache/hop/history/AuditEvent.java +++ b/engine/src/main/java/org/apache/hop/history/AuditEvent.java @@ -47,7 +47,9 @@ public String getGroup() { return group; } - /** @param group The group to set */ + /** + * @param group The group to set + */ public void setGroup(String group) { this.group = group; } @@ -61,7 +63,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -75,7 +79,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -89,7 +95,9 @@ public String getOperation() { return operation; } - /** @param operation The operation to set */ + /** + * @param operation The operation to set + */ public void setOperation(String operation) { this.operation = operation; } @@ -103,7 +111,9 @@ public Date getDate() { return date; } - /** @param date The date to set */ + /** + * @param date The date to set + */ public void setDate(Date date) { this.date = date; } diff --git a/engine/src/main/java/org/apache/hop/history/AuditList.java b/engine/src/main/java/org/apache/hop/history/AuditList.java index 9a21fd6ee57..7c1f5ff04ec 100644 --- a/engine/src/main/java/org/apache/hop/history/AuditList.java +++ b/engine/src/main/java/org/apache/hop/history/AuditList.java @@ -44,7 +44,9 @@ public List getNames() { return names; } - /** @param names The names to set */ + /** + * @param names The names to set + */ public void setNames(List names) { this.names = names; } diff --git a/engine/src/main/java/org/apache/hop/history/AuditManager.java b/engine/src/main/java/org/apache/hop/history/AuditManager.java index b01afd85c01..4f13b0033a0 100644 --- a/engine/src/main/java/org/apache/hop/history/AuditManager.java +++ b/engine/src/main/java/org/apache/hop/history/AuditManager.java @@ -16,16 +16,15 @@ */ package org.apache.hop.history; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.history.local.LocalAuditManager; - import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.history.local.LocalAuditManager; public class AuditManager { private static AuditManager instance; @@ -56,7 +55,9 @@ public IAuditManager getActiveAuditManager() { return activeAuditManager; } - /** @param activeAuditManager The activeAuditManager to set */ + /** + * @param activeAuditManager The activeAuditManager to set + */ public void setActiveAuditManager(IAuditManager activeAuditManager) { this.activeAuditManager = activeAuditManager; } diff --git a/engine/src/main/java/org/apache/hop/history/AuditState.java b/engine/src/main/java/org/apache/hop/history/AuditState.java index d3a8cab1a26..cebb46abcc2 100644 --- a/engine/src/main/java/org/apache/hop/history/AuditState.java +++ b/engine/src/main/java/org/apache/hop/history/AuditState.java @@ -65,7 +65,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -79,7 +81,9 @@ public Map getStateMap() { return stateMap; } - /** @param stateMap The stateMap to set */ + /** + * @param stateMap The stateMap to set + */ public void setStateMap(Map stateMap) { this.stateMap = stateMap; } diff --git a/engine/src/main/java/org/apache/hop/history/AuditStateMap.java b/engine/src/main/java/org/apache/hop/history/AuditStateMap.java index 2a4735c9190..e4cb145edc3 100644 --- a/engine/src/main/java/org/apache/hop/history/AuditStateMap.java +++ b/engine/src/main/java/org/apache/hop/history/AuditStateMap.java @@ -39,7 +39,9 @@ public Map getNameStateMap() { return nameStateMap; } - /** @param nameStateMap The nameStateMap to set */ + /** + * @param nameStateMap The nameStateMap to set + */ public void setNameStateMap(Map nameStateMap) { this.nameStateMap = nameStateMap; } diff --git a/engine/src/main/java/org/apache/hop/history/IAuditManager.java b/engine/src/main/java/org/apache/hop/history/IAuditManager.java index 0888abd6709..3d12c8c16bd 100644 --- a/engine/src/main/java/org/apache/hop/history/IAuditManager.java +++ b/engine/src/main/java/org/apache/hop/history/IAuditManager.java @@ -16,10 +16,9 @@ */ package org.apache.hop.history; -import org.apache.hop.core.exception.HopException; - import java.util.List; import java.util.Map; +import org.apache.hop.core.exception.HopException; /** This interface describes all the things you can do with a history manager */ public interface IAuditManager { diff --git a/engine/src/main/java/org/apache/hop/history/local/LocalAuditManager.java b/engine/src/main/java/org/apache/hop/history/local/LocalAuditManager.java index 5b16d3a734c..444f71d64e3 100644 --- a/engine/src/main/java/org/apache/hop/history/local/LocalAuditManager.java +++ b/engine/src/main/java/org/apache/hop/history/local/LocalAuditManager.java @@ -17,6 +17,16 @@ package org.apache.hop.history.local; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; @@ -29,17 +39,6 @@ import org.apache.hop.history.AuditStateMap; import org.apache.hop.history.IAuditManager; -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * The local audit manager stores its history in the hop home directory (~/.hop) under the history * folder So : $HOME/.hop/history diff --git a/engine/src/main/java/org/apache/hop/imp/HopImport.java b/engine/src/main/java/org/apache/hop/imp/HopImport.java index 450d0d4fb85..8829f78c0fd 100644 --- a/engine/src/main/java/org/apache/hop/imp/HopImport.java +++ b/engine/src/main/java/org/apache/hop/imp/HopImport.java @@ -17,6 +17,9 @@ package org.apache.hop.imp; +import java.io.IOException; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; @@ -43,10 +46,6 @@ import picocli.CommandLine.Option; import picocli.CommandLine.ParameterException; -import java.io.IOException; -import java.util.List; -import java.util.Map; - @Command(versionProvider = HopVersionProvider.class) public class HopImport implements Runnable, IHasHopMetadataProvider { @@ -115,11 +114,12 @@ public class HopImport implements Runnable, IHasHopMetadataProvider { description = "Displays this help message and quits.") private boolean helpRequested; - @Option(names = {"-v", "--version"}, + @Option( + names = {"-v", "--version"}, versionHelp = true, description = "Print version information and exit") - private boolean versionRequested; - + private boolean versionRequested; + private IVariables variables; private CommandLine cmd; private ILogChannel log; @@ -275,7 +275,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -289,7 +291,9 @@ public Boolean getSkippingExistingTargetFiles() { return skippingExistingTargetFiles; } - /** @param skippingExistingTargetFiles The skippingExistingTargetFiles to set */ + /** + * @param skippingExistingTargetFiles The skippingExistingTargetFiles to set + */ public void setSkippingExistingTargetFiles(Boolean skippingExistingTargetFiles) { this.skippingExistingTargetFiles = skippingExistingTargetFiles; } @@ -303,7 +307,9 @@ public Boolean getSkippingHiddenFilesAndFolders() { return skippingHiddenFilesAndFolders; } - /** @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set */ + /** + * @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set + */ public void setSkippingHiddenFilesAndFolders(Boolean skippingHiddenFilesAndFolders) { this.skippingHiddenFilesAndFolders = skippingHiddenFilesAndFolders; } @@ -317,7 +323,9 @@ public Boolean getSkippingFolders() { return skippingFolders; } - /** @param skippingFolders The skippingFolders to set */ + /** + * @param skippingFolders The skippingFolders to set + */ public void setSkippingFolders(Boolean skippingFolders) { this.skippingFolders = skippingFolders; } @@ -331,7 +339,9 @@ public IHopImport getHopImport() { return hopImport; } - /** @param hopImport The hopImport to set */ + /** + * @param hopImport The hopImport to set + */ public void setHopImport(IHopImport hopImport) { this.hopImport = hopImport; } @@ -345,7 +355,9 @@ public String getInputFolderName() { return inputFolderName; } - /** @param inputFolderName The inputFolderName to set */ + /** + * @param inputFolderName The inputFolderName to set + */ public void setInputFolderName(String inputFolderName) { this.inputFolderName = inputFolderName; } @@ -359,7 +371,9 @@ public String getOutputFolderName() { return outputFolderName; } - /** @param outputFolderName The outputFolderName to set */ + /** + * @param outputFolderName The outputFolderName to set + */ public void setOutputFolderName(String outputFolderName) { this.outputFolderName = outputFolderName; } @@ -373,7 +387,9 @@ public String getSharedXmlFilename() { return sharedXmlFilename; } - /** @param sharedXmlFilename The sharedXmlFilename to set */ + /** + * @param sharedXmlFilename The sharedXmlFilename to set + */ public void setSharedXmlFilename(String sharedXmlFilename) { this.sharedXmlFilename = sharedXmlFilename; } @@ -387,7 +403,9 @@ public String getKettlePropertiesFilename() { return kettlePropertiesFilename; } - /** @param kettlePropertiesFilename The kettlePropertiesFilename to set */ + /** + * @param kettlePropertiesFilename The kettlePropertiesFilename to set + */ public void setKettlePropertiesFilename(String kettlePropertiesFilename) { this.kettlePropertiesFilename = kettlePropertiesFilename; } @@ -401,7 +419,9 @@ public String getJdbcPropertiesFilename() { return jdbcPropertiesFilename; } - /** @param jdbcPropertiesFilename The jdbcPropertiesFilename to set */ + /** + * @param jdbcPropertiesFilename The jdbcPropertiesFilename to set + */ public void setJdbcPropertiesFilename(String jdbcPropertiesFilename) { this.jdbcPropertiesFilename = jdbcPropertiesFilename; } @@ -415,7 +435,9 @@ public String getTargetConfigFilename() { return targetConfigFilename; } - /** @param targetConfigFilename The targetConfigFilename to set */ + /** + * @param targetConfigFilename The targetConfigFilename to set + */ public void setTargetConfigFilename(String targetConfigFilename) { this.targetConfigFilename = targetConfigFilename; } @@ -429,7 +451,9 @@ public boolean isSkippingExistingTargetFiles() { return skippingExistingTargetFiles; } - /** @param skippingExistingTargetFiles The skippingExistingTargetFiles to set */ + /** + * @param skippingExistingTargetFiles The skippingExistingTargetFiles to set + */ public void setSkippingExistingTargetFiles(boolean skippingExistingTargetFiles) { this.skippingExistingTargetFiles = skippingExistingTargetFiles; } @@ -443,7 +467,9 @@ public boolean isSkippingHiddenFilesAndFolders() { return skippingHiddenFilesAndFolders; } - /** @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set */ + /** + * @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set + */ public void setSkippingHiddenFilesAndFolders(boolean skippingHiddenFilesAndFolders) { this.skippingHiddenFilesAndFolders = skippingHiddenFilesAndFolders; } @@ -457,7 +483,9 @@ public boolean isSkippingFolders() { return skippingFolders; } - /** @param skippingFolders The skippingFolders to set */ + /** + * @param skippingFolders The skippingFolders to set + */ public void setSkippingFolders(boolean skippingFolders) { this.skippingFolders = skippingFolders; } @@ -471,7 +499,9 @@ public boolean isHelpRequested() { return helpRequested; } - /** @param helpRequested The helpRequested to set */ + /** + * @param helpRequested The helpRequested to set + */ public void setHelpRequested(boolean helpRequested) { this.helpRequested = helpRequested; } @@ -485,7 +515,9 @@ public IVariables getVariables() { return variables; } - /** @param variables The variables to set */ + /** + * @param variables The variables to set + */ public void setVariables(IVariables variables) { this.variables = variables; } @@ -499,7 +531,9 @@ public CommandLine getCmd() { return cmd; } - /** @param cmd The cmd to set */ + /** + * @param cmd The cmd to set + */ public void setCmd(CommandLine cmd) { this.cmd = cmd; } @@ -513,7 +547,9 @@ public ILogChannel getLog() { return log; } - /** @param log The log to set */ + /** + * @param log The log to set + */ public void setLog(ILogChannel log) { this.log = log; } @@ -528,7 +564,9 @@ public MultiMetadataProvider getMetadataProvider() { return hopImport.getMetadataProvider(); } - /** @param metadataProvider The metadataProvider to set */ + /** + * @param metadataProvider The metadataProvider to set + */ @Override public void setMetadataProvider(MultiMetadataProvider metadataProvider) { hopImport.setMetadataProvider(metadataProvider); @@ -543,7 +581,9 @@ public boolean isFinishedWithoutError() { return finishedWithoutError; } - /** @param finishedWithoutError The finishedWithoutError to set */ + /** + * @param finishedWithoutError The finishedWithoutError to set + */ public void setFinishedWithoutError(boolean finishedWithoutError) { this.finishedWithoutError = finishedWithoutError; } @@ -557,7 +597,9 @@ public Boolean getListPluginTypes() { return listPluginTypes; } - /** @param listPluginTypes The listPluginTypes to set */ + /** + * @param listPluginTypes The listPluginTypes to set + */ public void setListPluginTypes(Boolean listPluginTypes) { this.listPluginTypes = listPluginTypes; } diff --git a/engine/src/main/java/org/apache/hop/imp/HopImportBase.java b/engine/src/main/java/org/apache/hop/imp/HopImportBase.java index e1f98fdbb2a..bfd685783f4 100644 --- a/engine/src/main/java/org/apache/hop/imp/HopImportBase.java +++ b/engine/src/main/java/org/apache/hop/imp/HopImportBase.java @@ -17,6 +17,15 @@ package org.apache.hop.imp; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Properties; +import java.util.TreeMap; +import java.util.stream.Collectors; +import javax.xml.transform.dom.DOMSource; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.database.DatabaseMeta; @@ -31,16 +40,6 @@ import org.apache.hop.metadata.serializer.json.JsonMetadataProvider; import org.apache.hop.metadata.serializer.multi.MultiMetadataProvider; -import javax.xml.transform.dom.DOMSource; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Properties; -import java.util.TreeMap; -import java.util.stream.Collectors; - public abstract class HopImportBase implements IHopImport { protected ILogChannel log; protected IVariables variables; @@ -232,7 +231,9 @@ public String getInputFolderName() { return inputFolderName; } - /** @param inputFolderName The inputFolderName to set */ + /** + * @param inputFolderName The inputFolderName to set + */ public void setInputFolderName(String inputFolderName) { this.inputFolderName = inputFolderName; } @@ -247,7 +248,9 @@ public String getOutputFolderName() { return outputFolderName; } - /** @param outputFolderName The outputFolderName to set */ + /** + * @param outputFolderName The outputFolderName to set + */ public void setOutputFolderName(String outputFolderName) { this.outputFolderName = outputFolderName; } @@ -261,7 +264,9 @@ public TreeMap getConnectionFileMap() { return connectionFileMap; } - /** @param connectionFileMap The connectionFileList to set */ + /** + * @param connectionFileMap The connectionFileList to set + */ public void setConnectionFileMap(TreeMap connectionFileMap) { this.connectionFileMap = connectionFileMap; } @@ -275,17 +280,23 @@ public List getConnectionsList() { return connectionsList; } - /** @param connectionsList The connectionsList to set */ + /** + * @param connectionsList The connectionsList to set + */ public void setConnectionsList(List connectionsList) { this.connectionsList = connectionsList; } - /** @param inputFolder The inputFolder to set */ + /** + * @param inputFolder The inputFolder to set + */ public void setInputFolder(FileObject inputFolder) { this.inputFolder = inputFolder; } - /** @param outputFolder The outputFolder to set */ + /** + * @param outputFolder The outputFolder to set + */ public void setOutputFolder(FileObject outputFolder) { this.outputFolder = outputFolder; } @@ -308,7 +319,9 @@ public HashMap getMigratedFilesMap() { return migratedFilesMap; } - /** @param migratedFilesMap The migratedFilesMap to set */ + /** + * @param migratedFilesMap The migratedFilesMap to set + */ public void setMigratedFilesMap(HashMap migratedFilesMap) { this.migratedFilesMap = migratedFilesMap; } @@ -322,7 +335,9 @@ public int getConnectionCounter() { return connectionCounter; } - /** @param connectionCounter The connectionCounter to set */ + /** + * @param connectionCounter The connectionCounter to set + */ public void setConnectionCounter(int connectionCounter) { this.connectionCounter = connectionCounter; } @@ -336,7 +351,9 @@ public int getVariableCounter() { return variableCounter; } - /** @param variableCounter The variableCounter to set */ + /** + * @param variableCounter The variableCounter to set + */ public void setVariableCounter(int variableCounter) { this.variableCounter = variableCounter; } @@ -351,7 +368,9 @@ public boolean isSkippingExistingTargetFiles() { return skippingExistingTargetFiles; } - /** @param skippingExistingTargetFiles The skippingExistingTargetFiles to set */ + /** + * @param skippingExistingTargetFiles The skippingExistingTargetFiles to set + */ @Override public void setSkippingExistingTargetFiles(boolean skippingExistingTargetFiles) { this.skippingExistingTargetFiles = skippingExistingTargetFiles; @@ -367,7 +386,9 @@ public String getSharedXmlFilename() { return sharedXmlFilename; } - /** @param sharedXmlFilename The sharedXmlFilename to set */ + /** + * @param sharedXmlFilename The sharedXmlFilename to set + */ @Override public void setSharedXmlFilename(String sharedXmlFilename) { this.sharedXmlFilename = sharedXmlFilename; @@ -383,7 +404,9 @@ public String getKettlePropertiesFilename() { return kettlePropertiesFilename; } - /** @param kettlePropertiesFilename The kettlePropertiesFilename to set */ + /** + * @param kettlePropertiesFilename The kettlePropertiesFilename to set + */ @Override public void setKettlePropertiesFilename(String kettlePropertiesFilename) { this.kettlePropertiesFilename = kettlePropertiesFilename; @@ -399,7 +422,9 @@ public String getJdbcPropertiesFilename() { return jdbcPropertiesFilename; } - /** @param jdbcPropertiesFilename The jdbcPropertiesFilename to set */ + /** + * @param jdbcPropertiesFilename The jdbcPropertiesFilename to set + */ @Override public void setJdbcPropertiesFilename(String jdbcPropertiesFilename) { this.jdbcPropertiesFilename = jdbcPropertiesFilename; @@ -424,7 +449,9 @@ public MultiMetadataProvider getMetadataProvider() { return metadataProvider; } - /** @param metadataProvider The metadataProvider to set */ + /** + * @param metadataProvider The metadataProvider to set + */ @Override public void setMetadataProvider(MultiMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; @@ -440,7 +467,9 @@ public String getTargetConfigFilename() { return targetConfigFilename; } - /** @param targetConfigFilename The targetConfigFilename to set */ + /** + * @param targetConfigFilename The targetConfigFilename to set + */ @Override public void setTargetConfigFilename(String targetConfigFilename) { this.targetConfigFilename = targetConfigFilename; @@ -471,7 +500,9 @@ public IVariables getCollectedVariables() { return collectedVariables; } - /** @param collectedVariables The collectedVariables to set */ + /** + * @param collectedVariables The collectedVariables to set + */ public void setCollectedVariables(IVariables collectedVariables) { this.collectedVariables = collectedVariables; } @@ -485,7 +516,9 @@ public IProgressMonitor getMonitor() { return monitor; } - /** @param monitor The monitor to set */ + /** + * @param monitor The monitor to set + */ public void setMonitor(IProgressMonitor monitor) { this.monitor = monitor; } @@ -499,7 +532,9 @@ public String getMetadataTargetFolder() { return metadataTargetFolder; } - /** @param metadataTargetFolder The metadataTargetFolder to set */ + /** + * @param metadataTargetFolder The metadataTargetFolder to set + */ public void setMetadataTargetFolder(String metadataTargetFolder) { this.metadataTargetFolder = metadataTargetFolder; } @@ -514,7 +549,9 @@ public boolean isSkippingHiddenFilesAndFolders() { return skippingHiddenFilesAndFolders; } - /** @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set */ + /** + * @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set + */ @Override public void setSkippingHiddenFilesAndFolders(boolean skippingHiddenFilesAndFolders) { this.skippingHiddenFilesAndFolders = skippingHiddenFilesAndFolders; @@ -530,7 +567,9 @@ public boolean isSkippingFolders() { return skippingFolders; } - /** @param skippingFolders The skippingFolders to set */ + /** + * @param skippingFolders The skippingFolders to set + */ @Override public void setSkippingFolders(boolean skippingFolders) { this.skippingFolders = skippingFolders; diff --git a/engine/src/main/java/org/apache/hop/imp/IHopImport.java b/engine/src/main/java/org/apache/hop/imp/IHopImport.java index 32d00d9f861..4d7a259b74b 100644 --- a/engine/src/main/java/org/apache/hop/imp/IHopImport.java +++ b/engine/src/main/java/org/apache/hop/imp/IHopImport.java @@ -89,7 +89,9 @@ public interface IHopImport { */ boolean isSkippingExistingTargetFiles(); - /** @param skippingExistingTargetFiles The skippingExistingTargetFiles to set */ + /** + * @param skippingExistingTargetFiles The skippingExistingTargetFiles to set + */ void setSkippingExistingTargetFiles(boolean skippingExistingTargetFiles); /** @@ -99,7 +101,9 @@ public interface IHopImport { */ String getSharedXmlFilename(); - /** @param sharedXmlFilename The sharedXmlFilename to set */ + /** + * @param sharedXmlFilename The sharedXmlFilename to set + */ void setSharedXmlFilename(String sharedXmlFilename); /** @@ -109,8 +113,11 @@ public interface IHopImport { */ String getKettlePropertiesFilename(); - /** @param kettlePropertiesFilename The kettlePropertiesFilename to set */ + /** + * @param kettlePropertiesFilename The kettlePropertiesFilename to set + */ void setKettlePropertiesFilename(String kettlePropertiesFilename); + /** * Gets jdbcPropertiesFilename * @@ -118,7 +125,9 @@ public interface IHopImport { */ String getJdbcPropertiesFilename(); - /** @param jdbcPropertiesFilename The jdbcPropertiesFilename to set */ + /** + * @param jdbcPropertiesFilename The jdbcPropertiesFilename to set + */ void setJdbcPropertiesFilename(String jdbcPropertiesFilename); /** @@ -135,15 +144,21 @@ public interface IHopImport { */ boolean isSkippingHiddenFilesAndFolders(); - /** @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set */ + /** + * @param skippingHiddenFilesAndFolders The skippingHiddenFilesAndFolders to set + */ void setSkippingHiddenFilesAndFolders(boolean skippingHiddenFilesAndFolders); - /** @param targetConfigFilename The targetConfigFilename to set */ + /** + * @param targetConfigFilename The targetConfigFilename to set + */ void setTargetConfigFilename(String targetConfigFilename); boolean isSkippingFolders(); - /** @param skippingFolders The skippingFolders to set */ + /** + * @param skippingFolders The skippingFolders to set + */ void setSkippingFolders(boolean skippingFolders); /** @@ -153,6 +168,8 @@ public interface IHopImport { */ MultiMetadataProvider getMetadataProvider(); - /** @param metadataProvider The metadataProvider to set */ + /** + * @param metadataProvider The metadataProvider to set + */ void setMetadataProvider(MultiMetadataProvider metadataProvider); } diff --git a/engine/src/main/java/org/apache/hop/imp/ImportPlugin.java b/engine/src/main/java/org/apache/hop/imp/ImportPlugin.java index f248fc9fc88..a2451f1166b 100644 --- a/engine/src/main/java/org/apache/hop/imp/ImportPlugin.java +++ b/engine/src/main/java/org/apache/hop/imp/ImportPlugin.java @@ -31,7 +31,9 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface ImportPlugin { - /** @return The ID of the plugin. You need to specify this on the command line. */ + /** + * @return The ID of the plugin. You need to specify this on the command line. + */ String id(); /** @@ -41,9 +43,13 @@ */ String name(); - /** @return The description of the plugin */ + /** + * @return The description of the plugin + */ String description(); - /** @return The documentation url */ + /** + * @return The documentation url + */ String documentationUrl() default ""; } diff --git a/engine/src/main/java/org/apache/hop/lineage/FieldnameLineage.java b/engine/src/main/java/org/apache/hop/lineage/FieldnameLineage.java index f3a12fef371..482e3e6c1d4 100644 --- a/engine/src/main/java/org/apache/hop/lineage/FieldnameLineage.java +++ b/engine/src/main/java/org/apache/hop/lineage/FieldnameLineage.java @@ -39,22 +39,30 @@ public FieldnameLineage(String inputFieldname, String outputFieldname) { this.outputFieldname = outputFieldname; } - /** @return the input Field name */ + /** + * @return the input Field name + */ public String getInputFieldname() { return inputFieldname; } - /** @param inputFieldname the input Field name to set */ + /** + * @param inputFieldname the input Field name to set + */ public void setInputFieldname(String inputFieldname) { this.inputFieldname = inputFieldname; } - /** @return the output Field name */ + /** + * @return the output Field name + */ public String getOutputFieldname() { return outputFieldname; } - /** @param outputFieldname the output Field name to set */ + /** + * @param outputFieldname the output Field name to set + */ public void setOutputFieldname(String outputFieldname) { this.outputFieldname = outputFieldname; } diff --git a/engine/src/main/java/org/apache/hop/lineage/PipelineDataLineage.java b/engine/src/main/java/org/apache/hop/lineage/PipelineDataLineage.java index 121deb150a4..937c7937819 100644 --- a/engine/src/main/java/org/apache/hop/lineage/PipelineDataLineage.java +++ b/engine/src/main/java/org/apache/hop/lineage/PipelineDataLineage.java @@ -17,6 +17,11 @@ package org.apache.hop.lineage; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; @@ -24,12 +29,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class will help calculate and contain the data lineage for all values in the pipeline.
* What we will get is a List of ValueLineage objects for all the values transforms in the pipeline. @@ -59,12 +58,16 @@ public void setPipelineMeta(PipelineMeta pipelineMeta) { this.pipelineMeta = pipelineMeta; } - /** @return the valueLineages */ + /** + * @return the valueLineages + */ public List getValueLineages() { return valueLineages; } - /** @param valueLineages the valueLineages to set */ + /** + * @param valueLineages the valueLineages to set + */ public void setValueLineages(List valueLineages) { this.valueLineages = valueLineages; } diff --git a/engine/src/main/java/org/apache/hop/lineage/ValueLineage.java b/engine/src/main/java/org/apache/hop/lineage/ValueLineage.java index a7d45c063cf..bd39fcbde1e 100644 --- a/engine/src/main/java/org/apache/hop/lineage/ValueLineage.java +++ b/engine/src/main/java/org/apache/hop/lineage/ValueLineage.java @@ -17,13 +17,12 @@ package org.apache.hop.lineage; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** * This class contains value lineage information.
* That means that we will have information on where and how a certain value is originating, being @@ -46,32 +45,44 @@ public ValueLineage(PipelineMeta pipelineMeta, IValueMeta valueMeta) { this.sourceTransforms = new ArrayList<>(); } - /** @return the pipelineMeta */ + /** + * @return the pipelineMeta + */ public PipelineMeta getPipelineMeta() { return pipelineMeta; } - /** @param pipelineMeta the pipelineMeta to set */ + /** + * @param pipelineMeta the pipelineMeta to set + */ public void setPipelineMeta(PipelineMeta pipelineMeta) { this.pipelineMeta = pipelineMeta; } - /** @return the valueMeta */ + /** + * @return the valueMeta + */ public IValueMeta getValueMeta() { return valueMeta; } - /** @param valueMeta the valueMeta to set */ + /** + * @param valueMeta the valueMeta to set + */ public void setValueMeta(IValueMeta valueMeta) { this.valueMeta = valueMeta; } - /** @return the sourceTransforms */ + /** + * @return the sourceTransforms + */ public List getSourceTransforms() { return sourceTransforms; } - /** @param sourceTransforms the sourceTransforms to set */ + /** + * @param sourceTransforms the sourceTransforms to set + */ public void setSourceTransforms(List sourceTransforms) { this.sourceTransforms = sourceTransforms; } diff --git a/engine/src/main/java/org/apache/hop/partition/PartitionSchema.java b/engine/src/main/java/org/apache/hop/partition/PartitionSchema.java index 0258f89d7ef..7a8f5f18509 100644 --- a/engine/src/main/java/org/apache/hop/partition/PartitionSchema.java +++ b/engine/src/main/java/org/apache/hop/partition/PartitionSchema.java @@ -17,6 +17,8 @@ package org.apache.hop.partition; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.HopMetadata; @@ -24,9 +26,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - /** * A partition schema allow you to partition a transform according into a number of partitions that * run independendly. It allows us to "map" @@ -106,32 +105,44 @@ public List calculatePartitionIds(IVariables variables) { } } - /** @return the partitionIDs */ + /** + * @return the partitionIDs + */ public List getPartitionIDs() { return partitionIDs; } - /** @param partitionIDs the partitionIDs to set */ + /** + * @param partitionIDs the partitionIDs to set + */ public void setPartitionIDs(List partitionIDs) { this.partitionIDs = partitionIDs; } - /** @return the dynamicallyDefined */ + /** + * @return the dynamicallyDefined + */ public boolean isDynamicallyDefined() { return dynamicallyDefined; } - /** @param dynamicallyDefined the dynamicallyDefined to set */ + /** + * @param dynamicallyDefined the dynamicallyDefined to set + */ public void setDynamicallyDefined(boolean dynamicallyDefined) { this.dynamicallyDefined = dynamicallyDefined; } - /** @return the number of partitions */ + /** + * @return the number of partitions + */ public String getNumberOfPartitions() { return numberOfPartitions; } - /** @param numberOfPartitions the number of partitions to set... */ + /** + * @param numberOfPartitions the number of partitions to set... + */ public void setNumberOfPartitions(String numberOfPartitions) { this.numberOfPartitions = numberOfPartitions; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/AbstractMetaInfo.java b/engine/src/main/java/org/apache/hop/pipeline/AbstractMetaInfo.java index 309b34d56ba..56e1e1d3585 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/AbstractMetaInfo.java +++ b/engine/src/main/java/org/apache/hop/pipeline/AbstractMetaInfo.java @@ -18,9 +18,8 @@ package org.apache.hop.pipeline; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Date; +import org.apache.hop.metadata.api.HopMetadataProperty; public abstract class AbstractMetaInfo { diff --git a/engine/src/main/java/org/apache/hop/pipeline/CheckTransformsExtension.java b/engine/src/main/java/org/apache/hop/pipeline/CheckTransformsExtension.java index 2f2b28b393a..44c982cce59 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/CheckTransformsExtension.java +++ b/engine/src/main/java/org/apache/hop/pipeline/CheckTransformsExtension.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - public class CheckTransformsExtension { private final List remarks; private final IVariables variables; diff --git a/engine/src/main/java/org/apache/hop/pipeline/Pipeline.java b/engine/src/main/java/org/apache/hop/pipeline/Pipeline.java index 2bf69ddc272..70069181c3c 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/Pipeline.java +++ b/engine/src/main/java/org/apache/hop/pipeline/Pipeline.java @@ -17,6 +17,31 @@ package org.apache.hop.pipeline; +import static com.google.common.base.Preconditions.checkNotNull; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.BIT_STATUS_SUM; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.FINISHED; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.INITIALIZING; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.PAUSED; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.PREPARING; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.RUNNING; +import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.STOPPED; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; @@ -91,32 +116,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; -import java.util.UUID; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.BIT_STATUS_SUM; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.FINISHED; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.INITIALIZING; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.PAUSED; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.PREPARING; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.RUNNING; -import static org.apache.hop.pipeline.Pipeline.BitMaskStatus.STOPPED; - /** * This class represents the information and operations associated with the execution of a Pipeline. * It loads, instantiates, initializes, runs, and monitors the execution of the pipeline contained @@ -1351,6 +1350,7 @@ public void pipelineCompleted() throws HopException { pipelineWaitUntilFinishedBlockingQueue.add(new Object()); } } + /** * Fires the start-event listeners (if any are registered). * diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineConfiguration.java b/engine/src/main/java/org/apache/hop/pipeline/PipelineConfiguration.java index 224189bf31d..e701ce28f20 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelineConfiguration.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineConfiguration.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline; +import java.io.IOException; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.metadata.SerializableMetadataProvider; @@ -27,8 +28,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.io.IOException; - public class PipelineConfiguration { public static final String XML_TAG = "pipeline_configuration"; @@ -83,23 +82,31 @@ public static final PipelineConfiguration fromXml(String xml) return new PipelineConfiguration(configNode); } - /** @return the pipelineExecutionConfiguration */ + /** + * @return the pipelineExecutionConfiguration + */ public PipelineExecutionConfiguration getPipelineExecutionConfiguration() { return pipelineExecutionConfiguration; } - /** @param pipelineExecutionConfiguration the pipelineExecutionConfiguration to set */ + /** + * @param pipelineExecutionConfiguration the pipelineExecutionConfiguration to set + */ public void setPipelineExecutionConfiguration( PipelineExecutionConfiguration pipelineExecutionConfiguration) { this.pipelineExecutionConfiguration = pipelineExecutionConfiguration; } - /** @return the pipelineMeta */ + /** + * @return the pipelineMeta + */ public PipelineMeta getPipelineMeta() { return pipelineMeta; } - /** @param pipelineMeta the pipelineMeta to set */ + /** + * @param pipelineMeta the pipelineMeta to set + */ public void setPipelineMeta(PipelineMeta pipelineMeta) { this.pipelineMeta = pipelineMeta; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineExecutionConfiguration.java b/engine/src/main/java/org/apache/hop/pipeline/PipelineExecutionConfiguration.java index 834bd19c417..20517b61b5b 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelineExecutionConfiguration.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineExecutionConfiguration.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; import org.apache.commons.lang.StringUtils; import org.apache.hop.IExecutionConfiguration; import org.apache.hop.core.Const; @@ -29,13 +35,6 @@ import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - public class PipelineExecutionConfiguration implements IExecutionConfiguration, IXml { public static final String XML_TAG = "pipeline_execution_configuration"; @@ -89,25 +88,33 @@ public Object clone() { } } - /** @param parametersMap the parameters to set */ + /** + * @param parametersMap the parameters to set + */ @Override public void setParametersMap(Map parametersMap) { this.parametersMap = parametersMap; } - /** @return the parameters. */ + /** + * @return the parameters. + */ @Override public Map getParametersMap() { return parametersMap; } - /** @return the variables */ + /** + * @return the variables + */ @Override public Map getVariablesMap() { return variablesMap; } - /** @param variablesMap the variables to set */ + /** + * @param variablesMap the variables to set + */ @Override public void setVariablesMap(Map variablesMap) { this.variablesMap = variablesMap; @@ -187,13 +194,17 @@ public void getUsedVariables(IVariables variables, PipelineMeta pipelineMeta) { } } - /** @return the logLevel */ + /** + * @return the logLevel + */ @Override public LogLevel getLogLevel() { return logLevel; } - /** @param logLevel the logLevel to set */ + /** + * @param logLevel the logLevel to set + */ @Override public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; @@ -311,46 +322,62 @@ public PipelineExecutionConfiguration(Node trecNode) throws HopException { } } - /** @return the previousResult */ + /** + * @return the previousResult + */ @Override public Result getPreviousResult() { return previousResult; } - /** @param previousResult the previousResult to set */ + /** + * @param previousResult the previousResult to set + */ @Override public void setPreviousResult(Result previousResult) { this.previousResult = previousResult; } - /** @return the clearingLog */ + /** + * @return the clearingLog + */ @Override public boolean isClearingLog() { return clearingLog; } - /** @param clearingLog the clearingLog to set */ + /** + * @param clearingLog the clearingLog to set + */ @Override public void setClearingLog(boolean clearingLog) { this.clearingLog = clearingLog; } - /** @return the passingExport */ + /** + * @return the passingExport + */ public boolean isPassingExport() { return passingExport; } - /** @param passingExport the passingExport to set */ + /** + * @param passingExport the passingExport to set + */ public void setPassingExport(boolean passingExport) { this.passingExport = passingExport; } - /** @return the showingSubComponents */ + /** + * @return the showingSubComponents + */ public boolean isShowingSubComponents() { return showingSubComponents; } - /** @param showingSubComponents the showingSubComponents to set */ + /** + * @param showingSubComponents the showingSubComponents to set + */ public void setShowingSubComponents(boolean showingSubComponents) { this.showingSubComponents = showingSubComponents; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineHopMeta.java b/engine/src/main/java/org/apache/hop/pipeline/PipelineHopMeta.java index 4692449689b..28cdfd5f42b 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelineHopMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineHopMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline; +import java.util.List; +import java.util.Objects; import org.apache.hop.base.BaseHopMeta; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopXmlException; @@ -25,9 +27,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; -import java.util.Objects; - /** Defines a link between 2 transforms in a pipeline */ public class PipelineHopMeta extends BaseHopMeta implements Comparable, Cloneable { @@ -51,11 +50,9 @@ public PipelineHopMeta() { public PipelineHopMeta(Node hopNode, List transforms) throws HopXmlException { try { - this.from = searchTransform(transforms, - XmlHandler.getTagValue(hopNode, XML_FROM_TAG)); - this.to = - searchTransform(transforms, XmlHandler.getTagValue(hopNode, XML_TO_TAG)); - this.enabled = getTagValueAsBoolean(hopNode, XML_ENABLED_TAG, true); + this.from = searchTransform(transforms, XmlHandler.getTagValue(hopNode, XML_FROM_TAG)); + this.to = searchTransform(transforms, XmlHandler.getTagValue(hopNode, XML_TO_TAG)); + this.enabled = getTagValueAsBoolean(hopNode, XML_ENABLED_TAG, true); } catch (Exception e) { throw new HopXmlException( BaseMessages.getString(PKG, "PipelineHopMeta.Exception.UnableToLoadHopInfo"), e); @@ -138,10 +135,8 @@ public String getXml() { if (this.from != null && this.to != null) { xml.append(" ").append(XmlHandler.openTag(XML_HOP_TAG)).append(Const.CR); - xml.append(" ") - .append(XmlHandler.addTagValue(XML_FROM_TAG, this.from.getName())); - xml.append(" ") - .append(XmlHandler.addTagValue(XML_TO_TAG, this.to.getName())); + xml.append(" ").append(XmlHandler.addTagValue(XML_FROM_TAG, this.from.getName())); + xml.append(" ").append(XmlHandler.addTagValue(XML_TO_TAG, this.to.getName())); xml.append(" ").append(XmlHandler.addTagValue(XML_ENABLED_TAG, enabled)); xml.append(" ").append(XmlHandler.closeTag(XML_HOP_TAG)).append(Const.CR); } diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineMetaSearchAnalyser.java b/engine/src/main/java/org/apache/hop/pipeline/PipelineMetaSearchAnalyser.java index d288be755bc..dd1d5c7add7 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelineMetaSearchAnalyser.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineMetaSearchAnalyser.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.NotePadMeta; import org.apache.hop.core.plugins.IPlugin; import org.apache.hop.core.plugins.PluginRegistry; @@ -30,9 +32,6 @@ import org.apache.hop.pipeline.transform.ITransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @SearchableAnalyserPlugin(id = "PipelineMetaSearchAnalyser", name = "Search in pipeline metadata") public class PipelineMetaSearchAnalyser extends BaseSearchableAnalyser implements ISearchableAnalyser { diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java index dca67a201e9..4d8efe46f1d 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java @@ -309,18 +309,18 @@ private void drawPipeline() throws HopException { checkDrawSlowTransformIndicator(transformMeta); } } - + // Display after slow transform indicator for (int i = 0; i < pipelineMeta.nrTransforms(); i++) { TransformMeta transformMeta = pipelineMeta.getTransform(i); - - // Draw transform information icon if description is available + + // Draw transform information icon if description is available drawTransformInformationIndicator(transformMeta); - + // Draw transform status indicators (running vs. done) drawTransformStatusIndicator(transformMeta); } - + // Draw data grid indicators (output data available) if (outputRowsMap != null && !outputRowsMap.isEmpty()) { for (int i = 0; i < pipelineMeta.nrTransforms(); i++) { @@ -387,7 +387,7 @@ private void checkDrawSlowTransformIndicator(TransformMeta transformMeta) { // if the transform can't keep up with its input, mark it by drawing an animation boolean isSlow = inputRows * 0.85 > outputRows; if (isSlow) { -// gc.setLineWidth(lineWidth + 1); + // gc.setLineWidth(lineWidth + 1); if (transformMeta.isSelected()) { gc.setLineWidth(lineWidth + 2); } else { @@ -398,15 +398,15 @@ private void checkDrawSlowTransformIndicator(TransformMeta transformMeta) { gc.setForeground(EColor.BACKGROUND); gc.setLineStyle(ELineStyle.SOLID); gc.drawRoundRectangle(x - 1, y - 1, iconSize + 1, iconSize + 1, 8, 8); - + gc.setForeground(EColor.DARKGRAY); gc.setLineStyle(ELineStyle.DOT); gc.drawRoundRectangle(x - 1, y - 1, iconSize + 1, iconSize + 1, 8, 8); } else { gc.setForeground(EColor.DARKGRAY); - gc.setLineStyle(ELineStyle.SOLID); + gc.setLineStyle(ELineStyle.SOLID); gc.drawRoundRectangle(x - 1, y - 1, iconSize + 1, iconSize + 1, 8, 8); - + gc.setForeground(EColor.BACKGROUND); gc.setLineStyle(ELineStyle.DOT); gc.drawRoundRectangle(x - 1, y - 1, iconSize + 1, iconSize + 1, 8, 8); @@ -599,7 +599,7 @@ private void drawTransformInformationIndicator(TransformMeta transformMeta) thro Point screen = real2screen(pt.x, pt.y); int x = screen.x; int y = screen.y; - + int xInfo = x - (miniIconSize / 2) - 1; int yInfo = y - (miniIconSize / 2) - 1; gc.drawImage(EImage.INFO_DISABLED, xInfo, yInfo, magnification); @@ -615,7 +615,7 @@ private void drawTransformInformationIndicator(TransformMeta transformMeta) thro transformMeta)); } } - + private void drawTransformStatusIndicator(TransformMeta transformMeta) throws HopException { if (transformMeta == null) { @@ -866,11 +866,11 @@ private void drawTransform(TransformMeta transformMeta) throws HopException { // See if we need to draw a line under the name to make the name look like a hyperlink. // if (name.equals(mouseOverName)) { - gc.setLineWidth(lineWidth); + gc.setLineWidth(lineWidth); gc.drawLine( namePosition.x, namePosition.y + nameExtent.y, - namePosition.x + nameExtent.x , + namePosition.x + nameExtent.x, namePosition.y + nameExtent.y); } @@ -959,7 +959,8 @@ public Point getNamePosition(String string, Point screen, int iconsize) { return new Point(xpos, ypos); } - private void drawLine(TransformMeta from, TransformMeta to, PipelineHopMeta hop, boolean isCandidate) + private void drawLine( + TransformMeta from, TransformMeta to, PipelineHopMeta hop, boolean isCandidate) throws HopException { int[] line = getLine(from, to); diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterExtension.java b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterExtension.java index 18f3c423101..29e2e2b84ab 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterExtension.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterExtension.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline; +import java.util.List; +import java.util.Map; import org.apache.hop.core.gui.AreaOwner; import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.IGc; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - public class PipelinePainterExtension { public IGc gc; diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterFlyoutExtension.java b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterFlyoutExtension.java index 86013d6556d..8eb9fc6b333 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterFlyoutExtension.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainterFlyoutExtension.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline; +import java.util.List; import org.apache.hop.core.gui.AreaOwner; import org.apache.hop.core.gui.IGc; import org.apache.hop.core.gui.Point; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - public class PipelinePainterFlyoutExtension { public IGc gc; diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java b/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java index c8df89a9e0b..3025e859545 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline; +import java.util.ArrayList; +import java.util.HashMap; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.Point; @@ -24,9 +26,6 @@ import org.apache.hop.core.svg.HopSvgGraphics2D; import org.apache.hop.core.variables.IVariables; -import java.util.ArrayList; -import java.util.HashMap; - public class PipelineSvgPainter { public static final String generatePipelineSvg( diff --git a/engine/src/main/java/org/apache/hop/pipeline/RowProducer.java b/engine/src/main/java/org/apache/hop/pipeline/RowProducer.java index 404ee359c9d..a24a6c03fa4 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/RowProducer.java +++ b/engine/src/main/java/org/apache/hop/pipeline/RowProducer.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline; +import java.util.concurrent.TimeUnit; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.ITransform; -import java.util.concurrent.TimeUnit; - /** Allows you to "Inject" rows into a transform. */ public class RowProducer { private IRowSet rowSet; @@ -62,7 +61,9 @@ public boolean putRow(IRowMeta rowMeta, Object[] row, boolean block) { return rowSet.putRow(rowMeta, row); } - /** @see IRowSet#putRowWait(IRowMeta, Object[], long, TimeUnit) */ + /** + * @see IRowSet#putRowWait(IRowMeta, Object[], long, TimeUnit) + */ public boolean putRowWait(IRowMeta rowMeta, Object[] rowData, long time, TimeUnit tu) { return rowSet.putRowWait(rowMeta, rowData, time, tu); } @@ -75,22 +76,30 @@ public void finished() { rowSet.setDone(); } - /** @return Returns the rowSet. */ + /** + * @return Returns the rowSet. + */ public IRowSet getRowSet() { return rowSet; } - /** @param rowSet The rowSet to set. */ + /** + * @param rowSet The rowSet to set. + */ public void setRowSet(IRowSet rowSet) { this.rowSet = rowSet; } - /** @return Returns the ITransform. */ + /** + * @return Returns the ITransform. + */ public ITransform getTransform() { return transform; } - /** @param transform The ITransform to set. */ + /** + * @param transform The ITransform to set. + */ public void setTransform(ITransform transform) { this.transform = transform; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/SingleThreadedPipelineExecutor.java b/engine/src/main/java/org/apache/hop/pipeline/SingleThreadedPipelineExecutor.java index d88fad7ce88..befa40af81c 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/SingleThreadedPipelineExecutor.java +++ b/engine/src/main/java/org/apache/hop/pipeline/SingleThreadedPipelineExecutor.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; @@ -26,9 +28,6 @@ import org.apache.hop.pipeline.transform.TransformMetaDataCombi; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.List; - public class SingleThreadedPipelineExecutor { private List transforms; diff --git a/engine/src/main/java/org/apache/hop/pipeline/TransformWithMappingMeta.java b/engine/src/main/java/org/apache/hop/pipeline/TransformWithMappingMeta.java index be0643e75da..59c28cd0713 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/TransformWithMappingMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/TransformWithMappingMeta.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline; +import static org.apache.hop.core.Const.INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER; +import static org.apache.hop.core.Const.INTERNAL_VARIABLE_PIPELINE_FILENAME_DIRECTORY; +import static org.apache.hop.core.Const.INTERNAL_VARIABLE_WORKFLOW_FILENAME_FOLDER; +import static org.apache.hop.core.Const.INTERNAL_VARIABLE_WORKFLOW_FILENAME_NAME; + import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; @@ -42,11 +47,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import static org.apache.hop.core.Const.INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER; -import static org.apache.hop.core.Const.INTERNAL_VARIABLE_PIPELINE_FILENAME_DIRECTORY; -import static org.apache.hop.core.Const.INTERNAL_VARIABLE_WORKFLOW_FILENAME_FOLDER; -import static org.apache.hop.core.Const.INTERNAL_VARIABLE_WORKFLOW_FILENAME_NAME; - /** This class is supposed to use in transforms where the mapping to sub pipelines takes place */ public abstract class TransformWithMappingMeta
extends BaseTransformMeta { diff --git a/engine/src/main/java/org/apache/hop/pipeline/config/PipelineRunConfiguration.java b/engine/src/main/java/org/apache/hop/pipeline/config/PipelineRunConfiguration.java index c7cf73f4d42..fb1b45f7fbf 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/config/PipelineRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/pipeline/config/PipelineRunConfiguration.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.config; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.DescribedVariable; @@ -28,9 +30,6 @@ import org.apache.hop.metadata.api.IHopMetadata; import org.apache.hop.metadata.api.IHopMetadataProvider; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "pipeline-run-configuration", name = "Pipeline Run Configuration", @@ -202,15 +201,15 @@ public void applyToVariables(IVariables variables) { } /** - * Find the first default run configuration in the metadata and return it. - * Return null if there's no default. + * Find the first default run configuration in the metadata and return it. Return null if there's + * no default. * * @param metadataProvider * @return The default run configuration or null if none is specified. * @throws HopException */ - public static final PipelineRunConfiguration findDefault( - IHopMetadataProvider metadataProvider) throws HopException { + public static final PipelineRunConfiguration findDefault(IHopMetadataProvider metadataProvider) + throws HopException { for (PipelineRunConfiguration runConfiguration : metadataProvider.getSerializer(PipelineRunConfiguration.class).loadAll()) { if (runConfiguration.isDefaultSelection()) { diff --git a/engine/src/main/java/org/apache/hop/pipeline/debug/IBreakPointListener.java b/engine/src/main/java/org/apache/hop/pipeline/debug/IBreakPointListener.java index 9cd363ead74..fe00548506a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/debug/IBreakPointListener.java +++ b/engine/src/main/java/org/apache/hop/pipeline/debug/IBreakPointListener.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.debug; -import org.apache.hop.core.row.IRowMeta; - import java.util.List; +import org.apache.hop.core.row.IRowMeta; public interface IBreakPointListener { void breakPointHit( diff --git a/engine/src/main/java/org/apache/hop/pipeline/debug/PipelineDebugMeta.java b/engine/src/main/java/org/apache/hop/pipeline/debug/PipelineDebugMeta.java index 97b3d9291e6..2b9eeff714a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/debug/PipelineDebugMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/debug/PipelineDebugMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.debug; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -27,10 +30,6 @@ import org.apache.hop.pipeline.transform.RowAdapter; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * For a certain pipeline, we want to be able to insert break-points into a pipeline. These * breakpoints can be applied to transforms. When a certain condition is met, the pipeline will be @@ -49,22 +48,30 @@ public PipelineDebugMeta(PipelineMeta pipelineMeta) { transformDebugMetaMap = new HashMap<>(); } - /** @return the referenced pipeline metadata */ + /** + * @return the referenced pipeline metadata + */ public PipelineMeta getPipelineMeta() { return pipelineMeta; } - /** @param pipelineMeta the pipeline metadata to reference */ + /** + * @param pipelineMeta the pipeline metadata to reference + */ public void setPipelineMeta(PipelineMeta pipelineMeta) { this.pipelineMeta = pipelineMeta; } - /** @return the map that contains the debugging information per transform */ + /** + * @return the map that contains the debugging information per transform + */ public Map getTransformDebugMetaMap() { return transformDebugMetaMap; } - /** @param transformDebugMeta the map that contains the debugging information per transform */ + /** + * @param transformDebugMeta the map that contains the debugging information per transform + */ public void setTransformDebugMetaMap(Map transformDebugMeta) { this.transformDebugMetaMap = transformDebugMeta; } @@ -219,7 +226,9 @@ public int getTotalNumberOfHits() { return total; } - /** @return the number of transforms used to preview or debug on */ + /** + * @return the number of transforms used to preview or debug on + */ public int getNrOfUsedTransforms() { int nr = 0; diff --git a/engine/src/main/java/org/apache/hop/pipeline/debug/TransformDebugMeta.java b/engine/src/main/java/org/apache/hop/pipeline/debug/TransformDebugMeta.java index 398bf5dd861..e2481ce52d5 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/debug/TransformDebugMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/debug/TransformDebugMeta.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.debug; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Condition; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** * This class is used to define debugging meta data for a certain transform. Basically it defines * for which condition a break-point becomes active. @@ -60,22 +59,30 @@ public TransformDebugMeta(TransformMeta transformMeta) { this.transformMeta = transformMeta; } - /** @return the transformMeta */ + /** + * @return the transformMeta + */ public TransformMeta getTransformMeta() { return transformMeta; } - /** @param transformMeta the transformMeta to set */ + /** + * @param transformMeta the transformMeta to set + */ public void setTransformMeta(TransformMeta transformMeta) { this.transformMeta = transformMeta; } - /** @return the condition */ + /** + * @return the condition + */ public Condition getCondition() { return condition; } - /** @param condition the condition to set */ + /** + * @param condition the condition to set + */ public void setCondition(Condition condition) { this.condition = condition; } @@ -106,62 +113,86 @@ public void fireBreakPointListeners(PipelineDebugMeta pipelineDebugMeta) { numberOfHits++; } - /** @return the rowCount */ + /** + * @return the rowCount + */ public int getRowCount() { return rowCount; } - /** @param rowCount the rowCount to set */ + /** + * @param rowCount the rowCount to set + */ public void setRowCount(int rowCount) { this.rowCount = rowCount; } - /** @return the readingFirstRows */ + /** + * @return the readingFirstRows + */ public boolean isReadingFirstRows() { return readingFirstRows; } - /** @param readingFirstRows the readingFirstRows to set */ + /** + * @param readingFirstRows the readingFirstRows to set + */ public void setReadingFirstRows(boolean readingFirstRows) { this.readingFirstRows = readingFirstRows; } - /** @return the pausingOnBreakPoint */ + /** + * @return the pausingOnBreakPoint + */ public boolean isPausingOnBreakPoint() { return pausingOnBreakPoint; } - /** @param pausingOnBreakPoint the pausingOnBreakPoint to set */ + /** + * @param pausingOnBreakPoint the pausingOnBreakPoint to set + */ public void setPausingOnBreakPoint(boolean pausingOnBreakPoint) { this.pausingOnBreakPoint = pausingOnBreakPoint; } - /** @return the rowBufferMeta */ + /** + * @return the rowBufferMeta + */ public IRowMeta getRowBufferMeta() { return rowBufferMeta; } - /** @param rowBufferMeta the rowBufferMeta to set */ + /** + * @param rowBufferMeta the rowBufferMeta to set + */ public void setRowBufferMeta(IRowMeta rowBufferMeta) { this.rowBufferMeta = rowBufferMeta; } - /** @return the rowBuffer */ + /** + * @return the rowBuffer + */ public List getRowBuffer() { return rowBuffer; } - /** @param rowBuffer the rowBuffer to set */ + /** + * @param rowBuffer the rowBuffer to set + */ public void setRowBuffer(List rowBuffer) { this.rowBuffer = rowBuffer; } - /** @return the number of times the break-point listeners got called */ + /** + * @return the number of times the break-point listeners got called + */ public int getNumberOfHits() { return numberOfHits; } - /** @param numberOfHits the number of times the break-point listeners got called */ + /** + * @param numberOfHits the number of times the break-point listeners got called + */ public void setNumberOfHits(int numberOfHits) { this.numberOfHits = numberOfHits; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/EngineComponent.java b/engine/src/main/java/org/apache/hop/pipeline/engine/EngineComponent.java index 8ffbb16ecc8..777edf9f1af 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/EngineComponent.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/EngineComponent.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.engine; +import java.util.Date; +import java.util.Objects; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.logging.LogLevel; @@ -24,9 +26,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.Date; -import java.util.Objects; - public class EngineComponent implements IEngineComponent { private static final Class PKG = BaseTransform.class; // For Translator @@ -94,7 +93,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -109,7 +110,9 @@ public int getCopyNr() { return copyNr; } - /** @param copyNr The copyNr to set */ + /** + * @param copyNr The copyNr to set + */ public void setCopyNr(int copyNr) { this.copyNr = copyNr; } @@ -124,7 +127,9 @@ public ILogChannel getLogChannel() { return logChannel; } - /** @param logChannel The logChannel to set */ + /** + * @param logChannel The logChannel to set + */ public void setLogChannel(ILogChannel logChannel) { this.logChannel = logChannel; } @@ -139,7 +144,9 @@ public String getLogChannelId() { return logChannelId; } - /** @param logChannelId The logChannelId to set */ + /** + * @param logChannelId The logChannelId to set + */ public void setLogChannelId(String logChannelId) { this.logChannelId = logChannelId; } @@ -154,7 +161,9 @@ public LogLevel getLogLevel() { return logLevel; } - /** @param logLevel The logLevel to set */ + /** + * @param logLevel The logLevel to set + */ @Override public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; @@ -170,7 +179,9 @@ public String getLogText() { return logText; } - /** @param logText The logText to set */ + /** + * @param logText The logText to set + */ public void setLogText(String logText) { this.logText = logText; } @@ -185,7 +196,9 @@ public boolean isRunning() { return running; } - /** @param running The running to set */ + /** + * @param running The running to set + */ public void setRunning(boolean running) { this.running = running; } @@ -200,7 +213,9 @@ public boolean isSelected() { return selected; } - /** @param selected The selected to set */ + /** + * @param selected The selected to set + */ public void setSelected(boolean selected) { this.selected = selected; } @@ -227,7 +242,9 @@ public void removeRowListener(IRowListener rowListener) { "Removing a row listener to this transform is not possible as it's not part of a running engine"); } - /** @param errors The errors to set */ + /** + * @param errors The errors to set + */ public void setErrors(long errors) { this.errors = errors; } @@ -242,7 +259,9 @@ public long getLinesRead() { return linesRead; } - /** @param linesRead The linesRead to set */ + /** + * @param linesRead The linesRead to set + */ public void setLinesRead(long linesRead) { this.linesRead = linesRead; } @@ -257,7 +276,9 @@ public long getLinesWritten() { return linesWritten; } - /** @param linesWritten The linesWritten to set */ + /** + * @param linesWritten The linesWritten to set + */ public void setLinesWritten(long linesWritten) { this.linesWritten = linesWritten; } @@ -272,7 +293,9 @@ public long getLinesInput() { return linesInput; } - /** @param linesInput The linesInput to set */ + /** + * @param linesInput The linesInput to set + */ public void setLinesInput(long linesInput) { this.linesInput = linesInput; } @@ -287,7 +310,9 @@ public long getLinesOutput() { return linesOutput; } - /** @param linesOutput The linesOutput to set */ + /** + * @param linesOutput The linesOutput to set + */ public void setLinesOutput(long linesOutput) { this.linesOutput = linesOutput; } @@ -302,7 +327,9 @@ public long getLinesRejected() { return linesRejected; } - /** @param linesRejected The linesRejected to set */ + /** + * @param linesRejected The linesRejected to set + */ public void setLinesRejected(long linesRejected) { this.linesRejected = linesRejected; } @@ -317,7 +344,9 @@ public long getLinesUpdated() { return linesUpdated; } - /** @param linesUpdated The linesUpdated to set */ + /** + * @param linesUpdated The linesUpdated to set + */ public void setLinesUpdated(long linesUpdated) { this.linesUpdated = linesUpdated; } @@ -342,7 +371,9 @@ public long getExecutionDuration() { return executionDuration; } - /** @param executionDuration The executionDuration to set */ + /** + * @param executionDuration The executionDuration to set + */ public void setExecutionDuration(long executionDuration) { this.executionDuration = executionDuration; } @@ -357,7 +388,9 @@ public long getInputBufferSize() { return inputBufferSize; } - /** @param inputBufferSize The inputBufferSize to set */ + /** + * @param inputBufferSize The inputBufferSize to set + */ public void setInputBufferSize(long inputBufferSize) { this.inputBufferSize = inputBufferSize; } @@ -372,7 +405,9 @@ public long getOutputBufferSize() { return outputBufferSize; } - /** @param outputBufferSize The outputBufferSize to set */ + /** + * @param outputBufferSize The outputBufferSize to set + */ public void setOutputBufferSize(long outputBufferSize) { this.outputBufferSize = outputBufferSize; } @@ -387,7 +422,9 @@ public boolean isStopped() { return stopped; } - /** @param stopped The stopped to set */ + /** + * @param stopped The stopped to set + */ public void setStopped(boolean stopped) { this.stopped = stopped; } @@ -402,7 +439,9 @@ public boolean isPaused() { return paused; } - /** @param paused The paused to set */ + /** + * @param paused The paused to set + */ public void setPaused(boolean paused) { this.paused = paused; } @@ -417,7 +456,9 @@ public ComponentExecutionStatus getStatus() { return status; } - /** @param status The status to set */ + /** + * @param status The status to set + */ public void setStatus(ComponentExecutionStatus status) { this.status = status; } @@ -432,7 +473,9 @@ public Date getInitStartDate() { return initStartDate; } - /** @param initStartDate The initStartDate to set */ + /** + * @param initStartDate The initStartDate to set + */ @Override public void setInitStartDate(Date initStartDate) { this.initStartDate = initStartDate; @@ -448,7 +491,9 @@ public Date getExecutionStartDate() { return executionStartDate; } - /** @param executionStartDate The executionStartDate to set */ + /** + * @param executionStartDate The executionStartDate to set + */ @Override public void setExecutionStartDate(Date executionStartDate) { this.executionStartDate = executionStartDate; @@ -464,7 +509,9 @@ public Date getFirstRowReadDate() { return firstRowReadDate; } - /** @param firstRowReadDate The firstRowReadDate to set */ + /** + * @param firstRowReadDate The firstRowReadDate to set + */ @Override public void setFirstRowReadDate(Date firstRowReadDate) { this.firstRowReadDate = firstRowReadDate; @@ -480,7 +527,9 @@ public Date getLastRowWrittenDate() { return lastRowWrittenDate; } - /** @param lastRowWrittenDate The lastRowWrittenDate to set */ + /** + * @param lastRowWrittenDate The lastRowWrittenDate to set + */ @Override public void setLastRowWrittenDate(Date lastRowWrittenDate) { this.lastRowWrittenDate = lastRowWrittenDate; @@ -496,7 +545,9 @@ public Date getExecutionEndDate() { return executionEndDate; } - /** @param executionEndDate The executionEndDate to set */ + /** + * @param executionEndDate The executionEndDate to set + */ @Override public void setExecutionEndDate(Date executionEndDate) { this.executionEndDate = executionEndDate; diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetric.java b/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetric.java index e4b284759eb..a3a747bb82c 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetric.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetric.java @@ -64,7 +64,9 @@ public String getCode() { return code; } - /** @param code The code to set */ + /** + * @param code The code to set + */ public void setCode(String code) { this.code = code; } @@ -79,7 +81,9 @@ public String getHeader() { return header; } - /** @param header The header to set */ + /** + * @param header The header to set + */ public void setHeader(String header) { this.header = header; } @@ -94,7 +98,9 @@ public String getTooltip() { return tooltip; } - /** @param tooltip The tooltip to set */ + /** + * @param tooltip The tooltip to set + */ public void setTooltip(String tooltip) { this.tooltip = tooltip; } @@ -109,7 +115,9 @@ public String getDisplayPriority() { return displayPriority; } - /** @param displayPriority The displayPriority to set */ + /** + * @param displayPriority The displayPriority to set + */ public void setDisplayPriority(String displayPriority) { this.displayPriority = displayPriority; } @@ -124,7 +132,9 @@ public boolean isNumeric() { return numeric; } - /** @param numeric The numeric to set */ + /** + * @param numeric The numeric to set + */ public void setNumeric(boolean numeric) { this.numeric = numeric; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetrics.java b/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetrics.java index 89dc80fe916..cca60381b72 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetrics.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/EngineMetrics.java @@ -17,8 +17,6 @@ package org.apache.hop.pipeline.engine; -import org.apache.hop.pipeline.performance.PerformanceSnapShot; - import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -26,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.hop.pipeline.performance.PerformanceSnapShot; /** Describes the metrics you can get from an execution engine */ public class EngineMetrics { @@ -177,7 +176,9 @@ public Date getStartDate() { return startDate; } - /** @param startDate The startDate to set */ + /** + * @param startDate The startDate to set + */ public void setStartDate(Date startDate) { this.startDate = startDate; } @@ -191,7 +192,9 @@ public Date getEndDate() { return endDate; } - /** @param endDate The endDate to set */ + /** + * @param endDate The endDate to set + */ public void setEndDate(Date endDate) { this.endDate = endDate; } @@ -205,7 +208,9 @@ public Map> getComponentMetricsMap() return componentMetricsMap; } - /** @param componentMetricsMap The componentMetricsMap to set */ + /** + * @param componentMetricsMap The componentMetricsMap to set + */ public void setComponentMetricsMap( Map> componentMetricsMap) { this.componentMetricsMap = componentMetricsMap; @@ -220,7 +225,9 @@ public Map getComponentStatusMap() { return componentStatusMap; } - /** @param componentStatusMap The componentStatusMap to set */ + /** + * @param componentStatusMap The componentStatusMap to set + */ public void setComponentStatusMap(Map componentStatusMap) { this.componentStatusMap = componentStatusMap; } @@ -234,7 +241,9 @@ public Map getComponentSpeedMap() { return componentSpeedMap; } - /** @param componentSpeedMap The componentSpeedMap to set */ + /** + * @param componentSpeedMap The componentSpeedMap to set + */ public void setComponentSpeedMap(Map componentSpeedMap) { this.componentSpeedMap = componentSpeedMap; } @@ -248,7 +257,9 @@ public Map getComponentRunningMap() { return componentRunningMap; } - /** @param componentRunningMap The componentRunningMap to set */ + /** + * @param componentRunningMap The componentRunningMap to set + */ public void setComponentRunningMap(Map componentRunningMap) { this.componentRunningMap = componentRunningMap; } @@ -262,7 +273,9 @@ public List getComponents() { return components; } - /** @param components The components to set */ + /** + * @param components The components to set + */ public void setComponents(List components) { this.components = components; } @@ -276,7 +289,9 @@ public Map> getComponentPerformanceS return componentPerformanceSnapshots; } - /** @param componentPerformanceSnapshots The componentPerformanceSnapshots to set */ + /** + * @param componentPerformanceSnapshots The componentPerformanceSnapshots to set + */ public void setComponentPerformanceSnapshots( Map> componentPerformanceSnapshots) { this.componentPerformanceSnapshots = componentPerformanceSnapshots; diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/IEngineComponent.java b/engine/src/main/java/org/apache/hop/pipeline/engine/IEngineComponent.java index 7dd3eb503f7..6a37b5e31f4 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/IEngineComponent.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/IEngineComponent.java @@ -17,22 +17,25 @@ package org.apache.hop.pipeline.engine; +import java.util.Date; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogLevel; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.Date; - /** * An identifiable component of an execution engine {@link IPipelineEngine} In a pipeline engine * this would be a transform */ public interface IEngineComponent { - /** @return The component name */ + /** + * @return The component name + */ String getName(); - /** @return The copy number (0 of higher for parallel runs) */ + /** + * @return The copy number (0 of higher for parallel runs) + */ int getCopyNr(); LogLevel getLogLevel(); @@ -41,7 +44,9 @@ public interface IEngineComponent { ILogChannel getLogChannel(); - /** @return The log channel ID or null if there is no separate log channel. */ + /** + * @return The log channel ID or null if there is no separate log channel. + */ String getLogChannelId(); /** @@ -51,19 +56,29 @@ public interface IEngineComponent { */ String getLogText(); - /** @return true if this component is running/active */ + /** + * @return true if this component is running/active + */ boolean isRunning(); - /** @return true if the component is selected in the user interface */ + /** + * @return true if the component is selected in the user interface + */ boolean isSelected(); - /** @return True if the component is stopped */ + /** + * @return True if the component is stopped + */ boolean isStopped(); - /** @return True if the component is paused */ + /** + * @return True if the component is paused + */ boolean isPaused(); - /** @return The number of errors in this component */ + /** + * @return The number of errors in this component + */ long getErrors(); long getLinesRead(); @@ -110,7 +125,9 @@ public interface IEngineComponent { */ Date getInitStartDate(); - /** @param initStartDate The initStartDate to set */ + /** + * @param initStartDate The initStartDate to set + */ void setInitStartDate(Date initStartDate); /** @@ -120,7 +137,9 @@ public interface IEngineComponent { */ Date getExecutionStartDate(); - /** @param executionStartDate The executionStartDate to set */ + /** + * @param executionStartDate The executionStartDate to set + */ void setExecutionStartDate(Date executionStartDate); /** @@ -130,7 +149,9 @@ public interface IEngineComponent { */ Date getFirstRowReadDate(); - /** @param firstRowReadDate The firstRowReadDate to set */ + /** + * @param firstRowReadDate The firstRowReadDate to set + */ void setFirstRowReadDate(Date firstRowReadDate); /** @@ -140,7 +161,9 @@ public interface IEngineComponent { */ Date getLastRowWrittenDate(); - /** @param lastRowWrittenDate The lastRowWrittenDate to set */ + /** + * @param lastRowWrittenDate The lastRowWrittenDate to set + */ void setLastRowWrittenDate(Date lastRowWrittenDate); /** @@ -150,6 +173,8 @@ public interface IEngineComponent { */ Date getExecutionEndDate(); - /** @param executionEndDate The executionEndDate to set */ + /** + * @param executionEndDate The executionEndDate to set + */ void setExecutionEndDate(Date executionEndDate); } diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/IPipelineEngine.java b/engine/src/main/java/org/apache/hop/pipeline/engine/IPipelineEngine.java index 981f544349b..57ffdf86605 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/IPipelineEngine.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/IPipelineEngine.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.engine; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.hop.core.IExtensionData; import org.apache.hop.core.IRowSet; import org.apache.hop.core.Result; @@ -38,10 +41,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.Date; -import java.util.List; -import java.util.Map; - /** * Describes the capabilities of an execution engine for a certain type of object called the subject * @@ -94,7 +93,9 @@ public interface IPipelineEngine */ void prepareExecution() throws HopException; - /** @return true if the engine is preparing execution */ + /** + * @return true if the engine is preparing execution + */ boolean isPreparing(); /** @@ -137,7 +138,9 @@ public interface IPipelineEngine void waitUntilFinished(); /** - * This method is called when all the finished listeners are executed and when the pipeline has completed. + * This method is called when all the finished listeners are executed and when the pipeline has + * completed. + * * @throws HopException */ void pipelineCompleted() throws HopException; @@ -172,7 +175,9 @@ public interface IPipelineEngine /** Resume the execution (all components). */ void resumeExecution(); - /** @return a number larger than 0 in case of errors */ + /** + * @return a number larger than 0 in case of errors + */ int getErrors(); /** @@ -326,7 +331,7 @@ void addExecutionStoppedListener(IExecutionStoppedListener> l * * @param preview */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") void setPreview(boolean preview); /** @@ -334,7 +339,7 @@ void addExecutionStoppedListener(IExecutionStoppedListener> l * * @return */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") boolean isPreview(); /** @@ -396,7 +401,7 @@ IRowSet findRowSet( * * @return True if feedback needs to be given */ - @Deprecated(since="2.0") // TODO: move this to the run configuration API + @Deprecated(since = "2.0") // TODO: move this to the run configuration API boolean isFeedbackShown(); /** @@ -404,7 +409,7 @@ IRowSet findRowSet( * * @return The feedback size in rows */ - @Deprecated(since="2.0") // TODO: move the run configuration API + @Deprecated(since = "2.0") // TODO: move the run configuration API int getFeedbackSize(); /** @@ -414,10 +419,14 @@ IRowSet findRowSet( */ Result getPreviousResult(); - /** @return The start date of the pipeline execution */ + /** + * @return The start date of the pipeline execution + */ Date getExecutionStartDate(); - /** @return The end date of the pipeline preparation */ + /** + * @return The end date of the pipeline preparation + */ Date getExecutionEndDate(); /** @@ -487,12 +496,13 @@ void addActiveSubWorkflow( Map getExtensionDataMap(); /** - * Plugins can add individual data samplers which will act upon the rows passing through the transforms - * in the pipeline. The execution information collected at this level will be sent to the execution - * information location if any is defined in the run configuration used to execute this pipeline. + * Plugins can add individual data samplers which will act upon the rows passing through the + * transforms in the pipeline. The execution information collected at this level will be sent to + * the execution information location if any is defined in the run configuration used to execute + * this pipeline. * * @param sampler The sampler to use */ > - void addExecutionDataSampler(Sampler sampler) throws HopException; + void addExecutionDataSampler(Sampler sampler) throws HopException; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineCapabilities.java b/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineCapabilities.java index c34f642035f..e6ca7f94393 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineCapabilities.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineCapabilities.java @@ -46,7 +46,9 @@ public boolean isSupportingPreview() { return supportingPreview; } - /** @param supportingPreview The supportingPreview to set */ + /** + * @param supportingPreview The supportingPreview to set + */ public void setSupportingPreview(boolean supportingPreview) { this.supportingPreview = supportingPreview; } @@ -60,7 +62,9 @@ public boolean isSupportingDebug() { return supportingDebug; } - /** @param supportingDebug The supportingDebug to set */ + /** + * @param supportingDebug The supportingDebug to set + */ public void setSupportingDebug(boolean supportingDebug) { this.supportingDebug = supportingDebug; } @@ -74,7 +78,9 @@ public boolean isSupportingSniffing() { return supportingSniffing; } - /** @param supportingSniffing The supportingSniffing to set */ + /** + * @param supportingSniffing The supportingSniffing to set + */ public void setSupportingSniffing(boolean supportingSniffing) { this.supportingSniffing = supportingSniffing; } @@ -88,7 +94,9 @@ public boolean isSupportingPause() { return supportingPause; } - /** @param supportingPause The supportingPause to set */ + /** + * @param supportingPause The supportingPause to set + */ public void setSupportingPause(boolean supportingPause) { this.supportingPause = supportingPause; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineFactory.java b/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineFactory.java index c166e13f82f..ee6382a5dfe 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineFactory.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEngineFactory.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.engine; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.IPlugin; @@ -29,8 +30,6 @@ import org.apache.hop.pipeline.config.IPipelineEngineRunConfiguration; import org.apache.hop.pipeline.config.PipelineRunConfiguration; -import java.util.List; - public class PipelineEngineFactory { /** diff --git a/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEnginePluginType.java b/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEnginePluginType.java index 72db33f9d84..6c8ddbfa18a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEnginePluginType.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engine/PipelineEnginePluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.engine; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - @PluginMainClassType(IPipelineEngine.class) @PluginAnnotationType(PipelineEnginePlugin.class) public class PipelineEnginePluginType extends BasePluginType { diff --git a/engine/src/main/java/org/apache/hop/pipeline/engines/EmptyPipelineRunConfiguration.java b/engine/src/main/java/org/apache/hop/pipeline/engines/EmptyPipelineRunConfiguration.java index 73ee4e5c357..ad9d97de0ad 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engines/EmptyPipelineRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engines/EmptyPipelineRunConfiguration.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.engines; +import java.util.Objects; import org.apache.hop.core.variables.Variables; import org.apache.hop.pipeline.config.IPipelineEngineRunConfiguration; -import java.util.Objects; - public class EmptyPipelineRunConfiguration extends Variables implements IPipelineEngineRunConfiguration { @@ -72,7 +71,9 @@ public String getEnginePluginId() { return pluginId; } - /** @param pluginId The pluginId to set */ + /** + * @param pluginId The pluginId to set + */ @Override public void setEnginePluginId(String pluginId) { this.pluginId = pluginId; @@ -88,7 +89,9 @@ public String getEnginePluginName() { return pluginName; } - /** @param pluginName The pluginName to set */ + /** + * @param pluginName The pluginName to set + */ @Override public void setEnginePluginName(String pluginName) { this.pluginName = pluginName; diff --git a/engine/src/main/java/org/apache/hop/pipeline/engines/local/LocalPipelineRunConfiguration.java b/engine/src/main/java/org/apache/hop/pipeline/engines/local/LocalPipelineRunConfiguration.java index 14ebcf3e538..fb3d81c3f20 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engines/local/LocalPipelineRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engines/local/LocalPipelineRunConfiguration.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.engines.local; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.gui.plugin.GuiElementType; import org.apache.hop.core.gui.plugin.GuiPlugin; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.config.PipelineRunConfiguration; import org.apache.hop.pipeline.engines.EmptyPipelineRunConfiguration; -import java.util.ArrayList; -import java.util.List; - @GuiPlugin(description = "Local pipeline run configuration widgets") public class LocalPipelineRunConfiguration extends EmptyPipelineRunConfiguration implements IPipelineEngineRunConfiguration { @@ -188,6 +187,7 @@ public List getSampleTypes(ILogChannel log, IHopMetadataProvider metadat } return list; } + /** * Gets rowSetSize * diff --git a/engine/src/main/java/org/apache/hop/pipeline/engines/localsingle/LocalSinglePipelineEngine.java b/engine/src/main/java/org/apache/hop/pipeline/engines/localsingle/LocalSinglePipelineEngine.java index 0671e1e9b61..3662cb98ce0 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engines/localsingle/LocalSinglePipelineEngine.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engines/localsingle/LocalSinglePipelineEngine.java @@ -99,7 +99,5 @@ public String getStatusDescription() { } @Override - public void pipelineCompleted() throws HopException { - - } + public void pipelineCompleted() throws HopException {} } diff --git a/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java b/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java index bdbc5bf507e..2e0473ada17 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java @@ -18,6 +18,16 @@ package org.apache.hop.pipeline.engines.remote; import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -82,17 +92,6 @@ import org.apache.hop.www.WebResult; import org.w3c.dom.Node; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; - @PipelineEnginePlugin( id = "Remote", name = "Hop remote pipeline engine", diff --git a/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineRunConfiguration.java b/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineRunConfiguration.java index 4eb976a13cf..37346be3a4c 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineRunConfiguration.java @@ -129,7 +129,9 @@ public String getHopServerName() { return hopServerName; } - /** @param hopServerName The hopServerName to set */ + /** + * @param hopServerName The hopServerName to set + */ public void setHopServerName(String hopServerName) { this.hopServerName = hopServerName; } @@ -143,7 +145,9 @@ public String getRunConfigurationName() { return runConfigurationName; } - /** @param runConfigurationName The runConfigurationName to set */ + /** + * @param runConfigurationName The runConfigurationName to set + */ public void setRunConfigurationName(String runConfigurationName) { this.runConfigurationName = runConfigurationName; } @@ -157,7 +161,9 @@ public String getServerPollDelay() { return serverPollDelay; } - /** @param serverPollDelay The serverPollDelay to set */ + /** + * @param serverPollDelay The serverPollDelay to set + */ public void setServerPollDelay(String serverPollDelay) { this.serverPollDelay = serverPollDelay; } @@ -171,7 +177,9 @@ public String getServerPollInterval() { return serverPollInterval; } - /** @param serverPollInterval The serverPollInterval to set */ + /** + * @param serverPollInterval The serverPollInterval to set + */ public void setServerPollInterval(String serverPollInterval) { this.serverPollInterval = serverPollInterval; } @@ -185,7 +193,9 @@ public boolean isExportingResources() { return exportingResources; } - /** @param exportingResources The exportingResources to set */ + /** + * @param exportingResources The exportingResources to set + */ public void setExportingResources(boolean exportingResources) { this.exportingResources = exportingResources; } @@ -199,7 +209,9 @@ public String getNamedResourcesSourceFolder() { return namedResourcesSourceFolder; } - /** @param namedResourcesSourceFolder The namedResourcesSourceFolder to set */ + /** + * @param namedResourcesSourceFolder The namedResourcesSourceFolder to set + */ public void setNamedResourcesSourceFolder(String namedResourcesSourceFolder) { this.namedResourcesSourceFolder = namedResourcesSourceFolder; } @@ -213,7 +225,9 @@ public String getNamedResourcesTargetFolder() { return namedResourcesTargetFolder; } - /** @param namedResourcesTargetFolder The namedResourcesTargetFolder to set */ + /** + * @param namedResourcesTargetFolder The namedResourcesTargetFolder to set + */ public void setNamedResourcesTargetFolder(String namedResourcesTargetFolder) { this.namedResourcesTargetFolder = namedResourcesTargetFolder; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/performance/PerformanceSnapShot.java b/engine/src/main/java/org/apache/hop/pipeline/performance/PerformanceSnapShot.java index 34072d7db1b..eb5e7233ac5 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/performance/PerformanceSnapShot.java +++ b/engine/src/main/java/org/apache/hop/pipeline/performance/PerformanceSnapShot.java @@ -110,222 +110,310 @@ public void diff(PerformanceSnapShot previous, long inputBufferSize, long output } } - /** @return the date */ + /** + * @return the date + */ public Date getDate() { return date; } - /** @param date the date to set */ + /** + * @param date the date to set + */ public void setDate(Date date) { this.date = date; } - /** @return the transformName */ + /** + * @return the transformName + */ public String getComponentName() { return componentName; } - /** @param componentName the transformName to set */ + /** + * @param componentName the transformName to set + */ public void setComponentName(String componentName) { this.componentName = componentName; } - /** @return the transform copy nr */ + /** + * @return the transform copy nr + */ public int getCopyNr() { return copyNr; } - /** @param copyNr the transform copy nr to set */ + /** + * @param copyNr the transform copy nr to set + */ public void setCopyNr(int copyNr) { this.copyNr = copyNr; } - /** @return the totalLinesRead */ + /** + * @return the totalLinesRead + */ public long getTotalLinesRead() { return totalLinesRead; } - /** @param totalLinesRead the totalLinesRead to set */ + /** + * @param totalLinesRead the totalLinesRead to set + */ public void setTotalLinesRead(long totalLinesRead) { this.totalLinesRead = totalLinesRead; } - /** @return the totalLinesWritten */ + /** + * @return the totalLinesWritten + */ public long getTotalLinesWritten() { return totalLinesWritten; } - /** @param totalLinesWritten the totalLinesWritten to set */ + /** + * @param totalLinesWritten the totalLinesWritten to set + */ public void setTotalLinesWritten(long totalLinesWritten) { this.totalLinesWritten = totalLinesWritten; } - /** @return the totalLinesInput */ + /** + * @return the totalLinesInput + */ public long getTotalLinesInput() { return totalLinesInput; } - /** @param totalLinesInput the totalLinesInput to set */ + /** + * @param totalLinesInput the totalLinesInput to set + */ public void setTotalLinesInput(long totalLinesInput) { this.totalLinesInput = totalLinesInput; } - /** @return the totalLinesOutput */ + /** + * @return the totalLinesOutput + */ public long getTotalLinesOutput() { return totalLinesOutput; } - /** @param totalLinesOutput the totalLinesOutput to set */ + /** + * @param totalLinesOutput the totalLinesOutput to set + */ public void setTotalLinesOutput(long totalLinesOutput) { this.totalLinesOutput = totalLinesOutput; } - /** @return the totalLinesUpdated */ + /** + * @return the totalLinesUpdated + */ public long getTotalLinesUpdated() { return totalLinesUpdated; } - /** @param totalLinesUpdated the totalLinesUpdated to set */ + /** + * @param totalLinesUpdated the totalLinesUpdated to set + */ public void setTotalLinesUpdated(long totalLinesUpdated) { this.totalLinesUpdated = totalLinesUpdated; } - /** @return the totalLinesRejected */ + /** + * @return the totalLinesRejected + */ public long getTotalLinesRejected() { return totalLinesRejected; } - /** @param totalLinesRejected the totalLinesRejected to set */ + /** + * @param totalLinesRejected the totalLinesRejected to set + */ public void setTotalLinesRejected(long totalLinesRejected) { this.totalLinesRejected = totalLinesRejected; } - /** @return the totalErrors */ + /** + * @return the totalErrors + */ public long getTotalErrors() { return totalErrors; } - /** @param totalErrors the totalErrors to set */ + /** + * @param totalErrors the totalErrors to set + */ public void setTotalErrors(long totalErrors) { this.totalErrors = totalErrors; } - /** @return the timeDifference */ + /** + * @return the timeDifference + */ public long getTimeDifference() { return timeDifference; } - /** @param timeDifference the timeDifference to set */ + /** + * @param timeDifference the timeDifference to set + */ public void setTimeDifference(long timeDifference) { this.timeDifference = timeDifference; } - /** @return the linesRead */ + /** + * @return the linesRead + */ public long getLinesRead() { return linesRead; } - /** @param linesRead the linesRead to set */ + /** + * @param linesRead the linesRead to set + */ public void setLinesRead(long linesRead) { this.linesRead = linesRead; } - /** @return the linesWritten */ + /** + * @return the linesWritten + */ public long getLinesWritten() { return linesWritten; } - /** @param linesWritten the linesWritten to set */ + /** + * @param linesWritten the linesWritten to set + */ public void setLinesWritten(long linesWritten) { this.linesWritten = linesWritten; } - /** @return the linesInput */ + /** + * @return the linesInput + */ public long getLinesInput() { return linesInput; } - /** @param linesInput the linesInput to set */ + /** + * @param linesInput the linesInput to set + */ public void setLinesInput(long linesInput) { this.linesInput = linesInput; } - /** @return the linesOutput */ + /** + * @return the linesOutput + */ public long getLinesOutput() { return linesOutput; } - /** @param linesOutput the linesOutput to set */ + /** + * @param linesOutput the linesOutput to set + */ public void setLinesOutput(long linesOutput) { this.linesOutput = linesOutput; } - /** @return the linesUpdated */ + /** + * @return the linesUpdated + */ public long getLinesUpdated() { return linesUpdated; } - /** @param linesUpdated the linesUpdated to set */ + /** + * @param linesUpdated the linesUpdated to set + */ public void setLinesUpdated(long linesUpdated) { this.linesUpdated = linesUpdated; } - /** @return the linesRejected */ + /** + * @return the linesRejected + */ public long getLinesRejected() { return linesRejected; } - /** @param linesRejected the linesRejected to set */ + /** + * @param linesRejected the linesRejected to set + */ public void setLinesRejected(long linesRejected) { this.linesRejected = linesRejected; } - /** @return the errors */ + /** + * @return the errors + */ public long getErrors() { return errors; } - /** @param errors the errors to set */ + /** + * @param errors the errors to set + */ public void setErrors(long errors) { this.errors = errors; } - /** @return the inputBufferSize */ + /** + * @return the inputBufferSize + */ public long getInputBufferSize() { return inputBufferSize; } - /** @param inputBufferSize the inputBufferSize to set */ + /** + * @param inputBufferSize the inputBufferSize to set + */ public void setInputBufferSize(long inputBufferSize) { this.inputBufferSize = inputBufferSize; } - /** @return the outputBufferSize */ + /** + * @return the outputBufferSize + */ public long getOutputBufferSize() { return outputBufferSize; } - /** @param outputBufferSize the outputBufferSize to set */ + /** + * @param outputBufferSize the outputBufferSize to set + */ public void setOutputBufferSize(long outputBufferSize) { this.outputBufferSize = outputBufferSize; } - /** @return the seqNr */ + /** + * @return the seqNr + */ public int getSeqNr() { return seqNr; } - /** @param seqNr the seqNr to set */ + /** + * @param seqNr the seqNr to set + */ public void setSeqNr(int seqNr) { this.seqNr = seqNr; } - /** @return the pipelineName */ + /** + * @return the pipelineName + */ public String getParentName() { return parentName; } - /** @param parentName the pipelineName to set */ + /** + * @param parentName the pipelineName to set + */ public void setParentName(String parentName) { this.parentName = parentName; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java b/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java index 98de7e946c6..505f1853460 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java @@ -19,6 +19,23 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import java.io.Closeable; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.BlockingRowSet; import org.apache.hop.core.Const; @@ -54,24 +71,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.pipeline.engines.local.LocalPipelineRunConfiguration; -import java.io.Closeable; -import java.io.IOException; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - /** * This class can be extended for the actual row processing of the implemented transform. * @@ -1312,7 +1311,8 @@ public void handlePutRowTo(IRowMeta rowMeta, Object[] row, IRowSet rowSet) } // Do not call the row listeners for targeted rows. - // It can cause rows with varying layouts to arrive at the same listener without a way to keep them apart. + // It can cause rows with varying layouts to arrive at the same listener without a way to keep + // them apart. // Keep adding to terminator_rows buffer... if (terminator && terminatorRows != null) { @@ -1719,14 +1719,14 @@ private Object[] handleGetRow() throws HopException { } /** - * The first non-null row we get we'll lock in the row metadata. - * For scenarios with multiple inputs, we move the metadata around (e.g. Merge Rows). + * The first non-null row we get we'll lock in the row metadata. For scenarios with multiple + * inputs, we move the metadata around (e.g. Merge Rows). * * @param row The input row (not null!) * @param inputRowSet The row set we're reading from right now */ private void obtainInputRowMeta(Object[] row, IRowSet inputRowSet) { - if (row==null) { + if (row == null) { return; } @@ -1739,30 +1739,30 @@ private void obtainInputRowMeta(Object[] row, IRowSet inputRowSet) { // Extra sanity check // - if (row!=null && inputRowMeta == null) { + if (row != null && inputRowMeta == null) { int nr = 0; for (IRowSet rowSet : inputRowSets) { log.logMinimal( - "===> Input row set #" - + nr - + ", done? " - + rowSet.isDone() - + ", size=" - + rowSet.size() - + ", metadata? " - + (rowSet.getRowMeta() != null)); + "===> Input row set #" + + nr + + ", done? " + + rowSet.isDone() + + ", size=" + + rowSet.size() + + ", metadata? " + + (rowSet.getRowMeta() != null)); nr++; } log.logMinimal("===> Current input row set nr=" + currentInputRowSetNr); throw new RuntimeException( - "No row metadata obtained for row " - + Arrays.toString(row) - + Const.CR - + "inputRowSet.getRowMeta()=" - + inputRowSet.getRowMeta() - + ", inputRowSets.size()=" - + inputRowSets.size()); + "No row metadata obtained for row " + + Arrays.toString(row) + + Const.CR + + "inputRowSet.getRowMeta()=" + + inputRowSet.getRowMeta() + + ", inputRowSets.size()=" + + inputRowSets.size()); } } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransformMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransformMeta.java index 58222613f15..e099e808609 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransformMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransformMeta.java @@ -94,7 +94,7 @@ public ITransform createTransform( PipelineMeta pipelineMeta, Pipeline pipeline) { try { - Type[] parameterizedTypes = getParameterizedTypes(getClass()); + Type[] parameterizedTypes = getParameterizedTypes(getClass()); Class
mainClass = (Class
) parameterizedTypes[0]; Class dataClass = (Class) parameterizedTypes[1]; @@ -114,7 +114,8 @@ public ITransform createTransform( return constructor.newInstance( new Object[] {transformMeta, this, data, copyNr, pipelineMeta, pipeline}); } catch (RuntimeException | ReflectiveOperationException e) { - throw new RuntimeException("Error create instance of transform: " + getClass().getCanonicalName(), e); + throw new RuntimeException( + "Error create instance of transform: " + getClass().getCanonicalName(), e); } } @@ -122,15 +123,16 @@ public ITransform createTransform( public ITransformData createTransformData() { try { Type[] parameterizedTypes = getParameterizedTypes(getClass()); - + Class dataClass = (Class) parameterizedTypes[1]; - + // Some tests class use BaseTransformMeta if (dataClass.isInterface()) return null; return dataClass.getDeclaredConstructor().newInstance(); } catch (RuntimeException | ReflectiveOperationException e) { - throw new RuntimeException("Error create instance of transform data: " + getClass().getCanonicalName(), e); + throw new RuntimeException( + "Error create instance of transform data: " + getClass().getCanonicalName(), e); } } @@ -268,8 +270,8 @@ public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider) } /** - * Gets the fields. - * This method doesn't pass along any pipeline metadata to help resolve output row metadata. + * Gets the fields. This method doesn't pass along any pipeline metadata to help resolve output + * row metadata. * * @param inputRowMeta the input row meta that is modified in this method to reflect the output * row metadata of the transform @@ -428,7 +430,7 @@ public boolean supportsErrorHandling() { public boolean supportsMultiCopyExecution() { return true; } - + /** This method is added to exclude certain transforms from layout checking. */ public boolean excludeFromRowLayoutVerification() { return false; diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/DynamicWaitTimes.java b/engine/src/main/java/org/apache/hop/pipeline/transform/DynamicWaitTimes.java index 672a801cc1e..ed049f2fa9c 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/DynamicWaitTimes.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/DynamicWaitTimes.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transform; -import org.apache.hop.core.IRowSet; -import org.apache.hop.core.util.Assert; - import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; +import org.apache.hop.core.IRowSet; +import org.apache.hop.core.util.Assert; final class DynamicWaitTimes { - - static SingleStreamStatus build(List rowSets, Supplier supplier, Integer waitTime) { + static SingleStreamStatus build( + List rowSets, Supplier supplier, Integer waitTime) { if (rowSets.size() == 1) { return new SingleStreamStatus(waitTime); } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/IRowDistribution.java b/engine/src/main/java/org/apache/hop/pipeline/transform/IRowDistribution.java index ce8064b318a..1ac9936219d 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/IRowDistribution.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/IRowDistribution.java @@ -23,10 +23,14 @@ public interface IRowDistribution { - /** @return The row distribution code (plugin id) */ + /** + * @return The row distribution code (plugin id) + */ String getCode(); - /** @return The row distribution description (plugin description) */ + /** + * @return The row distribution description (plugin description) + */ String getDescription(); /** diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransform.java b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransform.java index d175116a9a7..30e8f8ffed0 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransform.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransform.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transform; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.hop.core.IExtensionData; import org.apache.hop.core.IRowSet; import org.apache.hop.core.ResultFile; @@ -32,21 +37,16 @@ import org.apache.hop.pipeline.engine.IEngineComponent; import org.apache.hop.pipeline.engine.IPipelineEngine; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; - /** * The interface that any pipeline transform or plugin needs to implement. * *

Created on 12-AUG-2004 */ -public interface ITransform - extends IVariables, IHasLogChannel, IEngineComponent, IExtensionData { +public interface ITransform extends IVariables, IHasLogChannel, IEngineComponent, IExtensionData { - /** @return the pipeline that is executing this transform */ + /** + * @return the pipeline that is executing this transform + */ IPipelineEngine getPipeline(); /** @@ -83,7 +83,9 @@ public interface ITransform /** Stop running operations... */ void stopRunning() throws HopException; - /** @return true if the transform is running after having been initialized */ + /** + * @return true if the transform is running after having been initialized + */ @Override boolean isRunning(); @@ -94,22 +96,32 @@ public interface ITransform */ void setRunning(boolean running); - /** @return True if the transform is marked as stopped. Execution should stop immediate. */ + /** + * @return True if the transform is marked as stopped. Execution should stop immediate. + */ @Override boolean isStopped(); - /** @param stopped true if the transform needs to be stopped */ + /** + * @param stopped true if the transform needs to be stopped + */ void setStopped(boolean stopped); - /** @param stopped true if the transform needs to be safe stopped */ + /** + * @param stopped true if the transform needs to be safe stopped + */ default void setSafeStopped(boolean stopped) {} - /** @return true if transform is safe stopped. */ + /** + * @return true if transform is safe stopped. + */ default boolean isSafeStopped() { return false; } - /** @return True if the transform is paused */ + /** + * @return True if the transform is paused + */ @Override boolean isPaused(); @@ -129,10 +141,14 @@ default boolean isSafeStopped() { */ String getTransformName(); - /** @return The transforms copy number (default 0) */ + /** + * @return The transforms copy number (default 0) + */ int getCopy(); - /** @return the type ID of the transform... */ + /** + * @return the type ID of the transform... + */ String getTransformPluginId(); /** @@ -150,30 +166,44 @@ default boolean isSafeStopped() { */ void setErrors(long errors); - /** @return Returns the linesInput. */ + /** + * @return Returns the linesInput. + */ @Override long getLinesInput(); - /** @return Returns the linesOutput. */ + /** + * @return Returns the linesOutput. + */ @Override long getLinesOutput(); - /** @return Returns the linesRead. */ + /** + * @return Returns the linesRead. + */ @Override long getLinesRead(); - /** @return Returns the linesWritten. */ + /** + * @return Returns the linesWritten. + */ @Override long getLinesWritten(); - /** @return Returns the linesUpdated. */ + /** + * @return Returns the linesUpdated. + */ @Override long getLinesUpdated(); - /** @param linesRejected transforms the lines rejected by error handling. */ + /** + * @param linesRejected transforms the lines rejected by error handling. + */ void setLinesRejected(long linesRejected); - /** @return Returns the lines rejected by error handling. */ + /** + * @return Returns the lines rejected by error handling. + */ @Override long getLinesRejected(); @@ -184,7 +214,9 @@ default boolean isSafeStopped() { */ void putRow(IRowMeta row, Object[] data) throws HopException; - /** @return a row from the source transform(s). */ + /** + * @return a row from the source transform(s). + */ Object[] getRow() throws HopException; /** Signal output done to destination transforms */ @@ -207,22 +239,34 @@ default boolean isSafeStopped() { @Override void removeRowListener(IRowListener rowListener); - /** @return a list of the installed RowListeners */ + /** + * @return a list of the installed RowListeners + */ List getRowListeners(); - /** @return The list of active input rowsets for the transform */ + /** + * @return The list of active input rowsets for the transform + */ List getInputRowSets(); - /** @return The list of active output rowsets for the transform */ + /** + * @return The list of active output rowsets for the transform + */ List getOutputRowSets(); - /** @return true if the transform is running partitioned */ + /** + * @return true if the transform is running partitioned + */ boolean isPartitioned(); - /** @param partitionId the partitionID to set */ + /** + * @param partitionId the partitionID to set + */ void setPartitionId(String partitionId); - /** @return the transforms partition ID */ + /** + * @return the transforms partition ID + */ String getPartitionId(); /** Cleanup any left-over resources for this transform. */ @@ -253,20 +297,30 @@ default boolean isSafeStopped() { */ void addTransformStartedListener(ITransformStartedListener transformListener); - /** @return true if the thread is a special mapping transform */ + /** + * @return true if the thread is a special mapping transform + */ boolean isMapping(); - /** @return The metadata for this transform */ + /** + * @return The metadata for this transform + */ TransformMeta getTransformMeta(); - /** @return the logging channel for this transform */ + /** + * @return the logging channel for this transform + */ @Override ILogChannel getLogChannel(); - /** @return The total amount of rows in the input buffers */ + /** + * @return The total amount of rows in the input buffers + */ int rowsetInputSize(); - /** @return The total amount of rows in the output buffers */ + /** + * @return The total amount of rows in the output buffers + */ int rowsetOutputSize(); /** @@ -275,14 +329,20 @@ default boolean isSafeStopped() { */ long getProcessed(); - /** @return The result files for this transform */ + /** + * @return The result files for this transform + */ Map getResultFiles(); - /** @return the description as in {@link ITransformData} */ + /** + * @return the description as in {@link ITransformData} + */ @Override ComponentExecutionStatus getStatus(); - /** @return The number of ms that this transform has been running */ + /** + * @return The number of ms that this transform has been running + */ @Override long getExecutionDuration(); @@ -292,30 +352,36 @@ default boolean isSafeStopped() { */ void identifyErrorOutput(); - /** @param partitioned true if this transform is partitioned */ + /** + * @param partitioned true if this transform is partitioned + */ void setPartitioned(boolean partitioned); - /** @param partitioningMethod The repartitioning method */ + /** + * @param partitioningMethod The repartitioning method + */ void setRepartitioning(int partitioningMethod); /** - * When using the Single threaded engine this signals to the transform that a batch of records has been processed - * and that no more are expected in this batch. + * When using the Single threaded engine this signals to the transform that a batch of records has + * been processed and that no more are expected in this batch. * * @throws HopException In case an error occurs during the processing of the batch of rows. */ void batchComplete() throws HopException; /** - * When running in a Beam context this signals the transform that a new bundle was started. - * File writing transforms might want to create new files here. + * When running in a Beam context this signals the transform that a new bundle was started. File + * writing transforms might want to create new files here. + * * @throws HopException */ void startBundle() throws HopException; /** - * When running in a Beam context this signals the transform that a bundle was finished. - * File writing transforms will want to close open file(s) here. + * When running in a Beam context this signals the transform that a bundle was finished. File + * writing transforms will want to close open file(s) here. + * * @throws HopException */ void finishBundle() throws HopException; @@ -327,19 +393,29 @@ default boolean isSafeStopped() { */ void setMetadataProvider(IHopMetadataProvider metadataProvider); - /** @return The metadata that the transform uses to load external elements from. */ + /** + * @return The metadata that the transform uses to load external elements from. + */ IHopMetadataProvider getMetadataProvider(); - /** @return the index of the active (current) output row set */ + /** + * @return the index of the active (current) output row set + */ int getCurrentOutputRowSetNr(); - /** @param index Sets the index of the active (current) output row set to use. */ + /** + * @param index Sets the index of the active (current) output row set to use. + */ void setCurrentOutputRowSetNr(int index); - /** @return the index of the active (current) input row set */ + /** + * @return the index of the active (current) input row set + */ int getCurrentInputRowSetNr(); - /** @param index Sets the index of the active (current) input row set to use. */ + /** + * @param index Sets the index of the active (current) input row set to use. + */ void setCurrentInputRowSetNr(int index); default Collection subStatuses() { @@ -354,7 +430,9 @@ default void addRowSetToOutputRowSets(IRowSet rowSet) { getOutputRowSets().add(rowSet); } - /** @return Returns the transform specific metadata. */ + /** + * @return Returns the transform specific metadata. + */ ITransformMeta getMeta(); /** @@ -372,7 +450,9 @@ default void addRowSetToOutputRowSets(IRowSet rowSet) { @Override Date getInitStartDate(); - /** @param initStartDate The initStartDate to set */ + /** + * @param initStartDate The initStartDate to set + */ @Override void setInitStartDate(Date initStartDate); @@ -384,7 +464,9 @@ default void addRowSetToOutputRowSets(IRowSet rowSet) { @Override Date getExecutionStartDate(); - /** @param executionStartDate The executionStartDate to set */ + /** + * @param executionStartDate The executionStartDate to set + */ @Override void setExecutionStartDate(Date executionStartDate); @@ -396,7 +478,9 @@ default void addRowSetToOutputRowSets(IRowSet rowSet) { @Override Date getFirstRowReadDate(); - /** @param firstRowReadDate The firstRowReadDate to set */ + /** + * @param firstRowReadDate The firstRowReadDate to set + */ @Override void setFirstRowReadDate(Date firstRowReadDate); @@ -408,7 +492,9 @@ default void addRowSetToOutputRowSets(IRowSet rowSet) { @Override Date getLastRowWrittenDate(); - /** @param lastRowWrittenDate The lastRowWrittenDate to set */ + /** + * @param lastRowWrittenDate The lastRowWrittenDate to set + */ @Override void setLastRowWrittenDate(Date lastRowWrittenDate); @@ -420,7 +506,9 @@ default void addRowSetToOutputRowSets(IRowSet rowSet) { @Override Date getExecutionEndDate(); - /** @param executionEndDate The executionEndDate to set */ + /** + * @param executionEndDate The executionEndDate to set + */ @Override void setExecutionEndDate(Date executionEndDate); } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformData.java b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformData.java index 7ed71de9c0d..f4db3755eb7 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformData.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformData.java @@ -83,7 +83,6 @@ public interface ITransformData { */ boolean isDisposed(); - /** * Gets beamContext * diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformDialog.java b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformDialog.java index 571b4f533b0..c99bf3f0fe1 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformDialog.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformDialog.java @@ -32,11 +32,9 @@ public interface ITransformDialog { */ String open(); - /** - * Brings the dialog to the front if the dialog is already open. - */ + /** Brings the dialog to the front if the dialog is already open. */ void setActive(); - + /** * void populateComposite( Composite parent); * diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformIOMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformIOMeta.java index 11840aca08f..f7272f62475 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformIOMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformIOMeta.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transform; -import org.apache.hop.pipeline.transform.stream.IStream; - import java.util.List; +import org.apache.hop.pipeline.transform.stream.IStream; public interface ITransformIOMeta { @@ -67,13 +66,19 @@ public interface ITransformIOMeta { */ void setGeneralTargetDescription(String string); - /** @return the generalTargetDescription */ + /** + * @return the generalTargetDescription + */ String getGeneralTargetDescription(); - /** @return the generalInfoDescription */ + /** + * @return the generalInfoDescription + */ String getGeneralInfoDescription(); - /** @return true if the output targets of this transform are dynamic (variable) */ + /** + * @return true if the output targets of this transform are dynamic (variable) + */ boolean isOutputDynamic(); /** @@ -81,7 +86,9 @@ public interface ITransformIOMeta { */ void setOutputDynamic(boolean outputDynamic); - /** @return true if the input info sources of this transform are dynamic (variable) */ + /** + * @return true if the input info sources of this transform are dynamic (variable) + */ boolean isInputDynamic(); /** diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformMeta.java index 29b3e0e525d..1992349b021 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/ITransformMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transform; +import java.util.List; +import java.util.Map; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.SqlStatement; import org.apache.hop.core.exception.HopDatabaseException; @@ -40,9 +42,6 @@ import org.apache.hop.resource.ResourceReference; import org.w3c.dom.Node; -import java.util.List; -import java.util.Map; - /** * This interface allows custom transforms to talk to Hop. The ITransformMeta is the main Java * interface that a plugin implements. The responsibilities of the implementing class are listed @@ -176,14 +175,15 @@ void getFields( * @throws HopTransformException the hop transform exception */ void getFields( - PipelineMeta pipelineMeta, - IRowMeta inputRowMeta, - String name, - IRowMeta[] info, - TransformMeta nextTransform, - IVariables variables, - IHopMetadataProvider metadataProvider) - throws HopTransformException; + PipelineMeta pipelineMeta, + IRowMeta inputRowMeta, + String name, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables variables, + IHopMetadataProvider metadataProvider) + throws HopTransformException; + /** * Get the XML that represents the values in this transform * @@ -334,7 +334,7 @@ SqlStatement getSqlStatements( * @return true if this transform supports multi-copies execution. By default return true. */ boolean supportsMultiCopyExecution(); - + /** * Get a list of all the resource dependencies that the transform is depending on. * diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/RowDistributionPluginType.java b/engine/src/main/java/org/apache/hop/pipeline/transform/RowDistributionPluginType.java index cc9dac257b4..6f214ccd96a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/RowDistributionPluginType.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/RowDistributionPluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transform; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - /** This class represents the row distribution plugin type. */ @PluginMainClassType(IRowDistribution.class) @PluginAnnotationType(RowDistributionPlugin.class) diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/RunThread.java b/engine/src/main/java/org/apache/hop/pipeline/transform/RunThread.java index d42af2691b5..1cdbb87188a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/RunThread.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/RunThread.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transform; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -25,9 +27,6 @@ import org.apache.hop.core.logging.Metrics; import org.apache.hop.i18n.BaseMessages; -import java.util.Date; -import java.util.List; - public class RunThread implements Runnable { private static final Class PKG = BaseTransform.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformErrorMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformErrorMeta.java index 2db9fc30634..d3f945ae3e8 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformErrorMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformErrorMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transform; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.changed.ChangedFlag; import org.apache.hop.core.row.IRowMeta; @@ -29,8 +30,6 @@ import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.List; - /** This class contains the metadata to handle proper error handling on a transform level. */ public class TransformErrorMeta extends ChangedFlag implements Cloneable { public static final String XML_ERROR_TAG = "error"; @@ -188,72 +187,100 @@ public TransformErrorMeta(Node node, List transforms) { minPercentRows = XmlHandler.getTagValue(node, "min_pct_rows"); } - /** @return the error codes valuename */ + /** + * @return the error codes valuename + */ public String getErrorCodesValuename() { return errorCodesValuename; } - /** @param errorCodesValuename the error codes valuename to set */ + /** + * @param errorCodesValuename the error codes valuename to set + */ public void setErrorCodesValuename(String errorCodesValuename) { this.errorCodesValuename = errorCodesValuename; } - /** @return the error descriptions valuename */ + /** + * @return the error descriptions valuename + */ public String getErrorDescriptionsValuename() { return errorDescriptionsValuename; } - /** @param errorDescriptionsValuename the error descriptions valuename to set */ + /** + * @param errorDescriptionsValuename the error descriptions valuename to set + */ public void setErrorDescriptionsValuename(String errorDescriptionsValuename) { this.errorDescriptionsValuename = errorDescriptionsValuename; } - /** @return the error fields valuename */ + /** + * @return the error fields valuename + */ public String getErrorFieldsValuename() { return errorFieldsValuename; } - /** @param errorFieldsValuename the error fields valuename to set */ + /** + * @param errorFieldsValuename the error fields valuename to set + */ public void setErrorFieldsValuename(String errorFieldsValuename) { this.errorFieldsValuename = errorFieldsValuename; } - /** @return the nr errors valuename */ + /** + * @return the nr errors valuename + */ public String getNrErrorsValuename() { return nrErrorsValuename; } - /** @param nrErrorsValuename the nr errors valuename to set */ + /** + * @param nrErrorsValuename the nr errors valuename to set + */ public void setNrErrorsValuename(String nrErrorsValuename) { this.nrErrorsValuename = nrErrorsValuename; } - /** @return the target transform */ + /** + * @return the target transform + */ public TransformMeta getTargetTransform() { return targetTransform; } - /** @param targetTransform the target transform to set */ + /** + * @param targetTransform the target transform to set + */ public void setTargetTransform(TransformMeta targetTransform) { this.targetTransform = targetTransform; } - /** @return The source transform can send the error rows */ + /** + * @return The source transform can send the error rows + */ public TransformMeta getSourceTransform() { return sourceTransform; } - /** @param sourceTransform The source transform can send the error rows */ + /** + * @param sourceTransform The source transform can send the error rows + */ public void setSourceTransform(TransformMeta sourceTransform) { this.sourceTransform = sourceTransform; } - /** @return the enabled flag: Is the error handling enabled? */ + /** + * @return the enabled flag: Is the error handling enabled? + */ public boolean isEnabled() { return enabled; } - /** @param enabled the enabled flag to set: Is the error handling enabled? */ + /** + * @param enabled the enabled flag to set: Is the error handling enabled? + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -317,32 +344,44 @@ public void addErrorRowData( } } - /** @return the maxErrors */ + /** + * @return the maxErrors + */ public String getMaxErrors() { return maxErrors; } - /** @param maxErrors the maxErrors to set */ + /** + * @param maxErrors the maxErrors to set + */ public void setMaxErrors(String maxErrors) { this.maxErrors = maxErrors; } - /** @return the maxPercentErrors */ + /** + * @return the maxPercentErrors + */ public String getMaxPercentErrors() { return maxPercentErrors; } - /** @param maxPercentErrors the maxPercentErrors to set */ + /** + * @param maxPercentErrors the maxPercentErrors to set + */ public void setMaxPercentErrors(String maxPercentErrors) { this.maxPercentErrors = maxPercentErrors; } - /** @return the minRowsForPercent */ + /** + * @return the minRowsForPercent + */ public String getMinPercentRows() { return minPercentRows; } - /** @param minRowsForPercent the minRowsForPercent to set */ + /** + * @param minRowsForPercent the minRowsForPercent to set + */ public void setMinPercentRows(String minRowsForPercent) { this.minPercentRows = minRowsForPercent; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformIOMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformIOMeta.java index c7ffcd4f475..910ed9fbfc2 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformIOMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformIOMeta.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transform; -import org.apache.hop.pipeline.transform.stream.IStream; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.pipeline.transform.stream.IStream; public class TransformIOMeta implements ITransformIOMeta, Cloneable { private boolean inputAcceptor; @@ -64,35 +63,47 @@ protected TransformIOMeta clone() throws CloneNotSupportedException { return ioMeta; } - /** @return the inputAcceptor */ + /** + * @return the inputAcceptor + */ @Override public boolean isInputAcceptor() { return inputAcceptor; } - /** @param inputAcceptor the inputAcceptor to set */ + /** + * @param inputAcceptor the inputAcceptor to set + */ public void setInputAcceptor(boolean inputAcceptor) { this.inputAcceptor = inputAcceptor; } - /** @return the outputProducer */ + /** + * @return the outputProducer + */ @Override public boolean isOutputProducer() { return outputProducer; } - /** @param outputProducer the outputProducer to set */ + /** + * @param outputProducer the outputProducer to set + */ public void setOutputProducer(boolean outputProducer) { this.outputProducer = outputProducer; } - /** @return the inputOptional */ + /** + * @return the inputOptional + */ @Override public boolean isInputOptional() { return inputOptional; } - /** @param inputOptional the inputOptional to set */ + /** + * @param inputOptional the inputOptional to set + */ public void setInputOptional(boolean inputOptional) { this.inputOptional = inputOptional; } @@ -131,13 +142,17 @@ public List getTargetStreams() { return list; } - /** @return the sortedDataRequired */ + /** + * @return the sortedDataRequired + */ @Override public boolean isSortedDataRequired() { return sortedDataRequired; } - /** @param sortedDataRequired the sortedDataRequired to set */ + /** + * @param sortedDataRequired the sortedDataRequired to set + */ public void setSortedDataRequired(boolean sortedDataRequired) { this.sortedDataRequired = sortedDataRequired; } @@ -192,25 +207,33 @@ public void setInfoTransforms(TransformMeta[] infoTransforms) { } } - /** @return the generalInfoDescription */ + /** + * @return the generalInfoDescription + */ @Override public String getGeneralInfoDescription() { return generalInfoDescription; } - /** @param generalInfoDescription the generalInfoDescription to set */ + /** + * @param generalInfoDescription the generalInfoDescription to set + */ @Override public void setGeneralInfoDescription(String generalInfoDescription) { this.generalInfoDescription = generalInfoDescription; } - /** @return the generalTargetDescription */ + /** + * @return the generalTargetDescription + */ @Override public String getGeneralTargetDescription() { return generalTargetDescription; } - /** @param generalTargetDescription the generalTargetDescription to set */ + /** + * @param generalTargetDescription the generalTargetDescription to set + */ @Override public void setGeneralTargetDescription(String generalTargetDescription) { this.generalTargetDescription = generalTargetDescription; @@ -220,25 +243,33 @@ public void clearStreams() { streams.clear(); } - /** @return the outputDynamic */ + /** + * @return the outputDynamic + */ @Override public boolean isOutputDynamic() { return outputDynamic; } - /** @param outputDynamic the outputDynamic to set */ + /** + * @param outputDynamic the outputDynamic to set + */ @Override public void setOutputDynamic(boolean outputDynamic) { this.outputDynamic = outputDynamic; } - /** @return the inputDynamic */ + /** + * @return the inputDynamic + */ @Override public boolean isInputDynamic() { return inputDynamic; } - /** @param inputDynamic the inputDynamic to set */ + /** + * @param inputDynamic the inputDynamic to set + */ @Override public void setInputDynamic(boolean inputDynamic) { this.inputDynamic = inputDynamic; diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformInitThread.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformInitThread.java index 30fc1ddc447..42a5c70fd58 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformInitThread.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformInitThread.java @@ -94,12 +94,16 @@ public boolean isOk() { return ok; } - /** @return Returns the combi. */ + /** + * @return Returns the combi. + */ public TransformMetaDataCombi getCombi() { return combi; } - /** @param combi The combi to set. */ + /** + * @param combi The combi to set. + */ public void setCombi(TransformMetaDataCombi combi) { this.combi = combi; } @@ -113,17 +117,23 @@ public Pipeline getPipeline() { return pipeline; } - /** @param pipeline The pipeline to set */ + /** + * @param pipeline The pipeline to set + */ public void setPipeline(Pipeline pipeline) { this.pipeline = pipeline; } - /** @return the doIt */ + /** + * @return the doIt + */ public boolean isDoIt() { return doIt; } - /** @param doIt the doIt to set */ + /** + * @param doIt the doIt to set + */ public void setDoIt(boolean doIt) { this.doIt = doIt; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformMeta.java index 2c083501711..cf0d7f24c83 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transform; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.base.IBaseMeta; import org.apache.hop.core.Const; import org.apache.hop.core.IAttributes; @@ -48,10 +51,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** This class contains everything that is needed to define a transform. */ public class TransformMeta implements Cloneable, @@ -668,7 +667,7 @@ public static final TransformMeta findTransform( public boolean supportsMultiCopyExecution() { return transform.supportsMultiCopyExecution(); } - + public boolean supportsErrorHandling() { return transform.supportsErrorHandling(); } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformOption.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformOption.java index 295f704a603..cd6fc4a5173 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformOption.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformOption.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transform; +import java.util.List; import org.apache.commons.lang.BooleanUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -24,8 +25,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; -import java.util.List; - public class TransformOption { private static final Class PKG = TransformOption.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformPartitioningMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformPartitioningMeta.java index b7bd1e862f4..603a34083f7 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformPartitioningMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformPartitioningMeta.java @@ -49,14 +49,12 @@ public class TransformPartitioningMeta implements Cloneable { private int methodType; - @HopMetadataProperty - private String method; + @HopMetadataProperty private String method; @HopMetadataProperty(storeWithName = true) private PartitionSchema partitionSchema; - @HopMetadataProperty - private IPartitioner partitioner; + @HopMetadataProperty private IPartitioner partitioner; private boolean hasChanged = false; @@ -92,7 +90,9 @@ public TransformPartitioningMeta clone() { } } - /** @return true if the partition schema names are the same. */ + /** + * @return true if the partition schema names are the same. + */ @Override public boolean equals(Object obj) { if (obj == null) { @@ -143,12 +143,16 @@ public String toString() { return description; } - /** @return the partitioningMethod */ + /** + * @return the partitioningMethod + */ public int getMethodType() { return methodType; } - /** @param method the partitioning method to set */ + /** + * @param method the partitioning method to set + */ public void setMethod(String method) throws HopPluginException { if (!method.equals(this.method)) { this.method = method; @@ -275,12 +279,16 @@ public boolean isPartitioned() { return methodType != PARTITIONING_METHOD_NONE; } - /** @return the partitionSchema */ + /** + * @return the partitionSchema + */ public PartitionSchema getPartitionSchema() { return partitionSchema; } - /** @param partitionSchema the partitionSchema to set */ + /** + * @param partitionSchema the partitionSchema to set + */ public void setPartitionSchema(PartitionSchema partitionSchema) { this.partitionSchema = partitionSchema; hasChanged = true; diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformStatus.java b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformStatus.java index c17fb22cba7..6e64b3b7a87 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/TransformStatus.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/TransformStatus.java @@ -18,6 +18,13 @@ package org.apache.hop.pipeline.transform; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import javax.xml.bind.annotation.XmlRootElement; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -28,14 +35,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import javax.xml.bind.annotation.XmlRootElement; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - @XmlRootElement public class TransformStatus { public static final String XML_TAG = "transform_status"; @@ -321,152 +320,212 @@ public String[] getPeekFields() { return fields; } - /** @return the copy */ + /** + * @return the copy + */ public int getCopy() { return copy; } - /** @param copy the copy to set */ + /** + * @param copy the copy to set + */ public void setCopy(int copy) { this.copy = copy; } - /** @return the errors */ + /** + * @return the errors + */ public long getErrors() { return errors; } - /** @param errors the errors to set */ + /** + * @param errors the errors to set + */ public void setErrors(long errors) { this.errors = errors; } - /** @return the linesInput */ + /** + * @return the linesInput + */ public long getLinesInput() { return linesInput; } - /** @param linesInput the linesInput to set */ + /** + * @param linesInput the linesInput to set + */ public void setLinesInput(long linesInput) { this.linesInput = linesInput; } - /** @return the linesOutput */ + /** + * @return the linesOutput + */ public long getLinesOutput() { return linesOutput; } - /** @param linesOutput the linesOutput to set */ + /** + * @param linesOutput the linesOutput to set + */ public void setLinesOutput(long linesOutput) { this.linesOutput = linesOutput; } - /** @return the linesRead */ + /** + * @return the linesRead + */ public long getLinesRead() { return linesRead; } - /** @param linesRead the linesRead to set */ + /** + * @param linesRead the linesRead to set + */ public void setLinesRead(long linesRead) { this.linesRead = linesRead; } - /** @return the linesUpdated */ + /** + * @return the linesUpdated + */ public long getLinesUpdated() { return linesUpdated; } - /** @param linesUpdated the linesUpdated to set */ + /** + * @param linesUpdated the linesUpdated to set + */ public void setLinesUpdated(long linesUpdated) { this.linesUpdated = linesUpdated; } - /** @return the linesWritten */ + /** + * @return the linesWritten + */ public long getLinesWritten() { return linesWritten; } - /** @param linesWritten the linesWritten to set */ + /** + * @param linesWritten the linesWritten to set + */ public void setLinesWritten(long linesWritten) { this.linesWritten = linesWritten; } - /** @return the priority */ + /** + * @return the priority + */ public String getPriority() { return priority; } - /** @param priority the priority to set */ + /** + * @param priority the priority to set + */ public void setPriority(String priority) { this.priority = priority; } - /** @return the seconds */ + /** + * @return the seconds + */ public double getSeconds() { return seconds; } - /** @param seconds the seconds to set */ + /** + * @param seconds the seconds to set + */ public void setSeconds(double seconds) { this.seconds = seconds; } - /** @return the speed */ + /** + * @return the speed + */ public String getSpeed() { return speed; } - /** @param speed the speed to set */ + /** + * @param speed the speed to set + */ public void setSpeed(String speed) { this.speed = speed; } - /** @return the statusDescription */ + /** + * @return the statusDescription + */ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription the statusDescription to set */ + /** + * @param statusDescription the statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } - /** @return the transformName */ + /** + * @return the transformName + */ public String getTransformName() { return transformName; } - /** @param transformName the transformName to set */ + /** + * @param transformName the transformName to set + */ public void setTransformName(String transformName) { this.transformName = transformName; } - /** @return the linesRejected */ + /** + * @return the linesRejected + */ public long getLinesRejected() { return linesRejected; } - /** @param linesRejected the linesRejected to set */ + /** + * @param linesRejected the linesRejected to set + */ public void setLinesRejected(long linesRejected) { this.linesRejected = linesRejected; } - /** @return the stopped */ + /** + * @return the stopped + */ public boolean isStopped() { return stopped; } - /** @param stopped the stopped to set */ + /** + * @param stopped the stopped to set + */ public void setStopped(boolean stopped) { this.stopped = stopped; } - /** @return the paused */ + /** + * @return the paused + */ public boolean isPaused() { return paused; } - /** @param paused the paused to set */ + /** + * @param paused the paused to set + */ public void setPaused(boolean paused) { this.paused = paused; } @@ -496,7 +555,9 @@ public long getInputBufferSize() { return inputBufferSize; } - /** @param inputBufferSize The inputBufferSize to set */ + /** + * @param inputBufferSize The inputBufferSize to set + */ public void setInputBufferSize(long inputBufferSize) { this.inputBufferSize = inputBufferSize; } @@ -510,7 +571,9 @@ public long getOutputBufferSize() { return outputBufferSize; } - /** @param outputBufferSize The outputBufferSize to set */ + /** + * @param outputBufferSize The outputBufferSize to set + */ public void setOutputBufferSize(long outputBufferSize) { this.outputBufferSize = outputBufferSize; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/AbstractFileErrorHandler.java b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/AbstractFileErrorHandler.java index 85b4f4bd4fa..8233799a865 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/AbstractFileErrorHandler.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/AbstractFileErrorHandler.java @@ -17,14 +17,6 @@ package org.apache.hop.pipeline.transform.errorhandling; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.ResultFile; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.vfs.HopVfs; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.pipeline.transform.BaseTransform; - import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; @@ -34,6 +26,13 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.ResultFile; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.vfs.HopVfs; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.pipeline.transform.BaseTransform; public abstract class AbstractFileErrorHandler implements IFileErrorHandler { private static final Class PKG = AbstractFileErrorHandler.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/CompositeFileErrorHandler.java b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/CompositeFileErrorHandler.java index 026d9c44608..19f44b8e206 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/CompositeFileErrorHandler.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/CompositeFileErrorHandler.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transform.errorhandling; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopException; -import java.util.List; - public class CompositeFileErrorHandler implements IFileErrorHandler { private List handlers; diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerContentLineNumber.java b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerContentLineNumber.java index 156f624a268..1f6311128cd 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerContentLineNumber.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerContentLineNumber.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transform.errorhandling; +import java.util.Date; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.pipeline.transform.BaseTransform; -import java.util.Date; - public class FileErrorHandlerContentLineNumber extends AbstractFileErrorHandler { private static final Class PKG = FileErrorHandlerContentLineNumber.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerMissingFiles.java b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerMissingFiles.java index 0af5deb7f91..635aa2353e6 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerMissingFiles.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/errorhandling/FileErrorHandlerMissingFiles.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transform.errorhandling; +import java.util.Date; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.pipeline.transform.BaseTransform; -import java.util.Date; - public class FileErrorHandlerMissingFiles extends AbstractFileErrorHandler { private static final Class PKG = FileErrorHandlerMissingFiles.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transform/stream/Stream.java b/engine/src/main/java/org/apache/hop/pipeline/transform/stream/Stream.java index a0137968ef7..ff841d147cb 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transform/stream/Stream.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transform/stream/Stream.java @@ -98,61 +98,81 @@ public String getTransformName() { return transformMeta.getName(); } - /** @return the description */ + /** + * @return the description + */ @Override public String getDescription() { return description; } - /** @param description the description to set */ + /** + * @param description the description to set + */ @Override public void setDescription(String description) { this.description = description; } - /** @return the streamType */ + /** + * @return the streamType + */ @Override public StreamType getStreamType() { return streamType; } - /** @param streamType the streamType to set */ + /** + * @param streamType the streamType to set + */ @Override public void setStreamType(StreamType streamType) { this.streamType = streamType; } - /** @return the transformMeta */ + /** + * @return the transformMeta + */ @Override public TransformMeta getTransformMeta() { return transformMeta; } - /** @param transformMeta the transformMeta to set */ + /** + * @param transformMeta the transformMeta to set + */ @Override public void setTransformMeta(TransformMeta transformMeta) { this.transformMeta = transformMeta; } - /** @return the streamIcon */ + /** + * @return the streamIcon + */ @Override public StreamIcon getStreamIcon() { return streamIcon; } - /** @param streamIcon the streamIcon to set */ + /** + * @param streamIcon the streamIcon to set + */ @Override public void setStreamIcon(StreamIcon streamIcon) { this.streamIcon = streamIcon; } - /** @return the subject */ + /** + * @return the subject + */ @Override public String getSubject() { return subject; } - /** @param subject the subject to set */ + /** + * @param subject the subject to set + */ @Override public void setSubject(String subject) { this.subject = subject; diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/Dummy.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/Dummy.java index 89770375ee8..f4981881869 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/Dummy.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/Dummy.java @@ -25,8 +25,7 @@ import org.apache.hop.pipeline.transform.TransformMeta; /** Do nothing. Pass all input data to the next transforms. */ -public class Dummy extends BaseTransform -{ +public class Dummy extends BaseTransform { private static final Class PKG = DummyMeta.class; // For Translator public Dummy( diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/DummyMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/DummyMeta.java index 0632ac2bac7..4066a98223a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/DummyMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/dummy/DummyMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.dummy; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,8 +32,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "Dummy", image = "ui/images/dummy.svg", diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileField.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileField.java index e06f7c574f6..c997a49a3e4 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileField.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileField.java @@ -17,19 +17,18 @@ package org.apache.hop.pipeline.transforms.file; -import org.apache.hop.core.Const; -import org.apache.hop.core.gui.ITextFileInputField; -import org.apache.hop.core.injection.Injection; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaString; - import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import org.apache.hop.core.Const; +import org.apache.hop.core.gui.ITextFileInputField; +import org.apache.hop.core.injection.Injection; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaString; /** Describes a single field in a text file */ public class BaseFileField implements Cloneable, ITextFileInputField { diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputFiles.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputFiles.java index 1042588c481..a99288c4462 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputFiles.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputFiles.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.file; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.fileinput.FileInputList; import org.apache.hop.core.injection.Injection; import org.apache.hop.core.variables.IVariables; @@ -26,10 +29,6 @@ import org.apache.hop.resource.ResourceEntry.ResourceType; import org.apache.hop.resource.ResourceReference; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - /** Input files settings. */ public class BaseFileInputFiles implements Cloneable { private static final Class PKG = BaseFileInputFiles.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputMeta.java index f2a504ce1d1..299a3bf8b46 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputMeta.java @@ -18,6 +18,7 @@ package org.apache.hop.pipeline.transforms.file; import com.google.common.base.Preconditions; +import java.util.List; import org.apache.hop.core.fileinput.FileInputList; import org.apache.hop.core.injection.InjectionDeep; import org.apache.hop.core.variables.IVariables; @@ -29,8 +30,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.resource.ResourceReference; -import java.util.List; - /** Base meta for file-based input transforms. */ public abstract class BaseFileInputMeta< Main extends ITransform, @@ -58,7 +57,9 @@ public abstract class BaseFileInputMeta< /** The fields to import... */ @InjectionDeep public F[] inputFields; - /** @return the input fields. */ + /** + * @return the input fields. + */ public F[] getInputFields() { return inputFields; } @@ -90,7 +91,9 @@ public Object clone() { return retval; } - /** @param fileRequiredin The fileRequired to set. */ + /** + * @param fileRequiredin The fileRequired to set. + */ public void inputFiles_fileRequired(String[] fileRequiredin) { for (int i = 0; i < fileRequiredin.length; i++) { inputFiles.fileRequired[i] = getRequiredFilesCode(fileRequiredin[i]); diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransform.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransform.java index 7d18e7e2787..781763b8a1b 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransform.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransform.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.file; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -40,12 +45,6 @@ import org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerMissingFiles; import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** This class contains base functionality for file-based input transforms. */ public abstract class BaseFileInputTransform< Meta extends BaseFileInputMeta, Data extends BaseFileInputTransformData> diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformData.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformData.java index 01123e3f8c6..605d696d17a 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformData.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.file; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.fileinput.FileInputList; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - /** Some base data for file-based input transforms. */ public class BaseFileInputTransformData extends BaseTransformData { diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformUtils.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformUtils.java index 6f4cf8c3cb4..ec0522f15eb 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformUtils.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/BaseFileInputTransformUtils.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.file; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.fileinput.FileInputList; @@ -26,8 +27,6 @@ import org.apache.hop.core.row.value.ValueMetaString; import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; -import java.util.List; - /** Utils for file-based input transforms. */ public class BaseFileInputTransformUtils { diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/IBaseFileInputReader.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/IBaseFileInputReader.java index fd8d6fe7ce5..0008de73816 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/file/IBaseFileInputReader.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/file/IBaseFileInputReader.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.file; -import org.apache.hop.core.exception.HopException; - import java.io.Closeable; +import org.apache.hop.core.exception.HopException; /** Content-based reader for file. */ public interface IBaseFileInputReader extends Closeable { diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/Injector.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/Injector.java index ac9d4c741ce..7d1c92bb64d 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/Injector.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/Injector.java @@ -28,8 +28,7 @@ * Executor class to allow a java program to inject rows of data into a pipeline. This transform can * be used as a starting point in such a "headless" pipeline. */ -public class Injector extends BaseTransform -{ +public class Injector extends BaseTransform { private static final Class PKG = InjectorMeta.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorField.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorField.java index a1cf5814249..7d9855411fb 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorField.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorField.java @@ -66,7 +66,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -80,7 +82,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -94,7 +98,9 @@ public String getLength() { return length; } - /** @param length The length to set */ + /** + * @param length The length to set + */ public void setLength(String length) { this.length = length; } @@ -108,7 +114,9 @@ public String getPrecision() { return precision; } - /** @param precision The precision to set */ + /** + * @param precision The precision to set + */ public void setPrecision(String precision) { this.precision = precision; } diff --git a/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorMeta.java b/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorMeta.java index b64a598598a..1f7db32b204 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorMeta.java +++ b/engine/src/main/java/org/apache/hop/pipeline/transforms/injector/InjectorMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.injector; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - // TODO: check conversion of types from strings to numbers and back. // As compared in the old version. @@ -124,7 +123,9 @@ public List getInjectorFields() { return injectorFields; } - /** @param injectorFields The injectorFields to set */ + /** + * @param injectorFields The injectorFields to set + */ public void setInjectorFields(List injectorFields) { this.injectorFields = injectorFields; } diff --git a/engine/src/main/java/org/apache/hop/resource/IResourceExport.java b/engine/src/main/java/org/apache/hop/resource/IResourceExport.java index a2a007becdd..c92cca9f806 100644 --- a/engine/src/main/java/org/apache/hop/resource/IResourceExport.java +++ b/engine/src/main/java/org/apache/hop/resource/IResourceExport.java @@ -17,12 +17,11 @@ package org.apache.hop.resource; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.IHopMetadataProvider; -import java.util.Map; - /** The classes implementing this interface allow their used resources to be exported. */ public interface IResourceExport { diff --git a/engine/src/main/java/org/apache/hop/resource/IResourceHolder.java b/engine/src/main/java/org/apache/hop/resource/IResourceHolder.java index 42d7db0d8a3..148acd05aec 100644 --- a/engine/src/main/java/org/apache/hop/resource/IResourceHolder.java +++ b/engine/src/main/java/org/apache/hop/resource/IResourceHolder.java @@ -19,10 +19,14 @@ public interface IResourceHolder { - /** @return The name of the holder of the resource */ + /** + * @return The name of the holder of the resource + */ String getName(); - /** @return The description of the holder of the resource */ + /** + * @return The description of the holder of the resource + */ String getDescription(); /** diff --git a/engine/src/main/java/org/apache/hop/resource/IResourceNaming.java b/engine/src/main/java/org/apache/hop/resource/IResourceNaming.java index 20e1d5351ef..a732bfe24b8 100644 --- a/engine/src/main/java/org/apache/hop/resource/IResourceNaming.java +++ b/engine/src/main/java/org/apache/hop/resource/IResourceNaming.java @@ -17,12 +17,11 @@ package org.apache.hop.resource; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.hop.core.variables.IVariables; -import java.util.Map; - public interface IResourceNaming { enum FileNamingType { @@ -60,6 +59,8 @@ String nameResource( String nameResource(FileObject fileObject, IVariables variables, boolean pathOnly) throws FileSystemException; - /** @return the map of folders mapped to created parameters during the resource naming. */ + /** + * @return the map of folders mapped to created parameters during the resource naming. + */ Map getDirectoryMap(); } diff --git a/engine/src/main/java/org/apache/hop/resource/ResourceDefinition.java b/engine/src/main/java/org/apache/hop/resource/ResourceDefinition.java index 54763f61476..2b6252beb82 100644 --- a/engine/src/main/java/org/apache/hop/resource/ResourceDefinition.java +++ b/engine/src/main/java/org/apache/hop/resource/ResourceDefinition.java @@ -33,32 +33,44 @@ public ResourceDefinition(String filename, String content) { this.content = content; } - /** @return the filename */ + /** + * @return the filename + */ public String getFilename() { return filename; } - /** @param filename the filename to set */ + /** + * @param filename the filename to set + */ public void setFilename(String filename) { this.filename = filename; } - /** @return the content */ + /** + * @return the content + */ public String getContent() { return content; } - /** @param content the content to set */ + /** + * @param content the content to set + */ public void setContent(String content) { this.content = content; } - /** @return the origin of the resource as entered by the user. (optional) */ + /** + * @return the origin of the resource as entered by the user. (optional) + */ public String getOrigin() { return origin; } - /** @param origin the origin of the resource as entered by the user. (optional) */ + /** + * @param origin the origin of the resource as entered by the user. (optional) + */ public void setOrigin(String origin) { this.origin = origin; } diff --git a/engine/src/main/java/org/apache/hop/resource/ResourceEntry.java b/engine/src/main/java/org/apache/hop/resource/ResourceEntry.java index 6fc8aaa306a..b3c624a9a85 100644 --- a/engine/src/main/java/org/apache/hop/resource/ResourceEntry.java +++ b/engine/src/main/java/org/apache/hop/resource/ResourceEntry.java @@ -43,22 +43,30 @@ public ResourceEntry(String resource, ResourceType resourcetype) { this.resourcetype = resourcetype; } - /** @return the resource */ + /** + * @return the resource + */ public String getResource() { return resource; } - /** @param resource the resource to set */ + /** + * @param resource the resource to set + */ public void setResource(String resource) { this.resource = resource; } - /** @return the resourcetype */ + /** + * @return the resourcetype + */ public ResourceType getResourcetype() { return resourcetype; } - /** @param resourcetype the resourcetype to set */ + /** + * @param resourcetype the resourcetype to set + */ public void setResourcetype(ResourceType resourcetype) { this.resourcetype = resourcetype; } diff --git a/engine/src/main/java/org/apache/hop/resource/ResourceReference.java b/engine/src/main/java/org/apache/hop/resource/ResourceReference.java index 0e59818e675..5d23841d6dd 100644 --- a/engine/src/main/java/org/apache/hop/resource/ResourceReference.java +++ b/engine/src/main/java/org/apache/hop/resource/ResourceReference.java @@ -17,10 +17,9 @@ package org.apache.hop.resource; -import org.apache.hop.core.util.StringUtil; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.util.StringUtil; public class ResourceReference { private IResourceHolder resourceReferenceHolder; @@ -41,22 +40,30 @@ public ResourceReference(IResourceHolder resourceReferenceHolder) { this.entries = new ArrayList<>(); } - /** @return the resource reference holder */ + /** + * @return the resource reference holder + */ public IResourceHolder getReferenceHolder() { return resourceReferenceHolder; } - /** @param resourceReferenceHolder the resource reference holder to set */ + /** + * @param resourceReferenceHolder the resource reference holder to set + */ public void setReferenceHolder(IResourceHolder resourceReferenceHolder) { this.resourceReferenceHolder = resourceReferenceHolder; } - /** @return the entries */ + /** + * @return the entries + */ public List getEntries() { return entries; } - /** @param entries the entries to set */ + /** + * @param entries the entries to set + */ public void setEntries(List entries) { this.entries = entries; } diff --git a/engine/src/main/java/org/apache/hop/resource/ResourceUtil.java b/engine/src/main/java/org/apache/hop/resource/ResourceUtil.java index a222af93c0e..9f65c298927 100644 --- a/engine/src/main/java/org/apache/hop/resource/ResourceUtil.java +++ b/engine/src/main/java/org/apache/hop/resource/ResourceUtil.java @@ -17,6 +17,12 @@ package org.apache.hop.resource; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -30,13 +36,6 @@ import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.pipeline.PipelineMeta; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - public class ResourceUtil { private static final Class PKG = ResourceUtil.class; // For Translator @@ -164,7 +163,10 @@ public static final TopLevelResource serializeResourceExportInterface( ZipEntry jsonEntry = new ZipEntry("metadata.json"); jsonEntry.setComment("Export of the client metadata"); out.putNextEntry(jsonEntry); - out.write(new SerializableMetadataProvider(metadataProvider).toJson().getBytes(StandardCharsets.UTF_8)); + out.write( + new SerializableMetadataProvider(metadataProvider) + .toJson() + .getBytes(StandardCharsets.UTF_8)); out.closeEntry(); String zipURL = fileObject.getName().toString(); diff --git a/engine/src/main/java/org/apache/hop/resource/SimpleResourceNaming.java b/engine/src/main/java/org/apache/hop/resource/SimpleResourceNaming.java index 3e82c2c8f00..c237ed44d47 100644 --- a/engine/src/main/java/org/apache/hop/resource/SimpleResourceNaming.java +++ b/engine/src/main/java/org/apache/hop/resource/SimpleResourceNaming.java @@ -17,13 +17,12 @@ package org.apache.hop.resource; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.hop.core.variables.IVariables; -import java.util.HashMap; -import java.util.Map; - public class SimpleResourceNaming implements IResourceNaming { private final Map namedResources = new HashMap<>(); @@ -271,13 +270,17 @@ public void setUseOriginalPathInTargetName(boolean value) { this.useOriginalPathInTargetName = value; } - /** @return the directoryMap */ + /** + * @return the directoryMap + */ @Override public Map getDirectoryMap() { return directoryMap; } - /** @param directoryMap the directoryMap to set */ + /** + * @param directoryMap the directoryMap to set + */ public void setDirectoryMap(Map directoryMap) { this.directoryMap = directoryMap; } diff --git a/engine/src/main/java/org/apache/hop/resource/TopLevelResource.java b/engine/src/main/java/org/apache/hop/resource/TopLevelResource.java index c8c259e58f1..710b114efe0 100644 --- a/engine/src/main/java/org/apache/hop/resource/TopLevelResource.java +++ b/engine/src/main/java/org/apache/hop/resource/TopLevelResource.java @@ -34,32 +34,44 @@ public TopLevelResource(String baseResourceName, String archiveName, String reso this.resourceName = resourceName; } - /** @return the baseResourceName */ + /** + * @return the baseResourceName + */ public String getBaseResourceName() { return baseResourceName; } - /** @param baseResourceName the baseResourceName to set */ + /** + * @param baseResourceName the baseResourceName to set + */ public void setBaseResourceName(String baseResourceName) { this.baseResourceName = baseResourceName; } - /** @return the archiveName */ + /** + * @return the archiveName + */ public String getArchiveName() { return archiveName; } - /** @param archiveName the archiveName to set */ + /** + * @param archiveName the archiveName to set + */ public void setArchiveName(String archiveName) { this.archiveName = archiveName; } - /** @return the resourceName */ + /** + * @return the resourceName + */ public String getResourceName() { return resourceName; } - /** @param resourceName the resourceName to set */ + /** + * @param resourceName the resourceName to set + */ public void setResourceName(String resourceName) { this.resourceName = resourceName; } diff --git a/engine/src/main/java/org/apache/hop/run/HopRun.java b/engine/src/main/java/org/apache/hop/run/HopRun.java index 58ca1169477..fdaeec03b21 100644 --- a/engine/src/main/java/org/apache/hop/run/HopRun.java +++ b/engine/src/main/java/org/apache/hop/run/HopRun.java @@ -109,8 +109,9 @@ public class HopRun implements Runnable, IHasHopMetadataProvider { private String[] parameters = null; @Option( - names = {"-ps", "--parameters-separator"}, - description = "A character to be used as separator for our list of PARAMETER=VALUE pairs (default is ,)" ) + names = {"-ps", "--parameters-separator"}, + description = + "A character to be used as separator for our list of PARAMETER=VALUE pairs (default is ,)") private String parametersSeparator = null; @Option( @@ -128,7 +129,7 @@ public class HopRun implements Runnable, IHasHopMetadataProvider { names = {"-a", "--startaction"}, description = "The name of the action where to start a workflow") private String startActionName = null; - + @Option( names = {"-m", "--metadata-export"}, description = "A file containing exported metadata in JSON format") @@ -368,9 +369,9 @@ private void runWorkflow(CommandLine cmd, ILogChannel log) { } // Start workflow at action - // - configuration.setStartActionName(startActionName); - + // + configuration.setStartActionName(startActionName); + // Certain Hop plugins rely on this. Meh. // ExtensionPointHandler.callExtensionPoint( @@ -419,19 +420,19 @@ private void runWorkflow( // Also copy the parameter values over to the variables... // workflow.activateParameters(workflow); - + // If there is an alternative start action, pass it to the workflow // if (!Utils.isEmpty(configuration.getStartActionName())) { - ActionMeta startActionMeta = - workflowMeta.findAction(configuration.getStartActionName()); - - if ( startActionMeta==null ) { - throw new ExecutionException(cmd, "Error running workflow, specified start action not found"); - } + ActionMeta startActionMeta = workflowMeta.findAction(configuration.getStartActionName()); + + if (startActionMeta == null) { + throw new ExecutionException( + cmd, "Error running workflow, specified start action not found"); + } workflow.setStartActionMeta(startActionMeta); } - + log.logMinimal("Starting workflow: " + workflowMeta.getFilename()); workflow.startExecution(); @@ -510,7 +511,7 @@ private void parseParametersAndVariables( parametersSeparator = parametersSeparator == null ? "," : parametersSeparator; for (String parameter : parameters) { - for(String singleParameter : parameter.split(parametersSeparator)){ + for (String singleParameter : parameter.split(parametersSeparator)) { String[] split = singleParameter.split("=", 2); String key = split.length > 0 ? split[0] : null; String value = split.length > 1 ? split[1] : null; diff --git a/engine/src/main/java/org/apache/hop/search/HopSearch.java b/engine/src/main/java/org/apache/hop/search/HopSearch.java index 0a4d6d9ad78..df09de0e2f7 100644 --- a/engine/src/main/java/org/apache/hop/search/HopSearch.java +++ b/engine/src/main/java/org/apache/hop/search/HopSearch.java @@ -17,6 +17,11 @@ package org.apache.hop.search; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; @@ -51,12 +56,6 @@ import picocli.CommandLine.ParameterException; import picocli.CommandLine.Parameters; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - @Command(versionProvider = HopVersionProvider.class) public class HopSearch implements Runnable, IHasHopMetadataProvider { @@ -66,11 +65,12 @@ public class HopSearch implements Runnable, IHasHopMetadataProvider { description = "Displays this help message and quits.") private boolean helpRequested; - @Option(names = {"-v", "--version"}, + @Option( + names = {"-v", "--version"}, versionHelp = true, description = "Print version information and exit") private boolean versionRequested; - + @Parameters(description = "The string to search for") private String searchString; @@ -233,7 +233,9 @@ public CommandLine getCmd() { return cmd; } - /** @param cmd The cmd to set */ + /** + * @param cmd The cmd to set + */ public void setCmd(CommandLine cmd) { this.cmd = cmd; } @@ -248,7 +250,9 @@ public MultiMetadataProvider getMetadataProvider() { return metadataProvider; } - /** @param metadataProvider The metadataProvider to set */ + /** + * @param metadataProvider The metadataProvider to set + */ @Override public void setMetadataProvider(MultiMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; @@ -263,7 +267,9 @@ public boolean isHelpRequested() { return helpRequested; } - /** @param helpRequested The helpRequested to set */ + /** + * @param helpRequested The helpRequested to set + */ public void setHelpRequested(boolean helpRequested) { this.helpRequested = helpRequested; } @@ -277,7 +283,9 @@ public IVariables getVariables() { return variables; } - /** @param variables The variables to set */ + /** + * @param variables The variables to set + */ public void setVariables(IVariables variables) { this.variables = variables; } @@ -291,7 +299,9 @@ public List getSearchablesLocations() { return searchablesLocations; } - /** @param searchablesLocations The searchablesLocations to set */ + /** + * @param searchablesLocations The searchablesLocations to set + */ public void setSearchablesLocations(List searchablesLocations) { this.searchablesLocations = searchablesLocations; } @@ -305,7 +315,9 @@ public String getSearchString() { return searchString; } - /** @param searchString The searchString to set */ + /** + * @param searchString The searchString to set + */ public void setSearchString(String searchString) { this.searchString = searchString; } @@ -319,7 +331,9 @@ public Boolean getCaseInsensitive() { return caseInsensitive; } - /** @param caseInsensitive The caseInsensitive to set */ + /** + * @param caseInsensitive The caseInsensitive to set + */ public void setCaseInsensitive(Boolean caseInsensitive) { this.caseInsensitive = caseInsensitive; } @@ -333,7 +347,9 @@ public Boolean getRegularExpression() { return regularExpression; } - /** @param regularExpression The regularExpression to set */ + /** + * @param regularExpression The regularExpression to set + */ public void setRegularExpression(Boolean regularExpression) { this.regularExpression = regularExpression; } diff --git a/engine/src/main/java/org/apache/hop/server/HopServer.java b/engine/src/main/java/org/apache/hop/server/HopServer.java index f6591588e0f..7eb5bf7fe07 100644 --- a/engine/src/main/java/org/apache/hop/server/HopServer.java +++ b/engine/src/main/java/org/apache/hop/server/HopServer.java @@ -17,6 +17,23 @@ package org.apache.hop.server; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.text.MessageFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.net.ssl.SSLContext; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Result; @@ -82,24 +99,6 @@ import org.apache.http.ssl.SSLContexts; import org.w3c.dom.Node; -import javax.net.ssl.SSLContext; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.text.MessageFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static java.nio.charset.StandardCharsets.UTF_8; - @HopMetadata( key = "server", name = "Hop Server", @@ -516,7 +515,7 @@ public String constructUrl(IVariables variables, String serviceAndArguments) HttpPost buildSendXmlMethod(IVariables variables, byte[] content, String service) throws Exception { String encoding = Const.XML_ENCODING; - return buildSendMethod(variables, content, encoding, service, "text/xml"); + return buildSendMethod(variables, content, encoding, service, "text/xml"); } // Method is defined as package-protected in order to be accessible by unit tests @@ -544,7 +543,7 @@ HttpPost buildSendMethod( public String sendXml(IVariables variables, String xml, String service) throws Exception { String encoding = getXmlEncoding(xml); HttpPost method = - buildSendMethod(variables, xml.getBytes(encoding), encoding, service, "text/xml"); + buildSendMethod(variables, xml.getBytes(encoding), encoding, service, "text/xml"); try { return executeAuth(variables, method); } finally { @@ -1351,4 +1350,3 @@ public void setPropertiesMasterName(String propertiesMasterName) { this.propertiesMasterName = propertiesMasterName; } } - diff --git a/engine/src/main/java/org/apache/hop/workflow/ActionResult.java b/engine/src/main/java/org/apache/hop/workflow/ActionResult.java index 5809fdda9c3..4d99e97477a 100644 --- a/engine/src/main/java/org/apache/hop/workflow/ActionResult.java +++ b/engine/src/main/java/org/apache/hop/workflow/ActionResult.java @@ -17,10 +17,9 @@ package org.apache.hop.workflow; -import org.apache.hop.core.Result; - import java.util.Comparator; import java.util.Date; +import org.apache.hop.core.Result; /** * This class holds the result of a action after it was executed. Things we want to keep track of @@ -88,62 +87,86 @@ public Object clone() { } } - /** @param result The result to set. */ + /** + * @param result The result to set. + */ public void setResult(Result result) { this.result = result; } - /** @return Returns the result. */ + /** + * @return Returns the result. + */ public Result getResult() { return result; } - /** @return Returns the comment. */ + /** + * @return Returns the comment. + */ public String getComment() { return comment; } - /** @param comment The comment to set. */ + /** + * @param comment The comment to set. + */ public void setComment(String comment) { this.comment = comment; } - /** @return Returns the reason. */ + /** + * @return Returns the reason. + */ public String getReason() { return reason; } - /** @param reason The reason to set. */ + /** + * @param reason The reason to set. + */ public void setReason(String reason) { this.reason = reason; } - /** @return Returns the logDate. */ + /** + * @return Returns the logDate. + */ public Date getLogDate() { return logDate; } - /** @param logDate The logDate to set. */ + /** + * @param logDate The logDate to set. + */ public void setLogDate(Date logDate) { this.logDate = logDate; } - /** @return the actionName */ + /** + * @return the actionName + */ public String getActionName() { return actionName; } - /** @param actionName the actionName to set */ + /** + * @param actionName the actionName to set + */ public void setActionName(String actionName) { this.actionName = actionName; } - /** @return the actionFilename */ + /** + * @return the actionFilename + */ public String getActionFilename() { return actionFilename; } - /** @param actionFilename the actionFilename to set */ + /** + * @param actionFilename the actionFilename to set + */ public void setActionFilename(String actionFilename) { this.actionFilename = actionFilename; } @@ -181,12 +204,16 @@ public String getLogChannelId() { return logChannelId; } - /** @return the checkpoint */ + /** + * @return the checkpoint + */ public boolean isCheckpoint() { return checkpoint; } - /** @param checkpoint the checkpoint to set */ + /** + * @param checkpoint the checkpoint to set + */ public void setCheckpoint(boolean checkpoint) { this.checkpoint = checkpoint; } diff --git a/engine/src/main/java/org/apache/hop/workflow/Workflow.java b/engine/src/main/java/org/apache/hop/workflow/Workflow.java index b20ddabacde..2e41d1cfb44 100644 --- a/engine/src/main/java/org/apache/hop/workflow/Workflow.java +++ b/engine/src/main/java/org/apache/hop/workflow/Workflow.java @@ -17,6 +17,19 @@ package org.apache.hop.workflow; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -62,20 +75,6 @@ import org.apache.hop.workflow.config.WorkflowRunConfiguration; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.atomic.AtomicInteger; - /** * This class executes a workflow as defined by a WorkflowMeta object. * @@ -655,7 +654,7 @@ private Result executeFromStart( log.snap(Metrics.METRIC_ACTION_STOP, cloneJei.toString()); // Action execution duration - newResult.setElapsedTimeMillis(System.currentTimeMillis()-start); + newResult.setElapsedTimeMillis(System.currentTimeMillis() - start); if (interactive) { getActiveActions().remove(actionMeta); diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowConfiguration.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowConfiguration.java index b237ae7c580..e372e622210 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowConfiguration.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowConfiguration.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow; +import java.io.IOException; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.metadata.SerializableMetadataProvider; @@ -28,8 +29,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.io.IOException; - public class WorkflowConfiguration { public static final String XML_TAG = "workflow_configuration"; @@ -84,23 +83,31 @@ public static final WorkflowConfiguration fromXml(String xml, IVariables variabl return new WorkflowConfiguration(configNode, variables); } - /** @return the workflowExecutionConfiguration */ + /** + * @return the workflowExecutionConfiguration + */ public WorkflowExecutionConfiguration getWorkflowExecutionConfiguration() { return workflowExecutionConfiguration; } - /** @param workflowExecutionConfiguration the workflowExecutionConfiguration to set */ + /** + * @param workflowExecutionConfiguration the workflowExecutionConfiguration to set + */ public void setWorkflowExecutionConfiguration( WorkflowExecutionConfiguration workflowExecutionConfiguration) { this.workflowExecutionConfiguration = workflowExecutionConfiguration; } - /** @return the workflow metadata */ + /** + * @return the workflow metadata + */ public WorkflowMeta getWorkflowMeta() { return workflowMeta; } - /** @param workflowMeta the workflow meta data to set */ + /** + * @param workflowMeta the workflow meta data to set + */ public void setWorkflowMeta(WorkflowMeta workflowMeta) { this.workflowMeta = workflowMeta; } diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowExecutionConfiguration.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowExecutionConfiguration.java index 28acafce5bb..6c210aeffcb 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowExecutionConfiguration.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowExecutionConfiguration.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; import org.apache.commons.lang.StringUtils; import org.apache.hop.IExecutionConfiguration; import org.apache.hop.core.Const; @@ -29,13 +35,6 @@ import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - public class WorkflowExecutionConfiguration implements IExecutionConfiguration, IXml { public static final String XML_TAG = "workflow_execution_configuration"; @@ -90,25 +89,33 @@ public Object clone() { } } - /** @param parametersMap the parameters to set */ + /** + * @param parametersMap the parameters to set + */ @Override public void setParametersMap(Map parametersMap) { this.parametersMap = parametersMap; } - /** @return the parameters. */ + /** + * @return the parameters. + */ @Override public Map getParametersMap() { return parametersMap; } - /** @return the variables */ + /** + * @return the variables + */ @Override public Map getVariablesMap() { return variablesMap; } - /** @param variablesMap the variables to set */ + /** + * @param variablesMap the variables to set + */ @Override public void setVariablesMap(Map variablesMap) { this.variablesMap = variablesMap; @@ -175,13 +182,17 @@ public void setRunConfiguration(String runConfiguration) { this.runConfiguration = runConfiguration; } - /** @return the logLevel */ + /** + * @return the logLevel + */ @Override public LogLevel getLogLevel() { return logLevel; } - /** @param logLevel the logLevel to set */ + /** + * @param logLevel the logLevel to set + */ @Override public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; @@ -292,46 +303,62 @@ public WorkflowExecutionConfiguration(Node configNode) throws HopException { } } - /** @return the previousResult */ + /** + * @return the previousResult + */ @Override public Result getPreviousResult() { return previousResult; } - /** @param previousResult the previousResult to set */ + /** + * @param previousResult the previousResult to set + */ @Override public void setPreviousResult(Result previousResult) { this.previousResult = previousResult; } - /** @return the clearingLog */ + /** + * @return the clearingLog + */ @Override public boolean isClearingLog() { return clearingLog; } - /** @param clearingLog the clearingLog to set */ + /** + * @param clearingLog the clearingLog to set + */ @Override public void setClearingLog(boolean clearingLog) { this.clearingLog = clearingLog; } - /** @return the start action name */ + /** + * @return the start action name + */ public String getStartActionName() { return startActionName; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setStartActionName(String name) { this.startActionName = name; } - /** @return the gatheringMetrics */ + /** + * @return the gatheringMetrics + */ public boolean isGatheringMetrics() { return gatheringMetrics; } - /** @param gatheringMetrics the gatheringMetrics to set */ + /** + * @param gatheringMetrics the gatheringMetrics to set + */ public void setGatheringMetrics(boolean gatheringMetrics) { this.gatheringMetrics = gatheringMetrics; } @@ -353,7 +380,9 @@ public boolean isExpandingRemoteWorkflow() { return expandingRemoteWorkflow; } - /** @param expandingRemoteWorkflow The expandingRemoteWorkflow to set */ + /** + * @param expandingRemoteWorkflow The expandingRemoteWorkflow to set + */ public void setExpandingRemoteWorkflow(boolean expandingRemoteWorkflow) { this.expandingRemoteWorkflow = expandingRemoteWorkflow; } diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowHopMeta.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowHopMeta.java index 9273f09ae6a..bdc7237acd8 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowHopMeta.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowHopMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow; +import java.util.List; import org.apache.hop.base.BaseHopMeta; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopXmlException; @@ -25,15 +26,13 @@ import org.apache.hop.workflow.action.ActionMeta; import org.w3c.dom.Node; -import java.util.List; - /** This class defines a hop from one action copy to another. */ public class WorkflowHopMeta extends BaseHopMeta implements Cloneable { private static final Class PKG = WorkflowHopMeta.class; // For Translator public static final String XML_EVALUATION_TAG = "evaluation"; public static final String XML_UNCONDITIONAL_TAG = "unconditional"; - + private boolean evaluation; private boolean unconditional; @@ -106,12 +105,12 @@ public WorkflowHopMeta(Node hopNode, WorkflowMeta workflow) throws HopXmlExcepti try { String fromName = XmlHandler.getTagValue(hopNode, XML_FROM_TAG); String toName = XmlHandler.getTagValue(hopNode, XML_TO_TAG); - + this.from = workflow.findAction(fromName); this.to = workflow.findAction(toName); this.enabled = getTagValueAsBoolean(hopNode, XML_ENABLED_TAG, true); this.evaluation = getTagValueAsBoolean(hopNode, XML_EVALUATION_TAG, true); - this.unconditional = getTagValueAsBoolean(hopNode, XML_UNCONDITIONAL_TAG, false); + this.unconditional = getTagValueAsBoolean(hopNode, XML_UNCONDITIONAL_TAG, false); } catch (Exception e) { throw new HopXmlException( BaseMessages.getString(PKG, "WorkflowHopMeta.Exception.UnableToLoadHopInfoXML"), e); @@ -126,7 +125,8 @@ public String getXml() { xml.append(" ").append(XmlHandler.addTagValue(XML_TO_TAG, this.to.getName())); xml.append(" ").append(XmlHandler.addTagValue(XML_ENABLED_TAG, this.enabled)); xml.append(" ").append(XmlHandler.addTagValue(XML_EVALUATION_TAG, this.evaluation)); - xml.append(" ").append(XmlHandler.addTagValue(XML_UNCONDITIONAL_TAG, this.unconditional)); + xml.append(" ") + .append(XmlHandler.addTagValue(XML_UNCONDITIONAL_TAG, this.unconditional)); xml.append(" ").append(XmlHandler.closeTag(XML_HOP_TAG)).append(Const.CR); } @@ -200,7 +200,9 @@ public void setToAction(ActionMeta toAction) { changed = true; } - /** @param unconditional the unconditional to set */ + /** + * @param unconditional the unconditional to set + */ public void setUnconditional(boolean unconditional) { if (this.unconditional != unconditional) { setChanged(); diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java index 8ac24cab459..f1cf7b2d18f 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java @@ -17,6 +17,13 @@ package org.apache.hop.workflow; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; @@ -62,14 +69,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - /** * The definition of a Hop workflow is represented by a WorkflowMeta object. It is typically loaded * from a .hwf file or it is generated dynamically. The declared parameters of the workflow @@ -123,13 +122,13 @@ public class WorkflowMeta extends AbstractMeta /** A constant specifying the tag value for the XML node of the actions. */ public static final String XML_TAG_ACTIONS = "actions"; - + /** A constant specifying the tag value for the XML node of the notes. */ public static final String XML_TAG_NOTEPADS = "notepads"; - + /** A constant specifying the tag value for the XML node of the hops. */ public static final String XML_TAG_HOPS = "hops"; - + /** A constant specifying the tag value for the XML node of the workflow parameters. */ protected static final String XML_TAG_PARAMETERS = "parameters"; @@ -356,10 +355,13 @@ public String getXml(IVariables variables) throws HopException { .append( XmlHandler.addTagValue("name", getName())); // lossy if name is sync'ed with filename xml.append(" ") - .append(XmlHandler.addTagValue("name_sync_with_filename", info.isNameSynchronizedWithFilename())); + .append( + XmlHandler.addTagValue( + "name_sync_with_filename", info.isNameSynchronizedWithFilename())); xml.append(" ").append(XmlHandler.addTagValue("description", info.getDescription())); - xml.append(" ").append(XmlHandler.addTagValue("extended_description", info.getExtendedDescription())); + xml.append(" ") + .append(XmlHandler.addTagValue("extended_description", info.getExtendedDescription())); xml.append(" ").append(XmlHandler.addTagValue("workflow_version", workflowVersion)); if (workflowStatus >= 0) { xml.append(" ").append(XmlHandler.addTagValue("workflow_status", workflowStatus)); @@ -367,10 +369,13 @@ public String getXml(IVariables variables) throws HopException { xml.append(" ").append(XmlHandler.addTagValue("created_user", info.getCreatedUser())); xml.append(" ") - .append(XmlHandler.addTagValue("created_date", XmlHandler.date2string(info.getCreatedDate()))); + .append( + XmlHandler.addTagValue("created_date", XmlHandler.date2string(info.getCreatedDate()))); xml.append(" ").append(XmlHandler.addTagValue("modified_user", info.getModifiedUser())); xml.append(" ") - .append(XmlHandler.addTagValue("modified_date", XmlHandler.date2string(info.getModifiedDate()))); + .append( + XmlHandler.addTagValue( + "modified_date", XmlHandler.date2string(info.getModifiedDate()))); xml.append(" ").append(XmlHandler.openTag(XML_TAG_PARAMETERS)).append(Const.CR); String[] parameters = listParameters(); @@ -537,10 +542,10 @@ public void loadXml( "Y".equalsIgnoreCase(XmlHandler.getTagValue(workflowNode, "name_sync_with_filename"))); // description - info.setDescription( XmlHandler.getTagValue(workflowNode, "description")); + info.setDescription(XmlHandler.getTagValue(workflowNode, "description")); // extended description - info.setExtendedDescription( XmlHandler.getTagValue(workflowNode, "extended_description")); + info.setExtendedDescription(XmlHandler.getTagValue(workflowNode, "extended_description")); // workflow version workflowVersion = XmlHandler.getTagValue(workflowNode, "workflow_version"); @@ -549,7 +554,7 @@ public void loadXml( workflowStatus = Const.toInt(XmlHandler.getTagValue(workflowNode, "workflow_status"), -1); // Created user/date - info.setCreatedUser( XmlHandler.getTagValue(workflowNode, "created_user")); + info.setCreatedUser(XmlHandler.getTagValue(workflowNode, "created_user")); String createDate = XmlHandler.getTagValue(workflowNode, "created_date"); if (createDate != null) { @@ -2046,6 +2051,7 @@ public String getName() { return extractNameFromFilename( isNameSynchronizedWithFilename(), info.getName(), filename, getExtension()); } + /** * Set the name. * diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaInfo.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaInfo.java index 0772ef28e7e..bd5de3b2e66 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaInfo.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaInfo.java @@ -20,5 +20,4 @@ import org.apache.hop.pipeline.AbstractMetaInfo; -public class WorkflowMetaInfo extends AbstractMetaInfo { -} +public class WorkflowMetaInfo extends AbstractMetaInfo {} diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaSearchAnalyser.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaSearchAnalyser.java index eed728937a4..4b24519f84b 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaSearchAnalyser.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowMetaSearchAnalyser.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.NotePadMeta; import org.apache.hop.core.plugins.ActionPluginType; import org.apache.hop.core.plugins.IPlugin; @@ -30,9 +32,6 @@ import org.apache.hop.workflow.action.ActionMeta; import org.apache.hop.workflow.action.IAction; -import java.util.ArrayList; -import java.util.List; - @SearchableAnalyserPlugin(id = "WorkflowMetaSearchAnalyser", name = "Search in workflow metadata") public class WorkflowMetaSearchAnalyser extends BaseSearchableAnalyser implements ISearchableAnalyser { diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java index 21282374ef0..befede77178 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java @@ -256,10 +256,10 @@ protected void drawAction(ActionMeta actionMeta) throws HopException { boolean actionError = false; ActionResult actionResult = findActionResult(actionMeta); - if ( actionResult!=null && !actionResult.isCheckpoint() ) { + if (actionResult != null && !actionResult.isCheckpoint()) { actionError = !actionResult.getResult().getResult(); } - + if (actionError || actionMeta.isMissing()) { gc.setForeground(EColor.RED); } else if (actionMeta.isDeprecated()) { diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowPainterExtension.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowPainterExtension.java index 703c8a217c0..6a2bf7a5116 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowPainterExtension.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowPainterExtension.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow; +import java.util.List; import org.apache.hop.core.gui.AreaOwner; import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.IGc; import org.apache.hop.workflow.action.ActionMeta; -import java.util.List; - public class WorkflowPainterExtension { public IGc gc; diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java index 966537709ac..5339cd40c38 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow; +import java.util.ArrayList; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.Point; @@ -24,8 +25,6 @@ import org.apache.hop.core.svg.HopSvgGraphics2D; import org.apache.hop.core.variables.IVariables; -import java.util.ArrayList; - public class WorkflowSvgPainter { public static final String generateWorkflowSvg( diff --git a/engine/src/main/java/org/apache/hop/workflow/action/ActionBase.java b/engine/src/main/java/org/apache/hop/workflow/action/ActionBase.java index 70f0da2442b..fcd92d8d09e 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/ActionBase.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/ActionBase.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.action; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.IAttributes; @@ -55,13 +61,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - /** * Base class for the different types of workflow actions. Workflow actions can extend this base * class to get access to common member variables and default method behavior. However, ActionBase @@ -141,7 +140,6 @@ protected ActionBase(String name, String description) { } /** - * * @param name the name of the action * @param description the description of the action * @param pluginId the pluginId of the action @@ -158,13 +156,13 @@ protected ActionBase(String name, String description, String pluginId) { /** * Copy constructor variant + * * @param b The action base to copy */ protected ActionBase(ActionBase b) { this(b.name, b.description); } - /** * Checks if the Action object is equal to the specified object * @@ -1146,7 +1144,9 @@ public Map getExtensionDataMap() { return extensionDataMap; } - /** @return The parent workflowMeta at save and during execution. */ + /** + * @return The parent workflowMeta at save and during execution. + */ @Override public WorkflowMeta getParentWorkflowMeta() { return parentWorkflowMeta; diff --git a/engine/src/main/java/org/apache/hop/workflow/action/ActionMeta.java b/engine/src/main/java/org/apache/hop/workflow/action/ActionMeta.java index f6106dd19e0..bee70c5bdd8 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/ActionMeta.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/ActionMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.action; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.base.IBaseMeta; import org.apache.hop.core.Const; import org.apache.hop.core.IAttributes; @@ -35,9 +37,6 @@ import org.apache.hop.workflow.actions.missing.MissingAction; import org.w3c.dom.Node; -import java.util.HashMap; -import java.util.Map; - /** * This class describes the fact that a single Action can be used multiple times in the same * Workflow. Therefore it contains a link to a Action, a position, a number, etc. @@ -214,7 +213,9 @@ public IAction getAction() { return action; } - /** @return action in IAction.typeCode[] for native workflows, action.getTypeCode() for plugins */ + /** + * @return action in IAction.typeCode[] for native workflows, action.getTypeCode() for plugins + */ public String getTypeDesc() { IPlugin plugin = PluginRegistry.getInstance().findPluginWithId(ActionPluginType.class, action.getPluginId()); diff --git a/engine/src/main/java/org/apache/hop/workflow/action/IAction.java b/engine/src/main/java/org/apache/hop/workflow/action/IAction.java index bc8595b0510..2fa55a37f95 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/IAction.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/IAction.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.action; +import java.util.List; +import java.util.Map; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.IExtensionData; import org.apache.hop.core.Result; @@ -35,9 +37,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.util.List; -import java.util.Map; - /** * IAction is the main Java interface that a plugin implements. The responsibilities of the * implementing class are listed below: diff --git a/engine/src/main/java/org/apache/hop/workflow/action/IActionDialog.java b/engine/src/main/java/org/apache/hop/workflow/action/IActionDialog.java index 4fbb9f0ddbd..1eba3c30300 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/IActionDialog.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/IActionDialog.java @@ -59,11 +59,9 @@ public interface IActionDialog { */ IAction open(); - /** - * Brings the dialog to the front if the dialog is already open. - */ + /** Brings the dialog to the front if the dialog is already open. */ void setActive(); - + /** * The Metadata provider to pass * diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/AbstractFileValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/AbstractFileValidator.java index 87e02301d7a..415b6476ed2 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/AbstractFileValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/AbstractFileValidator.java @@ -17,12 +17,11 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; import org.apache.hop.core.variables.IVariables; -import java.util.List; - public abstract class AbstractFileValidator implements IActionValidator { private static final String KEY_VARIABLE_SPACE = "org.apache.hop.workflow.actions.file.variables"; diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/ActionValidatorUtils.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/ActionValidatorUtils.java index 672a7301225..ef2f33aff86 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/ActionValidatorUtils.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/ActionValidatorUtils.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.validator.GenericValidator; import org.apache.commons.validator.util.ValidatorUtils; @@ -24,9 +26,6 @@ import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; -import java.util.Map; - /** * Methods in this class are referenced in validator definitions within the validator resources file * (e.g. validator.xml). diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/AndValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/AndValidator.java index a702721a399..27e3fa52492 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/AndValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/AndValidator.java @@ -17,11 +17,10 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; - /** * Boolean ANDs the results of all validators. If one validator fails, false is * immediately returned. The validators list (a List<IActionValidator>) should be diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/EmailValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/EmailValidator.java index 4fa3b947aa8..17ba61d4be8 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/EmailValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/EmailValidator.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.commons.validator.GenericValidator; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; - public class EmailValidator implements IActionValidator { public static final EmailValidator INSTANCE = new EmailValidator(); diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/FileDoesNotExistValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/FileDoesNotExistValidator.java index 01ca0cc5999..9638649c6f6 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/FileDoesNotExistValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/FileDoesNotExistValidator.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.action.validator; +import java.io.IOException; +import java.util.List; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; @@ -24,9 +26,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.vfs.HopVfs; -import java.io.IOException; -import java.util.List; - /** Fails if a field's value is a filename and the file does not exist. */ public class FileDoesNotExistValidator extends AbstractFileValidator { diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/FileExistsValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/FileExistsValidator.java index e37037a0ae2..ab85179364a 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/FileExistsValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/FileExistsValidator.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.action.validator; +import java.io.IOException; +import java.util.List; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; @@ -24,9 +26,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.vfs.HopVfs; -import java.io.IOException; -import java.util.List; - /** Fails if a field's value is a filename and the file does not exist. */ public class FileExistsValidator extends AbstractFileValidator { diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/IActionValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/IActionValidator.java index 3de837bdb97..5cf00ab5d62 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/IActionValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/IActionValidator.java @@ -17,11 +17,10 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; - /** * The interface of a action validator. * diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/IntegerValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/IntegerValidator.java index f0e3cfa0a1e..f5cec42b403 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/IntegerValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/IntegerValidator.java @@ -17,14 +17,13 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.commons.validator.GenericTypeValidator; import org.apache.commons.validator.GenericValidator; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; - /** Fails if a field's value is not an integer. */ public class IntegerValidator implements IActionValidator { diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/LongValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/LongValidator.java index aeeacf77461..c78f4d8f302 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/LongValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/LongValidator.java @@ -17,14 +17,13 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.commons.validator.GenericTypeValidator; import org.apache.commons.validator.GenericValidator; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; - public class LongValidator implements IActionValidator { public static final LongValidator INSTANCE = new LongValidator(); diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/NotBlankValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/NotBlankValidator.java index 87d653caf6a..3950f02ef6c 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/NotBlankValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/NotBlankValidator.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.action.validator; +import java.util.List; import org.apache.commons.validator.GenericValidator; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.util.List; - /** * Fails if the field's value is either null, an empty string, or a string containing * only whitespace. diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/NotNullValidator.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/NotNullValidator.java index 8d6f645cf62..3709df40b62 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/NotNullValidator.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/NotNullValidator.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.action.validator; +import java.lang.reflect.InvocationTargetException; +import java.util.List; import org.apache.commons.beanutils.PropertyUtils; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; -import java.lang.reflect.InvocationTargetException; -import java.util.List; - /** Fails if a field's value is null. */ public class NotNullValidator implements IActionValidator { diff --git a/engine/src/main/java/org/apache/hop/workflow/action/validator/ValidatorMessages.java b/engine/src/main/java/org/apache/hop/workflow/action/validator/ValidatorMessages.java index 77be1d2ec80..b8a66dd9b4a 100644 --- a/engine/src/main/java/org/apache/hop/workflow/action/validator/ValidatorMessages.java +++ b/engine/src/main/java/org/apache/hop/workflow/action/validator/ValidatorMessages.java @@ -17,11 +17,10 @@ package org.apache.hop.workflow.action.validator; -import org.apache.hop.i18n.GlobalMessageUtil; - import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import org.apache.hop.i18n.GlobalMessageUtil; /** Utility class for getting formatted strings from validator resource bundle. */ public class ValidatorMessages { diff --git a/engine/src/main/java/org/apache/hop/workflow/actions/dummy/ActionDummy.java b/engine/src/main/java/org/apache/hop/workflow/actions/dummy/ActionDummy.java index e452fb9f136..08708af63ed 100644 --- a/engine/src/main/java/org/apache/hop/workflow/actions/dummy/ActionDummy.java +++ b/engine/src/main/java/org/apache/hop/workflow/actions/dummy/ActionDummy.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.dummy; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -29,8 +30,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.util.List; - @Action( id = "DUMMY", image = "ui/images/dummy.svg", diff --git a/engine/src/main/java/org/apache/hop/workflow/actions/start/ActionStart.java b/engine/src/main/java/org/apache/hop/workflow/actions/start/ActionStart.java index 215f92c7f4c..76b2b1721fd 100644 --- a/engine/src/main/java/org/apache/hop/workflow/actions/start/ActionStart.java +++ b/engine/src/main/java/org/apache/hop/workflow/actions/start/ActionStart.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.start; +import java.util.Calendar; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -28,9 +30,6 @@ import org.apache.hop.workflow.action.ActionBase; import org.apache.hop.workflow.action.IAction; -import java.util.Calendar; -import java.util.List; - /** The start action is starting point for workflow execution. */ @Action( id = ActionStart.ID, diff --git a/engine/src/main/java/org/apache/hop/workflow/engine/IWorkflowEngine.java b/engine/src/main/java/org/apache/hop/workflow/engine/IWorkflowEngine.java index 14ff33c36f1..32858b17d67 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engine/IWorkflowEngine.java +++ b/engine/src/main/java/org/apache/hop/workflow/engine/IWorkflowEngine.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.engine; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.IExtensionData; import org.apache.hop.core.Result; import org.apache.hop.core.RowMetaAndData; @@ -39,11 +43,6 @@ import org.apache.hop.workflow.config.IWorkflowEngineRunConfiguration; import org.apache.hop.workflow.config.WorkflowRunConfiguration; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - public interface IWorkflowEngine extends IVariables, ILoggingObject, INamedParameters, IExtensionData { diff --git a/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEnginePluginType.java b/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEnginePluginType.java index e5dfb5054e6..7dfec708fd4 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEnginePluginType.java +++ b/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEnginePluginType.java @@ -17,12 +17,11 @@ package org.apache.hop.workflow.engine; +import java.util.Map; import org.apache.hop.core.plugins.BasePluginType; import org.apache.hop.core.plugins.PluginAnnotationType; import org.apache.hop.core.plugins.PluginMainClassType; -import java.util.Map; - @PluginMainClassType(IWorkflowEngine.class) @PluginAnnotationType(WorkflowEnginePlugin.class) public class WorkflowEnginePluginType extends BasePluginType { diff --git a/engine/src/main/java/org/apache/hop/workflow/engines/empty/EmptyWorkflowRunConfiguration.java b/engine/src/main/java/org/apache/hop/workflow/engines/empty/EmptyWorkflowRunConfiguration.java index 7b93c7fd9f5..de6f8363487 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engines/empty/EmptyWorkflowRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/workflow/engines/empty/EmptyWorkflowRunConfiguration.java @@ -17,11 +17,10 @@ package org.apache.hop.workflow.engines.empty; +import java.util.Objects; import org.apache.hop.core.variables.Variables; import org.apache.hop.workflow.config.IWorkflowEngineRunConfiguration; -import java.util.Objects; - public class EmptyWorkflowRunConfiguration extends Variables implements IWorkflowEngineRunConfiguration, Cloneable { @@ -72,7 +71,9 @@ public String getEnginePluginId() { return pluginId; } - /** @param pluginId The pluginId to set */ + /** + * @param pluginId The pluginId to set + */ @Override public void setEnginePluginId(String pluginId) { this.pluginId = pluginId; @@ -88,7 +89,9 @@ public String getEnginePluginName() { return pluginName; } - /** @param pluginName The pluginName to set */ + /** + * @param pluginName The pluginName to set + */ @Override public void setEnginePluginName(String pluginName) { this.pluginName = pluginName; diff --git a/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowEngine.java b/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowEngine.java index 0ec7f438758..da3bc9353f2 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowEngine.java +++ b/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowEngine.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.engines.local; +import java.util.Date; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.IExtensionData; @@ -46,13 +52,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.apache.hop.workflow.engine.WorkflowEnginePlugin; -import java.util.Date; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - @WorkflowEnginePlugin( id = "Local", name = "Hop local workflow engine", diff --git a/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowRunConfiguration.java b/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowRunConfiguration.java index 84994dc1f22..5b57bb5e3fd 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/workflow/engines/local/LocalWorkflowRunConfiguration.java @@ -75,7 +75,9 @@ public boolean isSafeModeEnabled() { return safeModeEnabled; } - /** @param safeModeEnabled The safeModeEnabled to set */ + /** + * @param safeModeEnabled The safeModeEnabled to set + */ public void setSafeModeEnabled(boolean safeModeEnabled) { this.safeModeEnabled = safeModeEnabled; } @@ -89,7 +91,9 @@ public boolean isTransactional() { return transactional; } - /** @param transactional The transactional to set */ + /** + * @param transactional The transactional to set + */ public void setTransactional(boolean transactional) { this.transactional = transactional; } diff --git a/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowEngine.java b/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowEngine.java index 754b0c27d83..8448aaacff7 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowEngine.java +++ b/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowEngine.java @@ -17,6 +17,15 @@ package org.apache.hop.workflow.engines.remote; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -65,16 +74,6 @@ import org.apache.hop.www.RegisterWorkflowServlet; import org.apache.hop.www.WebResult; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - @WorkflowEnginePlugin( id = "Remote", name = "Hop remote workflow engine", @@ -389,7 +388,6 @@ public void sendToHopServer( parametersMap.put(param, getVariable(param)); } - if (remoteWorkflowRunConfiguration.isExportingResources()) { // First export the workflow... // @@ -679,7 +677,9 @@ public WorkflowMeta getWorkflowMeta() { return workflowMeta; } - /** @param workflowMeta The workflowMeta to set */ + /** + * @param workflowMeta The workflowMeta to set + */ @Override public void setWorkflowMeta(WorkflowMeta workflowMeta) { this.workflowMeta = workflowMeta; @@ -694,7 +694,9 @@ public String getPluginId() { return pluginId; } - /** @param pluginId The pluginId to set */ + /** + * @param pluginId The pluginId to set + */ public void setPluginId(String pluginId) { this.pluginId = pluginId; } @@ -708,7 +710,9 @@ public WorkflowRunConfiguration getWorkflowRunConfiguration() { return workflowRunConfiguration; } - /** @param workflowRunConfiguration The workflowRunConfiguration to set */ + /** + * @param workflowRunConfiguration The workflowRunConfiguration to set + */ @Override public void setWorkflowRunConfiguration(WorkflowRunConfiguration workflowRunConfiguration) { this.workflowRunConfiguration = workflowRunConfiguration; @@ -723,7 +727,9 @@ public Result getPreviousResult() { return previousResult; } - /** @param previousResult The previousResult to set */ + /** + * @param previousResult The previousResult to set + */ public void setPreviousResult(Result previousResult) { this.previousResult = previousResult; } @@ -738,7 +744,9 @@ public Result getResult() { return result; } - /** @param result The result to set */ + /** + * @param result The result to set + */ @Override public void setResult(Result result) { this.result = result; @@ -754,7 +762,9 @@ public IHopMetadataProvider getMetadataProvider() { return metadataProvider; } - /** @param metadataProvider The metadataProvider to set */ + /** + * @param metadataProvider The metadataProvider to set + */ @Override public void setMetadataProvider(IHopMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; @@ -770,7 +780,9 @@ public ILogChannel getLogChannel() { return logChannel; } - /** @param logChannel The logChannel to set */ + /** + * @param logChannel The logChannel to set + */ public void setLogChannel(ILogChannel logChannel) { this.logChannel = logChannel; } @@ -784,7 +796,9 @@ public LoggingObject getLoggingObject() { return loggingObject; } - /** @param loggingObject The loggingObject to set */ + /** + * @param loggingObject The loggingObject to set + */ public void setLoggingObject(LoggingObject loggingObject) { this.loggingObject = loggingObject; } @@ -799,7 +813,9 @@ public LogLevel getLogLevel() { return logLevel; } - /** @param logLevel The logLevel to set */ + /** + * @param logLevel The logLevel to set + */ @Override public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; @@ -814,7 +830,9 @@ public long getServerPollDelay() { return serverPollDelay; } - /** @param serverPollDelay The serverPollDelay to set */ + /** + * @param serverPollDelay The serverPollDelay to set + */ public void setServerPollDelay(long serverPollDelay) { this.serverPollDelay = serverPollDelay; } @@ -828,7 +846,9 @@ public long getServerPollInterval() { return serverPollInterval; } - /** @param serverPollInterval The serverPollInterval to set */ + /** + * @param serverPollInterval The serverPollInterval to set + */ public void setServerPollInterval(long serverPollInterval) { this.serverPollInterval = serverPollInterval; } @@ -842,7 +862,9 @@ public HopServer getHopServer() { return hopServer; } - /** @param hopServer The hopServer to set */ + /** + * @param hopServer The hopServer to set + */ public void setHopServer(HopServer hopServer) { this.hopServer = hopServer; } @@ -857,7 +879,9 @@ public String getContainerId() { return containerId; } - /** @param containerId The serverObjectId to set */ + /** + * @param containerId The serverObjectId to set + */ @Override public void setContainerId(String containerId) { this.containerId = containerId; @@ -872,7 +896,9 @@ public int getLastLogLineNr() { return lastLogLineNr; } - /** @param lastLogLineNr The lastLogLineNr to set */ + /** + * @param lastLogLineNr The lastLogLineNr to set + */ public void setLastLogLineNr(int lastLogLineNr) { this.lastLogLineNr = lastLogLineNr; } @@ -887,13 +913,17 @@ public boolean isStopped() { return stopped; } - /** @param stopped The stopped to set */ + /** + * @param stopped The stopped to set + */ @Override public void setStopped(boolean stopped) { this.stopped = stopped; } - /** @param workflowStatus The workflowStatus to set */ + /** + * @param workflowStatus The workflowStatus to set + */ public void setWorkflowStatus(HopServerWorkflowStatus workflowStatus) { this.workflowStatus = workflowStatus; } @@ -908,7 +938,9 @@ public boolean isInteractive() { return interactive; } - /** @param interactive The interactive to set */ + /** + * @param interactive The interactive to set + */ @Override public void setInteractive(boolean interactive) { this.interactive = interactive; @@ -924,7 +956,9 @@ public boolean isFinished() { return finished; } - /** @param finished The finished to set */ + /** + * @param finished The finished to set + */ @Override public void setFinished(boolean finished) { this.finished = finished; @@ -940,7 +974,9 @@ public boolean isInitialized() { return initialized; } - /** @param initialized The initialized to set */ + /** + * @param initialized The initialized to set + */ public void setInitialized(boolean initialized) { this.initialized = initialized; } @@ -954,7 +990,9 @@ public boolean isRunning() { return running; } - /** @param running The running to set */ + /** + * @param running The running to set + */ public void setRunning(boolean running) { this.running = running; } @@ -969,7 +1007,9 @@ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription The statusDescription to set */ + /** + * @param statusDescription The statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } @@ -984,7 +1024,9 @@ public boolean isActive() { return active; } - /** @param active The active to set */ + /** + * @param active The active to set + */ public void setActive(boolean active) { this.active = active; } @@ -999,7 +1041,9 @@ public Date getExecutionStartDate() { return executionStartDate; } - /** @param executionStartDate The executionStartDate to set */ + /** + * @param executionStartDate The executionStartDate to set + */ public void setExecutionStartDate(Date executionStartDate) { this.executionStartDate = executionStartDate; } @@ -1014,7 +1058,9 @@ public Date getExecutionEndDate() { return executionEndDate; } - /** @param executionEndDate The executionEndDate to set */ + /** + * @param executionEndDate The executionEndDate to set + */ public void setExecutionEndDate(Date executionEndDate) { this.executionEndDate = executionEndDate; } @@ -1030,7 +1076,9 @@ public void setExecutionEndDate(Date executionEndDate) { return workflowFinishedListeners; } - /** @param workflowFinishedListeners The workflowFinishedListeners to set */ + /** + * @param workflowFinishedListeners The workflowFinishedListeners to set + */ public void setWorkflowFinishedListeners( List>> workflowFinishedListeners) { this.workflowFinishedListeners = workflowFinishedListeners; @@ -1047,7 +1095,9 @@ public void setWorkflowFinishedListeners( return workflowStartedListeners; } - /** @param workflowStartedListeners The workflowStartedListeners to set */ + /** + * @param workflowStartedListeners The workflowStartedListeners to set + */ public void setWorkflowStartedListeners( List>> workflowStartedListeners) { this.workflowStartedListeners = workflowStartedListeners; @@ -1063,7 +1113,9 @@ public List getActionListeners() { return actionListeners; } - /** @param actionListeners The actionListeners to set */ + /** + * @param actionListeners The actionListeners to set + */ public void setActionListeners(List actionListeners) { this.actionListeners = actionListeners; } @@ -1077,7 +1129,9 @@ public List getDelegationListeners() { return delegationListeners; } - /** @param delegationListeners The delegationListeners to set */ + /** + * @param delegationListeners The delegationListeners to set + */ public void setDelegationListeners(List delegationListeners) { this.delegationListeners = delegationListeners; } @@ -1092,7 +1146,9 @@ public Set getActiveActions() { return activeActions; } - /** @param activeActions The activeActions to set */ + /** + * @param activeActions The activeActions to set + */ public void setActiveActions(Set activeActions) { this.activeActions = activeActions; } @@ -1106,7 +1162,9 @@ public INamedParameters getNamedParams() { return namedParams; } - /** @param namedParams The namedParams to set */ + /** + * @param namedParams The namedParams to set + */ public void setNamedParams(INamedParameters namedParams) { this.namedParams = namedParams; } @@ -1121,7 +1179,9 @@ public Map getExtensionDataMap() { return extensionDataMap; } - /** @param extensionDataMap The extensionDataMap to set */ + /** + * @param extensionDataMap The extensionDataMap to set + */ public void setExtensionDataMap(Map extensionDataMap) { this.extensionDataMap = extensionDataMap; } @@ -1135,7 +1195,9 @@ public List getSourceRows() { return sourceRows; } - /** @param sourceRows The sourceRows to set */ + /** + * @param sourceRows The sourceRows to set + */ @Override public void setSourceRows(List sourceRows) { this.sourceRows = sourceRows; @@ -1150,7 +1212,9 @@ public ActionMeta getStartActionMeta() { return startActionMeta; } - /** @param actionMeta The start action to set */ + /** + * @param actionMeta The start action to set + */ @Override public void setStartActionMeta(ActionMeta actionMeta) { this.startActionMeta = actionMeta; @@ -1166,7 +1230,9 @@ public WorkflowTracker getWorkflowTracker() { return workflowTracker; } - /** @param workflowTracker The workflowTracker to set */ + /** + * @param workflowTracker The workflowTracker to set + */ public void setWorkflowTracker(WorkflowTracker workflowTracker) { this.workflowTracker = workflowTracker; } @@ -1181,7 +1247,9 @@ public IWorkflowEngine getParentWorkflow() { return parentWorkflow; } - /** @param parentWorkflow The parentWorkflow to set */ + /** + * @param parentWorkflow The parentWorkflow to set + */ @Override public void setParentWorkflow(IWorkflowEngine parentWorkflow) { this.parentWorkflow = parentWorkflow; @@ -1197,7 +1265,9 @@ public IPipelineEngine getParentPipeline() { return parentPipeline; } - /** @param parentPipeline The parentPipeline to set */ + /** + * @param parentPipeline The parentPipeline to set + */ @Override public void setParentPipeline(IPipelineEngine parentPipeline) { this.parentPipeline = parentPipeline; @@ -1212,7 +1282,9 @@ public ILoggingObject getParentLoggingObject() { return parentLoggingObject; } - /** @param parentLoggingObject The parentLoggingObject to set */ + /** + * @param parentLoggingObject The parentLoggingObject to set + */ public void setParentLoggingObject(ILoggingObject parentLoggingObject) { this.parentLoggingObject = parentLoggingObject; } @@ -1237,7 +1309,9 @@ public boolean isForcingSeparateLogging() { return forcingSeparateLogging; } - /** @param forcingSeparateLogging The forcingSeparateLogging to set */ + /** + * @param forcingSeparateLogging The forcingSeparateLogging to set + */ @Override public void setForcingSeparateLogging(boolean forcingSeparateLogging) { this.forcingSeparateLogging = forcingSeparateLogging; @@ -1253,7 +1327,9 @@ public boolean isGatheringMetrics() { return gatheringMetrics; } - /** @param gatheringMetrics The gatheringMetrics to set */ + /** + * @param gatheringMetrics The gatheringMetrics to set + */ @Override public void setGatheringMetrics(boolean gatheringMetrics) { this.gatheringMetrics = gatheringMetrics; diff --git a/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowRunConfiguration.java b/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowRunConfiguration.java index 0a3a3aac307..47716fbf695 100644 --- a/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowRunConfiguration.java +++ b/engine/src/main/java/org/apache/hop/workflow/engines/remote/RemoteWorkflowRunConfiguration.java @@ -129,7 +129,9 @@ public String getHopServerName() { return hopServerName; } - /** @param hopServerName The hopServerName to set */ + /** + * @param hopServerName The hopServerName to set + */ public void setHopServerName(String hopServerName) { this.hopServerName = hopServerName; } @@ -143,7 +145,9 @@ public String getRunConfigurationName() { return runConfigurationName; } - /** @param runConfigurationName The runConfigurationName to set */ + /** + * @param runConfigurationName The runConfigurationName to set + */ public void setRunConfigurationName(String runConfigurationName) { this.runConfigurationName = runConfigurationName; } @@ -157,7 +161,9 @@ public String getServerPollDelay() { return serverPollDelay; } - /** @param serverPollDelay The serverPollDelay to set */ + /** + * @param serverPollDelay The serverPollDelay to set + */ public void setServerPollDelay(String serverPollDelay) { this.serverPollDelay = serverPollDelay; } @@ -171,7 +177,9 @@ public String getServerPollInterval() { return serverPollInterval; } - /** @param serverPollInterval The serverPollInterval to set */ + /** + * @param serverPollInterval The serverPollInterval to set + */ public void setServerPollInterval(String serverPollInterval) { this.serverPollInterval = serverPollInterval; } @@ -185,7 +193,9 @@ public boolean isExportingResources() { return exportingResources; } - /** @param exportingResources The exportingResources to set */ + /** + * @param exportingResources The exportingResources to set + */ public void setExportingResources(boolean exportingResources) { this.exportingResources = exportingResources; } @@ -199,7 +209,9 @@ public String getNamedResourcesSourceFolder() { return namedResourcesSourceFolder; } - /** @param namedResourcesSourceFolder The namedResourcesSourceFolder to set */ + /** + * @param namedResourcesSourceFolder The namedResourcesSourceFolder to set + */ public void setNamedResourcesSourceFolder(String namedResourcesSourceFolder) { this.namedResourcesSourceFolder = namedResourcesSourceFolder; } @@ -213,7 +225,9 @@ public String getNamedResourcesTargetFolder() { return namedResourcesTargetFolder; } - /** @param namedResourcesTargetFolder The namedResourcesTargetFolder to set */ + /** + * @param namedResourcesTargetFolder The namedResourcesTargetFolder to set + */ public void setNamedResourcesTargetFolder(String namedResourcesTargetFolder) { this.namedResourcesTargetFolder = namedResourcesTargetFolder; } diff --git a/engine/src/main/java/org/apache/hop/www/AddExportServlet.java b/engine/src/main/java/org/apache/hop/www/AddExportServlet.java index 3dbda6f25d9..f785d3d397d 100644 --- a/engine/src/main/java/org/apache/hop/www/AddExportServlet.java +++ b/engine/src/main/java/org/apache/hop/www/AddExportServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.UUID; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; @@ -41,15 +49,6 @@ import org.apache.hop.workflow.engine.WorkflowEngineFactory; import org.w3c.dom.Document; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.util.UUID; - /** * This servlet allows you to transport an exported workflow or pipeline over to the carte server as * a zip file. It ends up in a temporary file. @@ -193,8 +192,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) // Open the pipeline from inside the ZIP archive // PipelineMeta pipelineMeta = - new PipelineMeta( - fileUrl, metadataProvider, Variables.getADefaultVariableSpace()); + new PipelineMeta(fileUrl, metadataProvider, Variables.getADefaultVariableSpace()); serverObjectId = UUID.randomUUID().toString(); servletLoggingObject.setContainerObjectId(serverObjectId); @@ -203,7 +201,10 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) String runConfigurationName = executionConfiguration.getRunConfiguration(); IPipelineEngine pipeline = PipelineEngineFactory.createPipelineEngine( - variables, variables.resolve(runConfigurationName), metadataProvider, pipelineMeta); + variables, + variables.resolve(runConfigurationName), + metadataProvider, + pipelineMeta); pipeline.setParent(servletLoggingObject); // store it all in the map... diff --git a/engine/src/main/java/org/apache/hop/www/AddPipelineServlet.java b/engine/src/main/java/org/apache/hop/www/AddPipelineServlet.java index 522a52d3574..41e74bc00ec 100644 --- a/engine/src/main/java/org/apache/hop/www/AddPipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/AddPipelineServlet.java @@ -17,6 +17,13 @@ package org.apache.hop.www; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.UUID; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -34,14 +41,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.pipeline.engine.PipelineEngineFactory; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.UUID; - @HopServerServlet(id = "addPipeline", name = "Add a pipeline for execution") public class AddPipelineServlet extends BaseHttpServlet implements IHopServerPlugin { private static final long serialVersionUID = -6850701762586992604L; diff --git a/engine/src/main/java/org/apache/hop/www/AddWorkflowServlet.java b/engine/src/main/java/org/apache/hop/www/AddWorkflowServlet.java index e00c01e03b6..3b6b850ba8f 100644 --- a/engine/src/main/java/org/apache/hop/www/AddWorkflowServlet.java +++ b/engine/src/main/java/org/apache/hop/www/AddWorkflowServlet.java @@ -17,6 +17,15 @@ package org.apache.hop.www; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.Map; +import java.util.UUID; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.logging.LoggingObjectType; @@ -32,16 +41,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.apache.hop.workflow.engine.WorkflowEngineFactory; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Arrays; -import java.util.Map; -import java.util.UUID; - @HopServerServlet(id = "addWorkflow", name = "Add a workflow to the server") public class AddWorkflowServlet extends BaseHttpServlet implements IHopServerPlugin { private static final long serialVersionUID = -6850701762586992604L; diff --git a/engine/src/main/java/org/apache/hop/www/BaseHopServerPlugin.java b/engine/src/main/java/org/apache/hop/www/BaseHopServerPlugin.java index f9c8cfeb643..ac32f2ec972 100644 --- a/engine/src/main/java/org/apache/hop/www/BaseHopServerPlugin.java +++ b/engine/src/main/java/org/apache/hop/www/BaseHopServerPlugin.java @@ -19,16 +19,15 @@ import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableMultimap; -import org.apache.hop.core.annotations.HopServerServlet; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.hop.core.annotations.HopServerServlet; public abstract class BaseHopServerPlugin extends BaseHttpServlet implements IHopServerPlugin, IHopServerRequestHandler { @@ -39,7 +38,7 @@ public abstract class BaseHopServerPlugin extends BaseHttpServlet * @deprecated Should not be called directly. Use {@link #service(HttpServletRequest, * HttpServletResponse)} instead */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") @Override public void doGet(HttpServletRequest req, final HttpServletResponse resp) throws IOException { service(req, resp); diff --git a/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java b/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java index 7af6432fb15..c2397384669 100644 --- a/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java +++ b/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java @@ -17,6 +17,11 @@ package org.apache.hop.www; +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -24,12 +29,6 @@ import org.apache.hop.core.variables.Variables; import org.apache.http.entity.ContentType; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - public class BaseHttpServlet extends HttpServlet { protected static final long serialVersionUID = -1348342810327662788L; @@ -92,7 +91,7 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getContentLength() > 0 && req.getContentType() != null) { String encoding = getContentEncoding(req.getContentType()); - if(encoding != null){ + if (encoding != null) { req.setCharacterEncoding(encoding); } } @@ -190,12 +189,16 @@ public void setup(PipelineMap pipelineMap, WorkflowMap workflowMap) { this.variables = serverConfig.getVariables(); } - /** @param pipelineMap The pipelineMap to set */ + /** + * @param pipelineMap The pipelineMap to set + */ public void setPipelineMap(PipelineMap pipelineMap) { this.pipelineMap = pipelineMap; } - /** @param workflowMap The workflowMap to set */ + /** + * @param workflowMap The workflowMap to set + */ public void setWorkflowMap(WorkflowMap workflowMap) { this.workflowMap = workflowMap; } @@ -209,7 +212,9 @@ public HopServerConfig getServerConfig() { return serverConfig; } - /** @param serverConfig The serverConfig to set */ + /** + * @param serverConfig The serverConfig to set + */ public void setServerConfig(HopServerConfig serverConfig) { this.serverConfig = serverConfig; } @@ -223,7 +228,9 @@ public ILogChannel getLog() { return log; } - /** @param log The log to set */ + /** + * @param log The log to set + */ public void setLog(ILogChannel log) { this.log = log; } diff --git a/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java b/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java index 9f2f8aa0bb3..aae5b089c16 100644 --- a/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java +++ b/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java @@ -16,6 +16,8 @@ */ package org.apache.hop.www; +import java.util.Map; +import java.util.UUID; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -42,9 +44,6 @@ import org.apache.hop.workflow.engine.WorkflowEngineFactory; import org.json.simple.parser.ParseException; -import java.util.Map; -import java.util.UUID; - public abstract class BaseWorkflowServlet extends BodyHttpServlet { private static final long serialVersionUID = 8523062215275251356L; @@ -70,7 +69,8 @@ protected IWorkflowEngine createWorkflow( // Create the workflow and store in the list... // - String runConfigurationName = variables.resolve(workflowExecutionConfiguration.getRunConfiguration()); + String runConfigurationName = + variables.resolve(workflowExecutionConfiguration.getRunConfiguration()); final IWorkflowEngine workflow = WorkflowEngineFactory.createWorkflowEngine( variables, runConfigurationName, metadataProvider, workflowMeta, servletLoggingObject); diff --git a/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java b/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java index 745256be057..80737185a09 100644 --- a/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java +++ b/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java @@ -16,6 +16,10 @@ */ package org.apache.hop.www; +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.hop.core.Const; @@ -24,11 +28,6 @@ import org.apache.hop.i18n.PackageMessages; import org.owasp.encoder.Encode; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - public abstract class BodyHttpServlet extends BaseHttpServlet implements IHopServerPlugin { private static final long serialVersionUID = 6576714217004890327L; @@ -94,7 +93,7 @@ protected void beginHtml(HttpServletResponse response, PrintWriter out) throws I out.println(Encode.forHtml(getTitle())); out.println(""); out.println(""); - out.println(""); + out.println(""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/DeleteExecutionInfoServlet.java b/engine/src/main/java/org/apache/hop/www/DeleteExecutionInfoServlet.java index 40345680edc..b26d1639669 100644 --- a/engine/src/main/java/org/apache/hop/www/DeleteExecutionInfoServlet.java +++ b/engine/src/main/java/org/apache/hop/www/DeleteExecutionInfoServlet.java @@ -17,6 +17,12 @@ package org.apache.hop.www; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; @@ -26,13 +32,6 @@ import org.apache.hop.metadata.api.IHopMetadataSerializer; import org.apache.hop.metadata.serializer.multi.MultiMetadataProvider; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.PrintWriter; - @HopServerServlet(id = "registerExecInfo", name = "Register execution information") public class DeleteExecutionInfoServlet extends BaseHttpServlet implements IHopServerPlugin { private static final long serialVersionUID = -1901302231769020201L; diff --git a/engine/src/main/java/org/apache/hop/www/GetExecutionInfoServlet.java b/engine/src/main/java/org/apache/hop/www/GetExecutionInfoServlet.java index a0fdb15c807..6f7743b7ed6 100644 --- a/engine/src/main/java/org/apache/hop/www/GetExecutionInfoServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetExecutionInfoServlet.java @@ -90,7 +90,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) // response.setContentType("application/json"); response.setCharacterEncoding(Const.XML_ENCODING); - + PrintWriter out = response.getWriter(); // The type of information to request @@ -100,7 +100,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) // The name of the location is also in a parameter // String locationName = request.getParameter(PARAMETER_LOCATION); - + try { // validate the parameters // diff --git a/engine/src/main/java/org/apache/hop/www/GetPipelineImageServlet.java b/engine/src/main/java/org/apache/hop/www/GetPipelineImageServlet.java index cb3f4ecfe2a..0ee1d1fbcbf 100644 --- a/engine/src/main/java/org/apache/hop/www/GetPipelineImageServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetPipelineImageServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.util.Utils; import org.apache.hop.i18n.BaseMessages; @@ -24,14 +32,6 @@ import org.apache.hop.pipeline.PipelineSvgPainter; import org.apache.hop.pipeline.engine.IPipelineEngine; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "pipelineImage", name = "Generate a PNG image of a pipeline") public class GetPipelineImageServlet extends BaseHttpServlet implements IHopServerPlugin { @@ -48,7 +48,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) if (isJettyMode() && !request.getContextPath().startsWith(CONTEXT_PATH)) { return; } - if (!supportGraphicEnvironment){ + if (!supportGraphicEnvironment) { response.setStatus(HttpServletResponse.SC_NO_CONTENT); return; } diff --git a/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java b/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java index 16f2c1a819b..ec6828025f8 100644 --- a/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java @@ -17,7 +17,18 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.util.Date; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -36,17 +47,6 @@ import org.apache.hop.server.HttpUtil; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.URLEncoder; -import java.nio.charset.Charset; -import java.util.Date; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "pipelineStatus", name = "Get the status of a pipeline") public class GetPipelineStatusServlet extends BaseHttpServlet implements IHopServerPlugin { @@ -217,8 +217,9 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + "\">"); } out.println(""); - out.println(""); - + out.println( + ""); + if (isJettyMode()) { out.println( ""); diff --git a/engine/src/main/java/org/apache/hop/www/GetRootServlet.java b/engine/src/main/java/org/apache/hop/www/GetRootServlet.java index 805990aa7d2..d7c33a10d36 100644 --- a/engine/src/main/java/org/apache/hop/www/GetRootServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetRootServlet.java @@ -17,13 +17,12 @@ package org.apache.hop.www; -import org.apache.hop.i18n.BaseMessages; - +import java.io.IOException; +import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; +import org.apache.hop.i18n.BaseMessages; public class GetRootServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = GetRootServlet.class; // For Translator @@ -56,7 +55,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + BaseMessages.getString(PKG, "GetRootServlet.HopHopServer.Title") + ""); out.println(""); - out.println(""); + out.println(""); out.println(""); out.println(""); out.println("

" + BaseMessages.getString(PKG, "GetRootServlet.HopServerMenu") + "

"); diff --git a/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java b/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java index ecf68ecdd48..90166c56fd0 100644 --- a/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java @@ -18,6 +18,18 @@ package org.apache.hop.www; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.management.OperatingSystemMXBean; +import java.lang.management.RuntimeMXBean; +import java.lang.management.ThreadMXBean; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -29,19 +41,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.management.OperatingSystemMXBean; -import java.lang.management.RuntimeMXBean; -import java.lang.management.ThreadMXBean; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; - @HopServerServlet(id = "status", name = "Get the status of the server") public class GetStatusServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = GetStatusServlet.class; // For Translator @@ -147,7 +146,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + ""); out.println(""); out.println(""); - + int tableBorder = 1; if (!useLightTheme) { if (isJettyMode()) { diff --git a/engine/src/main/java/org/apache/hop/www/GetWorkflowImageServlet.java b/engine/src/main/java/org/apache/hop/www/GetWorkflowImageServlet.java index 0f14b935f91..57dfa322344 100644 --- a/engine/src/main/java/org/apache/hop/www/GetWorkflowImageServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetWorkflowImageServlet.java @@ -17,6 +17,13 @@ package org.apache.hop.www; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.util.Utils; import org.apache.hop.i18n.BaseMessages; @@ -24,14 +31,6 @@ import org.apache.hop.workflow.WorkflowSvgPainter; import org.apache.hop.workflow.engine.IWorkflowEngine; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; - @HopServerServlet(id = "workflowImage", name = "Generate a PNG image of a workflow") public class GetWorkflowImageServlet extends BaseHttpServlet implements IHopServerPlugin { @@ -48,7 +47,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) if (isJettyMode() && !request.getContextPath().startsWith(CONTEXT_PATH)) { return; } - if (!supportGraphicEnvironment){ + if (!supportGraphicEnvironment) { response.setStatus(HttpServletResponse.SC_NO_CONTENT); return; } diff --git a/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java b/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java index 29a4ff17918..c2aa8c042a5 100644 --- a/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java +++ b/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java @@ -17,7 +17,17 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -33,16 +43,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.URLEncoder; -import java.nio.charset.Charset; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "workflowStatus", name = "Get the status of a workflow") public class GetWorkflowStatusServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = GetWorkflowStatusServlet.class; // For Translator @@ -207,8 +207,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) if (isJettyMode()) { out.println( ""); - out.println(""); - + out.println( + ""); } out.println(""); out.println(""); diff --git a/engine/src/main/java/org/apache/hop/www/HopServerConfig.java b/engine/src/main/java/org/apache/hop/www/HopServerConfig.java index 15dd0a54bd8..f5061d1d986 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerConfig.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerConfig.java @@ -17,6 +17,11 @@ package org.apache.hop.www; +import java.net.SocketException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.logging.ILogChannel; @@ -29,12 +34,6 @@ import org.apache.hop.server.HopServer; import org.w3c.dom.Node; -import java.net.SocketException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - public class HopServerConfig implements IXml { public static final String XML_TAG = "hop-server-config"; @@ -207,7 +206,8 @@ private void checkNetworkInterfaceSetting(ILogChannel log, Node serverNode, HopS public HopServerConfig(String hostname, int port, int shutdownPort, boolean joining) { this(); this.joining = joining; - this.hopServer = new HopServer(hostname + ":" + port, hostname, "" + port, "" + shutdownPort, null, null); + this.hopServer = + new HopServer(hostname + ":" + port, hostname, "" + port, "" + shutdownPort, null, null); } /** diff --git a/engine/src/main/java/org/apache/hop/www/HopServerObjectEntry.java b/engine/src/main/java/org/apache/hop/www/HopServerObjectEntry.java index 0aeacdaa292..97c3b123921 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerObjectEntry.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerObjectEntry.java @@ -17,8 +17,8 @@ package org.apache.hop.www; -import javax.xml.bind.annotation.XmlRootElement; import java.util.Comparator; +import javax.xml.bind.annotation.XmlRootElement; /** A carte object entry in the pipeline or workflow maps */ @XmlRootElement @@ -67,22 +67,30 @@ public int compareTo(HopServerObjectEntry o) { return compare(this, o); } - /** @return the name */ + /** + * @return the name + */ public String getName() { return name; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setName(String name) { this.name = name; } - /** @return the id */ + /** + * @return the id + */ public String getId() { return id; } - /** @param id the id to set */ + /** + * @param id the id to set + */ public void setId(String id) { this.id = id; } diff --git a/engine/src/main/java/org/apache/hop/www/HopServerPipelineStatus.java b/engine/src/main/java/org/apache/hop/www/HopServerPipelineStatus.java index 8cfda9cfd87..75342e99049 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerPipelineStatus.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerPipelineStatus.java @@ -19,6 +19,10 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; @@ -32,11 +36,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - public class HopServerPipelineStatus { public static final String XML_TAG = "pipeline-status"; @@ -210,52 +209,72 @@ public static HopServerPipelineStatus fromXml(String xml) throws HopException { return status; } - /** @return the statusDescription */ + /** + * @return the statusDescription + */ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription the statusDescription to set */ + /** + * @param statusDescription the statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } - /** @return the pipelineName */ + /** + * @return the pipelineName + */ public String getPipelineName() { return pipelineName; } - /** @param pipelineName the pipelineName to set */ + /** + * @param pipelineName the pipelineName to set + */ public void setPipelineName(String pipelineName) { this.pipelineName = pipelineName; } - /** @return the errorDescription */ + /** + * @return the errorDescription + */ public String getErrorDescription() { return errorDescription; } - /** @param errorDescription the errorDescription to set */ + /** + * @param errorDescription the errorDescription to set + */ public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } - /** @return the transformStatusList */ + /** + * @return the transformStatusList + */ public List getTransformStatusList() { return transformStatusList; } - /** @param transformStatusList the transformStatusList to set */ + /** + * @param transformStatusList the transformStatusList to set + */ public void setTransformStatusList(List transformStatusList) { this.transformStatusList = transformStatusList; } - /** @return the loggingString */ + /** + * @return the loggingString + */ public String getLoggingString() { return loggingString; } - /** @param loggingString the loggingString to set */ + /** + * @param loggingString the loggingString to set + */ public void setLoggingString(String loggingString) { this.loggingString = loggingString; } @@ -330,62 +349,86 @@ public Result getResult(PipelineMeta pipelineMeta) { return result; } - /** @return the result */ + /** + * @return the result + */ public Result getResult() { return result; } - /** @param result the result to set */ + /** + * @param result the result to set + */ public void setResult(Result result) { this.result = result; } - /** @return the paused */ + /** + * @return the paused + */ public boolean isPaused() { return paused; } - /** @param paused the paused to set */ + /** + * @param paused the paused to set + */ public void setPaused(boolean paused) { this.paused = paused; } - /** @return the lastLoggingLineNr */ + /** + * @return the lastLoggingLineNr + */ public int getLastLoggingLineNr() { return lastLoggingLineNr; } - /** @param lastLoggingLineNr the lastLoggingLineNr to set */ + /** + * @param lastLoggingLineNr the lastLoggingLineNr to set + */ public void setLastLoggingLineNr(int lastLoggingLineNr) { this.lastLoggingLineNr = lastLoggingLineNr; } - /** @return the firstLoggingLineNr */ + /** + * @return the firstLoggingLineNr + */ public int getFirstLoggingLineNr() { return firstLoggingLineNr; } - /** @param firstLoggingLineNr the firstLoggingLineNr to set */ + /** + * @param firstLoggingLineNr the firstLoggingLineNr to set + */ public void setFirstLoggingLineNr(int firstLoggingLineNr) { this.firstLoggingLineNr = firstLoggingLineNr; } - /** @return the logDate */ + /** + * @return the logDate + */ public Date getLogDate() { return logDate; } - /** @param logDate */ + /** + * @param logDate + */ public void setLogDate(Date logDate) { this.logDate = logDate; } - /** @return the id */ + /** + * @return the id + */ public String getId() { return id; } - /** @param id the id to set */ + /** + * @param id the id to set + */ public void setId(String id) { this.id = id; } @@ -399,7 +442,9 @@ public Date getExecutionStartDate() { return executionStartDate; } - /** @param executionStartDate The executionStartDate to set */ + /** + * @param executionStartDate The executionStartDate to set + */ public void setExecutionStartDate(Date executionStartDate) { this.executionStartDate = executionStartDate; } @@ -413,7 +458,9 @@ public Date getExecutionEndDate() { return executionEndDate; } - /** @param executionEndDate The executionEndDate to set */ + /** + * @param executionEndDate The executionEndDate to set + */ public void setExecutionEndDate(Date executionEndDate) { this.executionEndDate = executionEndDate; } diff --git a/engine/src/main/java/org/apache/hop/www/HopServerServlet.java b/engine/src/main/java/org/apache/hop/www/HopServerServlet.java index 2cb4c60290a..52a7e9489e3 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerServlet.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerServlet.java @@ -17,6 +17,17 @@ package org.apache.hop.www; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -25,18 +36,6 @@ import org.apache.hop.core.plugins.IPluginTypeListener; import org.apache.hop.core.plugins.PluginRegistry; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.text.MessageFormat; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - public class HopServerServlet extends HttpServlet { private static final long serialVersionUID = 2434694833497859776L; diff --git a/engine/src/main/java/org/apache/hop/www/HopServerSingleton.java b/engine/src/main/java/org/apache/hop/www/HopServerSingleton.java index cdacf4cc499..84aba8b6ef0 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerSingleton.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerSingleton.java @@ -17,6 +17,10 @@ package org.apache.hop.www; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -36,11 +40,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.Timer; -import java.util.TimerTask; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicBoolean; - public class HopServerSingleton { private static final Class PKG = org.apache.hop.www.HopServer.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/www/HopServerStatus.java b/engine/src/main/java/org/apache/hop/www/HopServerStatus.java index 1b032e34fe2..2e951194098 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerStatus.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerStatus.java @@ -18,6 +18,8 @@ package org.apache.hop.www; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.util.Utils; @@ -25,9 +27,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - public class HopServerStatus { public static final String XML_TAG = "serverstatus"; @@ -164,32 +163,44 @@ public static HopServerStatus fromXml(String xml) throws HopException { return new HopServerStatus(XmlHandler.getSubNode(document, XML_TAG)); } - /** @return the statusDescription */ + /** + * @return the statusDescription + */ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription the statusDescription to set */ + /** + * @param statusDescription the statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } - /** @return the pipelineStatusList */ + /** + * @return the pipelineStatusList + */ public List getPipelineStatusList() { return pipelineStatusList; } - /** @param pipelineStatusList the pipelineStatusList to set */ + /** + * @param pipelineStatusList the pipelineStatusList to set + */ public void setPipelineStatusList(List pipelineStatusList) { this.pipelineStatusList = pipelineStatusList; } - /** @return the errorDescription */ + /** + * @return the errorDescription + */ public String getErrorDescription() { return errorDescription; } - /** @param errorDescription the errorDescription to set */ + /** + * @param errorDescription the errorDescription to set + */ public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } @@ -216,52 +227,72 @@ public HopServerWorkflowStatus findJobStatus(String workflowName, String id) { return null; } - /** @return the jobStatusList */ + /** + * @return the jobStatusList + */ public List getWorkflowStatusList() { return workflowStatusList; } - /** @param workflowStatusList the jobStatusList to set */ + /** + * @param workflowStatusList the jobStatusList to set + */ public void setWorkflowStatusList(List workflowStatusList) { this.workflowStatusList = workflowStatusList; } - /** @return the memoryFree */ + /** + * @return the memoryFree + */ public double getMemoryFree() { return memoryFree; } - /** @param memoryFree the memoryFree to set */ + /** + * @param memoryFree the memoryFree to set + */ public void setMemoryFree(long memoryFree) { this.memoryFree = memoryFree; } - /** @return the memoryTotal */ + /** + * @return the memoryTotal + */ public double getMemoryTotal() { return memoryTotal; } - /** @param memoryTotal the memoryTotal to set */ + /** + * @param memoryTotal the memoryTotal to set + */ public void setMemoryTotal(long memoryTotal) { this.memoryTotal = memoryTotal; } - /** @return the cpuCores */ + /** + * @return the cpuCores + */ public int getCpuCores() { return cpuCores; } - /** @param cpuCores the cpuCores to set */ + /** + * @param cpuCores the cpuCores to set + */ public void setCpuCores(int cpuCores) { this.cpuCores = cpuCores; } - /** @return the cpuProcessTime */ + /** + * @return the cpuProcessTime + */ public long getCpuProcessTime() { return cpuProcessTime; } - /** @param cpuProcessTime the cpuProcessTime to set */ + /** + * @param cpuProcessTime the cpuProcessTime to set + */ public void setCpuProcessTime(long cpuProcessTime) { this.cpuProcessTime = cpuProcessTime; } diff --git a/engine/src/main/java/org/apache/hop/www/HopServerWorkflowStatus.java b/engine/src/main/java/org/apache/hop/www/HopServerWorkflowStatus.java index 2ca9430af3b..2f969cff1dc 100644 --- a/engine/src/main/java/org/apache/hop/www/HopServerWorkflowStatus.java +++ b/engine/src/main/java/org/apache/hop/www/HopServerWorkflowStatus.java @@ -19,6 +19,8 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.IOException; +import java.util.Date; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; @@ -30,9 +32,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.Date; - public class HopServerWorkflowStatus { public static final String XML_TAG = "workflow-status"; @@ -170,42 +169,58 @@ public static HopServerWorkflowStatus fromXml(String xml) throws HopException { return status; } - /** @return the statusDescription */ + /** + * @return the statusDescription + */ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription the statusDescription to set */ + /** + * @param statusDescription the statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } - /** @return the workflow name */ + /** + * @return the workflow name + */ public String getWorkflowName() { return workflowName; } - /** @param workflowName the workflow name to set */ + /** + * @param workflowName the workflow name to set + */ public void setWorkflowName(String workflowName) { this.workflowName = workflowName; } - /** @return the errorDescription */ + /** + * @return the errorDescription + */ public String getErrorDescription() { return errorDescription; } - /** @param errorDescription the errorDescription to set */ + /** + * @param errorDescription the errorDescription to set + */ public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } - /** @return the loggingString */ + /** + * @return the loggingString + */ public String getLoggingString() { return loggingString; } - /** @param loggingString the loggingString to set */ + /** + * @param loggingString the loggingString to set + */ public void setLoggingString(String loggingString) { this.loggingString = loggingString; } @@ -243,52 +258,72 @@ public boolean isStopped() { || getStatusDescription().equalsIgnoreCase(Pipeline.STRING_STOPPED_WITH_ERRORS); } - /** @return the result */ + /** + * @return the result + */ public Result getResult() { return result; } - /** @param result the result to set */ + /** + * @param result the result to set + */ public void setResult(Result result) { this.result = result; } - /** @return the firstLoggingLineNr */ + /** + * @return the firstLoggingLineNr + */ public int getFirstLoggingLineNr() { return firstLoggingLineNr; } - /** @param firstLoggingLineNr the firstLoggingLineNr to set */ + /** + * @param firstLoggingLineNr the firstLoggingLineNr to set + */ public void setFirstLoggingLineNr(int firstLoggingLineNr) { this.firstLoggingLineNr = firstLoggingLineNr; } - /** @return the lastLoggingLineNr */ + /** + * @return the lastLoggingLineNr + */ public int getLastLoggingLineNr() { return lastLoggingLineNr; } - /** @param lastLoggingLineNr the lastLoggingLineNr to set */ + /** + * @param lastLoggingLineNr the lastLoggingLineNr to set + */ public void setLastLoggingLineNr(int lastLoggingLineNr) { this.lastLoggingLineNr = lastLoggingLineNr; } - /** @return the logDate */ + /** + * @return the logDate + */ public Date getLogDate() { return logDate; } - /** @param logDate */ + /** + * @param logDate + */ public void setLogDate(Date logDate) { this.logDate = logDate; } - /** @return the id */ + /** + * @return the id + */ public String getId() { return id; } - /** @param id the id to set */ + /** + * @param id the id to set + */ public void setId(String id) { this.id = id; } @@ -302,7 +337,9 @@ public Date getExecutionStartDate() { return executionStartDate; } - /** @param executionStartDate The executionStartDate to set */ + /** + * @param executionStartDate The executionStartDate to set + */ public void setExecutionStartDate(Date executionStartDate) { this.executionStartDate = executionStartDate; } @@ -316,7 +353,9 @@ public Date getExecutionEndDate() { return executionEndDate; } - /** @param executionEndDate The executionEndDate to set */ + /** + * @param executionEndDate The executionEndDate to set + */ public void setExecutionEndDate(Date executionEndDate) { this.executionEndDate = executionEndDate; } diff --git a/engine/src/main/java/org/apache/hop/www/IHopServerRequestHandler.java b/engine/src/main/java/org/apache/hop/www/IHopServerRequestHandler.java index 84a41aab59c..2068b40bd2d 100644 --- a/engine/src/main/java/org/apache/hop/www/IHopServerRequestHandler.java +++ b/engine/src/main/java/org/apache/hop/www/IHopServerRequestHandler.java @@ -24,7 +24,9 @@ import java.util.Collection; import java.util.Map; -/** @see BaseHopServerPlugin */ +/** + * @see BaseHopServerPlugin + */ public interface IHopServerRequestHandler { void handleRequest(IHopServerRequest request) throws IOException; diff --git a/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java b/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java index 6b634667acd..b9ffb93e6fa 100644 --- a/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.util.Utils; @@ -26,14 +34,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "pausePipeline", name = "Pause or continue a pipeline") public class PausePipelineServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = PausePipelineServlet.class; // For Translator @@ -90,7 +90,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + URLEncoder.encode(id, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println( + ""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/PipelineMap.java b/engine/src/main/java/org/apache/hop/www/PipelineMap.java index d06f3e98d4c..195af37475d 100644 --- a/engine/src/main/java/org/apache/hop/www/PipelineMap.java +++ b/engine/src/main/java/org/apache/hop/www/PipelineMap.java @@ -17,16 +17,15 @@ package org.apache.hop.www; -import org.apache.hop.pipeline.Pipeline; -import org.apache.hop.pipeline.PipelineConfiguration; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.engine.IPipelineEngine; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import org.apache.hop.pipeline.Pipeline; +import org.apache.hop.pipeline.PipelineConfiguration; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.engine.IPipelineEngine; /** This is a map between the pipeline name and the (running/waiting/finished) pipeline. */ public class PipelineMap { diff --git a/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java b/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java index 549512d3c4c..e443d71573a 100644 --- a/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.logging.HopLogStore; @@ -29,14 +37,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "prepareExec", name = "Prepare the execution of a pipeline") public class PrepareExecutionPipelineServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = PrepareExecutionPipelineServlet.class; // For Translator @@ -92,7 +92,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + URLEncoder.encode(pipelineName, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println(""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/RegisterPackageServlet.java b/engine/src/main/java/org/apache/hop/www/RegisterPackageServlet.java index 32b6d18b09e..713bbdb06f2 100644 --- a/engine/src/main/java/org/apache/hop/www/RegisterPackageServlet.java +++ b/engine/src/main/java/org/apache/hop/www/RegisterPackageServlet.java @@ -16,6 +16,13 @@ */ package org.apache.hop.www; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.text.MessageFormat; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.annotations.HopServerServlet; @@ -42,14 +49,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.text.MessageFormat; - @HopServerServlet(id = "registerPackage", name = "Upload a resources export file") public class RegisterPackageServlet extends BaseWorkflowServlet { diff --git a/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java b/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java index 8b4af9fad59..c9e4b02b2fe 100644 --- a/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java @@ -16,6 +16,10 @@ */ package org.apache.hop.www; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -24,10 +28,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.engine.IPipelineEngine; import org.json.simple.parser.ParseException; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; @HopServerServlet(id = "registerPipeline", name = "Add a pipeline to the server") public class RegisterPipelineServlet extends BaseWorkflowServlet { diff --git a/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java b/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java index a47eb619c61..bfa72af7b67 100644 --- a/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java +++ b/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java @@ -16,6 +16,10 @@ */ package org.apache.hop.www; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -24,10 +28,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; import org.json.simple.parser.ParseException; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; @HopServerServlet(id = "registerWorkflow", name = "Add a workflow to the server") public class RegisterWorkflowServlet extends BaseWorkflowServlet { diff --git a/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java b/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java index 43ce8bd6531..17e1a851b96 100644 --- a/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java @@ -17,6 +17,11 @@ package org.apache.hop.www; +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.logging.HopLogStore; @@ -27,12 +32,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - @HopServerServlet(id = "removePipeline", name = "Remove a pipeline") public class RemovePipelineServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = RemovePipelineServlet.class; // For Translator @@ -116,7 +115,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + BaseMessages.getString(PKG, "RemovePipelineServlet.PipelineRemoved") + ""); out.println(""); - out.println(""); + out.println( + ""); out.println(""); out.println(""); out.println( diff --git a/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java b/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java index 2d1b815326e..92af0820397 100644 --- a/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java +++ b/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java @@ -17,6 +17,11 @@ package org.apache.hop.www; +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.logging.HopLogStore; @@ -27,12 +32,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - @HopServerServlet(id = "removeWorkflow", name = "Remove a workflow from the server") public class RemoveWorkflowServlet extends BaseHttpServlet implements IHopServerPlugin { @@ -113,7 +112,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + BaseMessages.getString(PKG, "RemoveWorkflowServlet.WorkflowRemoved") + ""); out.println(""); - out.println(""); + out.println( + ""); out.println(""); out.println(""); out.println( diff --git a/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java b/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java index 30b3dbeaf4d..83e41b85c25 100644 --- a/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java +++ b/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java @@ -17,6 +17,15 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import java.util.List; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopTransformException; @@ -32,15 +41,6 @@ import org.apache.hop.pipeline.transform.IRowListener; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import java.util.List; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "sniffTransform", name = "Sniff test a pipeline transform") public class SniffTransformServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = GetPipelineStatusServlet.class; // For Translator @@ -215,7 +215,8 @@ public void errorRowWrittenEvent(IRowMeta rowMeta, Object[] row) + URLEncoder.encode(id, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println( + ""); out.println(""); out.println(""); out.println( diff --git a/engine/src/main/java/org/apache/hop/www/SocketPortAllocation.java b/engine/src/main/java/org/apache/hop/www/SocketPortAllocation.java index 1d921dc23af..972bfe94cef 100644 --- a/engine/src/main/java/org/apache/hop/www/SocketPortAllocation.java +++ b/engine/src/main/java/org/apache/hop/www/SocketPortAllocation.java @@ -58,12 +58,16 @@ public SocketPortAllocation( this.allocated = true; } - /** @return the port */ + /** + * @return the port + */ public int getPort() { return port; } - /** @param port the port to set */ + /** + * @param port the port to set + */ public void setPort(int port) { this.port = port; } @@ -85,102 +89,142 @@ public int hashCode() { return Integer.valueOf(port).hashCode(); } - /** @return the lastRequested */ + /** + * @return the lastRequested + */ public Date getLastRequested() { return lastRequested; } - /** @param lastRequested the lastRequested to set */ + /** + * @param lastRequested the lastRequested to set + */ public void setLastRequested(Date lastRequested) { this.lastRequested = lastRequested; } - /** @return the pipelineName */ + /** + * @return the pipelineName + */ public String getPipelineName() { return pipelineName; } - /** @param pipelineName the pipelineName to set */ + /** + * @param pipelineName the pipelineName to set + */ public void setPipelineName(String pipelineName) { this.pipelineName = pipelineName; } - /** @return the allocated */ + /** + * @return the allocated + */ public boolean isAllocated() { return allocated; } - /** @param allocated the allocated to set */ + /** + * @param allocated the allocated to set + */ public void setAllocated(boolean allocated) { this.allocated = allocated; } - /** @return the sourceTransformName */ + /** + * @return the sourceTransformName + */ public String getSourceTransformName() { return sourceTransformName; } - /** @param sourceTransformName the sourceTransformName to set */ + /** + * @param sourceTransformName the sourceTransformName to set + */ public void setSourceTransformName(String sourceTransformName) { this.sourceTransformName = sourceTransformName; } - /** @return the sourceTransformCopy */ + /** + * @return the sourceTransformCopy + */ public String getSourceTransformCopy() { return sourceTransformCopy; } - /** @param sourceTransformCopy the sourceTransformCopy to set */ + /** + * @param sourceTransformCopy the sourceTransformCopy to set + */ public void setSourceTransformCopy(String sourceTransformCopy) { this.sourceTransformCopy = sourceTransformCopy; } - /** @return the targetTransformName */ + /** + * @return the targetTransformName + */ public String getTargetTransformName() { return targetTransformName; } - /** @param targetTransformName the targetTransformName to set */ + /** + * @param targetTransformName the targetTransformName to set + */ public void setTargetTransformName(String targetTransformName) { this.targetTransformName = targetTransformName; } - /** @return the targetTransformCopy */ + /** + * @return the targetTransformCopy + */ public String getTargetTransformCopy() { return targetTransformCopy; } - /** @param targetTransformCopy the targetTransformCopy to set */ + /** + * @param targetTransformCopy the targetTransformCopy to set + */ public void setTargetTransformCopy(String targetTransformCopy) { this.targetTransformCopy = targetTransformCopy; } - /** @return the sourceServerName */ + /** + * @return the sourceServerName + */ public String getSourceServerName() { return sourceServerName; } - /** @param sourceServerName the sourceServerName to set */ + /** + * @param sourceServerName the sourceServerName to set + */ public void setSourceServerName(String sourceServerName) { this.sourceServerName = sourceServerName; } - /** @return the targetServerName */ + /** + * @return the targetServerName + */ public String getTargetServerName() { return targetServerName; } - /** @param targetServerName the targetServerName to set */ + /** + * @param targetServerName the targetServerName to set + */ public void setTargetServerName(String targetServerName) { this.targetServerName = targetServerName; } - /** @return the serverObjectId */ + /** + * @return the serverObjectId + */ public String getClusterRunId() { return clusterRunId; } - /** @param clusterRunId the serverObjectId to set */ + /** + * @param clusterRunId the serverObjectId to set + */ public void setClusterRunId(String clusterRunId) { this.clusterRunId = clusterRunId; } diff --git a/engine/src/main/java/org/apache/hop/www/SslConfiguration.java b/engine/src/main/java/org/apache/hop/www/SslConfiguration.java index 30972031e61..9a0846c2739 100644 --- a/engine/src/main/java/org/apache/hop/www/SslConfiguration.java +++ b/engine/src/main/java/org/apache/hop/www/SslConfiguration.java @@ -66,24 +66,32 @@ public SslConfiguration(Node sslConfigNode) { setKeyStoreType(XmlHandler.getTagValue(sslConfigNode, XML_TAG_KEY_STORE_TYPE)); } - /** @return the keyStoreType */ + /** + * @return the keyStoreType + */ public String getKeyStoreType() { return keyStoreType; } - /** @param keyStoreType the keyStoreType to set */ + /** + * @param keyStoreType the keyStoreType to set + */ public void setKeyStoreType(String keyStoreType) { if (keyStoreType != null) { this.keyStoreType = keyStoreType; } } - /** @return the keyStorePath */ + /** + * @return the keyStorePath + */ public String getKeyStore() { return keyStore; } - /** @param keyStore the keyStore to set */ + /** + * @param keyStore the keyStore to set + */ public void setKeyStore(String keyStore) { Validate.notNull( keyStore, @@ -96,12 +104,16 @@ public void setKeyStore(String keyStore) { this.keyStore = keyStore; } - /** @return the keyStorePassword */ + /** + * @return the keyStorePassword + */ public String getKeyStorePassword() { return keyStorePassword; } - /** @param keyStorePassword the keyStorePassword to set */ + /** + * @param keyStorePassword the keyStorePassword to set + */ public void setKeyStorePassword(String keyStorePassword) { Validate.notNull( keyStorePassword, @@ -114,12 +126,16 @@ public void setKeyStorePassword(String keyStorePassword) { this.keyStorePassword = keyStorePassword; } - /** @return the keyPassword */ + /** + * @return the keyPassword + */ public String getKeyPassword() { return (this.keyPassword != null) ? this.keyPassword : getKeyStorePassword(); } - /** @param keyPassword the keyPassword to set */ + /** + * @param keyPassword the keyPassword to set + */ public void setKeyPassword(String keyPassword) { this.keyPassword = keyPassword; } diff --git a/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java b/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java index 65c99136f28..795f1fa3ade 100644 --- a/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -27,14 +35,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "startExec", name = "Start the execution of a pipeline") public class StartExecutionPipelineServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = StartExecutionPipelineServlet.class; // For Translator @@ -84,7 +84,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + URLEncoder.encode(pipelineName, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println(""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java b/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java index 0810f2b3408..895f26d002d 100644 --- a/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java @@ -17,6 +17,15 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import java.util.UUID; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; @@ -31,15 +40,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import java.util.UUID; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "startPipeline", name = "Prepare and start the execution of a pipeline") public class StartPipelineServlet extends BaseHttpServlet implements IHopServerPlugin { @@ -95,7 +95,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + URLEncoder.encode(pipelineName, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println(""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java b/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java index 377fcee9e0f..633fe13cbe4 100644 --- a/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java +++ b/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java @@ -17,6 +17,15 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import java.util.UUID; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.exception.HopException; @@ -33,15 +42,6 @@ import org.apache.hop.workflow.engine.WorkflowEngineFactory; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import java.util.UUID; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "startWorkflow", name = "Start a workflow") public class StartWorkflowServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = StartWorkflowServlet.class; // For Translator @@ -92,7 +92,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + URLEncoder.encode(workflowName, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println(""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java b/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java index abb25e3a9c9..8ef1da622f7 100644 --- a/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java +++ b/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.util.Utils; @@ -26,14 +34,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "stopPipeline", name = "Stop a pipeline") public class StopPipelineServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = StopPipelineServlet.class; // For Translator @@ -84,7 +84,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) + URLEncoder.encode(pipelineName, UTF_8) + "\">"); out.println(""); - out.println(""); + out.println( + ""); out.println(""); out.println(""); } diff --git a/engine/src/main/java/org/apache/hop/www/StopWorkflowServlet.java b/engine/src/main/java/org/apache/hop/www/StopWorkflowServlet.java index 872fe2d21bd..cefe4b5fe46 100644 --- a/engine/src/main/java/org/apache/hop/www/StopWorkflowServlet.java +++ b/engine/src/main/java/org/apache/hop/www/StopWorkflowServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URLEncoder; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; import org.apache.hop.core.util.Utils; @@ -26,14 +34,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.owasp.encoder.Encode; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import static java.nio.charset.StandardCharsets.UTF_8; - @HopServerServlet(id = "stopWorkflow", name = "Stop a workflow") public class StopWorkflowServlet extends BaseHttpServlet implements IHopServerPlugin { private static final Class PKG = StopWorkflowServlet.class; // For Translator diff --git a/engine/src/main/java/org/apache/hop/www/WebResult.java b/engine/src/main/java/org/apache/hop/www/WebResult.java index 73b7fc51550..26f8391bc41 100644 --- a/engine/src/main/java/org/apache/hop/www/WebResult.java +++ b/engine/src/main/java/org/apache/hop/www/WebResult.java @@ -105,12 +105,16 @@ public static WebResult fromXmlString(String xml) throws HopXmlException { } } - /** @return the id */ + /** + * @return the id + */ public String getId() { return id; } - /** @param id the id to set */ + /** + * @param id the id to set + */ public void setId(String id) { this.id = id; } diff --git a/engine/src/main/java/org/apache/hop/www/WebServer.java b/engine/src/main/java/org/apache/hop/www/WebServer.java index 339ca57ad71..45f8eb77ce4 100644 --- a/engine/src/main/java/org/apache/hop/www/WebServer.java +++ b/engine/src/main/java/org/apache/hop/www/WebServer.java @@ -298,8 +298,8 @@ public void startServer() throws Exception { // Start execution createListeners(); // Temp disable shutdown listener #3367 -// Thread monitor = new MonitorThread(server, hostname, shutdownPort); -// monitor.start(); + // Thread monitor = new MonitorThread(server, hostname, shutdownPort); + // monitor.start(); server.start(); } @@ -355,8 +355,8 @@ private void createListeners() { // Temp disable shutdown listener #3367 // log.logBasic( -// BaseMessages.getString( -// PKG, "WebServer.Log.CreateShutDownListener", hostname, "" + shutdownPort)); + // BaseMessages.getString( + // PKG, "WebServer.Log.CreateShutDownListener", hostname, "" + shutdownPort)); server.setConnectors(new Connector[] {connector}); } diff --git a/engine/src/main/java/org/apache/hop/www/WebServiceServlet.java b/engine/src/main/java/org/apache/hop/www/WebServiceServlet.java index 63f8e35b23a..1c722dcc186 100644 --- a/engine/src/main/java/org/apache/hop/www/WebServiceServlet.java +++ b/engine/src/main/java/org/apache/hop/www/WebServiceServlet.java @@ -17,6 +17,14 @@ package org.apache.hop.www; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.UUID; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; @@ -42,15 +50,6 @@ import org.apache.hop.pipeline.transform.RowAdapter; import org.apache.hop.www.service.WebService; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.UUID; - @HopServerServlet(id = "webService", name = "Output the content of a field in a transform") public class WebServiceServlet extends BaseHttpServlet implements IHopServerPlugin { diff --git a/engine/src/main/java/org/apache/hop/www/WorkflowMap.java b/engine/src/main/java/org/apache/hop/www/WorkflowMap.java index 6111048d06f..7522b9cb668 100644 --- a/engine/src/main/java/org/apache/hop/www/WorkflowMap.java +++ b/engine/src/main/java/org/apache/hop/www/WorkflowMap.java @@ -17,17 +17,16 @@ package org.apache.hop.www; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.util.Utils; import org.apache.hop.workflow.WorkflowConfiguration; import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - /** This is a map between the workflow name and the (running/waiting/finished) workflow. */ public class WorkflowMap { private final Map> workflowMap; @@ -153,12 +152,16 @@ public synchronized HopServerObjectEntry getFirstHopServerObjectEntry(String wor } } - /** @return the hopServerConfig */ + /** + * @return the hopServerConfig + */ public HopServerConfig getHopServerConfig() { return hopServerConfig; } - /** @param hopServerConfig the hopServerConfig to set */ + /** + * @param hopServerConfig the hopServerConfig to set + */ public void setHopServerConfig(HopServerConfig hopServerConfig) { this.hopServerConfig = hopServerConfig; } diff --git a/engine/src/main/java/org/apache/hop/www/jaxrs/HopServerResource.java b/engine/src/main/java/org/apache/hop/www/jaxrs/HopServerResource.java index a2013216cb5..776fe234982 100644 --- a/engine/src/main/java/org/apache/hop/www/jaxrs/HopServerResource.java +++ b/engine/src/main/java/org/apache/hop/www/jaxrs/HopServerResource.java @@ -17,6 +17,12 @@ package org.apache.hop.www.jaxrs; +import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.workflow.WorkflowMeta; @@ -25,13 +31,6 @@ import org.apache.hop.www.HopServerObjectEntry; import org.apache.hop.www.HopServerSingleton; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.util.ArrayList; -import java.util.List; - @Path("/carte") public class HopServerResource { diff --git a/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineResource.java b/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineResource.java index 71076a329c5..96f8de32990 100644 --- a/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineResource.java +++ b/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineResource.java @@ -17,6 +17,14 @@ package org.apache.hop.www.jaxrs; +import java.util.UUID; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -37,15 +45,6 @@ import org.apache.hop.www.HopServerObjectEntry; import org.apache.hop.www.HopServerSingleton; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.UUID; - @Path("/carte/pipeline") public class PipelineResource { diff --git a/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineStatus.java b/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineStatus.java index 632a870cb6b..dd91fe57dfc 100644 --- a/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineStatus.java +++ b/engine/src/main/java/org/apache/hop/www/jaxrs/PipelineStatus.java @@ -17,11 +17,10 @@ package org.apache.hop.www.jaxrs; -import org.apache.hop.pipeline.transform.TransformStatus; - -import javax.xml.bind.annotation.XmlRootElement; import java.util.ArrayList; import java.util.List; +import javax.xml.bind.annotation.XmlRootElement; +import org.apache.hop.pipeline.transform.TransformStatus; @XmlRootElement public class PipelineStatus { diff --git a/engine/src/main/java/org/apache/hop/www/jaxrs/ServerStatus.java b/engine/src/main/java/org/apache/hop/www/jaxrs/ServerStatus.java index 072989ebfc3..84aca7b6b9d 100644 --- a/engine/src/main/java/org/apache/hop/www/jaxrs/ServerStatus.java +++ b/engine/src/main/java/org/apache/hop/www/jaxrs/ServerStatus.java @@ -17,17 +17,16 @@ package org.apache.hop.www.jaxrs; +import java.lang.management.OperatingSystemMXBean; +import java.lang.management.RuntimeMXBean; +import java.lang.management.ThreadMXBean; +import javax.xml.bind.annotation.XmlRootElement; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.util.Utils; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import javax.xml.bind.annotation.XmlRootElement; -import java.lang.management.OperatingSystemMXBean; -import java.lang.management.RuntimeMXBean; -import java.lang.management.ThreadMXBean; - @XmlRootElement public class ServerStatus { @@ -115,62 +114,86 @@ public ServerStatus(Node statusNode) throws HopException { osArchitecture = XmlHandler.getTagValue(statusNode, "os_arch"); } - /** @return the statusDescription */ + /** + * @return the statusDescription + */ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription the statusDescription to set */ + /** + * @param statusDescription the statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } - /** @return the errorDescription */ + /** + * @return the errorDescription + */ public String getErrorDescription() { return errorDescription; } - /** @param errorDescription the errorDescription to set */ + /** + * @param errorDescription the errorDescription to set + */ public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } - /** @return the memoryFree */ + /** + * @return the memoryFree + */ public double getMemoryFree() { return memoryFree; } - /** @param memoryFree the memoryFree to set */ + /** + * @param memoryFree the memoryFree to set + */ public void setMemoryFree(long memoryFree) { this.memoryFree = memoryFree; } - /** @return the memoryTotal */ + /** + * @return the memoryTotal + */ public double getMemoryTotal() { return memoryTotal; } - /** @param memoryTotal the memoryTotal to set */ + /** + * @param memoryTotal the memoryTotal to set + */ public void setMemoryTotal(long memoryTotal) { this.memoryTotal = memoryTotal; } - /** @return the cpuCores */ + /** + * @return the cpuCores + */ public int getCpuCores() { return cpuCores; } - /** @param cpuCores the cpuCores to set */ + /** + * @param cpuCores the cpuCores to set + */ public void setCpuCores(int cpuCores) { this.cpuCores = cpuCores; } - /** @return the cpuProcessTime */ + /** + * @return the cpuProcessTime + */ public long getCpuProcessTime() { return cpuProcessTime; } - /** @param cpuProcessTime the cpuProcessTime to set */ + /** + * @param cpuProcessTime the cpuProcessTime to set + */ public void setCpuProcessTime(long cpuProcessTime) { this.cpuProcessTime = cpuProcessTime; } diff --git a/engine/src/main/java/org/apache/hop/www/jaxrs/WorkflowResource.java b/engine/src/main/java/org/apache/hop/www/jaxrs/WorkflowResource.java index e890de21d74..c4bf1149eaf 100644 --- a/engine/src/main/java/org/apache/hop/www/jaxrs/WorkflowResource.java +++ b/engine/src/main/java/org/apache/hop/www/jaxrs/WorkflowResource.java @@ -17,6 +17,14 @@ package org.apache.hop.www.jaxrs; +import java.util.UUID; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.LoggingObjectType; import org.apache.hop.core.logging.SimpleLoggingObject; @@ -33,15 +41,6 @@ import org.apache.hop.www.HopServerObjectEntry; import org.apache.hop.www.HopServerSingleton; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.UUID; - @Path("/carte/workflow") public class WorkflowResource { diff --git a/engine/src/test/java/org/apache/hop/base/AbstractMetaTest.java b/engine/src/test/java/org/apache/hop/base/AbstractMetaTest.java index 2b9bdfddd68..ed4390fb3f4 100644 --- a/engine/src/test/java/org/apache/hop/base/AbstractMetaTest.java +++ b/engine/src/test/java/org/apache/hop/base/AbstractMetaTest.java @@ -16,6 +16,27 @@ */ package org.apache.hop.base; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.CountDownLatch; import org.apache.hop.core.NotePadMeta; import org.apache.hop.core.changed.IChanged; import org.apache.hop.core.changed.IHopObserver; @@ -36,28 +57,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.concurrent.CountDownLatch; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - public class AbstractMetaTest { AbstractMeta meta; @@ -269,7 +268,6 @@ public void testNotes() throws Exception { assertEquals(2, indexes.length); } - @Test public void testAddDeleteModifyObserver() throws Exception { IHopObserver observer = mock(IHopObserver.class); @@ -345,9 +343,7 @@ public String getName() { } @Override - public void setName(String newName) { - - } + public void setName(String newName) {} @Override public boolean isNameSynchronizedWithFilename() { @@ -355,9 +351,7 @@ public boolean isNameSynchronizedWithFilename() { } @Override - public void setNameSynchronizedWithFilename(boolean nameSynchronizedWithFilename) { - - } + public void setNameSynchronizedWithFilename(boolean nameSynchronizedWithFilename) {} @Override public String getDescription() { @@ -365,9 +359,7 @@ public String getDescription() { } @Override - public void setDescription(String description) { - - } + public void setDescription(String description) {} @Override public String getExtendedDescription() { @@ -375,9 +367,7 @@ public String getExtendedDescription() { } @Override - public void setExtendedDescription(String extendedDescription) { - - } + public void setExtendedDescription(String extendedDescription) {} // Reuse this method to set a mock internal variable variables @Override @@ -395,14 +385,10 @@ public Date getCreatedDate() { } @Override - public void setCreatedDate(Date createdDate) { - - } + public void setCreatedDate(Date createdDate) {} @Override - public void setCreatedUser(String createdUser) { - - } + public void setCreatedUser(String createdUser) {} @Override public String getCreatedUser() { @@ -410,9 +396,7 @@ public String getCreatedUser() { } @Override - public void setModifiedDate(Date modifiedDate) { - - } + public void setModifiedDate(Date modifiedDate) {} @Override public Date getModifiedDate() { @@ -420,9 +404,7 @@ public Date getModifiedDate() { } @Override - public void setModifiedUser(String modifiedUser) { - - } + public void setModifiedUser(String modifiedUser) {} @Override public String getModifiedUser() { diff --git a/engine/src/test/java/org/apache/hop/base/LoadSaveBase.java b/engine/src/test/java/org/apache/hop/base/LoadSaveBase.java index 369a6b7204e..cd54091fa77 100644 --- a/engine/src/test/java/org/apache/hop/base/LoadSaveBase.java +++ b/engine/src/test/java/org/apache/hop/base/LoadSaveBase.java @@ -17,6 +17,17 @@ package org.apache.hop.base; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; @@ -33,18 +44,6 @@ import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidatorFactory; import org.apache.test.util.JavaBeanManipulator; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public abstract class LoadSaveBase { protected final Class clazz; @@ -61,7 +60,8 @@ public LoadSaveBase( Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, Map> fieldLoadSaveValidatorTypeMap, - IInitializer initializer) throws HopException { + IInitializer initializer) + throws HopException { this.clazz = clazz; this.attributes = new ArrayList(attributes); @@ -90,7 +90,8 @@ public LoadSaveBase( Map getterMap, Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, - Map> fieldLoadSaveValidatorTypeMap) throws HopException { + Map> fieldLoadSaveValidatorTypeMap) + throws HopException { this( clazz, attributes, @@ -102,13 +103,7 @@ public LoadSaveBase( } public LoadSaveBase(Class clazz, List attributes) throws HopException { - this( - clazz, - attributes, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - new HashMap<>()); + this(clazz, attributes, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>()); } private void addHopMetadataPropertyCommonAttributes() throws HopException { @@ -121,14 +116,14 @@ private void addHopMetadataPropertyCommonAttributes() throws HopException { continue; } HopMetadataProperty annotation = field.getAnnotation(HopMetadataProperty.class); - if (annotation!=null) { + if (annotation != null) { String attribute = field.getName(); if (!attributes.contains(attribute)) { attributes.add(attribute); } } } - } catch(Exception e) { + } catch (Exception e) { throw new HopException("Error adding common attributes from Hop metadata properties", e); } } diff --git a/engine/src/test/java/org/apache/hop/base/MockFilenameChangeListener.java b/engine/src/test/java/org/apache/hop/base/MockFilenameChangeListener.java index a3635796f70..3168afed7c7 100644 --- a/engine/src/test/java/org/apache/hop/base/MockFilenameChangeListener.java +++ b/engine/src/test/java/org/apache/hop/base/MockFilenameChangeListener.java @@ -16,9 +16,8 @@ */ package org.apache.hop.base; -import org.apache.hop.core.listeners.IFilenameChangedListener; - import java.util.Objects; +import org.apache.hop.core.listeners.IFilenameChangedListener; public class MockFilenameChangeListener implements IFilenameChangedListener { @@ -59,7 +58,9 @@ public int getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(int id) { this.id = id; } diff --git a/engine/src/test/java/org/apache/hop/concurrency/ActiveSubPipelineConcurrencyTest.java b/engine/src/test/java/org/apache/hop/concurrency/ActiveSubPipelineConcurrencyTest.java index 42d7d978988..35704ccfeea 100644 --- a/engine/src/test/java/org/apache/hop/concurrency/ActiveSubPipelineConcurrencyTest.java +++ b/engine/src/test/java/org/apache/hop/concurrency/ActiveSubPipelineConcurrencyTest.java @@ -17,15 +17,14 @@ package org.apache.hop.concurrency; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.engine.IPipelineEngine; -import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; -import org.junit.Test; - import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.engine.IPipelineEngine; +import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; +import org.junit.Test; /** * In this test we add new elements to shared pipeline concurrently and get added elements from this diff --git a/engine/src/test/java/org/apache/hop/concurrency/BaseRowSetConcurrentTest.java b/engine/src/test/java/org/apache/hop/concurrency/BaseRowSetConcurrentTest.java index ab06e34e08f..c42ac646170 100644 --- a/engine/src/test/java/org/apache/hop/concurrency/BaseRowSetConcurrentTest.java +++ b/engine/src/test/java/org/apache/hop/concurrency/BaseRowSetConcurrentTest.java @@ -17,10 +17,6 @@ package org.apache.hop.concurrency; -import org.apache.hop.core.BlockingRowSet; -import org.junit.Assert; -import org.junit.Test; - import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -29,6 +25,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.hop.core.BlockingRowSet; +import org.junit.Assert; +import org.junit.Test; /** * We have a {@link org.apache.hop.core.BaseRowSet} with a bunch of attributes (originTransformName, diff --git a/engine/src/test/java/org/apache/hop/concurrency/BaseTransformConcurrencyTest.java b/engine/src/test/java/org/apache/hop/concurrency/BaseTransformConcurrencyTest.java index f47afec2946..f86c0d978dc 100644 --- a/engine/src/test/java/org/apache/hop/concurrency/BaseTransformConcurrencyTest.java +++ b/engine/src/test/java/org/apache/hop/concurrency/BaseTransformConcurrencyTest.java @@ -17,6 +17,13 @@ package org.apache.hop.concurrency; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.PipelineMeta; @@ -29,14 +36,6 @@ import org.apache.hop.pipeline.transform.TransformPartitioningMeta; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class BaseTransformConcurrencyTest { private static final String TRANSFORM_META = "TransformMeta"; diff --git a/engine/src/test/java/org/apache/hop/concurrency/RowMetaConcurrencyTest.java b/engine/src/test/java/org/apache/hop/concurrency/RowMetaConcurrencyTest.java index 411b7190ade..01287808528 100644 --- a/engine/src/test/java/org/apache/hop/concurrency/RowMetaConcurrencyTest.java +++ b/engine/src/test/java/org/apache/hop/concurrency/RowMetaConcurrencyTest.java @@ -17,10 +17,8 @@ package org.apache.hop.concurrency; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.core.row.value.ValueMetaString; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Collections; @@ -33,9 +31,10 @@ import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.core.row.value.ValueMetaString; +import org.junit.Test; public class RowMetaConcurrencyTest { diff --git a/engine/src/test/java/org/apache/hop/concurrency/WorkflowMapConcurrencyTest.java b/engine/src/test/java/org/apache/hop/concurrency/WorkflowMapConcurrencyTest.java index 08561ab8eaf..82a653d9a4b 100644 --- a/engine/src/test/java/org/apache/hop/concurrency/WorkflowMapConcurrencyTest.java +++ b/engine/src/test/java/org/apache/hop/concurrency/WorkflowMapConcurrencyTest.java @@ -17,6 +17,15 @@ package org.apache.hop.concurrency; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.collections4.ListUtils; import org.apache.hop.workflow.WorkflowConfiguration; import org.apache.hop.workflow.WorkflowMeta; @@ -27,16 +36,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class WorkflowMapConcurrencyTest { public static final String WORKFLOW_NAME_STRING = "workflow"; public static final String WORKFLOW_ID_STRING = "workflow"; diff --git a/engine/src/test/java/org/apache/hop/concurrency/WorkflowTrackerConcurrencyTest.java b/engine/src/test/java/org/apache/hop/concurrency/WorkflowTrackerConcurrencyTest.java index c13f05c7f77..933ecc6f93f 100644 --- a/engine/src/test/java/org/apache/hop/concurrency/WorkflowTrackerConcurrencyTest.java +++ b/engine/src/test/java/org/apache/hop/concurrency/WorkflowTrackerConcurrencyTest.java @@ -17,6 +17,18 @@ package org.apache.hop.concurrency; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.collections4.ListUtils; import org.apache.hop.core.gui.WorkflowTracker; import org.apache.hop.workflow.ActionResult; @@ -27,19 +39,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** * This test consists of two similar cases. There are three type of actors: getters, searchers and * updaters. They work simultaneously within their own threads. Getters invoke {@linkplain diff --git a/engine/src/test/java/org/apache/hop/core/ConcurrentMapPropertiesTest.java b/engine/src/test/java/org/apache/hop/core/ConcurrentMapPropertiesTest.java index fd96a60c6af..144eef99821 100644 --- a/engine/src/test/java/org/apache/hop/core/ConcurrentMapPropertiesTest.java +++ b/engine/src/test/java/org/apache/hop/core/ConcurrentMapPropertiesTest.java @@ -16,9 +16,6 @@ */ package org.apache.hop.core; -import org.junit.Assert; -import org.junit.Test; - import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -30,6 +27,8 @@ import java.util.Properties; import java.util.UUID; import java.util.stream.Collectors; +import org.junit.Assert; +import org.junit.Test; public class ConcurrentMapPropertiesTest { diff --git a/engine/src/test/java/org/apache/hop/core/NotePadMetaTest.java b/engine/src/test/java/org/apache/hop/core/NotePadMetaTest.java index c4c42353394..df87ce972a4 100644 --- a/engine/src/test/java/org/apache/hop/core/NotePadMetaTest.java +++ b/engine/src/test/java/org/apache/hop/core/NotePadMetaTest.java @@ -18,13 +18,13 @@ package org.apache.hop.core; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; import org.junit.Test; import org.w3c.dom.Node; -import static org.junit.Assert.assertEquals; - public class NotePadMetaTest { @Test diff --git a/engine/src/test/java/org/apache/hop/core/attributes/AttributesUtilTest.java b/engine/src/test/java/org/apache/hop/core/attributes/AttributesUtilTest.java index 10fa6682d8f..024857cd7c3 100644 --- a/engine/src/test/java/org/apache/hop/core/attributes/AttributesUtilTest.java +++ b/engine/src/test/java/org/apache/hop/core/attributes/AttributesUtilTest.java @@ -17,6 +17,14 @@ package org.apache.hop.core.attributes; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.nullable; + +import java.util.HashMap; +import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -25,15 +33,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.w3c.dom.Node; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.nullable; - @PrepareForTest(AttributesUtil.class) @RunWith(PowerMockRunner.class) public class AttributesUtilTest { diff --git a/engine/src/test/java/org/apache/hop/core/auth/core/AuthenticationManagerTest.java b/engine/src/test/java/org/apache/hop/core/auth/core/AuthenticationManagerTest.java index 31185e4f877..fc9317cb93d 100644 --- a/engine/src/test/java/org/apache/hop/core/auth/core/AuthenticationManagerTest.java +++ b/engine/src/test/java/org/apache/hop/core/auth/core/AuthenticationManagerTest.java @@ -17,6 +17,16 @@ package org.apache.hop.core.auth.core; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.hop.core.auth.DelegatingKerberosConsumer; import org.apache.hop.core.auth.DelegatingKerberosConsumerForClassloaderBridging; import org.apache.hop.core.auth.DelegatingNoAuthConsumer; @@ -30,17 +40,6 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class AuthenticationManagerTest { private AuthenticationManager manager; private NoAuthenticationAuthenticationProvider noAuthenticationAuthenticationProvider; diff --git a/engine/src/test/java/org/apache/hop/core/compress/CompressionInputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/CompressionInputStreamTest.java index 9827a1e4702..259e432a08f 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/CompressionInputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/CompressionInputStreamTest.java @@ -17,6 +17,17 @@ package org.apache.hop.core.compress; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.junit.After; @@ -26,18 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - public class CompressionInputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/CompressionOutputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/CompressionOutputStreamTest.java index 332f9a30bee..f01b9d953d6 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/CompressionOutputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/CompressionOutputStreamTest.java @@ -17,6 +17,12 @@ package org.apache.hop.core.compress; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.junit.After; @@ -26,13 +32,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class CompressionOutputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/CompressionPluginTypeTest.java b/engine/src/test/java/org/apache/hop/core/compress/CompressionPluginTypeTest.java index 531d160268f..f988f802b35 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/CompressionPluginTypeTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/CompressionPluginTypeTest.java @@ -17,18 +17,18 @@ package org.apache.hop.core.compress; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + public class CompressionPluginTypeTest { @BeforeClass diff --git a/engine/src/test/java/org/apache/hop/core/compress/CompressionProviderFactoryTest.java b/engine/src/test/java/org/apache/hop/core/compress/CompressionProviderFactoryTest.java index 46171529485..68a0c372fc0 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/CompressionProviderFactoryTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/CompressionProviderFactoryTest.java @@ -17,6 +17,13 @@ package org.apache.hop.core.compress; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Collection; +import java.util.HashMap; import org.apache.hop.core.compress.gzip.GzipCompressionProvider; import org.apache.hop.core.compress.hadoopsnappy.HadoopSnappyCompressionProvider; import org.apache.hop.core.compress.snappy.SnappyCompressionProvider; @@ -30,14 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Collection; -import java.util.HashMap; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class CompressionProviderFactoryTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/NoneCompressionProviderTest.java b/engine/src/test/java/org/apache/hop/core/compress/NoneCompressionProviderTest.java index 910ff2ccda3..e916bf2fbdb 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/NoneCompressionProviderTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/NoneCompressionProviderTest.java @@ -17,6 +17,14 @@ package org.apache.hop.core.compress; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.apache.hop.core.compress.NoneCompressionProvider.NoneCompressionInputStream; import org.apache.hop.core.compress.NoneCompressionProvider.NoneCompressionOutputStream; import org.apache.hop.core.plugins.PluginRegistry; @@ -28,15 +36,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class NoneCompressionProviderTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStreamTest.java index 848f64ce4b6..9a1b7dd8142 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionInputStreamTest.java @@ -17,6 +17,15 @@ package org.apache.hop.core.compress.gzip; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.GZIPOutputStream; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.compress.ICompressionProvider; @@ -29,16 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.GZIPOutputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class GzipCompressionInputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStreamTest.java index 9ea45840862..df8ee9e9547 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionOutputStreamTest.java @@ -17,6 +17,12 @@ package org.apache.hop.core.compress.gzip; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.compress.ICompressionProvider; @@ -29,13 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - public class GzipCompressionOutputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionProviderTest.java b/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionProviderTest.java index b135b3f042f..fd744348d12 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionProviderTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/gzip/GzipCompressionProviderTest.java @@ -17,6 +17,15 @@ package org.apache.hop.core.compress.gzip; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.plugins.PluginRegistry; @@ -28,16 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class GzipCompressionProviderTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStreamTest.java index a4d4f5fa815..e35739588ac 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionInputStreamTest.java @@ -17,6 +17,13 @@ package org.apache.hop.core.compress.snappy; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.compress.ICompressionProvider; @@ -31,14 +38,6 @@ import org.xerial.snappy.SnappyInputStream; import org.xerial.snappy.SnappyOutputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class SnappyCompressionInputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStreamTest.java index fac46f11831..dd8ee830927 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionOutputStreamTest.java @@ -17,6 +17,11 @@ package org.apache.hop.core.compress.snappy; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.compress.ICompressionProvider; @@ -29,12 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class SnappyCompressionOutputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionProviderTest.java b/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionProviderTest.java index 7304fe626dc..8898a06d922 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionProviderTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/snappy/SnappyCompressionProviderTest.java @@ -17,6 +17,14 @@ package org.apache.hop.core.compress.snappy; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.plugins.PluginRegistry; @@ -30,15 +38,6 @@ import org.xerial.snappy.SnappyInputStream; import org.xerial.snappy.SnappyOutputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class SnappyCompressionProviderTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionInputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionInputStreamTest.java index 75e9295864b..8a13a01f65c 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionInputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionInputStreamTest.java @@ -17,6 +17,15 @@ package org.apache.hop.core.compress.zip; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.compress.ICompressionProvider; @@ -29,16 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class ZipCompressionInputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStreamTest.java b/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStreamTest.java index d63d8906476..f84f567f65f 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStreamTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionOutputStreamTest.java @@ -17,6 +17,17 @@ package org.apache.hop.core.compress.zip; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; import org.apache.hop.core.Const; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; @@ -30,18 +41,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class ZipCompressionOutputStreamTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionProviderTest.java b/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionProviderTest.java index d57913e0557..626108d72fc 100644 --- a/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionProviderTest.java +++ b/engine/src/test/java/org/apache/hop/core/compress/zip/ZipCompressionProviderTest.java @@ -17,6 +17,15 @@ package org.apache.hop.core.compress.zip; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; import org.apache.hop.core.compress.CompressionPluginType; import org.apache.hop.core.compress.CompressionProviderFactory; import org.apache.hop.core.plugins.PluginRegistry; @@ -28,16 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class ZipCompressionProviderTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/gui/WorkflowTrackerTest.java b/engine/src/test/java/org/apache/hop/core/gui/WorkflowTrackerTest.java index 453e76b71de..d9e3be6ff60 100644 --- a/engine/src/test/java/org/apache/hop/core/gui/WorkflowTrackerTest.java +++ b/engine/src/test/java/org/apache/hop/core/gui/WorkflowTrackerTest.java @@ -17,6 +17,12 @@ package org.apache.hop.core.gui; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.hop.core.Const; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.ActionResult; @@ -26,12 +32,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class WorkflowTrackerTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/injection/BaseMetadataInjectionTest.java b/engine/src/test/java/org/apache/hop/core/injection/BaseMetadataInjectionTest.java index 31123669d57..4c7f4e25a0e 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/BaseMetadataInjectionTest.java +++ b/engine/src/test/java/org/apache/hop/core/injection/BaseMetadataInjectionTest.java @@ -17,6 +17,14 @@ package org.apache.hop.core.injection; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; @@ -34,15 +42,6 @@ import org.junit.After; import org.junit.Ignore; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - /** Base class for test metadata injection. */ @Ignore public abstract class BaseMetadataInjectionTest { diff --git a/engine/src/test/java/org/apache/hop/core/injection/MetaAnnotationInjectionTest.java b/engine/src/test/java/org/apache/hop/core/injection/MetaAnnotationInjectionTest.java index e37bdc7defc..87992490ace 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/MetaAnnotationInjectionTest.java +++ b/engine/src/test/java/org/apache/hop/core/injection/MetaAnnotationInjectionTest.java @@ -17,6 +17,16 @@ package org.apache.hop.core.injection; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.injection.bean.BeanInjectionInfo; @@ -32,17 +42,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - public class MetaAnnotationInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/core/injection/MetaPropInjectionTest.java b/engine/src/test/java/org/apache/hop/core/injection/MetaPropInjectionTest.java index e9fc1273267..3834e63908a 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/MetaPropInjectionTest.java +++ b/engine/src/test/java/org/apache/hop/core/injection/MetaPropInjectionTest.java @@ -17,6 +17,13 @@ package org.apache.hop.core.injection; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.injection.bean.BeanInjectionInfo; import org.apache.hop.core.injection.bean.BeanInjector; @@ -31,14 +38,6 @@ import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class MetaPropInjectionTest { /** diff --git a/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanChild.java b/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanChild.java index 4f50d3f5d5c..faadd5ebc15 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanChild.java +++ b/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanChild.java @@ -19,5 +19,4 @@ import org.apache.hop.core.injection.InjectionSupported; @InjectionSupported(localizationPrefix = "") -public class MetaBeanChild extends MetaBeanMiddle { -} +public class MetaBeanChild extends MetaBeanMiddle {} diff --git a/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanMiddle.java b/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanMiddle.java index dde19624995..d5315b416a2 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanMiddle.java +++ b/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanMiddle.java @@ -16,5 +16,4 @@ */ package org.apache.hop.core.injection.inheritance; -public class MetaBeanMiddle extends MetaBeanParent { -} +public class MetaBeanMiddle extends MetaBeanParent {} diff --git a/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanParent.java b/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanParent.java index 65da8ac07a3..a23cb356182 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanParent.java +++ b/engine/src/test/java/org/apache/hop/core/injection/inheritance/MetaBeanParent.java @@ -16,15 +16,15 @@ */ package org.apache.hop.core.injection.inheritance; +import java.util.List; import org.apache.hop.core.injection.Injection; import org.apache.hop.core.injection.InjectionDeep; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.ITransform; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - -public class MetaBeanParent extends BaseTransformMeta { +public class MetaBeanParent + extends BaseTransformMeta { @InjectionDeep public List items; diff --git a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanChild.java b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanChild.java index f5e58f9d132..2564ee69b06 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanChild.java +++ b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanChild.java @@ -42,7 +42,9 @@ public String getChildField1() { return childField1; } - /** @param childField1 The childField1 to set */ + /** + * @param childField1 The childField1 to set + */ public void setChildField1(String childField1) { this.childField1 = childField1; } @@ -56,7 +58,9 @@ public String getChildField2() { return childField2; } - /** @param childField2 The childField2 to set */ + /** + * @param childField2 The childField2 to set + */ public void setChildField2(String childField2) { this.childField2 = childField2; } @@ -70,7 +74,9 @@ public PropBeanGrandChild getGrandChild() { return grandChild; } - /** @param grandChild The grandChild to set */ + /** + * @param grandChild The grandChild to set + */ public void setGrandChild(PropBeanGrandChild grandChild) { this.grandChild = grandChild; } diff --git a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanGrandChild.java b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanGrandChild.java index f03cd531f4b..13efbec4aa0 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanGrandChild.java +++ b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanGrandChild.java @@ -42,7 +42,9 @@ public String getGrandChildName() { return grandChildName; } - /** @param grandChildName The grandChildName to set */ + /** + * @param grandChildName The grandChildName to set + */ public void setGrandChildName(String grandChildName) { this.grandChildName = grandChildName; } @@ -56,7 +58,9 @@ public String getGrandChildDescription() { return grandChildDescription; } - /** @param grandChildDescription The grandChildDescription to set */ + /** + * @param grandChildDescription The grandChildDescription to set + */ public void setGrandChildDescription(String grandChildDescription) { this.grandChildDescription = grandChildDescription; } diff --git a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanListChild.java b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanListChild.java index 64300b408c4..b45afbee69e 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanListChild.java +++ b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanListChild.java @@ -17,9 +17,8 @@ package org.apache.hop.core.injection.metadata; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class PropBeanListChild { @@ -60,7 +59,9 @@ public String getF1() { return f1; } - /** @param f1 The f1 to set */ + /** + * @param f1 The f1 to set + */ public void setF1(String f1) { this.f1 = f1; } @@ -74,7 +75,9 @@ public String getF2() { return f2; } - /** @param f2 The f2 to set */ + /** + * @param f2 The f2 to set + */ public void setF2(String f2) { this.f2 = f2; } diff --git a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanParent.java b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanParent.java index 3f555cc97c0..c7a917ada9b 100644 --- a/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanParent.java +++ b/engine/src/test/java/org/apache/hop/core/injection/metadata/PropBeanParent.java @@ -17,10 +17,9 @@ package org.apache.hop.core.injection.metadata; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; public class PropBeanParent { @@ -59,7 +58,9 @@ public String getStringField() { return stringField; } - /** @param stringField The stringField to set */ + /** + * @param stringField The stringField to set + */ public void setStringField(String stringField) { this.stringField = stringField; } @@ -73,7 +74,9 @@ public int getIntField() { return intField; } - /** @param intField The intField to set */ + /** + * @param intField The intField to set + */ public void setIntField(int intField) { this.intField = intField; } @@ -87,7 +90,9 @@ public long getLongField() { return longField; } - /** @param longField The longField to set */ + /** + * @param longField The longField to set + */ public void setLongField(long longField) { this.longField = longField; } @@ -101,7 +106,9 @@ public boolean isBooleanField() { return booleanField; } - /** @param booleanField The booleanField to set */ + /** + * @param booleanField The booleanField to set + */ public void setBooleanField(boolean booleanField) { this.booleanField = booleanField; } @@ -115,7 +122,9 @@ public PropBeanChild getChild() { return child; } - /** @param child The child to set */ + /** + * @param child The child to set + */ public void setChild(PropBeanChild child) { this.child = child; } @@ -129,7 +138,9 @@ public List getChildren() { return children; } - /** @param children The children to set */ + /** + * @param children The children to set + */ public void setChildren(List children) { this.children = children; } @@ -143,7 +154,9 @@ public List getStrings() { return strings; } - /** @param strings The strings to set */ + /** + * @param strings The strings to set + */ public void setStrings(List strings) { this.strings = strings; } diff --git a/engine/src/test/java/org/apache/hop/core/logging/LogChannelFileWriterTest.java b/engine/src/test/java/org/apache/hop/core/logging/LogChannelFileWriterTest.java index 44705233306..858b49eedb0 100644 --- a/engine/src/test/java/org/apache/hop/core/logging/LogChannelFileWriterTest.java +++ b/engine/src/test/java/org/apache/hop/core/logging/LogChannelFileWriterTest.java @@ -17,6 +17,16 @@ package org.apache.hop.core.logging; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.OutputStream; import org.apache.commons.vfs2.FileContent; import org.apache.commons.vfs2.FileObject; import org.junit.Before; @@ -27,17 +37,6 @@ import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import java.io.OutputStream; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class LogChannelFileWriterTest { diff --git a/engine/src/test/java/org/apache/hop/core/logging/LogMessageTest.java b/engine/src/test/java/org/apache/hop/core/logging/LogMessageTest.java index 8268624629c..90a9a96973e 100644 --- a/engine/src/test/java/org/apache/hop/core/logging/LogMessageTest.java +++ b/engine/src/test/java/org/apache/hop/core/logging/LogMessageTest.java @@ -17,6 +17,9 @@ package org.apache.hop.core.logging; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.Const; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.variables.DescribedVariable; @@ -26,9 +29,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class LogMessageTest { private LogMessage logMessage; diff --git a/engine/src/test/java/org/apache/hop/core/metadata/SerializableMetadataProviderTest.java b/engine/src/test/java/org/apache/hop/core/metadata/SerializableMetadataProviderTest.java index 5971816e73d..5e95300d16a 100644 --- a/engine/src/test/java/org/apache/hop/core/metadata/SerializableMetadataProviderTest.java +++ b/engine/src/test/java/org/apache/hop/core/metadata/SerializableMetadataProviderTest.java @@ -17,6 +17,9 @@ package org.apache.hop.core.metadata; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.metadata.api.IHopMetadataSerializer; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; @@ -24,9 +27,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class SerializableMetadataProviderTest { @Before @@ -40,11 +40,29 @@ public void testRoundTrip() throws Exception { IHopMetadataSerializer sourceSerializer = source.getSerializer(HopServer.class); HopServer sourceServer1 = new HopServer( - "server1", "hostname1", "8181", "8182", "username1", "password1", null, null, null, false); + "server1", + "hostname1", + "8181", + "8182", + "username1", + "password1", + null, + null, + null, + false); sourceSerializer.save(sourceServer1); HopServer sourceServer2 = new HopServer( - "server2", "hostname2", "8282", "8283", "username2", "password2", null, null, null, true); + "server2", + "hostname2", + "8282", + "8283", + "username2", + "password2", + null, + null, + null, + true); sourceSerializer.save(sourceServer2); SerializableMetadataProvider serializableMetadataProvider = diff --git a/engine/src/test/java/org/apache/hop/core/reflection/StringSearchResultTest.java b/engine/src/test/java/org/apache/hop/core/reflection/StringSearchResultTest.java index b8bf4bd02de..2c6062f18f8 100644 --- a/engine/src/test/java/org/apache/hop/core/reflection/StringSearchResultTest.java +++ b/engine/src/test/java/org/apache/hop/core/reflection/StringSearchResultTest.java @@ -17,15 +17,15 @@ package org.apache.hop.core.reflection; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.Const; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.i18n.BaseMessages; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class StringSearchResultTest { private Class PKG = Const.class; diff --git a/engine/src/test/java/org/apache/hop/core/reflection/StringSearcherTest.java b/engine/src/test/java/org/apache/hop/core/reflection/StringSearcherTest.java index 4321a8564c0..d3d5ecd999f 100644 --- a/engine/src/test/java/org/apache/hop/core/reflection/StringSearcherTest.java +++ b/engine/src/test/java/org/apache/hop/core/reflection/StringSearcherTest.java @@ -1,90 +1,90 @@ -/* - * 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 org.apache.hop.core.reflection; - -import org.apache.hop.core.HopEnvironment; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.junit.BeforeClass; -import org.junit.ClassRule; - -// import org.apache.hop.pipeline.transforms.filterrows.FilterRowsMeta; - -public class StringSearcherTest { - @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - - @BeforeClass - public static void setUpBeforeClass() throws org.apache.hop.core.exception.HopException { - HopEnvironment.init(); - } - - // TODO: Move Test - /* @Test - public void testSearchConditionCase() { - String dummyTransformName = "Output"; - DummyMeta dummyMeta = new DummyMeta(); - String dummyTransformPid = PluginRegistry.getInstance().getPluginId( TransformPluginType.class, dummyMeta ); - TransformMeta dummyTransform = new TransformMeta( dummyTransformPid, dummyTransformname, dummyMeta ); - - List stringList = new ArrayList(); - StringSearcher.findMetaData( dummyTransform, 0, stringList, dummyMeta, 0 ); - - int checkCount = 0; - String aResult = null; - // Check that it found a couple of fields and emits the values properly - for ( int i = 0; i < stringList.size(); i++ ) { - aResult = stringList.get( i ).toString(); - if ( aResult.endsWith( "Dummy (transformId)" ) ) { - checkCount++; - } else if ( aResult.endsWith( "Output (name)" ) ) { - checkCount++; - } - if ( checkCount == 2 ) { - break; - } - } - assertEquals( 2, checkCount ); - - FilterRowsMeta filterRowsMeta = new FilterRowsMeta(); - Condition condition = new Condition(); - condition.setNegated( false ); - condition.setLeftValuename( "wibble_t" ); - condition.setRightValuename( "wobble_s" ); - condition.setFunction( org.apache.hop.core.Condition.FUNC_EQUAL ); - filterRowsMeta.setDefault(); - filterRowsMeta.setCondition( condition ); - - String filterRowsPluginPid = PluginRegistry.getInstance().getPluginId( TransformPluginType.class, filterRowsMeta ); - TransformMeta filterRowsTransform = new TransformMeta( filterRowsPluginPid, "Filter Rows", filterRowsMeta ); - - stringList.clear(); - StringSearcher.findMetaData( filterRowsTransform, 0, stringList, filterRowsMeta, 0 ); - - checkCount = 0; - for ( int i = 0; i < stringList.size(); i++ ) { - aResult = stringList.get( i ).toString(); - if ( aResult.endsWith( "FilterRows (transformId)" ) ) { - checkCount++; - } else if ( aResult.endsWith( "Filter Rows (name)" ) ) { - checkCount++; - } - if ( checkCount == 2 ) { - break; - } - } - assertEquals( 2, checkCount ); - }*/ -} +/* + * 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 org.apache.hop.core.reflection; + +import org.apache.hop.core.HopEnvironment; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.junit.BeforeClass; +import org.junit.ClassRule; + +// import org.apache.hop.pipeline.transforms.filterrows.FilterRowsMeta; + +public class StringSearcherTest { + @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); + + @BeforeClass + public static void setUpBeforeClass() throws org.apache.hop.core.exception.HopException { + HopEnvironment.init(); + } + + // TODO: Move Test + /* @Test + public void testSearchConditionCase() { + String dummyTransformName = "Output"; + DummyMeta dummyMeta = new DummyMeta(); + String dummyTransformPid = PluginRegistry.getInstance().getPluginId( TransformPluginType.class, dummyMeta ); + TransformMeta dummyTransform = new TransformMeta( dummyTransformPid, dummyTransformname, dummyMeta ); + + List stringList = new ArrayList(); + StringSearcher.findMetaData( dummyTransform, 0, stringList, dummyMeta, 0 ); + + int checkCount = 0; + String aResult = null; + // Check that it found a couple of fields and emits the values properly + for ( int i = 0; i < stringList.size(); i++ ) { + aResult = stringList.get( i ).toString(); + if ( aResult.endsWith( "Dummy (transformId)" ) ) { + checkCount++; + } else if ( aResult.endsWith( "Output (name)" ) ) { + checkCount++; + } + if ( checkCount == 2 ) { + break; + } + } + assertEquals( 2, checkCount ); + + FilterRowsMeta filterRowsMeta = new FilterRowsMeta(); + Condition condition = new Condition(); + condition.setNegated( false ); + condition.setLeftValuename( "wibble_t" ); + condition.setRightValuename( "wobble_s" ); + condition.setFunction( org.apache.hop.core.Condition.FUNC_EQUAL ); + filterRowsMeta.setDefault(); + filterRowsMeta.setCondition( condition ); + + String filterRowsPluginPid = PluginRegistry.getInstance().getPluginId( TransformPluginType.class, filterRowsMeta ); + TransformMeta filterRowsTransform = new TransformMeta( filterRowsPluginPid, "Filter Rows", filterRowsMeta ); + + stringList.clear(); + StringSearcher.findMetaData( filterRowsTransform, 0, stringList, filterRowsMeta, 0 ); + + checkCount = 0; + for ( int i = 0; i < stringList.size(); i++ ) { + aResult = stringList.get( i ).toString(); + if ( aResult.endsWith( "FilterRows (transformId)" ) ) { + checkCount++; + } else if ( aResult.endsWith( "Filter Rows (name)" ) ) { + checkCount++; + } + if ( checkCount == 2 ) { + break; + } + } + assertEquals( 2, checkCount ); + }*/ +} diff --git a/engine/src/test/java/org/apache/hop/core/row/ValueDataUtilTest.java b/engine/src/test/java/org/apache/hop/core/row/ValueDataUtilTest.java index 8e18cdc94ce..2af31e668e0 100644 --- a/engine/src/test/java/org/apache/hop/core/row/ValueDataUtilTest.java +++ b/engine/src/test/java/org/apache/hop/core/row/ValueDataUtilTest.java @@ -17,6 +17,17 @@ package org.apache.hop.core.row; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.Arrays; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -31,18 +42,6 @@ import org.junit.Test; import org.mockito.stubbing.Answer; -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class ValueDataUtilTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); private static String yyyy_MM_dd = "yyyy-MM-dd"; diff --git a/engine/src/test/java/org/apache/hop/core/util/ConfigurableStreamLoggerTest.java b/engine/src/test/java/org/apache/hop/core/util/ConfigurableStreamLoggerTest.java index 10659613ac4..dbdea35aa14 100644 --- a/engine/src/test/java/org/apache/hop/core/util/ConfigurableStreamLoggerTest.java +++ b/engine/src/test/java/org/apache/hop/core/util/ConfigurableStreamLoggerTest.java @@ -17,6 +17,9 @@ package org.apache.hop.core.util; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.logging.LogLevel; @@ -24,10 +27,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - public class ConfigurableStreamLoggerTest { public static String INPUT = "str1\nstr2"; diff --git a/engine/src/test/java/org/apache/hop/core/util/JavaScriptUtilsTest.java b/engine/src/test/java/org/apache/hop/core/util/JavaScriptUtilsTest.java index 85607942a80..ddf3a2e863e 100644 --- a/engine/src/test/java/org/apache/hop/core/util/JavaScriptUtilsTest.java +++ b/engine/src/test/java/org/apache/hop/core/util/JavaScriptUtilsTest.java @@ -17,6 +17,15 @@ package org.apache.hop.core.util; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; + +import java.math.BigDecimal; +import java.util.Date; import org.apache.hop.core.row.IValueMeta; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -27,16 +36,6 @@ import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.Undefined; -import java.math.BigDecimal; -import java.util.Date; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; - /** A set of tests for {@linkplain JavaScriptUtils} class. */ public class JavaScriptUtilsTest { diff --git a/engine/src/test/java/org/apache/hop/execution/ExecutionDataTest.java b/engine/src/test/java/org/apache/hop/execution/ExecutionDataTest.java index acad847c34d..492c0e60e83 100644 --- a/engine/src/test/java/org/apache/hop/execution/ExecutionDataTest.java +++ b/engine/src/test/java/org/apache/hop/execution/ExecutionDataTest.java @@ -18,7 +18,15 @@ package org.apache.hop.execution; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import com.fasterxml.jackson.databind.ObjectMapper; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.json.HopJson; import org.apache.hop.core.row.IRowMeta; @@ -27,15 +35,6 @@ import org.junit.Before; import org.junit.Test; -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class ExecutionDataTest { @Before @@ -105,13 +104,9 @@ public void testSerialization() throws Exception { }, new Object[] {6L, "Nulls", null, null, null, null, null}); - ExecutionDataSetMeta setMeta = new ExecutionDataSetMeta( - "firstRows", - "12345-logchannel-id", - "transformName", - "0", - "First rows of transform" - ); + ExecutionDataSetMeta setMeta = + new ExecutionDataSetMeta( + "firstRows", "12345-logchannel-id", "transformName", "0", "First rows of transform"); ExecutionData data = ExecutionDataBuilder.of() .addDataSets(Map.of("firstRows", new RowBuffer(rowMeta, rows))) diff --git a/engine/src/test/java/org/apache/hop/history/AuditManagerTest.java b/engine/src/test/java/org/apache/hop/history/AuditManagerTest.java index feb60f3b2e7..75b5aefbb2d 100644 --- a/engine/src/test/java/org/apache/hop/history/AuditManagerTest.java +++ b/engine/src/test/java/org/apache/hop/history/AuditManagerTest.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.history.local.LocalAuditManager; import org.junit.Ignore; diff --git a/engine/src/test/java/org/apache/hop/pipeline/DatabaseImpactTest.java b/engine/src/test/java/org/apache/hop/pipeline/DatabaseImpactTest.java index 39d5d1d21d6..01b11e278c1 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/DatabaseImpactTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/DatabaseImpactTest.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IValueMeta; @@ -25,9 +28,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class DatabaseImpactTest { private Class PKG = Pipeline.class; diff --git a/engine/src/test/java/org/apache/hop/pipeline/ModPartitionerTest.java b/engine/src/test/java/org/apache/hop/pipeline/ModPartitionerTest.java index 643d6a300dc..7a2185306d2 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/ModPartitionerTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/ModPartitionerTest.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class ModPartitionerTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/pipeline/PDI_11948_PipelineTest.java b/engine/src/test/java/org/apache/hop/pipeline/PDI_11948_PipelineTest.java index a32d5774fae..85860fe04c9 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/PDI_11948_PipelineTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/PDI_11948_PipelineTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline; -import org.junit.Test; - import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; +import org.junit.Test; + public class PDI_11948_PipelineTest { @Test(expected = IllegalArgumentException.class) diff --git a/engine/src/test/java/org/apache/hop/pipeline/PartitionerLoadSaveTester.java b/engine/src/test/java/org/apache/hop/pipeline/PartitionerLoadSaveTester.java index 56328cec471..02b3b2af005 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/PartitionerLoadSaveTester.java +++ b/engine/src/test/java/org/apache/hop/pipeline/PartitionerLoadSaveTester.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline; -import org.apache.hop.base.LoadSaveBase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; - import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.List; import java.util.Map; +import org.apache.hop.base.LoadSaveBase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.xml.XmlHandler; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; public class PartitionerLoadSaveTester extends LoadSaveBase { @@ -35,7 +34,8 @@ public PartitionerLoadSaveTester( Map getterMap, Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, - Map> fieldLoadSaveValidatorTypeMap) throws HopException { + Map> fieldLoadSaveValidatorTypeMap) + throws HopException { super( clazz, attributes, @@ -45,7 +45,8 @@ public PartitionerLoadSaveTester( fieldLoadSaveValidatorTypeMap); } - public PartitionerLoadSaveTester(Class clazz, List commonAttributes) throws HopException { + public PartitionerLoadSaveTester(Class clazz, List commonAttributes) + throws HopException { super(clazz, commonAttributes); } diff --git a/engine/src/test/java/org/apache/hop/pipeline/PipelineMetaTest.java b/engine/src/test/java/org/apache/hop/pipeline/PipelineMetaTest.java index a5d7320f209..54d6db2b946 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/PipelineMetaTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/PipelineMetaTest.java @@ -29,9 +29,7 @@ import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.any; import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.nullable; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/engine/src/test/java/org/apache/hop/pipeline/PipelineTest.java b/engine/src/test/java/org/apache/hop/pipeline/PipelineTest.java index 3a71f0eeb57..d97a4131baf 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/PipelineTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/PipelineTest.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Collections; +import java.util.concurrent.CountDownLatch; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -35,18 +46,6 @@ import org.mockito.Mock; import org.mockito.Mockito; -import java.util.Collections; -import java.util.concurrent.CountDownLatch; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - public class PipelineTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @Mock private ITransform transformMock, transformMock2; diff --git a/engine/src/test/java/org/apache/hop/pipeline/PipelineTestingUtil.java b/engine/src/test/java/org/apache/hop/pipeline/PipelineTestingUtil.java index c4e1e1dd3c3..c8442009b5e 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/PipelineTestingUtil.java +++ b/engine/src/test/java/org/apache/hop/pipeline/PipelineTestingUtil.java @@ -17,20 +17,19 @@ package org.apache.hop.pipeline; -import org.apache.hop.core.BlockingRowSet; -import org.apache.hop.core.IRowSet; -import org.apache.hop.pipeline.transform.BaseTransform; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.apache.hop.core.BlockingRowSet; +import org.apache.hop.core.IRowSet; +import org.apache.hop.pipeline.transform.BaseTransform; + public class PipelineTestingUtil { public static List execute( diff --git a/engine/src/test/java/org/apache/hop/pipeline/PipelineTransformCollector.java b/engine/src/test/java/org/apache/hop/pipeline/PipelineTransformCollector.java index 7c8fd4891b5..80971c267eb 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/PipelineTransformCollector.java +++ b/engine/src/test/java/org/apache/hop/pipeline/PipelineTransformCollector.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.ArrayList; -import java.util.List; - /** * Helper class for testcases. You can add an instance of this class to a transform to read all of * the Rows the transform read or wrote. diff --git a/engine/src/test/java/org/apache/hop/pipeline/RowProducerTest.java b/engine/src/test/java/org/apache/hop/pipeline/RowProducerTest.java index de0168b3d74..43018cfa8af 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/RowProducerTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/RowProducerTest.java @@ -16,14 +16,6 @@ */ package org.apache.hop.pipeline; -import org.apache.hop.core.IRowSet; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.ITransform; -import org.junit.Before; -import org.junit.Test; - -import java.util.concurrent.TimeUnit; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -34,6 +26,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.util.concurrent.TimeUnit; +import org.apache.hop.core.IRowSet; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.ITransform; +import org.junit.Before; +import org.junit.Test; + public class RowProducerTest { RowProducer rowProducer; diff --git a/engine/src/test/java/org/apache/hop/pipeline/TransformLoadSaveTester.java b/engine/src/test/java/org/apache/hop/pipeline/TransformLoadSaveTester.java index 6fdb636fad4..860c64bbd82 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/TransformLoadSaveTester.java +++ b/engine/src/test/java/org/apache/hop/pipeline/TransformLoadSaveTester.java @@ -17,27 +17,27 @@ package org.apache.hop.pipeline; -import org.apache.hop.base.LoadSaveBase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.hop.pipeline.transform.ITransformMeta; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; - import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.hop.base.LoadSaveBase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.xml.XmlHandler; +import org.apache.hop.pipeline.transform.ITransformMeta; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; public class TransformLoadSaveTester extends LoadSaveBase { public TransformLoadSaveTester( - Class clazz, - List xmlAttributes, - Map getterMap, - Map setterMap, - Map> fieldLoadSaveValidatorAttributeMap, - Map> fieldLoadSaveValidatorTypeMap) throws HopException { + Class clazz, + List xmlAttributes, + Map getterMap, + Map setterMap, + Map> fieldLoadSaveValidatorAttributeMap, + Map> fieldLoadSaveValidatorTypeMap) + throws HopException { super( clazz, xmlAttributes, @@ -51,7 +51,8 @@ public TransformLoadSaveTester(Class clazz) throws HopException { this(clazz, new ArrayList<>()); } - public TransformLoadSaveTester(Class clazz, List commonAttributes) throws HopException { + public TransformLoadSaveTester(Class clazz, List commonAttributes) + throws HopException { super(clazz, commonAttributes); } diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformMetaCloningTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformMetaCloningTest.java index 1ed45e7dffc..3b0bb7ce2a0 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformMetaCloningTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformMetaCloningTest.java @@ -17,13 +17,6 @@ package org.apache.hop.pipeline.transform; -import org.apache.hop.core.database.Database; -import org.apache.hop.pipeline.transform.stream.IStream; -import org.apache.hop.pipeline.transform.stream.Stream; -import org.junit.Test; - -import java.util.List; - import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -33,6 +26,12 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import java.util.List; +import org.apache.hop.core.database.Database; +import org.apache.hop.pipeline.transform.stream.IStream; +import org.apache.hop.pipeline.transform.stream.Stream; +import org.junit.Test; + public class BaseTransformMetaCloningTest { @Test diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformTest.java index a1036c92e41..2e9597c6480 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/BaseTransformTest.java @@ -17,6 +17,25 @@ package org.apache.hop.pipeline.transform; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.anyObject; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.hop.core.BlockingRowSet; import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; @@ -45,26 +64,6 @@ import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.anyObject; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class BaseTransformTest { private TransformMockHelper mockHelper; diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/DynamicWaitTimesTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/DynamicWaitTimesTest.java index 83eb1ed4170..2dc2072799b 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/DynamicWaitTimesTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/DynamicWaitTimesTest.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transform; -import junit.framework.TestCase; -import org.apache.hop.core.BlockingRowSet; -import org.apache.hop.core.IRowSet; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import junit.framework.TestCase; +import org.apache.hop.core.BlockingRowSet; +import org.apache.hop.core.IRowSet; public class DynamicWaitTimesTest extends TestCase { @@ -48,7 +47,7 @@ public void testMultiStreamStatus() { List rowSetList = new ArrayList<>( Arrays.asList(new BlockingRowSet(1), new BlockingRowSet(2), new BlockingRowSet(7))); - status = DynamicWaitTimes.build(rowSetList, () -> activeStreamIndex.get(),20); + status = DynamicWaitTimes.build(rowSetList, () -> activeStreamIndex.get(), 20); for (IRowSet iRowSet : rowSetList) { status.adjust(false, iRowSet); assertEquals(1, status.get()); diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformErrorMetaTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformErrorMetaTest.java index 06216a946c8..9c71c6db871 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformErrorMetaTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformErrorMetaTest.java @@ -17,15 +17,15 @@ package org.apache.hop.pipeline.transform; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.variables.Variables; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class TransformErrorMetaTest { @Test diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformMetaTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformMetaTest.java index c85ebbeae46..8738740ab1e 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformMetaTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformMetaTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transform; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.util.AbstractTransformMeta; import org.apache.hop.core.variables.IVariables; @@ -26,17 +36,6 @@ import org.apache.hop.utils.TestUtils; import org.junit.Test; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class TransformMetaTest { private static final IVariables variables = new Variables(); diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformOptionTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformOptionTest.java index b2baae11d8d..e7d2f9d47dd 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformOptionTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformOptionTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transform; +import static org.apache.hop.i18n.BaseMessages.getString; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.exception.HopException; @@ -28,14 +35,6 @@ import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import java.util.ArrayList; -import java.util.List; - -import static org.apache.hop.i18n.BaseMessages.getString; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class TransformOptionTest { @Mock TransformMeta transformMeta; diff --git a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformStatusTest.java b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformStatusTest.java index 7a613e4cb0f..cc99d262455 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transform/TransformStatusTest.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transform/TransformStatusTest.java @@ -16,10 +16,10 @@ */ package org.apache.hop.pipeline.transform; -import org.junit.Test; - import static org.junit.Assert.assertEquals; +import org.junit.Test; + public class TransformStatusTest { @Test diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/LoadSaveTester.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/LoadSaveTester.java index 23efd2409a9..b634779cda4 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/LoadSaveTester.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/LoadSaveTester.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.loadsave; +import static org.junit.Assert.assertNotSame; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.base.LoadSaveBase; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; @@ -29,15 +37,6 @@ import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidatorFactory; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertNotSame; - public class LoadSaveTester extends LoadSaveBase { public LoadSaveTester( @@ -47,7 +46,8 @@ public LoadSaveTester( Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, Map> fieldLoadSaveValidatorTypeMap, - IInitializer metaInitializerIFace) throws HopException { + IInitializer metaInitializerIFace) + throws HopException { super( clazz, attributes, @@ -64,7 +64,8 @@ public LoadSaveTester( Map getterMap, Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, - Map> fieldLoadSaveValidatorTypeMap) throws HopException { + Map> fieldLoadSaveValidatorTypeMap) + throws HopException { this( clazz, attributes, @@ -75,19 +76,13 @@ public LoadSaveTester( null); } - public LoadSaveTester( Class clazz, List attributes, Map getterMap, - Map setterMap) throws HopException { - this( - clazz, - attributes, - getterMap, - setterMap, - new HashMap<>(), - new HashMap<>()); + Map setterMap) + throws HopException { + this(clazz, attributes, getterMap, setterMap, new HashMap<>(), new HashMap<>()); } public LoadSaveTester(Class clazz, List attributes) throws HopException { @@ -147,7 +142,7 @@ protected void testClone() throws HopException { * @deprecated the {@link #testSerialization()} method should be used instead, as additional tests * may be added in the future to cover other topics related to transform serialization */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") // TODO Change method visibility to protected public void testXmlRoundTrip() throws HopException { T metaToSave = createMeta(); diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/initializer/IInitializer.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/initializer/IInitializer.java index f0b844fd5ca..6f03562bb84 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/initializer/IInitializer.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/initializer/IInitializer.java @@ -28,6 +28,6 @@ public interface IInitializer { * transformMeta, and immediately call setter methods. Commonly, this is used for transforms * that define an allocate method, which pre-populate empty arrays */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") void modify(T object); } diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ArrayLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ArrayLoadSaveValidator.java index 4e60b070df3..1d775e77ee7 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ArrayLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ArrayLoadSaveValidator.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.exception.HopException; - import java.lang.reflect.Array; import java.util.Random; +import org.apache.hop.core.exception.HopException; public class ArrayLoadSaveValidator implements IFieldLoadSaveValidator { private final IFieldLoadSaveValidator validator; diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ConditionLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ConditionLoadSaveValidator.java index ccceae9690d..62826f1aaf7 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ConditionLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ConditionLoadSaveValidator.java @@ -16,11 +16,10 @@ */ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.Condition; -import org.apache.hop.core.exception.HopException; - import java.util.Random; import java.util.UUID; +import org.apache.hop.core.Condition; +import org.apache.hop.core.exception.HopException; public class ConditionLoadSaveValidator implements IFieldLoadSaveValidator { final Random rand = new Random(); diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DatabaseMetaLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DatabaseMetaLoadSaveValidator.java index 1c6dea7fc1e..2d927efa298 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DatabaseMetaLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DatabaseMetaLoadSaveValidator.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.database.DatabaseMeta; - import java.util.Random; import java.util.UUID; +import org.apache.hop.core.database.DatabaseMeta; public class DatabaseMetaLoadSaveValidator implements IFieldLoadSaveValidator { diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DefaultFieldLoadSaveValidatorFactory.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DefaultFieldLoadSaveValidatorFactory.java index da9a519ce0a..2da5f3496c5 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DefaultFieldLoadSaveValidatorFactory.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/DefaultFieldLoadSaveValidatorFactory.java @@ -17,9 +17,6 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; - import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Date; @@ -27,6 +24,8 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; public class DefaultFieldLoadSaveValidatorFactory implements IFieldLoadSaveValidatorFactory { diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/IFieldLoadSaveValidatorFactory.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/IFieldLoadSaveValidatorFactory.java index b8d1efe7b99..e32a18a399e 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/IFieldLoadSaveValidatorFactory.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/IFieldLoadSaveValidatorFactory.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; - import java.lang.reflect.Type; +import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; public interface IFieldLoadSaveValidatorFactory { IFieldLoadSaveValidator createValidator(IGetter getterMethod); diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ListLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ListLoadSaveValidator.java index 13536a0293c..d5e88f2007b 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ListLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ListLoadSaveValidator.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.exception.HopException; - import java.util.ArrayList; import java.util.List; import java.util.Random; +import org.apache.hop.core.exception.HopException; public class ListLoadSaveValidator implements IFieldLoadSaveValidator> { diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/LocaleLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/LocaleLoadSaveValidator.java index dfc44a8b7b1..d701fa3acc7 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/LocaleLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/LocaleLoadSaveValidator.java @@ -16,10 +16,9 @@ */ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.util.Utils; - import java.util.Locale; import java.util.Random; +import org.apache.hop.core.util.Utils; public class LocaleLoadSaveValidator implements IFieldLoadSaveValidator { @Override diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/MapLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/MapLoadSaveValidator.java index 455f40ec591..88f1cbf7286 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/MapLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/MapLoadSaveValidator.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.exception.HopException; - import java.util.LinkedHashMap; import java.util.Map; import java.util.Random; +import org.apache.hop.core.exception.HopException; public class MapLoadSaveValidator implements IFieldLoadSaveValidator> { @@ -57,7 +56,8 @@ public Map getTestObject() { } @Override - public boolean validateTestObject(Map original, Object actual) throws HopException { + public boolean validateTestObject(Map original, Object actual) + throws HopException { if (actual instanceof Map) { Map actualMap = (Map) actual; if (original.size() != actualMap.size()) { diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ObjectValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ObjectValidator.java index abf271c5a4a..fef85d44435 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ObjectValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/ObjectValidator.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; -import org.apache.hop.pipeline.transforms.loadsave.setter.ISetter; -import org.apache.test.util.JavaBeanManipulator; - import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; +import org.apache.hop.pipeline.transforms.loadsave.setter.ISetter; +import org.apache.test.util.JavaBeanManipulator; public class ObjectValidator implements IFieldLoadSaveValidator { private final IFieldLoadSaveValidatorFactory fieldLoadSaveValidatorFactory; diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveBooleanArrayLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveBooleanArrayLoadSaveValidator.java index 1ca2ad4ff1e..cc464907324 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveBooleanArrayLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveBooleanArrayLoadSaveValidator.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.exception.HopException; - import java.util.Random; +import org.apache.hop.core.exception.HopException; public class PrimitiveBooleanArrayLoadSaveValidator implements IFieldLoadSaveValidator { private final IFieldLoadSaveValidator validator; diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntArrayLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntArrayLoadSaveValidator.java index 9dbf7dd5054..b89c1f22f81 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntArrayLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntArrayLoadSaveValidator.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.exception.HopException; - import java.util.Random; +import org.apache.hop.core.exception.HopException; public class PrimitiveIntArrayLoadSaveValidator implements IFieldLoadSaveValidator { private final IFieldLoadSaveValidator validator; diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntegerArrayLoadSaveValidator.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntegerArrayLoadSaveValidator.java index db1ba1b9bff..dcdb8e54b13 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntegerArrayLoadSaveValidator.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/validator/PrimitiveIntegerArrayLoadSaveValidator.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.loadsave.validator; -import org.apache.hop.core.exception.HopException; - import java.util.Random; +import org.apache.hop.core.exception.HopException; public class PrimitiveIntegerArrayLoadSaveValidator implements IFieldLoadSaveValidator { diff --git a/engine/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java b/engine/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java index 30b35da7c0b..82a75ae499a 100644 --- a/engine/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java +++ b/engine/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java @@ -17,6 +17,19 @@ package org.apache.hop.pipeline.transforms.mock; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.hop.core.IRowSet; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -35,20 +48,6 @@ import org.mockito.Mockito; import org.mockito.stubbing.Answer; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class TransformMockHelper { public final TransformMeta transformMeta; public final Data iTransformData; diff --git a/engine/src/test/java/org/apache/hop/server/HopServerTest.java b/engine/src/test/java/org/apache/hop/server/HopServerTest.java index 3c0d3e2bcba..4db14b07a2a 100644 --- a/engine/src/test/java/org/apache/hop/server/HopServerTest.java +++ b/engine/src/test/java/org/apache/hop/server/HopServerTest.java @@ -17,6 +17,28 @@ package org.apache.hop.server; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.nullable; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -47,29 +69,6 @@ import org.junit.Test; import org.mockito.stubbing.Answer; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.nullable; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - /** * Tests for HopServer class * diff --git a/engine/src/test/java/org/apache/hop/utils/FileUtilsTest.java b/engine/src/test/java/org/apache/hop/utils/FileUtilsTest.java index c0a0a6725de..c97388f198f 100644 --- a/engine/src/test/java/org/apache/hop/utils/FileUtilsTest.java +++ b/engine/src/test/java/org/apache/hop/utils/FileUtilsTest.java @@ -17,14 +17,13 @@ package org.apache.hop.utils; +import static org.junit.Assert.assertTrue; + +import java.io.File; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.util.FileUtil; import org.junit.Test; -import java.io.File; - -import static org.junit.Assert.assertTrue; - public class FileUtilsTest { @Test diff --git a/engine/src/test/java/org/apache/hop/utils/TestUtils.java b/engine/src/test/java/org/apache/hop/utils/TestUtils.java index 41823e848eb..0949dc75c42 100644 --- a/engine/src/test/java/org/apache/hop/utils/TestUtils.java +++ b/engine/src/test/java/org/apache/hop/utils/TestUtils.java @@ -17,6 +17,12 @@ package org.apache.hop.utils; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.UUID; import org.apache.commons.io.FileUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -25,19 +31,12 @@ import org.apache.hop.core.variables.Variables; import org.apache.hop.core.vfs.HopVfs; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -import static org.junit.Assert.assertTrue; - public class TestUtils { /** * Do not use this method because it does not delete the temp folder after java process tear down */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") public static String createTempDir() { String ret = null; try { diff --git a/engine/src/test/java/org/apache/hop/workflow/WorkflowMetaTest.java b/engine/src/test/java/org/apache/hop/workflow/WorkflowMetaTest.java index ffffd7f9271..49020d37755 100644 --- a/engine/src/test/java/org/apache/hop/workflow/WorkflowMetaTest.java +++ b/engine/src/test/java/org/apache/hop/workflow/WorkflowMetaTest.java @@ -17,6 +17,19 @@ package org.apache.hop.workflow; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.same; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.net.URISyntaxException; import org.apache.hop.core.Const; import org.apache.hop.core.NotePadMeta; import org.apache.hop.core.exception.HopException; @@ -37,20 +50,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import java.io.IOException; -import java.net.URISyntaxException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.same; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - public class WorkflowMetaTest { private static final String WORKFLOW_META_NAME = "workflowName"; diff --git a/engine/src/test/java/org/apache/hop/workflow/WorkflowTest.java b/engine/src/test/java/org/apache/hop/workflow/WorkflowTest.java index c6709786f4e..157ebffdc59 100644 --- a/engine/src/test/java/org/apache/hop/workflow/WorkflowTest.java +++ b/engine/src/test/java/org/apache/hop/workflow/WorkflowTest.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + import org.apache.hop.core.database.Database; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.variables.IVariables; @@ -28,9 +31,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - public class WorkflowTest { private static final String STRING_DEFAULT = ""; private IWorkflowEngine mockedWorkflow; diff --git a/engine/src/test/java/org/apache/hop/workflow/action/WorkflowActionMetaTest.java b/engine/src/test/java/org/apache/hop/workflow/action/WorkflowActionMetaTest.java index 1b836547ea0..801a5d86f9b 100644 --- a/engine/src/test/java/org/apache/hop/workflow/action/WorkflowActionMetaTest.java +++ b/engine/src/test/java/org/apache/hop/workflow/action/WorkflowActionMetaTest.java @@ -17,16 +17,16 @@ package org.apache.hop.workflow.action; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; + import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.actions.start.ActionStart; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; - public class WorkflowActionMetaTest { private static final String ATTRIBUTE_GROUP = "aGroupName"; diff --git a/engine/src/test/java/org/apache/hop/workflow/action/loadsave/LoadSaveTester.java b/engine/src/test/java/org/apache/hop/workflow/action/loadsave/LoadSaveTester.java index 2bc0e1e55a6..bfb26afe7a8 100644 --- a/engine/src/test/java/org/apache/hop/workflow/action/loadsave/LoadSaveTester.java +++ b/engine/src/test/java/org/apache/hop/workflow/action/loadsave/LoadSaveTester.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.action.loadsave; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.base.LoadSaveBase; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; @@ -26,12 +31,6 @@ import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.apache.hop.workflow.action.IAction; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class LoadSaveTester extends LoadSaveBase { public LoadSaveTester( @@ -41,7 +40,8 @@ public LoadSaveTester( Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, Map> fieldLoadSaveValidatorTypeMap, - ActionInitializer actionInitializer) throws HopException { + ActionInitializer actionInitializer) + throws HopException { super( clazz, attributes, @@ -57,7 +57,8 @@ public LoadSaveTester( Map getterMap, Map setterMap, Map> fieldLoadSaveValidatorAttributeMap, - Map> fieldLoadSaveValidatorTypeMap) throws HopException { + Map> fieldLoadSaveValidatorTypeMap) + throws HopException { this( clazz, attributes, @@ -72,14 +73,9 @@ public LoadSaveTester( Class clazz, List attributes, Map getterMap, - Map setterMap) throws HopException { - this( - clazz, - attributes, - getterMap, - setterMap, - new HashMap<>(), - new HashMap<>()); + Map setterMap) + throws HopException { + this(clazz, attributes, getterMap, setterMap, new HashMap<>(), new HashMap<>()); } @Override diff --git a/engine/src/test/java/org/apache/hop/workflow/action/loadsave/WorkflowActionLoadSaveTestSupport.java b/engine/src/test/java/org/apache/hop/workflow/action/loadsave/WorkflowActionLoadSaveTestSupport.java index 6c924c01e25..9e71a69f6b5 100644 --- a/engine/src/test/java/org/apache/hop/workflow/action/loadsave/WorkflowActionLoadSaveTestSupport.java +++ b/engine/src/test/java/org/apache/hop/workflow/action/loadsave/WorkflowActionLoadSaveTestSupport.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.action.loadsave; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -25,11 +29,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public abstract class WorkflowActionLoadSaveTestSupport { protected LoadSaveTester tester; @@ -49,12 +48,7 @@ public void setUp() throws Exception { tester = new LoadSaveTester<>( - getActionClass(), - attributes, - getters, - setters, - attributeValidators, - typeValidators); + getActionClass(), attributes, getters, setters, attributeValidators, typeValidators); } @Test diff --git a/engine/src/test/java/org/apache/hop/www/BaseHopServerPluginTest.java b/engine/src/test/java/org/apache/hop/www/BaseHopServerPluginTest.java index 01573b87180..e6a56572389 100644 --- a/engine/src/test/java/org/apache/hop/www/BaseHopServerPluginTest.java +++ b/engine/src/test/java/org/apache/hop/www/BaseHopServerPluginTest.java @@ -17,21 +17,6 @@ package org.apache.hop.www; -import com.google.common.collect.ImmutableList; -import org.apache.hop.core.logging.ILogChannel; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; @@ -40,6 +25,20 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.google.common.collect.ImmutableList; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.hop.core.logging.ILogChannel; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; + public class BaseHopServerPluginTest { HttpServletRequest req = mock(HttpServletRequest.class); diff --git a/engine/src/test/java/org/apache/hop/www/GetPipelineStatusServletTest.java b/engine/src/test/java/org/apache/hop/www/GetPipelineStatusServletTest.java index 0d285f765e9..6e2e0005d10 100644 --- a/engine/src/test/java/org/apache/hop/www/GetPipelineStatusServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/GetPipelineStatusServletTest.java @@ -17,6 +17,19 @@ package org.apache.hop.www; +import static org.junit.Assert.assertFalse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -30,20 +43,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static org.junit.Assert.assertFalse; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class GetPipelineStatusServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/GetRootServletTest.java b/engine/src/test/java/org/apache/hop/www/GetRootServletTest.java index b1caa756df2..73c05b0178f 100644 --- a/engine/src/test/java/org/apache/hop/www/GetRootServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/GetRootServletTest.java @@ -17,16 +17,15 @@ package org.apache.hop.www; -import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import org.junit.Test; /** * Tests for GetRootServlet class diff --git a/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java b/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java index 731cab84f21..a7b1356fd63 100644 --- a/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static org.junit.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -25,19 +37,6 @@ import org.junit.Before; import org.junit.Test; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static org.junit.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class GetStatusServletTest { private PipelineMap mockPipelineMap; private WorkflowMap mockWorkflowMap; diff --git a/engine/src/test/java/org/apache/hop/www/GetWorkflowStatusServletTest.java b/engine/src/test/java/org/apache/hop/www/GetWorkflowStatusServletTest.java index 050b1b45ebc..664f4d72645 100644 --- a/engine/src/test/java/org/apache/hop/www/GetWorkflowStatusServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/GetWorkflowStatusServletTest.java @@ -17,6 +17,21 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -32,22 +47,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class GetWorkflowStatusServletTest { private WorkflowMap mockWorkflowMap; diff --git a/engine/src/test/java/org/apache/hop/www/HopServerConfigTest.java b/engine/src/test/java/org/apache/hop/www/HopServerConfigTest.java index 4e69814e096..36249d911de 100644 --- a/engine/src/test/java/org/apache/hop/www/HopServerConfigTest.java +++ b/engine/src/test/java/org/apache/hop/www/HopServerConfigTest.java @@ -16,6 +16,15 @@ */ package org.apache.hop.www; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.xml.XmlHandler; @@ -25,16 +34,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class HopServerConfigTest { public static final String XML_TAG_HOP_SERVER_CONFIG = "hop-server-config"; diff --git a/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusLoadSaveTester.java b/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusLoadSaveTester.java index 4b65c9673bd..9d857ef02f2 100644 --- a/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusLoadSaveTester.java +++ b/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusLoadSaveTester.java @@ -17,13 +17,12 @@ package org.apache.hop.www; -import org.apache.hop.base.LoadSaveBase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; - import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.base.LoadSaveBase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; public class HopServerPipelineStatusLoadSaveTester extends LoadSaveBase { @@ -35,7 +34,8 @@ public HopServerPipelineStatusLoadSaveTester( public HopServerPipelineStatusLoadSaveTester( Class clazz, List attributes, - Map> fieldLoadSaveValidatorAttributeMap) throws HopException { + Map> fieldLoadSaveValidatorAttributeMap) + throws HopException { super( clazz, attributes, diff --git a/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusTest.java b/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusTest.java index 251d0d3d1a2..6117a5eb7e7 100644 --- a/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusTest.java +++ b/engine/src/test/java/org/apache/hop/www/HopServerPipelineStatusTest.java @@ -17,6 +17,16 @@ package org.apache.hop.www; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.hop.core.Result; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; @@ -32,17 +42,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class HopServerPipelineStatusTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/www/HopServerTest.java b/engine/src/test/java/org/apache/hop/www/HopServerTest.java index 41f673dfe98..c0954438255 100644 --- a/engine/src/test/java/org/apache/hop/www/HopServerTest.java +++ b/engine/src/test/java/org/apache/hop/www/HopServerTest.java @@ -16,6 +16,17 @@ */ package org.apache.hop.www; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.powermock.api.mockito.PowerMockito.mockStatic; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; @@ -26,18 +37,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.powermock.api.mockito.PowerMockito.mockStatic; - @RunWith(PowerMockRunner.class) @PrepareForTest(Client.class) public class HopServerTest { diff --git a/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusLoadSaveTester.java b/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusLoadSaveTester.java index d9856276c5d..84bdd18b0e7 100644 --- a/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusLoadSaveTester.java +++ b/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusLoadSaveTester.java @@ -17,13 +17,12 @@ package org.apache.hop.www; -import org.apache.hop.base.LoadSaveBase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; - import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.base.LoadSaveBase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; public class HopServerWorkflowStatusLoadSaveTester extends LoadSaveBase { @@ -35,7 +34,8 @@ public HopServerWorkflowStatusLoadSaveTester( public HopServerWorkflowStatusLoadSaveTester( Class clazz, List attributes, - Map> fieldLoadSaveValidatorAttributeMap) throws HopException { + Map> fieldLoadSaveValidatorAttributeMap) + throws HopException { super( clazz, attributes, diff --git a/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusTest.java b/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusTest.java index b3cb06601bf..2f1e6ad2e65 100644 --- a/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusTest.java +++ b/engine/src/test/java/org/apache/hop/www/HopServerWorkflowStatusTest.java @@ -17,6 +17,16 @@ package org.apache.hop.www; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.util.Utils; @@ -30,17 +40,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class HopServerWorkflowStatusTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/hop/www/PausePipelineServletTest.java b/engine/src/test/java/org/apache/hop/www/PausePipelineServletTest.java index 29f6b5ed157..84b185addea 100644 --- a/engine/src/test/java/org/apache/hop/www/PausePipelineServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/PausePipelineServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -30,19 +42,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class PausePipelineServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/PrepareExecutionPipelineServletTest.java b/engine/src/test/java/org/apache/hop/www/PrepareExecutionPipelineServletTest.java index cf1447e2187..5dac398807f 100644 --- a/engine/src/test/java/org/apache/hop/www/PrepareExecutionPipelineServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/PrepareExecutionPipelineServletTest.java @@ -16,6 +16,18 @@ */ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -31,19 +43,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class PrepareExecutionPipelineServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/RemovePipelineServletTest.java b/engine/src/test/java/org/apache/hop/www/RemovePipelineServletTest.java index d7799206122..b66635b4450 100644 --- a/engine/src/test/java/org/apache/hop/www/RemovePipelineServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/RemovePipelineServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -30,19 +42,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class RemovePipelineServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/RemoveWorkflowServletTest.java b/engine/src/test/java/org/apache/hop/www/RemoveWorkflowServletTest.java index d711a575290..501df9c3055 100644 --- a/engine/src/test/java/org/apache/hop/www/RemoveWorkflowServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/RemoveWorkflowServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -31,19 +43,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class RemoveWorkflowServletTest { private WorkflowMap mockWorkflowMap; diff --git a/engine/src/test/java/org/apache/hop/www/ServletTestUtils.java b/engine/src/test/java/org/apache/hop/www/ServletTestUtils.java index fcd5bf7947a..dc57ef60603 100644 --- a/engine/src/test/java/org/apache/hop/www/ServletTestUtils.java +++ b/engine/src/test/java/org/apache/hop/www/ServletTestUtils.java @@ -17,10 +17,9 @@ package org.apache.hop.www; -import org.apache.commons.lang.StringUtils; - import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.lang.StringUtils; public class ServletTestUtils { public static final char[] BAD_CHARACTERS_TO_ESCAPE = {'<', '>', '\'', '\"'}; diff --git a/engine/src/test/java/org/apache/hop/www/SniffTransformServletTest.java b/engine/src/test/java/org/apache/hop/www/SniffTransformServletTest.java index a729b3aacc5..21a80f8ad2c 100644 --- a/engine/src/test/java/org/apache/hop/www/SniffTransformServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/SniffTransformServletTest.java @@ -17,6 +17,20 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -31,21 +45,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class SniffTransformServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/StartExecutionPipelineServletTest.java b/engine/src/test/java/org/apache/hop/www/StartExecutionPipelineServletTest.java index 2ab1ef64b90..2a41c948d2b 100644 --- a/engine/src/test/java/org/apache/hop/www/StartExecutionPipelineServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/StartExecutionPipelineServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -30,19 +42,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class StartExecutionPipelineServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/StartPipelineServletTest.java b/engine/src/test/java/org/apache/hop/www/StartPipelineServletTest.java index 6178d8232b6..3432db1b1a1 100644 --- a/engine/src/test/java/org/apache/hop/www/StartPipelineServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/StartPipelineServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -30,19 +42,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class StartPipelineServletTest { private PipelineMap mockPipelineMap; diff --git a/engine/src/test/java/org/apache/hop/www/StartWorkflowServletTest.java b/engine/src/test/java/org/apache/hop/www/StartWorkflowServletTest.java index b60483f293c..ecfb12895e7 100644 --- a/engine/src/test/java/org/apache/hop/www/StartWorkflowServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/StartWorkflowServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -31,19 +43,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class StartWorkflowServletTest { private WorkflowMap mockWorkflowMap; diff --git a/engine/src/test/java/org/apache/hop/www/StopWorkflowServletTest.java b/engine/src/test/java/org/apache/hop/www/StopWorkflowServletTest.java index c65c8616d60..d4e53393906 100644 --- a/engine/src/test/java/org/apache/hop/www/StopWorkflowServletTest.java +++ b/engine/src/test/java/org/apache/hop/www/StopWorkflowServletTest.java @@ -17,6 +17,18 @@ package org.apache.hop.www; +import static junit.framework.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -31,19 +43,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import static junit.framework.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) public class StopWorkflowServletTest { private WorkflowMap mockWorkflowMap; diff --git a/engine/src/test/java/org/apache/hop/www/WebResultTest.java b/engine/src/test/java/org/apache/hop/www/WebResultTest.java index c5bd20692dd..fb426f6c0eb 100644 --- a/engine/src/test/java/org/apache/hop/www/WebResultTest.java +++ b/engine/src/test/java/org/apache/hop/www/WebResultTest.java @@ -17,16 +17,15 @@ package org.apache.hop.www; -import org.apache.hop.core.exception.HopXmlException; -import org.junit.Test; - -import java.util.UUID; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; +import java.util.UUID; +import org.apache.hop.core.exception.HopXmlException; +import org.junit.Test; + public class WebResultTest { @Test diff --git a/engine/src/test/java/org/apache/hop/www/WebServerTest.java b/engine/src/test/java/org/apache/hop/www/WebServerTest.java index 1d246638f5f..8dcd368021e 100644 --- a/engine/src/test/java/org/apache/hop/www/WebServerTest.java +++ b/engine/src/test/java/org/apache/hop/www/WebServerTest.java @@ -16,6 +16,13 @@ */ package org.apache.hop.www; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -29,14 +36,6 @@ import org.junit.Ignore; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @Ignore // TODO replace by integration tests public class WebServerTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/engine/src/test/java/org/apache/test/util/GetterSetterTester.java b/engine/src/test/java/org/apache/test/util/GetterSetterTester.java index 0f8fbe14cd9..b310346591e 100644 --- a/engine/src/test/java/org/apache/test/util/GetterSetterTester.java +++ b/engine/src/test/java/org/apache/test/util/GetterSetterTester.java @@ -17,12 +17,11 @@ package org.apache.test.util; -import org.apache.hop.pipeline.transforms.loadsave.setter.ISetter; - import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import org.apache.hop.pipeline.transforms.loadsave.setter.ISetter; public class GetterSetterTester { private final Map> objectTesterMap; diff --git a/engine/src/test/java/org/apache/test/util/JavaBeanManipulator.java b/engine/src/test/java/org/apache/test/util/JavaBeanManipulator.java index 144efe5a39d..71350a46eee 100644 --- a/engine/src/test/java/org/apache/test/util/JavaBeanManipulator.java +++ b/engine/src/test/java/org/apache/test/util/JavaBeanManipulator.java @@ -17,6 +17,9 @@ package org.apache.test.util; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.pipeline.transforms.loadsave.getter.FieldGetter; import org.apache.hop.pipeline.transforms.loadsave.getter.IGetter; import org.apache.hop.pipeline.transforms.loadsave.getter.MethodGetter; @@ -24,10 +27,6 @@ import org.apache.hop.pipeline.transforms.loadsave.setter.ISetter; import org.apache.hop.pipeline.transforms.loadsave.setter.MethodSetter; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class JavaBeanManipulator { private final Class clazz; private final Map getterMap; diff --git a/engine/src/test/java/org/apache/test/util/ObjectTesterBuilder.java b/engine/src/test/java/org/apache/test/util/ObjectTesterBuilder.java index 531271c9d63..8b60c9c92c1 100644 --- a/engine/src/test/java/org/apache/test/util/ObjectTesterBuilder.java +++ b/engine/src/test/java/org/apache/test/util/ObjectTesterBuilder.java @@ -17,14 +17,13 @@ package org.apache.test.util; +import java.util.ArrayList; +import java.util.Collection; import org.apache.test.util.impl.CollectionObjectProvider; import org.apache.test.util.impl.DefaultObjectTester; import org.apache.test.util.impl.DotEqualsValidator; import org.apache.test.util.impl.EqualsEqualsValidator; -import java.util.ArrayList; -import java.util.Collection; - public class ObjectTesterBuilder { private Collection objects; diff --git a/engine/src/test/java/org/apache/test/util/SingleThreadedExecutionGuarder.java b/engine/src/test/java/org/apache/test/util/SingleThreadedExecutionGuarder.java index 4d565264199..2e8d2db4c4f 100644 --- a/engine/src/test/java/org/apache/test/util/SingleThreadedExecutionGuarder.java +++ b/engine/src/test/java/org/apache/test/util/SingleThreadedExecutionGuarder.java @@ -17,6 +17,8 @@ package org.apache.test.util; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -32,8 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertNotNull; - /** * This is a base class for creating guard tests, that check a transform cannot be executed in the * single-threaded mode diff --git a/engine/src/test/java/org/apache/test/util/XXEUtils.java b/engine/src/test/java/org/apache/test/util/XXEUtils.java index c2ac6a30532..75ca8b1cf9d 100644 --- a/engine/src/test/java/org/apache/test/util/XXEUtils.java +++ b/engine/src/test/java/org/apache/test/util/XXEUtils.java @@ -17,7 +17,9 @@ package org.apache.test.util; public class XXEUtils { - /** @see */ + /** + * @see + */ public static final String MALICIOUS_XML = "\n" + " implements IObjectProvider { private final Collection objects; diff --git a/engine/src/test/java/org/apache/test/util/impl/DefaultObjectTester.java b/engine/src/test/java/org/apache/test/util/impl/DefaultObjectTester.java index 25fd8d751cc..5b44a16eea1 100644 --- a/engine/src/test/java/org/apache/test/util/impl/DefaultObjectTester.java +++ b/engine/src/test/java/org/apache/test/util/impl/DefaultObjectTester.java @@ -17,12 +17,11 @@ package org.apache.test.util.impl; +import java.util.Collection; import org.apache.test.util.IObjectProvider; import org.apache.test.util.IObjectTester; import org.apache.test.util.IObjectValidator; -import java.util.Collection; - public class DefaultObjectTester implements IObjectTester { private final IObjectProvider provider; private final IObjectValidator validator; diff --git a/engine/src/test/java/org/apache/test/util/impl/DotEqualsValidator.java b/engine/src/test/java/org/apache/test/util/impl/DotEqualsValidator.java index 15d5688fa18..8fdbcc5723b 100644 --- a/engine/src/test/java/org/apache/test/util/impl/DotEqualsValidator.java +++ b/engine/src/test/java/org/apache/test/util/impl/DotEqualsValidator.java @@ -17,10 +17,10 @@ package org.apache.test.util.impl; -import org.apache.test.util.IObjectValidator; - import static org.junit.Assert.assertEquals; +import org.apache.test.util.IObjectValidator; + public class DotEqualsValidator implements IObjectValidator { @Override diff --git a/engine/src/test/java/org/apache/test/util/impl/EqualsEqualsValidator.java b/engine/src/test/java/org/apache/test/util/impl/EqualsEqualsValidator.java index d83b3de2169..68837655045 100644 --- a/engine/src/test/java/org/apache/test/util/impl/EqualsEqualsValidator.java +++ b/engine/src/test/java/org/apache/test/util/impl/EqualsEqualsValidator.java @@ -17,10 +17,10 @@ package org.apache.test.util.impl; -import org.apache.test.util.IObjectValidator; - import static org.junit.Assert.assertTrue; +import org.apache.test.util.IObjectValidator; + public class EqualsEqualsValidator implements IObjectValidator { @Override diff --git a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java index 77cd023a75a..e90e0d6bc40 100644 --- a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java +++ b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.abort; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -29,8 +30,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.action.validator.ActionValidatorUtils; -import java.util.List; - /** Action type to abort a workflow. */ @Action( id = "ABORT", diff --git a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java index eecf6bd38e2..9569ef4b05b 100644 --- a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java +++ b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java @@ -43,7 +43,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; - /** This dialog allows you to edit a Action Abort object. */ public class ActionAbortDialog extends ActionDialog implements IActionDialog { private static final Class PKG = ActionAbortDialog.class; // For Translator @@ -151,8 +150,7 @@ public IAction open() { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, (Event e) -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, 0, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, 0, null); getData(); diff --git a/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java b/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java index 01977fc9c8c..7966c62cedb 100644 --- a/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java +++ b/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.abort; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionAbortLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/ActionAddResultFilenames.java b/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/ActionAddResultFilenames.java index 5f8018efdb8..2cb51924491 100644 --- a/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/ActionAddResultFilenames.java +++ b/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/ActionAddResultFilenames.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.addresultfilenames; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; @@ -42,12 +47,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'add result filenames' action. */ @Action( id = "ADD_RESULT_FILENAMES", diff --git a/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/Argument.java b/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/Argument.java index e1e82afec37..bdf6b262cc5 100644 --- a/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/Argument.java +++ b/plugins/actions/addresultfilenames/src/main/java/org/apache/hop/workflow/actions/addresultfilenames/Argument.java @@ -43,7 +43,9 @@ public String getArgument() { return argument; } - /** @param argument The argument to set */ + /** + * @param argument The argument to set + */ public void setArgument(String argument) { this.argument = argument; } @@ -57,7 +59,9 @@ public String getMask() { return mask; } - /** @param mask The mask to set */ + /** + * @param mask The mask to set + */ public void setMask(String mask) { this.mask = mask; } diff --git a/plugins/actions/addresultfilenames/src/test/java/org/apache/hop/workflow/actions/addresultfilenames/WorkflowActionAddResultFilenamesLoadSaveTest.java b/plugins/actions/addresultfilenames/src/test/java/org/apache/hop/workflow/actions/addresultfilenames/WorkflowActionAddResultFilenamesLoadSaveTest.java index 5f2ff18bf82..20194003fb3 100644 --- a/plugins/actions/addresultfilenames/src/test/java/org/apache/hop/workflow/actions/addresultfilenames/WorkflowActionAddResultFilenamesLoadSaveTest.java +++ b/plugins/actions/addresultfilenames/src/test/java/org/apache/hop/workflow/actions/addresultfilenames/WorkflowActionAddResultFilenamesLoadSaveTest.java @@ -17,6 +17,7 @@ */ package org.apache.hop.workflow.actions.addresultfilenames; +import java.util.UUID; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.ListLoadSaveValidator; @@ -24,8 +25,6 @@ import org.junit.Before; import org.junit.ClassRule; -import java.util.UUID; - public class WorkflowActionAddResultFilenamesLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/as400command/src/main/java/org/apache/hop/workflow/actions/as400command/ActionAs400Command.java b/plugins/actions/as400command/src/main/java/org/apache/hop/workflow/actions/as400command/ActionAs400Command.java index a061668fb28..10e4f583f31 100644 --- a/plugins/actions/as400command/src/main/java/org/apache/hop/workflow/actions/as400command/ActionAs400Command.java +++ b/plugins/actions/as400command/src/main/java/org/apache/hop/workflow/actions/as400command/ActionAs400Command.java @@ -20,6 +20,7 @@ import com.ibm.as400.access.AS400; import com.ibm.as400.access.AS400Message; import com.ibm.as400.access.CommandCall; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -38,8 +39,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.List; - /** Action for executing a AS/400 CL Commands. */ @Action( id = "AS400Command", diff --git a/plugins/actions/as400command/src/test/java/org/apache/hop/workflow/actions/as400command/ActionAs400CommandLoadSaveTest.java b/plugins/actions/as400command/src/test/java/org/apache/hop/workflow/actions/as400command/ActionAs400CommandLoadSaveTest.java index b1555dbf7ce..758acc81bd4 100644 --- a/plugins/actions/as400command/src/test/java/org/apache/hop/workflow/actions/as400command/ActionAs400CommandLoadSaveTest.java +++ b/plugins/actions/as400command/src/test/java/org/apache/hop/workflow/actions/as400command/ActionAs400CommandLoadSaveTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.as400command; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class ActionAs400CommandLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnections.java b/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnections.java index 439114e3c58..d8f72a88594 100644 --- a/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnections.java +++ b/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnections.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.checkdbconnection; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -38,9 +40,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.ArrayList; -import java.util.List; - /** This check db connections */ @Action( id = "CHECK_DB_CONNECTIONS", diff --git a/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsDialog.java b/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsDialog.java index ca22b494e4b..5d8548bba6b 100644 --- a/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsDialog.java +++ b/plugins/actions/checkdbconnection/src/main/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.checkdbconnection; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.util.Utils; @@ -48,8 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - /** This dialog allows you to edit the check database connection action settings. */ public class ActionCheckDbConnectionsDialog extends ActionDialog implements IActionDialog { private static final Class PKG = ActionCheckDbConnectionsDialog.class; // For Translator diff --git a/plugins/actions/checkdbconnection/src/test/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsTest.java b/plugins/actions/checkdbconnection/src/test/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsTest.java index e2caa954a8c..6c1238487f5 100644 --- a/plugins/actions/checkdbconnection/src/test/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsTest.java +++ b/plugins/actions/checkdbconnection/src/test/java/org/apache/hop/workflow/actions/checkdbconnection/ActionCheckDbConnectionsTest.java @@ -18,15 +18,15 @@ package org.apache.hop.workflow.actions.checkdbconnection; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; import org.apache.hop.workflow.action.ActionSerializationTestUtil; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class ActionCheckDbConnectionsTest { @Test diff --git a/plugins/actions/checkfilelocked/src/main/java/org/apache/hop/workflow/actions/checkfilelocked/LockFile.java b/plugins/actions/checkfilelocked/src/main/java/org/apache/hop/workflow/actions/checkfilelocked/LockFile.java index 30d3e97ba41..bd52f010863 100644 --- a/plugins/actions/checkfilelocked/src/main/java/org/apache/hop/workflow/actions/checkfilelocked/LockFile.java +++ b/plugins/actions/checkfilelocked/src/main/java/org/apache/hop/workflow/actions/checkfilelocked/LockFile.java @@ -25,6 +25,7 @@ public class LockFile { /** name of file to check */ private String filename; + /** lock indicator */ private boolean locked; diff --git a/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExist.java b/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExist.java index 49b3da8b765..92a17ba722d 100644 --- a/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExist.java +++ b/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExist.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.columnsexist; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -37,9 +39,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.ArrayList; -import java.util.List; - /** This defines a column exists action. */ @Action( id = "COLUMNS_EXIST", diff --git a/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistDialog.java b/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistDialog.java index c4ed93af424..5852e453078 100644 --- a/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistDialog.java +++ b/plugins/actions/columnsexist/src/main/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.columnsexist; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; @@ -56,8 +58,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; /** * This dialog allows you to edit the Column Exists action settings. (select the connection and the @@ -315,7 +315,7 @@ public void getData() { if (action.getColumns() != null) { for (int i = 0; i < action.getColumns().size(); i++) { - ColumnExist column = action.getColumns().get(i); + ColumnExist column = action.getColumns().get(i); TableItem ti = wFields.table.getItem(i); ti.setText(1, column.getName()); } @@ -341,14 +341,14 @@ private void ok() { mb.open(); return; } - + action.setName(wName.getText()); action.setDatabaseMeta(wConnection.loadSelectedElement()); action.setTableName(wTablename.getText()); action.setSchemaName(wSchemaname.getText()); List columns = new ArrayList<>(); - + int nrItems = wFields.nrNonEmpty(); for (int i = 0; i < nrItems; i++) { String name = wFields.getNonEmpty(i).getText(1); @@ -405,7 +405,7 @@ private void getSchemaNames() { return; } DatabaseMeta databaseMeta = wConnection.loadSelectedElement(); - if (databaseMeta != null) { + if (databaseMeta != null) { try (Database database = new Database(loggingObject, variables, databaseMeta)) { database.connect(); String[] schemas = database.getSchemas(); diff --git a/plugins/actions/columnsexist/src/test/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistTest.java b/plugins/actions/columnsexist/src/test/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistTest.java index c4e75503e77..601323ffdf5 100644 --- a/plugins/actions/columnsexist/src/test/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistTest.java +++ b/plugins/actions/columnsexist/src/test/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistTest.java @@ -18,6 +18,7 @@ package org.apache.hop.workflow.actions.columnsexist; import static org.junit.Assert.assertEquals; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; @@ -26,7 +27,7 @@ /** Unit tests for column exist action. */ public class ActionColumnsExistTest { - + @Test public void testSerialization() throws Exception { HopClientEnvironment.init(); diff --git a/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFiles.java b/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFiles.java index 9a8b26f11a8..2ce6c890f54 100644 --- a/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFiles.java +++ b/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFiles.java @@ -17,6 +17,16 @@ package org.apache.hop.workflow.actions.copyfiles; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileFilterSelector; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; @@ -50,17 +60,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'copy files' action. */ @Action( id = "COPY_FILES", @@ -1239,7 +1238,9 @@ public boolean isCopyEmptyFolders() { return copyEmptyFolders; } - /** @param copyEmptyFolders The copyEmptyFolders to set */ + /** + * @param copyEmptyFolders The copyEmptyFolders to set + */ public void setCopyEmptyFolders(boolean copyEmptyFolders) { this.copyEmptyFolders = copyEmptyFolders; } @@ -1253,7 +1254,9 @@ public boolean isArgFromPrevious() { return argFromPrevious; } - /** @param argFromPrevious The argFromPrevious to set */ + /** + * @param argFromPrevious The argFromPrevious to set + */ public void setArgFromPrevious(boolean argFromPrevious) { this.argFromPrevious = argFromPrevious; } @@ -1267,7 +1270,9 @@ public boolean isOverwriteFiles() { return overwriteFiles; } - /** @param overwriteFiles The overwriteFiles to set */ + /** + * @param overwriteFiles The overwriteFiles to set + */ public void setOverwriteFiles(boolean overwriteFiles) { this.overwriteFiles = overwriteFiles; } @@ -1281,7 +1286,9 @@ public boolean isIncludeSubFolders() { return includeSubFolders; } - /** @param includeSubFolders The includeSubFolders to set */ + /** + * @param includeSubFolders The includeSubFolders to set + */ public void setIncludeSubFolders(boolean includeSubFolders) { this.includeSubFolders = includeSubFolders; } @@ -1295,7 +1302,9 @@ public boolean isAddResultFilenames() { return addResultFilenames; } - /** @param addResultFilenames The addResultFilenames to set */ + /** + * @param addResultFilenames The addResultFilenames to set + */ public void setAddResultFilenames(boolean addResultFilenames) { this.addResultFilenames = addResultFilenames; } @@ -1309,7 +1318,9 @@ public boolean isRemoveSourceFiles() { return removeSourceFiles; } - /** @param removeSourceFiles The removeSourceFiles to set */ + /** + * @param removeSourceFiles The removeSourceFiles to set + */ public void setRemoveSourceFiles(boolean removeSourceFiles) { this.removeSourceFiles = removeSourceFiles; } @@ -1323,7 +1334,9 @@ public boolean isDestinationIsAFile() { return destinationIsAFile; } - /** @param destinationIsAFile The destinationIsAFile to set */ + /** + * @param destinationIsAFile The destinationIsAFile to set + */ public void setDestinationIsAFile(boolean destinationIsAFile) { this.destinationIsAFile = destinationIsAFile; } @@ -1337,7 +1350,9 @@ public boolean isCreateDestinationFolder() { return createDestinationFolder; } - /** @param createDestinationFolder The createDestinationFolder to set */ + /** + * @param createDestinationFolder The createDestinationFolder to set + */ public void setCreateDestinationFolder(boolean createDestinationFolder) { this.createDestinationFolder = createDestinationFolder; } @@ -1351,7 +1366,9 @@ public String[] getSourceFileFolder() { return sourceFileFolder; } - /** @param sourceFileFolder The sourceFileFolder to set */ + /** + * @param sourceFileFolder The sourceFileFolder to set + */ public void setSourceFileFolder(String[] sourceFileFolder) { this.sourceFileFolder = sourceFileFolder; } @@ -1365,7 +1382,9 @@ public String[] getDestinationFileFolder() { return destinationFileFolder; } - /** @param destinationFileFolder The destinationFileFolder to set */ + /** + * @param destinationFileFolder The destinationFileFolder to set + */ public void setDestinationFileFolder(String[] destinationFileFolder) { this.destinationFileFolder = destinationFileFolder; } @@ -1379,7 +1398,9 @@ public String[] getWildcard() { return wildcard; } - /** @param wildcard The wildcard to set */ + /** + * @param wildcard The wildcard to set + */ public void setWildcard(String[] wildcard) { this.wildcard = wildcard; } @@ -1393,7 +1414,9 @@ public HashSet getListFilesRemove() { return listFilesRemove; } - /** @param listFilesRemove The listFilesRemove to set */ + /** + * @param listFilesRemove The listFilesRemove to set + */ public void setListFilesRemove(HashSet listFilesRemove) { this.listFilesRemove = listFilesRemove; } @@ -1407,7 +1430,9 @@ public HashSet getListAddResult() { return listAddResult; } - /** @param listAddResult The listAddResult to set */ + /** + * @param listAddResult The listAddResult to set + */ public void setListAddResult(HashSet listAddResult) { this.listAddResult = listAddResult; } @@ -1421,7 +1446,9 @@ public int getNbrFail() { return nbrFail; } - /** @param nbrFail The nbrFail to set */ + /** + * @param nbrFail The nbrFail to set + */ public void setNbrFail(int nbrFail) { this.nbrFail = nbrFail; } diff --git a/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFilesDialog.java b/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFilesDialog.java index 85995b7b62e..846bbdf5803 100644 --- a/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFilesDialog.java +++ b/plugins/actions/copyfiles/src/main/java/org/apache/hop/workflow/actions/copyfiles/ActionCopyFilesDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.copyfiles; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.Props; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -53,9 +55,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.util.HashMap; -import java.util.Map; - /** This dialog allows you to edit the Copy Files action settings. */ public class ActionCopyFilesDialog extends ActionDialog implements IActionDialog { private static final Class PKG = ActionCopyFiles.class; // For Translator diff --git a/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesLoadSaveTest.java b/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesLoadSaveTest.java index 4a7ead4f794..741d422a189 100644 --- a/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesLoadSaveTest.java +++ b/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesLoadSaveTest.java @@ -16,6 +16,11 @@ */ package org.apache.hop.workflow.actions.copyfiles; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -23,12 +28,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionCopyFilesLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesTest.java b/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesTest.java index f6f92d5306a..f41a5ab8f0f 100644 --- a/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesTest.java +++ b/plugins/actions/copyfiles/src/test/java/org/apache/hop/workflow/actions/copyfiles/WorkflowActionCopyFilesTest.java @@ -16,21 +16,6 @@ */ package org.apache.hop.workflow.actions.copyfiles; -import org.apache.hop.core.Result; -import org.apache.hop.core.logging.HopLogStore; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.hop.workflow.Workflow; -import org.apache.hop.workflow.WorkflowMeta; -import org.apache.hop.workflow.engine.IWorkflowEngine; -import org.apache.hop.workflow.engines.local.LocalWorkflowEngine; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -43,6 +28,20 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import org.apache.hop.core.Result; +import org.apache.hop.core.logging.HopLogStore; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.core.xml.XmlHandler; +import org.apache.hop.workflow.Workflow; +import org.apache.hop.workflow.WorkflowMeta; +import org.apache.hop.workflow.engine.IWorkflowEngine; +import org.apache.hop.workflow.engines.local.LocalWorkflowEngine; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + public class WorkflowActionCopyFilesTest { private ActionCopyFiles entry; diff --git a/plugins/actions/copymoveresultfilenames/src/main/java/org/apache/hop/workflow/actions/copymoveresultfilenames/ActionCopyMoveResultFilenames.java b/plugins/actions/copymoveresultfilenames/src/main/java/org/apache/hop/workflow/actions/copymoveresultfilenames/ActionCopyMoveResultFilenames.java index 2ebe5fd9da2..e2d8d51d48e 100644 --- a/plugins/actions/copymoveresultfilenames/src/main/java/org/apache/hop/workflow/actions/copymoveresultfilenames/ActionCopyMoveResultFilenames.java +++ b/plugins/actions/copymoveresultfilenames/src/main/java/org/apache/hop/workflow/actions/copymoveresultfilenames/ActionCopyMoveResultFilenames.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.actions.copymoveresultfilenames; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileUtil; import org.apache.hop.core.Const; @@ -41,13 +47,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * This defines a 'copymoveresultfilenames' action. Its main use would be to copy or move files in * the result filenames to a destination folder. that can be used to control the flow in ETL cycles. @@ -462,8 +461,7 @@ private boolean getSuccessStatus() { boolean retval = false; if ((nrErrors == 0 && getSuccessCondition().equals(SUCCESS_IF_NO_ERRORS)) - || (nrSuccess >= limitFiles - && getSuccessCondition().equals(SUCCESS_IF_AT_LEAST_X_FILES)) + || (nrSuccess >= limitFiles && getSuccessCondition().equals(SUCCESS_IF_AT_LEAST_X_FILES)) || (nrErrors <= limitFiles && getSuccessCondition().equals(SUCCESS_IF_ERRORS_LESS))) { retval = true; } diff --git a/plugins/actions/copymoveresultfilenames/src/test/java/org/apache/hop/workflow/actions/copymoveresultfilenames/WorkflowActionCopyMoveResultFilenamesTest.java b/plugins/actions/copymoveresultfilenames/src/test/java/org/apache/hop/workflow/actions/copymoveresultfilenames/WorkflowActionCopyMoveResultFilenamesTest.java index 793f6f7a6d3..a6aaab565ba 100644 --- a/plugins/actions/copymoveresultfilenames/src/test/java/org/apache/hop/workflow/actions/copymoveresultfilenames/WorkflowActionCopyMoveResultFilenamesTest.java +++ b/plugins/actions/copymoveresultfilenames/src/test/java/org/apache/hop/workflow/actions/copymoveresultfilenames/WorkflowActionCopyMoveResultFilenamesTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.copymoveresultfilenames; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionCopyMoveResultFilenamesTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFile.java b/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFile.java index 6ad098c2f4d..1c2ed4811e1 100644 --- a/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFile.java +++ b/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFile.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.createfile; +import java.io.IOException; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -39,9 +41,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.List; - /** * This defines a 'create file' action. Its main use would be to create empty trigger files that can * be used to control the flow in ETL cycles. diff --git a/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFileDialog.java b/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFileDialog.java index 4f3fd1e9bf4..cc1c9ad4cfb 100644 --- a/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFileDialog.java +++ b/plugins/actions/createfile/src/main/java/org/apache/hop/workflow/actions/createfile/ActionCreateFileDialog.java @@ -75,7 +75,7 @@ public IAction open() { Shell parent = getParent(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE); - shell.setMinimumSize(400, 210); + shell.setMinimumSize(400, 210); PropsUi.setLook(shell); WorkflowDialog.setShellImage(shell, action); @@ -200,8 +200,7 @@ public void widgetSelected(SelectionEvent e) { wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); diff --git a/plugins/actions/createfile/src/test/java/org/apache/hop/workflow/actions/createfile/WorkflowActionCreateFileLoadSaveTest.java b/plugins/actions/createfile/src/test/java/org/apache/hop/workflow/actions/createfile/WorkflowActionCreateFileLoadSaveTest.java index ce7706fcffc..44774426cad 100644 --- a/plugins/actions/createfile/src/test/java/org/apache/hop/workflow/actions/createfile/WorkflowActionCreateFileLoadSaveTest.java +++ b/plugins/actions/createfile/src/test/java/org/apache/hop/workflow/actions/createfile/WorkflowActionCreateFileLoadSaveTest.java @@ -16,14 +16,13 @@ */ package org.apache.hop.workflow.actions.createfile; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionCreateFileLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolder.java b/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolder.java index 478d2d4a285..8ed681dbb85 100644 --- a/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolder.java +++ b/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolder.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.createfolder; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; @@ -35,8 +36,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.apache.hop.workflow.action.validator.ValidatorContext; -import java.util.List; - /** * This defines a 'create folder' action. Its main use would be to create empty folder that can be * used to control the flow in ETL cycles. diff --git a/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolderDialog.java b/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolderDialog.java index ce5eabb197b..1b1947faff0 100644 --- a/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolderDialog.java +++ b/plugins/actions/createfolder/src/main/java/org/apache/hop/workflow/actions/createfolder/ActionCreateFolderDialog.java @@ -171,8 +171,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); diff --git a/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelay.java b/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelay.java index b3f0174826c..d2721916048 100644 --- a/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelay.java +++ b/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelay.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.delay; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -31,8 +32,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.List; - /** Action type to sleep for a time. It uses a piece of javascript to do this. \ */ @Action( id = "DELAY", diff --git a/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelayDialog.java b/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelayDialog.java index 19638cdb7de..17e3321a65a 100644 --- a/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelayDialog.java +++ b/plugins/actions/delay/src/main/java/org/apache/hop/workflow/actions/delay/ActionDelayDialog.java @@ -146,8 +146,7 @@ public IAction open() { wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); diff --git a/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayLoadSaveTest.java b/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayLoadSaveTest.java index 7e63e38e954..5e9ef6c9cc3 100644 --- a/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayLoadSaveTest.java +++ b/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayLoadSaveTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.delay; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionDelayLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayTest.java b/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayTest.java index 0337b444b90..3dc7604a173 100644 --- a/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayTest.java +++ b/plugins/actions/delay/src/test/java/org/apache/hop/workflow/actions/delay/WorkflowActionDelayTest.java @@ -17,12 +17,12 @@ package org.apache.hop.workflow.actions.delay; -import org.apache.hop.core.util.Utils; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import org.apache.hop.core.util.Utils; +import org.junit.Test; + public class WorkflowActionDelayTest { @Test diff --git a/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFile.java b/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFile.java index f4b14587c1e..6e349a4c934 100644 --- a/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFile.java +++ b/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFile.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.deletefile; +import java.io.IOException; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -39,9 +41,6 @@ import org.apache.hop.workflow.action.validator.FileExistsValidator; import org.apache.hop.workflow.action.validator.ValidatorContext; -import java.io.IOException; -import java.util.List; - /** * This defines a 'delete file' action. Its main use would be to delete trigger files, but it will * delete any file. diff --git a/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFileDialog.java b/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFileDialog.java index 595a8c4e729..273d2c9b52a 100644 --- a/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFileDialog.java +++ b/plugins/actions/deletefile/src/main/java/org/apache/hop/workflow/actions/deletefile/ActionDeleteFileDialog.java @@ -177,8 +177,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); // Add listeners wCancel.addListener(SWT.Selection, e -> cancel()); diff --git a/plugins/actions/deletefile/src/test/java/org/apache/hop/workflow/actions/deletefile/WorkflowActionDeleteFileLoadSaveTest.java b/plugins/actions/deletefile/src/test/java/org/apache/hop/workflow/actions/deletefile/WorkflowActionDeleteFileLoadSaveTest.java index 4b2077368e5..eb9fb665e14 100644 --- a/plugins/actions/deletefile/src/test/java/org/apache/hop/workflow/actions/deletefile/WorkflowActionDeleteFileLoadSaveTest.java +++ b/plugins/actions/deletefile/src/test/java/org/apache/hop/workflow/actions/deletefile/WorkflowActionDeleteFileLoadSaveTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.deletefile; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionDeleteFileLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/deletefiles/src/main/java/org/apache/hop/workflow/actions/deletefiles/ActionDeleteFiles.java b/plugins/actions/deletefiles/src/main/java/org/apache/hop/workflow/actions/deletefiles/ActionDeleteFiles.java index 11cc4eb2a69..5f109a64ff7 100644 --- a/plugins/actions/deletefiles/src/main/java/org/apache/hop/workflow/actions/deletefiles/ActionDeleteFiles.java +++ b/plugins/actions/deletefiles/src/main/java/org/apache/hop/workflow/actions/deletefiles/ActionDeleteFiles.java @@ -19,6 +19,11 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; @@ -50,12 +55,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'delete files' action. */ @Action( id = "DELETE_FILES", diff --git a/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowActionDeleteFilesLoadSaveTest.java b/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowActionDeleteFilesLoadSaveTest.java index a7cf1e1e0c1..eda9c2016e2 100644 --- a/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowActionDeleteFilesLoadSaveTest.java +++ b/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowActionDeleteFilesLoadSaveTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.deletefiles; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionDeleteFilesLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowEntryDeleteFilesTest.java b/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowEntryDeleteFilesTest.java index 909a18c162d..d2430800150 100644 --- a/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowEntryDeleteFilesTest.java +++ b/plugins/actions/deletefiles/src/test/java/org/apache/hop/workflow/actions/deletefiles/WorkflowEntryDeleteFilesTest.java @@ -17,6 +17,19 @@ package org.apache.hop.workflow.actions.deletefiles; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.nullable; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.RowMetaAndData; @@ -31,20 +44,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.nullable; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - public class WorkflowEntryDeleteFilesTest { private final String PATH_TO_FILE = "path/to/file"; private final String STRING_SPACES_ONLY = " "; diff --git a/plugins/actions/deletefolders/src/main/java/org/apache/hop/workflow/actions/deletefolders/ActionDeleteFolders.java b/plugins/actions/deletefolders/src/main/java/org/apache/hop/workflow/actions/deletefolders/ActionDeleteFolders.java index aba87698689..e18e61aef5c 100644 --- a/plugins/actions/deletefolders/src/main/java/org/apache/hop/workflow/actions/deletefolders/ActionDeleteFolders.java +++ b/plugins/actions/deletefolders/src/main/java/org/apache/hop/workflow/actions/deletefolders/ActionDeleteFolders.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.deletefolders; +import java.io.IOException; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; @@ -46,9 +48,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.List; - /** This defines a 'delete folders' action. */ @Action( id = "DELETE_FOLDERS", diff --git a/plugins/actions/deletefolders/src/test/java/org/apache/hop/workflow/actions/deletefolders/WorkflowActionDeleteFoldersLoadSaveTest.java b/plugins/actions/deletefolders/src/test/java/org/apache/hop/workflow/actions/deletefolders/WorkflowActionDeleteFoldersLoadSaveTest.java index f4508e36ab0..76f0f3bd5a3 100644 --- a/plugins/actions/deletefolders/src/test/java/org/apache/hop/workflow/actions/deletefolders/WorkflowActionDeleteFoldersLoadSaveTest.java +++ b/plugins/actions/deletefolders/src/test/java/org/apache/hop/workflow/actions/deletefolders/WorkflowActionDeleteFoldersLoadSaveTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.deletefolders; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionDeleteFoldersLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenames.java b/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenames.java index 1dee1a21913..dbeabf30092 100644 --- a/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenames.java +++ b/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenames.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.deleteresultfilenames; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -37,11 +41,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * This defines a 'deleteresultfilenames' action. Its main use would be to create empty folder that * can be used to control the flow in ETL cycles. diff --git a/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenamesDialog.java b/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenamesDialog.java index 47760166758..21b798ea684 100644 --- a/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenamesDialog.java +++ b/plugins/actions/deleteresultfilenames/src/main/java/org/apache/hop/workflow/actions/deleteresultfilenames/ActionDeleteResultFilenamesDialog.java @@ -195,8 +195,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); CheckLimit(); diff --git a/plugins/actions/deleteresultfilenames/src/test/java/org/apache/hop/workflow/actions/deleteresultfilenames/WorkflowActionDeleteResultFilenamesTest.java b/plugins/actions/deleteresultfilenames/src/test/java/org/apache/hop/workflow/actions/deleteresultfilenames/WorkflowActionDeleteResultFilenamesTest.java index c5490ba3b99..2a9801e031c 100644 --- a/plugins/actions/deleteresultfilenames/src/test/java/org/apache/hop/workflow/actions/deleteresultfilenames/WorkflowActionDeleteResultFilenamesTest.java +++ b/plugins/actions/deleteresultfilenames/src/test/java/org/apache/hop/workflow/actions/deleteresultfilenames/WorkflowActionDeleteResultFilenamesTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.deleteresultfilenames; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionDeleteResultFilenamesTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/dostounix/src/main/java/org/apache/hop/workflow/actions/dostounix/ActionDosToUnix.java b/plugins/actions/dostounix/src/main/java/org/apache/hop/workflow/actions/dostounix/ActionDosToUnix.java index dd374640916..9a1be2e6b0b 100644 --- a/plugins/actions/dostounix/src/main/java/org/apache/hop/workflow/actions/dostounix/ActionDosToUnix.java +++ b/plugins/actions/dostounix/src/main/java/org/apache/hop/workflow/actions/dostounix/ActionDosToUnix.java @@ -18,6 +18,16 @@ package org.apache.hop.workflow.actions.dostounix; import com.google.common.annotations.VisibleForTesting; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -41,17 +51,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'Dos to Unix' action. */ @Action( id = "DOS_UNIX_CONVERTER", diff --git a/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowActionDosToUnixTest.java b/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowActionDosToUnixTest.java index f6bf7ac719d..0b4e462f96b 100644 --- a/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowActionDosToUnixTest.java +++ b/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowActionDosToUnixTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.dostounix; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionDosToUnixTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowEntryDosToUnix_ConversionIdempotency_Test.java b/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowEntryDosToUnix_ConversionIdempotency_Test.java index 1cdb5e13097..d1997ad81f8 100644 --- a/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowEntryDosToUnix_ConversionIdempotency_Test.java +++ b/plugins/actions/dostounix/src/test/java/org/apache/hop/workflow/actions/dostounix/WorkflowEntryDosToUnix_ConversionIdempotency_Test.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.dostounix; +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; import org.apache.commons.io.IOUtils; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.vfs.HopVfs; @@ -27,12 +32,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; - -import static org.junit.Assert.assertEquals; - public class WorkflowEntryDosToUnix_ConversionIdempotency_Test { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEval.java b/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEval.java index 2b1d1e1e83a..e08aec569ec 100644 --- a/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEval.java +++ b/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEval.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.eval; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -35,8 +36,6 @@ import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.Scriptable; -import java.util.List; - /** * Action type to evaluate the result of a previous action. It uses a piece of javascript to do * this. diff --git a/plugins/actions/eval/src/test/java/org/apache/hop/workflow/actions/eval/WorkflowActionEvalLoadSaveTest.java b/plugins/actions/eval/src/test/java/org/apache/hop/workflow/actions/eval/WorkflowActionEvalLoadSaveTest.java index 0307a6bce30..02abfd9b589 100644 --- a/plugins/actions/eval/src/test/java/org/apache/hop/workflow/actions/eval/WorkflowActionEvalLoadSaveTest.java +++ b/plugins/actions/eval/src/test/java/org/apache/hop/workflow/actions/eval/WorkflowActionEvalLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.eval; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.core.Const; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -24,12 +29,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionEvalLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/evalfilesmetrics/src/main/java/org/apache/hop/workflow/actions/evalfilesmetrics/ActionEvalFilesMetrics.java b/plugins/actions/evalfilesmetrics/src/main/java/org/apache/hop/workflow/actions/evalfilesmetrics/ActionEvalFilesMetrics.java index 2dfa4a9f726..ab7e4cf1a93 100644 --- a/plugins/actions/evalfilesmetrics/src/main/java/org/apache/hop/workflow/actions/evalfilesmetrics/ActionEvalFilesMetrics.java +++ b/plugins/actions/evalfilesmetrics/src/main/java/org/apache/hop/workflow/actions/evalfilesmetrics/ActionEvalFilesMetrics.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.actions.evalfilesmetrics; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -45,13 +51,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'evaluate files metrics' action. */ @Action( id = "EVAL_FILES_METRICS", diff --git a/plugins/actions/evalfilesmetrics/src/test/java/org/apache/hop/workflow/actions/evalfilesmetrics/WorkflowActionEvalFilesMetricsLoadSaveTest.java b/plugins/actions/evalfilesmetrics/src/test/java/org/apache/hop/workflow/actions/evalfilesmetrics/WorkflowActionEvalFilesMetricsLoadSaveTest.java index 02d473372c1..9c731ae3fb0 100644 --- a/plugins/actions/evalfilesmetrics/src/test/java/org/apache/hop/workflow/actions/evalfilesmetrics/WorkflowActionEvalFilesMetricsLoadSaveTest.java +++ b/plugins/actions/evalfilesmetrics/src/test/java/org/apache/hop/workflow/actions/evalfilesmetrics/WorkflowActionEvalFilesMetricsLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.evalfilesmetrics; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -25,12 +30,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionEvalFilesMetricsLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContent.java b/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContent.java index 65f3b3c72f7..6d9f1dd40d3 100644 --- a/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContent.java +++ b/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContent.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.evaluatetablecontent; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -42,9 +44,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - /** This defines a Table content evaluation action */ @Action( id = "EVAL_TABLE_CONTENT", @@ -122,7 +121,9 @@ public Object clone() { return je; } - /** @return the successCondition */ + /** + * @return the successCondition + */ public int getSuccessCondition() { return successCondition; } diff --git a/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContentDialog.java b/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContentDialog.java index e0289108f3c..878c399cd32 100644 --- a/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContentDialog.java +++ b/plugins/actions/evaluatetablecontent/src/main/java/org/apache/hop/workflow/actions/evaluatetablecontent/ActionEvalTableContentDialog.java @@ -550,7 +550,7 @@ private void getSql() { case SWT.NO: wSql.setText(sql); break; - case SWT.YES: + case SWT.YES: try (Database db = new Database(loggingObject, variables, inf)) { db.connect(); IRowMeta fields = db.getQueryFields(sql, false); diff --git a/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/MockDriver.java b/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/MockDriver.java index 4531f570678..b2ef4c71c8b 100644 --- a/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/MockDriver.java +++ b/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/MockDriver.java @@ -17,7 +17,10 @@ package org.apache.hop.workflow.actions.evaluatetablecontent; -import org.mockito.stubbing.Answer; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.sql.Connection; import java.sql.Driver; @@ -32,11 +35,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Logger; - -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import org.mockito.stubbing.Answer; public class MockDriver implements Driver { private static final List drivers = new ArrayList<>(); diff --git a/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentLoadSaveTest.java b/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentLoadSaveTest.java index 2dcb130715b..6a3290f6c6e 100644 --- a/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentLoadSaveTest.java +++ b/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentLoadSaveTest.java @@ -17,17 +17,16 @@ package org.apache.hop.workflow.actions.evaluatetablecontent; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IntLoadSaveValidator; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class WorkflowActionEvalTableContentLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentTest.java b/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentTest.java index 37ed4bc6827..b3b36641c4e 100644 --- a/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentTest.java +++ b/plugins/actions/evaluatetablecontent/src/test/java/org/apache/hop/workflow/actions/evaluatetablecontent/WorkflowActionEvalTableContentTest.java @@ -17,6 +17,15 @@ package org.apache.hop.workflow.actions.evaluatetablecontent; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.Result; import org.apache.hop.core.database.BaseDatabaseMeta; @@ -41,16 +50,6 @@ import org.junit.Test; import org.mockito.stubbing.Answer; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /* * Action: Evaluate rows number in a table: * Apache Hop Server logs with error from Quartz even though the workflow finishes successfully. @@ -188,7 +187,7 @@ public void testNrErrorsFailure() throws Exception { res.getNrErrors(), 0); } - + @Test public void testNrErrorsSuccess() throws Exception { action.setLimit("5"); diff --git a/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompare.java b/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompare.java index a754a29f1ff..3b40c6a739d 100644 --- a/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompare.java +++ b/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompare.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.filecompare; +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.ICheckResult; @@ -41,11 +45,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.apache.hop.workflow.action.validator.ValidatorContext; -import java.io.BufferedInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.util.List; - /** * This defines a 'file compare' action. It will compare 2 files in a binary way, and will either * follow the true flow upon the files being the same or the false flow otherwise. diff --git a/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompareDialog.java b/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompareDialog.java index 77679202594..752bca20d11 100644 --- a/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompareDialog.java +++ b/plugins/actions/filecompare/src/main/java/org/apache/hop/workflow/actions/filecompare/ActionFileCompareDialog.java @@ -215,8 +215,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); diff --git a/plugins/actions/filecompare/src/test/java/org/apache/hop/workflow/actions/filecompare/WorkflowActionFileCompareTest.java b/plugins/actions/filecompare/src/test/java/org/apache/hop/workflow/actions/filecompare/WorkflowActionFileCompareTest.java index 2e16a96e4cd..90604216662 100644 --- a/plugins/actions/filecompare/src/test/java/org/apache/hop/workflow/actions/filecompare/WorkflowActionFileCompareTest.java +++ b/plugins/actions/filecompare/src/test/java/org/apache/hop/workflow/actions/filecompare/WorkflowActionFileCompareTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.filecompare; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionFileCompareTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExists.java b/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExists.java index 4dfb41d6e1e..60eb3e931d5 100644 --- a/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExists.java +++ b/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExists.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.fileexists; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -39,9 +41,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.List; -import java.util.Map; - /** * The File Exists action verifies that a specified file exists on the server on which Hop is * running. diff --git a/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExistsDialog.java b/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExistsDialog.java index 54c7bd2385c..24714305346 100644 --- a/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExistsDialog.java +++ b/plugins/actions/fileexists/src/main/java/org/apache/hop/workflow/actions/fileexists/ActionFileExistsDialog.java @@ -158,8 +158,7 @@ public IAction open() { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); diff --git a/plugins/actions/fileexists/src/test/java/org/apache/hop/workflow/actions/fileexists/WorkflowActionFileExistsTest.java b/plugins/actions/fileexists/src/test/java/org/apache/hop/workflow/actions/fileexists/WorkflowActionFileExistsTest.java index 793dcfe5ac0..b0461d83887 100644 --- a/plugins/actions/fileexists/src/test/java/org/apache/hop/workflow/actions/fileexists/WorkflowActionFileExistsTest.java +++ b/plugins/actions/fileexists/src/test/java/org/apache/hop/workflow/actions/fileexists/WorkflowActionFileExistsTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.fileexists; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionFileExistsTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/filesexist/src/main/java/org/apache/hop/workflow/actions/filesexist/ActionFilesExist.java b/plugins/actions/filesexist/src/main/java/org/apache/hop/workflow/actions/filesexist/ActionFilesExist.java index 9f156784fea..524fcae5eab 100644 --- a/plugins/actions/filesexist/src/main/java/org/apache/hop/workflow/actions/filesexist/ActionFilesExist.java +++ b/plugins/actions/filesexist/src/main/java/org/apache/hop/workflow/actions/filesexist/ActionFilesExist.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.filesexist; +import java.io.IOException; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,9 +35,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.io.IOException; -import java.util.List; - /** This defines a Files exist action. */ @Action( id = "FILES_EXIST", diff --git a/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistLoadSaveTest.java b/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistLoadSaveTest.java index 76fce26d801..0159ca7c5ec 100644 --- a/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistLoadSaveTest.java +++ b/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.filesexist; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionFilesExistLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistTest.java b/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistTest.java index 796acaadb93..2f059d910c6 100644 --- a/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistTest.java +++ b/plugins/actions/filesexist/src/test/java/org/apache/hop/workflow/actions/filesexist/WorkflowActionFilesExistTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.filesexist; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + import org.apache.hop.core.Result; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.utils.TestUtils; @@ -29,11 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - public class WorkflowActionFilesExistTest { private IWorkflowEngine workflow; private ActionFilesExist action; diff --git a/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmpty.java b/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmpty.java index 926c22e2722..46e976394eb 100644 --- a/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmpty.java +++ b/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmpty.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.folderisempty; +import java.io.IOException; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; @@ -36,11 +40,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.io.IOException; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * This defines a 'create folder' action. Its main use would be to create empty folder that can be * used to control the flow in ETL cycles. diff --git a/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmptyDialog.java b/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmptyDialog.java index 927cdf0c012..f50e00a9bb9 100644 --- a/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmptyDialog.java +++ b/plugins/actions/folderisempty/src/main/java/org/apache/hop/workflow/actions/folderisempty/ActionFolderIsEmptyDialog.java @@ -229,8 +229,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); checkLimitSearch(); diff --git a/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyLoadSaveTest.java b/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyLoadSaveTest.java index ad772c84cc7..4854ce2069b 100644 --- a/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyLoadSaveTest.java +++ b/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.folderisempty; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionFolderIsEmptyLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyTest.java b/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyTest.java index 82325d9f2c4..97a27c2206a 100644 --- a/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyTest.java +++ b/plugins/actions/folderisempty/src/test/java/org/apache/hop/workflow/actions/folderisempty/WorkflowActionFolderIsEmptyTest.java @@ -17,6 +17,14 @@ package org.apache.hop.workflow.actions.folderisempty; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.attribute.FileAttribute; import org.apache.hop.core.Result; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.workflow.WorkflowMeta; @@ -29,15 +37,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.io.File; -import java.nio.file.Files; -import java.nio.file.attribute.FileAttribute; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - public class WorkflowActionFolderIsEmptyTest { private IWorkflowEngine workflow; private ActionFolderIsEmpty action; diff --git a/plugins/actions/folderscompare/src/main/java/org/apache/hop/workflow/actions/folderscompare/ActionFoldersCompare.java b/plugins/actions/folderscompare/src/main/java/org/apache/hop/workflow/actions/folderscompare/ActionFoldersCompare.java index 6fb4b47b3b2..e7b5ee83afa 100644 --- a/plugins/actions/folderscompare/src/main/java/org/apache/hop/workflow/actions/folderscompare/ActionFoldersCompare.java +++ b/plugins/actions/folderscompare/src/main/java/org/apache/hop/workflow/actions/folderscompare/ActionFoldersCompare.java @@ -17,6 +17,16 @@ package org.apache.hop.workflow.actions.folderscompare; +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; @@ -41,17 +51,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.io.BufferedInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * This defines a 'folder compare' action. It will compare 2 folders, and will either follow the * true flow upon the files being the same or the false flow otherwise. diff --git a/plugins/actions/folderscompare/src/test/java/org/apache/hop/workflow/actions/folderscompare/WorkflowActionFoldersCompareTest.java b/plugins/actions/folderscompare/src/test/java/org/apache/hop/workflow/actions/folderscompare/WorkflowActionFoldersCompareTest.java index 15842a9041b..9ac2db8b910 100644 --- a/plugins/actions/folderscompare/src/test/java/org/apache/hop/workflow/actions/folderscompare/WorkflowActionFoldersCompareTest.java +++ b/plugins/actions/folderscompare/src/test/java/org/apache/hop/workflow/actions/folderscompare/WorkflowActionFoldersCompareTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.folderscompare; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionFoldersCompareTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java index cbb235d4064..628b1fb043b 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java @@ -18,6 +18,15 @@ package org.apache.hop.workflow.actions.ftp; import com.google.common.annotations.VisibleForTesting; +import java.io.File; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.vfs2.FileObject; @@ -49,16 +58,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.File; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines an FTP action. */ @Action( id = "FTP", @@ -798,13 +797,17 @@ protected boolean needsDownload(String filename) { return retval; } - /** @return the activeConnection */ + /** + * @return the activeConnection + */ @Override public boolean isActiveConnection() { return activeConnection; } - /** @param activeConnection Sets the active connection to passive or not */ + /** + * @param activeConnection Sets the active connection to passive or not + */ public void setActiveConnection(boolean activeConnection) { this.activeConnection = activeConnection; } @@ -866,7 +869,9 @@ public String getServerName() { return serverName; } - /** @param serverName The serverName to set */ + /** + * @param serverName The serverName to set + */ public void setServerName(String serverName) { this.serverName = serverName; } @@ -881,7 +886,9 @@ public String getUserName() { return userName; } - /** @param userName The userName to set */ + /** + * @param userName The userName to set + */ public void setUserName(String userName) { this.userName = userName; } @@ -896,7 +903,9 @@ public String getPassword() { return password; } - /** @param password The password to set */ + /** + * @param password The password to set + */ public void setPassword(String password) { this.password = password; } @@ -910,7 +919,9 @@ public String getRemoteDirectory() { return remoteDirectory; } - /** @param remoteDirectory The ftpDirectory to set */ + /** + * @param remoteDirectory The ftpDirectory to set + */ public void setRemoteDirectory(String remoteDirectory) { this.remoteDirectory = remoteDirectory; } @@ -924,7 +935,9 @@ public String getTargetDirectory() { return targetDirectory; } - /** @param targetDirectory The targetDirectory to set */ + /** + * @param targetDirectory The targetDirectory to set + */ public void setTargetDirectory(String targetDirectory) { this.targetDirectory = targetDirectory; } @@ -938,7 +951,9 @@ public String getWildcard() { return wildcard; } - /** @param wildcard The wildcard to set */ + /** + * @param wildcard The wildcard to set + */ public void setWildcard(String wildcard) { this.wildcard = wildcard; } @@ -953,7 +968,9 @@ public boolean isBinaryMode() { return binaryMode; } - /** @param binaryMode The binaryMode to set */ + /** + * @param binaryMode The binaryMode to set + */ public void setBinaryMode(boolean binaryMode) { this.binaryMode = binaryMode; } @@ -968,7 +985,9 @@ public int getTimeout() { return timeout; } - /** @param timeout The timeout to set */ + /** + * @param timeout The timeout to set + */ public void setTimeout(int timeout) { this.timeout = timeout; } @@ -982,7 +1001,9 @@ public boolean isRemove() { return remove; } - /** @param remove The remove to set */ + /** + * @param remove The remove to set + */ public void setRemove(boolean remove) { this.remove = remove; } @@ -996,7 +1017,9 @@ public boolean isOnlyGettingNewFiles() { return onlyGettingNewFiles; } - /** @param onlyGettingNewFiles The onlyGettingNewFiles to set */ + /** + * @param onlyGettingNewFiles The onlyGettingNewFiles to set + */ public void setOnlyGettingNewFiles(boolean onlyGettingNewFiles) { this.onlyGettingNewFiles = onlyGettingNewFiles; } @@ -1011,7 +1034,9 @@ public String getControlEncoding() { return controlEncoding; } - /** @param controlEncoding The controlEncoding to set */ + /** + * @param controlEncoding The controlEncoding to set + */ public void setControlEncoding(String controlEncoding) { this.controlEncoding = controlEncoding; } @@ -1025,7 +1050,9 @@ public boolean isMoveFiles() { return moveFiles; } - /** @param moveFiles The movefiles to set */ + /** + * @param moveFiles The movefiles to set + */ public void setMoveFiles(boolean moveFiles) { this.moveFiles = moveFiles; } @@ -1039,7 +1066,9 @@ public String getMoveToDirectory() { return moveToDirectory; } - /** @param moveToDirectory The movetodirectory to set */ + /** + * @param moveToDirectory The movetodirectory to set + */ public void setMoveToDirectory(String moveToDirectory) { this.moveToDirectory = moveToDirectory; } @@ -1053,7 +1082,9 @@ public boolean isAddDate() { return addDate; } - /** @param addDate The adddate to set */ + /** + * @param addDate The adddate to set + */ public void setAddDate(boolean addDate) { this.addDate = addDate; } @@ -1067,7 +1098,9 @@ public boolean isAddTime() { return addTime; } - /** @param addTime The addtime to set */ + /** + * @param addTime The addtime to set + */ public void setAddTime(boolean addTime) { this.addTime = addTime; } @@ -1081,7 +1114,9 @@ public boolean isSpecifyFormat() { return specifyFormat; } - /** @param specifyFormat The specifyFormat to set */ + /** + * @param specifyFormat The specifyFormat to set + */ public void setSpecifyFormat(boolean specifyFormat) { this.specifyFormat = specifyFormat; } @@ -1095,7 +1130,9 @@ public String getDateTimeFormat() { return dateTimeFormat; } - /** @param dateTimeFormat The dateTimeFormat to set */ + /** + * @param dateTimeFormat The dateTimeFormat to set + */ public void setDateTimeFormat(String dateTimeFormat) { this.dateTimeFormat = dateTimeFormat; } @@ -1109,7 +1146,9 @@ public boolean isAddDateBeforeExtension() { return addDateBeforeExtension; } - /** @param addDateBeforeExtension The addDateBeforeExtension to set */ + /** + * @param addDateBeforeExtension The addDateBeforeExtension to set + */ public void setAddDateBeforeExtension(boolean addDateBeforeExtension) { this.addDateBeforeExtension = addDateBeforeExtension; } @@ -1123,7 +1162,9 @@ public boolean isAddResult() { return isAddResult; } - /** @param addResult The isaddresult to set */ + /** + * @param addResult The isaddresult to set + */ public void setAddResult(boolean addResult) { this.isAddResult = addResult; } @@ -1137,7 +1178,9 @@ public boolean isCreateMoveFolder() { return createMoveFolder; } - /** @param createMoveFolder The createmovefolder to set */ + /** + * @param createMoveFolder The createmovefolder to set + */ public void setCreateMoveFolder(boolean createMoveFolder) { this.createMoveFolder = createMoveFolder; } @@ -1152,7 +1195,9 @@ public String getServerPort() { return serverPort; } - /** @param serverPort The port to set */ + /** + * @param serverPort The port to set + */ public void setServerPort(String serverPort) { this.serverPort = serverPort; } @@ -1167,7 +1212,9 @@ public String getProxyHost() { return proxyHost; } - /** @param proxyHost The proxyHost to set */ + /** + * @param proxyHost The proxyHost to set + */ public void setProxyHost(String proxyHost) { this.proxyHost = proxyHost; } @@ -1182,7 +1229,9 @@ public String getProxyPort() { return proxyPort; } - /** @param proxyPort The proxyPort to set */ + /** + * @param proxyPort The proxyPort to set + */ public void setProxyPort(String proxyPort) { this.proxyPort = proxyPort; } @@ -1197,7 +1246,9 @@ public String getProxyUsername() { return proxyUsername; } - /** @param proxyUsername The proxyUsername to set */ + /** + * @param proxyUsername The proxyUsername to set + */ public void setProxyUsername(String proxyUsername) { this.proxyUsername = proxyUsername; } @@ -1212,7 +1263,9 @@ public String getProxyPassword() { return proxyPassword; } - /** @param proxyPassword The proxyPassword to set */ + /** + * @param proxyPassword The proxyPassword to set + */ public void setProxyPassword(String proxyPassword) { this.proxyPassword = proxyPassword; } @@ -1227,7 +1280,9 @@ public String getSocksProxyHost() { return socksProxyHost; } - /** @param socksProxyHost The socksProxyHost to set */ + /** + * @param socksProxyHost The socksProxyHost to set + */ public void setSocksProxyHost(String socksProxyHost) { this.socksProxyHost = socksProxyHost; } @@ -1242,7 +1297,9 @@ public String getSocksProxyPort() { return socksProxyPort; } - /** @param socksProxyPort The socksProxyPort to set */ + /** + * @param socksProxyPort The socksProxyPort to set + */ public void setSocksProxyPort(String socksProxyPort) { this.socksProxyPort = socksProxyPort; } @@ -1257,7 +1314,9 @@ public String getSocksProxyUsername() { return socksProxyUsername; } - /** @param socksProxyUsername The socksProxyUsername to set */ + /** + * @param socksProxyUsername The socksProxyUsername to set + */ public void setSocksProxyUsername(String socksProxyUsername) { this.socksProxyUsername = socksProxyUsername; } @@ -1272,7 +1331,9 @@ public String getSocksProxyPassword() { return socksProxyPassword; } - /** @param socksProxyPassword The socksProxyPassword to set */ + /** + * @param socksProxyPassword The socksProxyPassword to set + */ public void setSocksProxyPassword(String socksProxyPassword) { this.socksProxyPassword = socksProxyPassword; } @@ -1286,7 +1347,9 @@ public int getIfFileExistsSkip() { return ifFileExistsSkip; } - /** @param ifFileExistsSkip The ifFileExistsSkip to set */ + /** + * @param ifFileExistsSkip The ifFileExistsSkip to set + */ public void setIfFileExistsSkip(int ifFileExistsSkip) { this.ifFileExistsSkip = ifFileExistsSkip; } @@ -1300,7 +1363,9 @@ public int getIfFileExistsCreateUniq() { return ifFileExistsCreateUniq; } - /** @param ifFileExistsCreateUniq The ifFileExistsCreateUniq to set */ + /** + * @param ifFileExistsCreateUniq The ifFileExistsCreateUniq to set + */ public void setIfFileExistsCreateUniq(int ifFileExistsCreateUniq) { this.ifFileExistsCreateUniq = ifFileExistsCreateUniq; } @@ -1314,7 +1379,9 @@ public int getIfFileExistsFail() { return ifFileExistsFail; } - /** @param ifFileExistsFail The ifFileExistsFail to set */ + /** + * @param ifFileExistsFail The ifFileExistsFail to set + */ public void setIfFileExistsFail(int ifFileExistsFail) { this.ifFileExistsFail = ifFileExistsFail; } @@ -1328,7 +1395,9 @@ public int getIfFileExists() { return ifFileExists; } - /** @param ifFileExists The ifFileExists to set */ + /** + * @param ifFileExists The ifFileExists to set + */ public void setIfFileExists(int ifFileExists) { this.ifFileExists = ifFileExists; } @@ -1342,7 +1411,9 @@ public String getStringIfFileExists() { return stringIfFileExists; } - /** @param stringIfFileExists The stringIfFileExists to set */ + /** + * @param stringIfFileExists The stringIfFileExists to set + */ public void setStringIfFileExists(String stringIfFileExists) { this.stringIfFileExists = stringIfFileExists; } @@ -1356,7 +1427,9 @@ public String getNrLimit() { return nrLimit; } - /** @param nrLimit The nrLimit to set */ + /** + * @param nrLimit The nrLimit to set + */ public void setNrLimit(String nrLimit) { this.nrLimit = nrLimit; } @@ -1370,7 +1443,9 @@ public String getSuccessCondition() { return successCondition; } - /** @param successCondition The successCondition to set */ + /** + * @param successCondition The successCondition to set + */ public void setSuccessCondition(String successCondition) { this.successCondition = successCondition; } @@ -1384,7 +1459,9 @@ public long getNrErrors() { return nrErrors; } - /** @param nrErrors The nrErrors to set */ + /** + * @param nrErrors The nrErrors to set + */ public void setNrErrors(long nrErrors) { this.nrErrors = nrErrors; } @@ -1398,7 +1475,9 @@ public long getNrFilesRetrieved() { return nrFilesRetrieved; } - /** @param nrFilesRetrieved The nrFilesRetrieved to set */ + /** + * @param nrFilesRetrieved The nrFilesRetrieved to set + */ public void setNrFilesRetrieved(long nrFilesRetrieved) { this.nrFilesRetrieved = nrFilesRetrieved; } @@ -1412,7 +1491,9 @@ public boolean isSuccessConditionBroken() { return successConditionBroken; } - /** @param successConditionBroken The successConditionBroken to set */ + /** + * @param successConditionBroken The successConditionBroken to set + */ public void setSuccessConditionBroken(boolean successConditionBroken) { this.successConditionBroken = successConditionBroken; } @@ -1426,7 +1507,9 @@ public int getLimitFiles() { return limitFiles; } - /** @param limitFiles The limitFiles to set */ + /** + * @param limitFiles The limitFiles to set + */ public void setLimitFiles(int limitFiles) { this.limitFiles = limitFiles; } @@ -1440,7 +1523,9 @@ public String getTargetFilename() { return targetFilename; } - /** @param targetFilename The targetFilename to set */ + /** + * @param targetFilename The targetFilename to set + */ public void setTargetFilename(String targetFilename) { this.targetFilename = targetFilename; } diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtpDialog.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtpDialog.java index f700ed12c2e..727af8fc89a 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtpDialog.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtpDialog.java @@ -945,7 +945,7 @@ public void widgetSelected(SelectionEvent e) { new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - //Ignore widget selected event + // Ignore widget selected event } }); diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpdelete/ActionFtpDelete.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpdelete/ActionFtpDelete.java index 3693e100978..17b6729ab5f 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpdelete/ActionFtpDelete.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpdelete/ActionFtpDelete.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.ftpdelete; +import java.net.InetAddress; +import java.util.HashSet; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.net.ftp.FTPClient; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -44,12 +49,6 @@ import org.apache.hop.workflow.actions.util.IFtpConnection; import org.w3c.dom.Node; -import java.net.InetAddress; -import java.util.HashSet; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines an FTP action. */ @Action( id = "FTP_DELETE", @@ -276,32 +275,44 @@ public void setCopyPrevious(boolean copyprevious) { this.copyPrevious = copyprevious; } - /** @param publickey The publicpublickey to set. */ + /** + * @param publickey The publicpublickey to set. + */ public void setUsePublicKey(boolean publickey) { this.publicPublicKey = publickey; } - /** @return Returns the use public key. */ + /** + * @return Returns the use public key. + */ public boolean isUsePublicKey() { return publicPublicKey; } - /** @param keyfilename The key filename to set. */ + /** + * @param keyfilename The key filename to set. + */ public void setKeyFilename(String keyfilename) { this.keyFilename = keyfilename; } - /** @return Returns the key filename. */ + /** + * @return Returns the key filename. + */ public String getKeyFilename() { return keyFilename; } - /** @param keyFilePass The key file pass to set. */ + /** + * @param keyFilePass The key file pass to set. + */ public void setKeyFilePass(String keyFilePass) { this.keyFilePass = keyFilePass; } - /** @return Returns the key file pass. */ + /** + * @return Returns the key file pass. + */ public String getKeyFilePass() { return keyFilePass; } @@ -322,17 +333,23 @@ public String getSuccessCondition() { return successCondition; } - /** @return Returns the directory. */ + /** + * @return Returns the directory. + */ public String getRemoteDirectory() { return remoteDirectory; } - /** @param directory The directory to set. */ + /** + * @param directory The directory to set. + */ public void setRemoteDirectory(String directory) { this.remoteDirectory = directory; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ @Override public String getPassword() { return password; @@ -343,18 +360,24 @@ public boolean isBinaryMode() { return true; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the serverName. */ + /** + * @return Returns the serverName. + */ @Override public String getServerName() { return serverName; } - /** @param serverName The serverName to set. */ + /** + * @param serverName The serverName to set. + */ public void setServerName(String serverName) { this.serverName = serverName; } @@ -367,33 +390,45 @@ public String getProtocol() { return protocol; } - /** @return Returns the userName. */ + /** + * @return Returns the userName. + */ @Override public String getUserName() { return userName; } - /** @param userName The userName to set. */ + /** + * @param userName The userName to set. + */ public void setUserName(String userName) { this.userName = userName; } - /** @return Returns the wildcard. */ + /** + * @return Returns the wildcard. + */ public String getWildcard() { return wildcard; } - /** @param wildcard The wildcard to set. */ + /** + * @param wildcard The wildcard to set. + */ public void setWildcard(String wildcard) { this.wildcard = wildcard; } - /** @param timeout The timeout to set. */ + /** + * @param timeout The timeout to set. + */ public void setTimeout(int timeout) { this.timeout = timeout; } - /** @return Returns the timeout. */ + /** + * @return Returns the timeout. + */ @Override public int getTimeout() { return timeout; @@ -404,13 +439,17 @@ public String getControlEncoding() { return null; } - /** @return Returns the hostname of the ftp-proxy. */ + /** + * @return Returns the hostname of the ftp-proxy. + */ @Override public String getProxyHost() { return proxyHost; } - /** @param proxyHost The hostname of the proxy. */ + /** + * @param proxyHost The hostname of the proxy. + */ public void setProxyHost(String proxyHost) { this.proxyHost = proxyHost; } @@ -423,46 +462,62 @@ public void setUseProxy(boolean useproxy) { this.useProxy = useproxy; } - /** @return Returns the password which is used to authenticate at the proxy. */ + /** + * @return Returns the password which is used to authenticate at the proxy. + */ @Override public String getProxyPassword() { return proxyPassword; } - /** @param proxyPassword The password which is used to authenticate at the proxy. */ + /** + * @param proxyPassword The password which is used to authenticate at the proxy. + */ public void setProxyPassword(String proxyPassword) { this.proxyPassword = proxyPassword; } - /** @return Returns the port of the ftp. */ + /** + * @return Returns the port of the ftp. + */ @Override public String getServerPort() { return serverPort; } - /** @param serverPort The port of the ftp. */ + /** + * @param serverPort The port of the ftp. + */ public void setServerPort(String serverPort) { this.serverPort = serverPort; } - /** @return Returns the port of the ftp-proxy. */ + /** + * @return Returns the port of the ftp-proxy. + */ @Override public String getProxyPort() { return proxyPort; } - /** @param proxyPort The port of the ftp-proxy. */ + /** + * @param proxyPort The port of the ftp-proxy. + */ public void setProxyPort(String proxyPort) { this.proxyPort = proxyPort; } - /** @return Returns the username which is used to authenticate at the proxy. */ + /** + * @return Returns the username which is used to authenticate at the proxy. + */ @Override public String getProxyUsername() { return proxyUsername; } - /** @param proxyUsername The username which is used to authenticate at the proxy. */ + /** + * @param proxyUsername The username which is used to authenticate at the proxy. + */ public void setProxyUsername(String proxyUsername) { this.proxyUsername = proxyUsername; } @@ -724,13 +779,17 @@ public boolean isEvaluation() { return true; } - /** @return the activeConnection */ + /** + * @return the activeConnection + */ @Override public boolean isActiveConnection() { return activeConnection; } - /** @param activeConnection the activeConnection to set */ + /** + * @param activeConnection the activeConnection to set + */ public void setActiveConnection(boolean activeConnection) { this.activeConnection = activeConnection; } @@ -782,46 +841,62 @@ public List getResourceDependencies( return references; } - /** @return Socks proxy host */ + /** + * @return Socks proxy host + */ @Override public String getSocksProxyHost() { return this.socksProxyHost; } - /** @return Socks proxy port */ + /** + * @return Socks proxy port + */ @Override public String getSocksProxyPort() { return this.socksProxyPort; } - /** @return Socks proxy username */ + /** + * @return Socks proxy username + */ @Override public String getSocksProxyUsername() { return this.socksProxyUsername; } - /** @return Socks proxy username */ + /** + * @return Socks proxy username + */ @Override public String getSocksProxyPassword() { return this.socksProxyPassword; } - /** @return Sets socks proxy host */ + /** + * @return Sets socks proxy host + */ public void setSocksProxyHost(String socksProxyHost) { this.socksProxyHost = socksProxyHost; } - /** @return Sets socks proxy port */ + /** + * @return Sets socks proxy port + */ public void setSocksProxyPort(String socksProxyPort) { this.socksProxyPort = socksProxyPort; } - /** @return Sets socks proxy username */ + /** + * @return Sets socks proxy username + */ public void setSocksProxyUsername(String socksProxyUsername) { this.socksProxyUsername = socksProxyUsername; } - /** @return Sets socks proxy username */ + /** + * @return Sets socks proxy username + */ public void setSocksProxyPassword(String socksProxyPassword) { this.socksProxyPassword = socksProxyPassword; } diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpput/ActionFtpPut.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpput/ActionFtpPut.java index cdce8b78e3d..3c35e5a4075 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpput/ActionFtpPut.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftpput/ActionFtpPut.java @@ -17,6 +17,15 @@ package org.apache.hop.workflow.actions.ftpput; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.hop.core.Const; @@ -44,16 +53,6 @@ import org.apache.hop.workflow.actions.util.IFtpConnection; import org.w3c.dom.Node; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines an FTP put action. */ @Action( id = "FTP_PUT", @@ -206,34 +205,46 @@ public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVari } } - /** @return Returns the binaryMode. */ + /** + * @return Returns the binaryMode. + */ @Override public boolean isBinaryMode() { return binaryMode; } - /** @param binaryMode The binaryMode to set. */ + /** + * @param binaryMode The binaryMode to set. + */ public void setBinaryMode(boolean binaryMode) { this.binaryMode = binaryMode; } - /** @param timeout The timeout to set. */ + /** + * @param timeout The timeout to set. + */ public void setTimeout(int timeout) { this.timeout = timeout; } - /** @return Returns the timeout. */ + /** + * @return Returns the timeout. + */ @Override public int getTimeout() { return timeout; } - /** @return Returns the onlyGettingNewFiles. */ + /** + * @return Returns the onlyGettingNewFiles. + */ public boolean isOnlyPuttingNewFiles() { return onlyPuttingNewFiles; } - /** @param onlyPuttingNewFiles Only transfer new files to the remote host */ + /** + * @param onlyPuttingNewFiles Only transfer new files to the remote host + */ public void setOnlyPuttingNewFiles(boolean onlyPuttingNewFiles) { this.onlyPuttingNewFiles = onlyPuttingNewFiles; } @@ -258,75 +269,103 @@ public void setControlEncoding(String encoding) { this.controlEncoding = encoding; } - /** @return Returns the remoteDirectory. */ + /** + * @return Returns the remoteDirectory. + */ public String getRemoteDirectory() { return remoteDirectory; } - /** @param directory The remoteDirectory to set. */ + /** + * @param directory The remoteDirectory to set. + */ public void setRemoteDirectory(String directory) { this.remoteDirectory = directory; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ @Override public String getPassword() { return password; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the serverName. */ + /** + * @return Returns the serverName. + */ @Override public String getServerName() { return serverName; } - /** @param serverName The serverName to set. */ + /** + * @param serverName The serverName to set. + */ public void setServerName(String serverName) { this.serverName = serverName; } - /** @return Returns the userName. */ + /** + * @return Returns the userName. + */ @Override public String getUserName() { return userName; } - /** @param userName The userName to set. */ + /** + * @param userName The userName to set. + */ public void setUserName(String userName) { this.userName = userName; } - /** @return Returns the wildcard. */ + /** + * @return Returns the wildcard. + */ public String getWildcard() { return wildcard; } - /** @param wildcard The wildcard to set. */ + /** + * @param wildcard The wildcard to set. + */ public void setWildcard(String wildcard) { this.wildcard = wildcard; } - /** @return Returns the localDirectory. */ + /** + * @return Returns the localDirectory. + */ public String getLocalDirectory() { return localDirectory; } - /** @param directory The localDirectory to set. */ + /** + * @param directory The localDirectory to set. + */ public void setLocalDirectory(String directory) { this.localDirectory = directory; } - /** @param remove The remove to set. */ + /** + * @param remove The remove to set. + */ public void setRemove(boolean remove) { this.remove = remove; } - /** @return Returns the remove. */ + /** + * @return Returns the remove. + */ public boolean getRemove() { return remove; } @@ -340,101 +379,137 @@ public void setServerPort(String serverPort) { this.serverPort = serverPort; } - /** @return the activeConnection */ + /** + * @return the activeConnection + */ @Override public boolean isActiveConnection() { return activeConnection; } - /** @param activeConnection set to true to get an active FTP connection */ + /** + * @param activeConnection set to true to get an active FTP connection + */ public void setActiveConnection(boolean activeConnection) { this.activeConnection = activeConnection; } - /** @return Returns the hostname of the ftp-proxy. */ + /** + * @return Returns the hostname of the ftp-proxy. + */ @Override public String getProxyHost() { return proxyHost; } - /** @param proxyHost The hostname of the proxy. */ + /** + * @param proxyHost The hostname of the proxy. + */ public void setProxyHost(String proxyHost) { this.proxyHost = proxyHost; } - /** @return Returns the password which is used to authenticate at the proxy. */ + /** + * @return Returns the password which is used to authenticate at the proxy. + */ @Override public String getProxyPassword() { return proxyPassword; } - /** @param proxyPassword The password which is used to authenticate at the proxy. */ + /** + * @param proxyPassword The password which is used to authenticate at the proxy. + */ public void setProxyPassword(String proxyPassword) { this.proxyPassword = proxyPassword; } - /** @return Returns the port of the ftp-proxy. */ + /** + * @return Returns the port of the ftp-proxy. + */ @Override public String getProxyPort() { return proxyPort; } - /** @param proxyPort The port of the ftp-proxy. */ + /** + * @param proxyPort The port of the ftp-proxy. + */ public void setProxyPort(String proxyPort) { this.proxyPort = proxyPort; } - /** @return Returns the username which is used to authenticate at the proxy. */ + /** + * @return Returns the username which is used to authenticate at the proxy. + */ @Override public String getProxyUsername() { return proxyUsername; } - /** @param socksProxyHost The socks proxy host to set */ + /** + * @param socksProxyHost The socks proxy host to set + */ public void setSocksProxyHost(String socksProxyHost) { this.socksProxyHost = socksProxyHost; } - /** @param socksProxyPort The socks proxy port to set */ + /** + * @param socksProxyPort The socks proxy port to set + */ public void setSocksProxyPort(String socksProxyPort) { this.socksProxyPort = socksProxyPort; } - /** @param socksProxyUsername The socks proxy username to set */ + /** + * @param socksProxyUsername The socks proxy username to set + */ public void setSocksProxyUsername(String socksProxyUsername) { this.socksProxyUsername = socksProxyUsername; } - /** @param socksProxyPassword The socks proxy password to set */ + /** + * @param socksProxyPassword The socks proxy password to set + */ public void setSocksProxyPassword(String socksProxyPassword) { this.socksProxyPassword = socksProxyPassword; } - /** @return The sox proxy host name */ + /** + * @return The sox proxy host name + */ @Override public String getSocksProxyHost() { return this.socksProxyHost; } - /** @return The socks proxy port */ + /** + * @return The socks proxy port + */ @Override public String getSocksProxyPort() { return this.socksProxyPort; } - /** @return The socks proxy username */ + /** + * @return The socks proxy username + */ @Override public String getSocksProxyUsername() { return this.socksProxyUsername; } - /** @return The socks proxy password */ + /** + * @return The socks proxy password + */ @Override public String getSocksProxyPassword() { return this.socksProxyPassword; } - /** @param proxyUsername The username which is used to authenticate at the proxy. */ + /** + * @param proxyUsername The username which is used to authenticate at the proxy. + */ public void setProxyUsername(String proxyUsername) { this.proxyUsername = proxyUsername; } @@ -559,7 +634,7 @@ public Result execute(Result previousResult, int nr) { + ftpclient.getReplyString()); } } - if(binaryMode){ + if (binaryMode) { ftpclient.setFileType(FTP.BINARY_FILE_TYPE); } boolean success = ftpclient.storeFile(file, inputStream); diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/ActionSftp.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/ActionSftp.java index 0addc3fed10..66ca2f24358 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/ActionSftp.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/ActionSftp.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.sftp; +import java.net.InetAddress; +import java.util.HashSet; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -44,12 +49,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.net.InetAddress; -import java.util.HashSet; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a SFTP action. */ @Action( id = "SFTP", @@ -204,62 +203,86 @@ public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVari } } - /** @return Returns the directory. */ + /** + * @return Returns the directory. + */ public String getScpDirectory() { return sftpDirectory; } - /** @param directory The directory to set. */ + /** + * @param directory The directory to set. + */ public void setScpDirectory(String directory) { this.sftpDirectory = directory; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the compression. */ + /** + * @return Returns the compression. + */ public String getCompression() { return compression; } - /** @param compression The compression to set. */ + /** + * @param compression The compression to set. + */ public void setCompression(String compression) { this.compression = compression; } - /** @return Returns the serverName. */ + /** + * @return Returns the serverName. + */ public String getServerName() { return serverName; } - /** @param serverName The serverName to set. */ + /** + * @param serverName The serverName to set. + */ public void setServerName(String serverName) { this.serverName = serverName; } - /** @return Returns the userName. */ + /** + * @return Returns the userName. + */ public String getUserName() { return userName; } - /** @param userName The userName to set. */ + /** + * @param userName The userName to set. + */ public void setUserName(String userName) { this.userName = userName; } - /** @return Returns the wildcard. */ + /** + * @return Returns the wildcard. + */ public String getWildcard() { return wildcard; } - /** @param wildcard The wildcard to set. */ + /** + * @param wildcard The wildcard to set. + */ public void setWildcard(String wildcard) { this.wildcard = wildcard; } @@ -272,7 +295,9 @@ public boolean isAddToResult() { return isaddresult; } - /** @return Returns the targetDirectory. */ + /** + * @return Returns the targetDirectory. + */ public String getTargetDirectory() { return targetDirectory; } @@ -293,17 +318,23 @@ public void setCopyPrevious(boolean copyprevious) { this.copyprevious = copyprevious; } - /** @param targetDirectory The targetDirectory to set. */ + /** + * @param targetDirectory The targetDirectory to set. + */ public void setTargetDirectory(String targetDirectory) { this.targetDirectory = targetDirectory; } - /** @param remove The remove to set. */ + /** + * @param remove The remove to set. + */ public void setRemove(boolean remove) { this.remove = remove; } - /** @return Returns the remove. */ + /** + * @return Returns the remove. + */ public boolean getRemove() { return remove; } diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/SftpClient.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/SftpClient.java index d68f722b3ea..de884228646 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/SftpClient.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftp/SftpClient.java @@ -29,6 +29,10 @@ import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpATTRS; import com.jcraft.jsch.SftpException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.FileUtil; @@ -38,11 +42,6 @@ import org.apache.hop.core.util.Utils; import org.apache.hop.core.vfs.HopVfs; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; - public class SftpClient { private static final String COMPRESSION_S2C = "compression.s2c"; diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftpput/ActionSftpPut.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftpput/ActionSftpPut.java index 87c4ee985fa..e3a07a3a50c 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftpput/ActionSftpPut.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftpput/ActionSftpPut.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.actions.sftpput; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.Const; @@ -45,13 +51,6 @@ import org.apache.hop.workflow.actions.sftp.SftpClient; import org.w3c.dom.Node; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines an SFTP put action. */ @Action( id = "SFTPPUT", @@ -286,22 +285,30 @@ public static int getAfterSftpPutByDesc(String tt) { return getAfterSftpPutByCode(tt); } - /** @param createDestinationFolder The create destination folder flag to set. */ + /** + * @param createDestinationFolder The create destination folder flag to set. + */ public void setCreateDestinationFolder(boolean createDestinationFolder) { this.createDestinationFolder = createDestinationFolder; } - /** @return Returns the create destination folder flag */ + /** + * @return Returns the create destination folder flag + */ public boolean isCreateDestinationFolder() { return createDestinationFolder; } - /** @param successWhenNoFile The successWhenNoFile flag to set. */ + /** + * @param successWhenNoFile The successWhenNoFile flag to set. + */ public void setSuccessWhenNoFile(boolean successWhenNoFile) { this.successWhenNoFile = successWhenNoFile; } - /** @return Returns the create successWhenNoFile folder flag */ + /** + * @return Returns the create successWhenNoFile folder flag + */ public boolean isSuccessWhenNoFile() { return successWhenNoFile; } @@ -314,72 +321,100 @@ public String getDestinationFolder() { return destinationFolder; } - /** @return Returns the afterFTPS. */ + /** + * @return Returns the afterFTPS. + */ public int getAfterFtps() { return afterFtps; } - /** @param value The afterFTPS to set. */ + /** + * @param value The afterFTPS to set. + */ public void setAfterFtps(int value) { this.afterFtps = value; } - /** @return Returns the directory. */ + /** + * @return Returns the directory. + */ public String getScpDirectory() { return remoteDirectory; } - /** @param directory The directory to set. */ + /** + * @param directory The directory to set. + */ public void setScpDirectory(String directory) { this.remoteDirectory = directory; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the serverName. */ + /** + * @return Returns the serverName. + */ public String getServerName() { return serverName; } - /** @param serverName The serverName to set. */ + /** + * @param serverName The serverName to set. + */ public void setServerName(String serverName) { this.serverName = serverName; } - /** @return Returns the userName. */ + /** + * @return Returns the userName. + */ public String getUserName() { return userName; } - /** @param userName The userName to set. */ + /** + * @param userName The userName to set. + */ public void setUserName(String userName) { this.userName = userName; } - /** @return Returns the wildcard. */ + /** + * @return Returns the wildcard. + */ public String getWildcard() { return wildcard; } - /** @param wildcard The wildcard to set. */ + /** + * @param wildcard The wildcard to set. + */ public void setWildcard(String wildcard) { this.wildcard = wildcard; } - /** @return Returns the localdirectory. */ + /** + * @return Returns the localdirectory. + */ public String getLocalDirectory() { return localDirectory; } - /** @param localDirectory The localDirectory to set. */ + /** + * @param localDirectory The localDirectory to set. + */ public void setLocalDirectory(String localDirectory) { this.localDirectory = localDirectory; } @@ -432,12 +467,16 @@ public void setAddFilenameResut(boolean addFilenameResut) { this.addFilenameResut = addFilenameResut; } - /** @return Returns the compression. */ + /** + * @return Returns the compression. + */ public String getCompression() { return compression; } - /** @param compression The compression to set. */ + /** + * @param compression The compression to set. + */ public void setCompression(String compression) { this.compression = compression; } diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/util/FtpClientUtil.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/util/FtpClientUtil.java index 6c70ed06873..9275e737376 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/util/FtpClientUtil.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/util/FtpClientUtil.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow.actions.util; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Proxy; import org.apache.commons.lang.StringUtils; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; @@ -27,10 +30,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Proxy; - public class FtpClientUtil { private static final Class PKG = FtpClientUtil.class; // For Translator diff --git a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftp/WorkflowActionFtpLoadSaveTest.java b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftp/WorkflowActionFtpLoadSaveTest.java index 9da307dc231..ea7da5419b1 100644 --- a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftp/WorkflowActionFtpLoadSaveTest.java +++ b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftp/WorkflowActionFtpLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.ftp; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionFtpLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -35,38 +34,38 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "serverPort", - "serverName", - "userName", - "password", - "remoteDirectory", - "targetDirectory", - "wildcard", - "binaryMode", - "timeout", - "remove", - "onlyGettingNewFiles", - "activeConnection", - "controlEncoding", - "moveFiles", - "moveToDirectory", - "addDate", - "addTime", - "specifyFormat", - "dateTimeFormat", - "addDateBeforeExtension", - "addResult", - "createMoveFolder", - "proxyHost", - "proxyPort", - "proxyUsername", - "proxyPassword", - "socksProxyHost", - "socksProxyPort", - "socksProxyUsername", - "socksProxyPassword", - "stringIfFileExists", - "nrLimit", - "successCondition"); + "serverPort", + "serverName", + "userName", + "password", + "remoteDirectory", + "targetDirectory", + "wildcard", + "binaryMode", + "timeout", + "remove", + "onlyGettingNewFiles", + "activeConnection", + "controlEncoding", + "moveFiles", + "moveToDirectory", + "addDate", + "addTime", + "specifyFormat", + "dateTimeFormat", + "addDateBeforeExtension", + "addResult", + "createMoveFolder", + "proxyHost", + "proxyPort", + "proxyUsername", + "proxyPassword", + "socksProxyHost", + "socksProxyPort", + "socksProxyUsername", + "socksProxyPassword", + "stringIfFileExists", + "nrLimit", + "successCondition"); } } diff --git a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpdelete/WorkflowActionFtpDeleteLoadSaveTest.java b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpdelete/WorkflowActionFtpDeleteLoadSaveTest.java index cb41c9c4c49..caff0b87a13 100644 --- a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpdelete/WorkflowActionFtpDeleteLoadSaveTest.java +++ b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpdelete/WorkflowActionFtpDeleteLoadSaveTest.java @@ -17,15 +17,14 @@ package org.apache.hop.workflow.actions.ftpdelete; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionFtpDeleteLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @@ -39,30 +38,30 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "protocol", - "serverName", - "serverPort", - "userName", - "password", - "remoteDirectory", - "wildcard", - "timeout", - "activeConnection", - "useProxy", - "proxyHost", - "proxyPort", - "proxyUsername", - "proxyPassword", - "usePublicKey", - "keyFilename", - "keyFilePass", - "limitSuccess", - "successCondition", - "copyPrevious", - "socksProxyHost", - "socksProxyPort", - "socksProxyUsername", - "socksProxyPassword"); + "protocol", + "serverName", + "serverPort", + "userName", + "password", + "remoteDirectory", + "wildcard", + "timeout", + "activeConnection", + "useProxy", + "proxyHost", + "proxyPort", + "proxyUsername", + "proxyPassword", + "usePublicKey", + "keyFilename", + "keyFilePass", + "limitSuccess", + "successCondition", + "copyPrevious", + "socksProxyHost", + "socksProxyPort", + "socksProxyUsername", + "socksProxyPassword"); } @Override diff --git a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpput/WorkflowActionFtpPutLoadSaveTest.java b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpput/WorkflowActionFtpPutLoadSaveTest.java index 9e1f23e6f87..b344022e6a0 100644 --- a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpput/WorkflowActionFtpPutLoadSaveTest.java +++ b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/ftpput/WorkflowActionFtpPutLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.ftpput; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionFtpPutLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/SftpClientTest.java b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/SftpClientTest.java index 6345738fa04..4b313b9a8fb 100644 --- a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/SftpClientTest.java +++ b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/SftpClientTest.java @@ -17,10 +17,19 @@ package org.apache.hop.workflow.actions.sftp; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; +import java.net.InetAddress; import org.apache.hop.core.exception.HopWorkflowException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.junit.After; @@ -28,16 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.net.InetAddress; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SftpClientTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/WorkflowActionSftpLoadSaveTest.java b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/WorkflowActionSftpLoadSaveTest.java index e2c65b7f338..e93553827cf 100644 --- a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/WorkflowActionSftpLoadSaveTest.java +++ b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftp/WorkflowActionSftpLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.sftp; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionSftpLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -35,25 +34,25 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "serverName", - "serverPort", - "userName", - "password", - "scpDirectory", - "targetDirectory", - "wildcard", - "remove", - "addToResult", - "createTargetFolder", - "copyPrevious", - "useKeyFile", - "keyFilename", - "keyPassPhrase", - "compression", - "proxyType", - "proxyHost", - "proxyPort", - "proxyUsername", - "proxyPassword"); + "serverName", + "serverPort", + "userName", + "password", + "scpDirectory", + "targetDirectory", + "wildcard", + "remove", + "addToResult", + "createTargetFolder", + "copyPrevious", + "useKeyFile", + "keyFilename", + "keyPassPhrase", + "compression", + "proxyType", + "proxyHost", + "proxyPort", + "proxyUsername", + "proxyPassword"); } } diff --git a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftpput/WorkflowActionSftpPutLoadSaveTest.java b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftpput/WorkflowActionSftpPutLoadSaveTest.java index f044bad382c..72f8565239a 100644 --- a/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftpput/WorkflowActionSftpPutLoadSaveTest.java +++ b/plugins/actions/ftp/src/test/java/org/apache/hop/workflow/actions/sftpput/WorkflowActionSftpPutLoadSaveTest.java @@ -17,17 +17,16 @@ package org.apache.hop.workflow.actions.sftpput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IntLoadSaveValidator; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class WorkflowActionSftpPutLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -40,30 +39,30 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "serverName", - "serverPort", - "userName", - "password", - "scpDirectory", - "localDirectory", - "wildcard", - "copyPrevious", - "copyPreviousFiles", - "addFilenameResut", - "useKeyFile", - "keyFilename", - "keyPassPhrase", - "compression", - "proxyType", - "proxyHost", - "proxyPort", - "proxyUsername", - "proxyPassword", - "createRemoteFolder", - "afterFtps", - "destinationFolder", - "createDestinationFolder", - "successWhenNoFile"); + "serverName", + "serverPort", + "userName", + "password", + "scpDirectory", + "localDirectory", + "wildcard", + "copyPrevious", + "copyPreviousFiles", + "addFilenameResut", + "useKeyFile", + "keyFilename", + "keyPassPhrase", + "compression", + "proxyType", + "proxyHost", + "proxyPort", + "proxyUsername", + "proxyPassword", + "createRemoteFolder", + "afterFtps", + "destinationFolder", + "createDestinationFolder", + "successWhenNoFile"); } @Override diff --git a/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/ActionGetPOP.java b/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/ActionGetPOP.java index 6ac28770b82..7891be49fd8 100644 --- a/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/ActionGetPOP.java +++ b/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/ActionGetPOP.java @@ -18,6 +18,12 @@ package org.apache.hop.workflow.actions.getpop; import jakarta.mail.Flags.Flag; +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; @@ -46,13 +52,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Pattern; - /** This defines an get pop action. */ @Action( id = "GET_POP", @@ -374,7 +373,7 @@ public void setPort(String sslport) { this.sslport = sslport; } - public void setUseXOAUTH2( boolean usexoauth2 ) { + public void setUseXOAUTH2(boolean usexoauth2) { this.usexoauth2 = usexoauth2; } @@ -618,7 +617,9 @@ public String geProxyUsername() { return this.proxyusername; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } @@ -643,12 +644,16 @@ public void setAttachmentFolder(String folderName) { this.attachmentfolder = folderName; } - /** @param delete The delete to set. */ + /** + * @param delete The delete to set. + */ public void setDelete(boolean delete) { this.delete = delete; } - /** @return Returns the delete. */ + /** + * @return Returns the delete. + */ public boolean getDelete() { return delete; } @@ -677,17 +682,23 @@ public String getAttachmentWildcard() { return attachmentwildcard; } - /** @param usessl The usessl to set. */ + /** + * @param usessl The usessl to set. + */ public void setUseSSL(boolean usessl) { this.usessl = usessl; } - /** @return Returns the usessl. */ + /** + * @return Returns the usessl. + */ public boolean isUseSSL() { return this.usessl; } - /** @return Returns the useproxy. */ + /** + * @return Returns the useproxy. + */ public boolean isUseProxy() { return this.useproxy; } @@ -728,7 +739,9 @@ public boolean isDifferentFolderForAttachment() { return this.usedifferentfolderforattachment; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } @@ -1097,8 +1110,7 @@ void fetchOneFolder( // Get next message mailConn.fetchNext(); int messagenumber = mailConn.getMessage().getMessageNumber(); - boolean okPOP3 = - usePOP3 ? true : false; + boolean okPOP3 = usePOP3 ? true : false; boolean okIMAP = !usePOP3; if (okPOP3 || okIMAP) { diff --git a/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/MailConnection.java b/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/MailConnection.java index 5ae084b7418..56f69f0980d 100644 --- a/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/MailConnection.java +++ b/plugins/actions/getpop/src/main/java/org/apache/hop/workflow/actions/getpop/MailConnection.java @@ -41,15 +41,6 @@ import jakarta.mail.search.RecipientStringTerm; import jakarta.mail.search.SearchTerm; import jakarta.mail.search.SubjectTerm; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.vfs.HopVfs; -import org.apache.hop.i18n.BaseMessages; - import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -61,6 +52,14 @@ import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.vfs.HopVfs; +import org.apache.hop.i18n.BaseMessages; /** MailConnection handles the process of connecting to, reading from POP3/IMAP. */ public class MailConnection { @@ -76,6 +75,7 @@ public class MailConnection { private boolean usexoauth2; private boolean useproxy; private String proxyusername; + /** Protocol used. Should be PROTOCOL_POP3 (0) for POP3 and PROTOCOL_IMAP (1) to IMAP */ private int protocol; @@ -83,8 +83,10 @@ public class MailConnection { private Session session = null; private Store store = null; private Folder folder = null; + /** Contains the list of retrieved messages */ private Message[] messages; + /** Contains the current message */ private Message message; @@ -190,8 +192,8 @@ public MailConnection( this.prop.setProperty("mail." + protocolString + ".port", "" + port); this.prop.setProperty("mail." + protocolString + ".socketFactory.port", "" + port); if (usexoauth2) { - this.prop.setProperty("mail." + protocolString + ".ssl.enable", "true"); - this.prop.setProperty("mail." + protocolString + ".auth.mechanisms", "XOAUTH2"); + this.prop.setProperty("mail." + protocolString + ".ssl.enable", "true"); + this.prop.setProperty("mail." + protocolString + ".auth.mechanisms", "XOAUTH2"); } // Create session object @@ -230,12 +232,16 @@ public MailConnection( } } - /** @return Returns the connection status. true if the connection is still opened */ + /** + * @return Returns the connection status. true if the connection is still opened + */ public boolean isConnected() { return (this.store != null && this.store.isConnected()); } - /** @return Returns the use of SSL. true if the connection use SSL */ + /** + * @return Returns the use of SSL. true if the connection use SSL + */ public boolean isUseSSL() { return this.usessl; } @@ -247,22 +253,30 @@ public boolean isUseXOAUTH2() { return this.usexoauth2; } - /** @return Returns the use of proxy. true if the connection use proxy */ + /** + * @return Returns the use of proxy. true if the connection use proxy + */ public boolean isUseProxy() { return this.useproxy; } - /** @return Returns the proxy username. */ + /** + * @return Returns the proxy username. + */ public String getProxyUsername() { return this.proxyusername; } - /** @return Returns the store */ + /** + * @return Returns the store + */ public Store getStore() { return this.store; } - /** @return Returns the folder */ + /** + * @return Returns the folder + */ public Folder getFolder() { return this.folder; } diff --git a/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/MailConnectionTest.java b/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/MailConnectionTest.java index e691b648f37..8e942d3637d 100644 --- a/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/MailConnectionTest.java +++ b/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/MailConnectionTest.java @@ -16,9 +16,13 @@ */ package org.apache.hop.workflow.actions.getpop; +import static org.mockito.Mockito.when; + import jakarta.mail.Folder; import jakarta.mail.MessagingException; import jakarta.mail.Store; +import java.io.File; +import java.io.IOException; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -28,11 +32,6 @@ import org.mockito.Mockito; import org.mockito.stubbing.Answer; -import java.io.File; -import java.io.IOException; - -import static org.mockito.Mockito.when; - public class MailConnectionTest { private Mconn conn; diff --git a/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java b/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java index 07040409826..de148747809 100644 --- a/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java +++ b/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java @@ -17,17 +17,16 @@ package org.apache.hop.workflow.actions.getpop; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IntLoadSaveValidator; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class WorkflowActionGetPOPLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -40,45 +39,45 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "serverName", - "userName", - "password", - "useSSL", - "port", - "outputDirectory", - "filenamePattern", - "retrievemails", - "firstMails", - "delete", - "saveMessage", - "saveAttachment", - "differentFolderForAttachment", - "protocol", - "attachmentFolder", - "attachmentWildcard", - "valueImapList", - "firstIMAPMails", - "IMAPFolder", - "senderSearchTerm", - "notTermSenderSearch", - "receipientSearch", - "notTermReceipientSearch", - "subjectSearch", - "notTermSubjectSearch", - "bodySearch", - "notTermBodySearch", - "conditionReceivedDate", - "notTermReceivedDateSearch", - "receivedDate1", - "receivedDate2", - "actiontype", - "moveToIMAPFolder", - "createMoveToFolder", - "createLocalFolder", - "afterGetIMAP", - "includeSubFolders", - "useProxy", - "proxyUsername"); + "serverName", + "userName", + "password", + "useSSL", + "port", + "outputDirectory", + "filenamePattern", + "retrievemails", + "firstMails", + "delete", + "saveMessage", + "saveAttachment", + "differentFolderForAttachment", + "protocol", + "attachmentFolder", + "attachmentWildcard", + "valueImapList", + "firstIMAPMails", + "IMAPFolder", + "senderSearchTerm", + "notTermSenderSearch", + "receipientSearch", + "notTermReceipientSearch", + "subjectSearch", + "notTermSubjectSearch", + "bodySearch", + "notTermBodySearch", + "conditionReceivedDate", + "notTermReceivedDateSearch", + "receivedDate1", + "receivedDate2", + "actiontype", + "moveToIMAPFolder", + "createMoveToFolder", + "createLocalFolder", + "afterGetIMAP", + "includeSubFolders", + "useProxy", + "proxyUsername"); } @Override diff --git a/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowEntryGetPOPTest.java b/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowEntryGetPOPTest.java index cac6e34a681..81074f65c82 100644 --- a/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowEntryGetPOPTest.java +++ b/plugins/actions/getpop/src/test/java/org/apache/hop/workflow/actions/getpop/WorkflowEntryGetPOPTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.workflow.actions.getpop; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import jakarta.activation.DataHandler; import jakarta.activation.FileDataSource; import jakarta.mail.Flags.Flag; @@ -23,6 +27,9 @@ import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeBodyPart; import jakarta.mail.internet.MimeMultipart; +import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.LogLevel; @@ -37,14 +44,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import java.io.File; -import java.io.IOException; -import java.text.SimpleDateFormat; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - public class WorkflowEntryGetPOPTest { @Mock MailConnection mailConn; diff --git a/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java b/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java index e4f3d9a801b..df2f32c5b04 100644 --- a/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java +++ b/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java @@ -17,6 +17,22 @@ package org.apache.hop.workflow.actions.http; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Authenticator; +import java.net.MalformedURLException; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.net.URLConnection; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.net.ssl.HttpsURLConnection; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -43,23 +59,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.w3c.dom.Node; -import javax.net.ssl.HttpsURLConnection; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Authenticator; -import java.net.MalformedURLException; -import java.net.PasswordAuthentication; -import java.net.URL; -import java.net.URLConnection; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** This defines an HTTP action. */ @Action( id = "HTTP", @@ -237,22 +236,30 @@ public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVari } } - /** @return Returns the URL. */ + /** + * @return Returns the URL. + */ public String getUrl() { return url; } - /** @param url The URL to set. */ + /** + * @param url The URL to set. + */ public void setUrl(String url) { this.url = url; } - /** @return Returns the target filename. */ + /** + * @return Returns the target filename. + */ public String getTargetFilename() { return targetFilename; } - /** @param targetFilename The target filename to set. */ + /** + * @param targetFilename The target filename to set. + */ public void setTargetFilename(String targetFilename) { this.targetFilename = targetFilename; } @@ -438,7 +445,8 @@ protected PasswordAuthentication getPasswordAuthentication() { if (isIgnoreSsl()) { HttpsURLConnection httpsConn = (HttpsURLConnection) connection; - httpsConn.setSSLSocketFactory(HttpClientManager.getTrustAllSslContext().getSocketFactory()); + httpsConn.setSSLSocketFactory( + HttpClientManager.getTrustAllSslContext().getSocketFactory()); httpsConn.setHostnameVerifier(HttpClientManager.getHostnameVerifier(isDebug(), log)); } @@ -587,12 +595,16 @@ public void setUploadFilename(String uploadFilename) { this.uploadFilename = uploadFilename; } - /** @return Returns the Result URL Fieldname. */ + /** + * @return Returns the Result URL Fieldname. + */ public String getUrlFieldname() { return urlFieldname; } - /** @param getFieldname The Result URL Fieldname to set. */ + /** + * @param getFieldname The Result URL Fieldname to set. + */ public void setUrlFieldname(String getFieldname) { this.urlFieldname = getFieldname; } @@ -627,42 +639,58 @@ public void setDestinationFieldname(String destinationFieldname) { this.destinationFieldname = destinationFieldname; } - /** @return Returns the runForEveryRow. */ + /** + * @return Returns the runForEveryRow. + */ public boolean isRunForEveryRow() { return runForEveryRow; } - /** @param runForEveryRow The runForEveryRow to set. */ + /** + * @param runForEveryRow The runForEveryRow to set. + */ public void setRunForEveryRow(boolean runForEveryRow) { this.runForEveryRow = runForEveryRow; } - /** @return Returns the fileAppended. */ + /** + * @return Returns the fileAppended. + */ public boolean isFileAppended() { return fileAppended; } - /** @param fileAppended The fileAppended to set. */ + /** + * @param fileAppended The fileAppended to set. + */ public void setFileAppended(boolean fileAppended) { this.fileAppended = fileAppended; } - /** @return Returns the dateTimeAdded. */ + /** + * @return Returns the dateTimeAdded. + */ public boolean isDateTimeAdded() { return dateTimeAdded; } - /** @param dateTimeAdded The dateTimeAdded to set. */ + /** + * @param dateTimeAdded The dateTimeAdded to set. + */ public void setDateTimeAdded(boolean dateTimeAdded) { this.dateTimeAdded = dateTimeAdded; } - /** @return Returns the uploadFilenameExtension. */ + /** + * @return Returns the uploadFilenameExtension. + */ public String getTargetFilenameExtension() { return targetFilenameExtension; } - /** @param uploadFilenameExtension The uploadFilenameExtension to set. */ + /** + * @param uploadFilenameExtension The uploadFilenameExtension to set. + */ public void setTargetFilenameExtension(String uploadFilenameExtension) { this.targetFilenameExtension = uploadFilenameExtension; } diff --git a/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttpDialog.java b/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttpDialog.java index 8fd2f2b6f76..4726d2ebea0 100644 --- a/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttpDialog.java +++ b/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttpDialog.java @@ -225,7 +225,7 @@ public IAction open() { // START OF TargetFileGroupGROUP/// // / Group wTargetFileGroup = setupWebServerReplyGroup(wGeneralComp); - + setupTargetFileLine(lsMod, middle, margin, wTargetFileGroup); setupAppendFileLine(middle, margin, wTargetFileGroup); setupAddDateTimeLine(middle, margin, wTargetFileGroup); @@ -290,7 +290,8 @@ public IAction open() { return action; } - private void setupHeaderTable(ModifyListener lsMod, int margin, CTabItem wHeadersTab, Composite wHeadersComp) { + private void setupHeaderTable( + ModifyListener lsMod, int margin, CTabItem wHeadersTab, Composite wHeadersComp) { int rows = action.getHeaderName() == null ? 1 @@ -361,7 +362,8 @@ private void setupAddFilenameLine(int middle, int margin, Group wTargetFileGroup wAddFilenameToResult.setLayoutData(fdAddFilenameToResult); } - private void setupTargetExtensionLine(ModifyListener lsMod, int middle, int margin, Group wTargetFileGroup) { + private void setupTargetExtensionLine( + ModifyListener lsMod, int middle, int margin, Group wTargetFileGroup) { // TargetExt line wlTargetExt = new Label(wTargetFileGroup, SWT.RIGHT); wlTargetExt.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileExt.Label")); @@ -430,7 +432,8 @@ private void setupAppendFileLine(int middle, int margin, Group wTargetFileGroup) wAppend.setLayoutData(fdAppend); } - private void setupTargetFileLine(ModifyListener lsMod, int middle, int margin, Group wTargetFileGroup) { + private void setupTargetFileLine( + ModifyListener lsMod, int middle, int margin, Group wTargetFileGroup) { // TargetFile line wlTargetFile = new Label(wTargetFileGroup, SWT.RIGHT); wlTargetFile.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFile.Label")); @@ -478,7 +481,8 @@ private Group setupWebServerReplyGroup(Composite wGeneralComp) { return wTargetFileGroup; } - private void setupUploadFileLine(ModifyListener lsMod, int middle, int margin, Group wAuthentication, Group wUpLoadFile) { + private void setupUploadFileLine( + ModifyListener lsMod, int middle, int margin, Group wAuthentication, Group wUpLoadFile) { // UploadFile line wlUploadFile = new Label(wUpLoadFile, SWT.RIGHT); wlUploadFile.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadFile.Label")); @@ -530,7 +534,8 @@ private Group setupUploadFileGroup(Composite wGeneralComp) { return wUpLoadFile; } - private void setupIgnoreHostLine(ModifyListener lsMod, int middle, int margin, Group wAuthentication) { + private void setupIgnoreHostLine( + ModifyListener lsMod, int middle, int margin, Group wAuthentication) { // IgnoreHosts line Label wlNonProxyHosts = new Label(wAuthentication, SWT.RIGHT); wlNonProxyHosts.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyIgnoreRegexp.Label")); @@ -552,7 +557,8 @@ private void setupIgnoreHostLine(ModifyListener lsMod, int middle, int margin, G wNonProxyHosts.setLayoutData(fdNonProxyHosts); } - private void setupProxyPortLine(ModifyListener lsMod, int middle, int margin, Group wAuthentication) { + private void setupProxyPortLine( + ModifyListener lsMod, int middle, int margin, Group wAuthentication) { // ProxyPort line Label wlProxyPort = new Label(wAuthentication, SWT.RIGHT); wlProxyPort.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyPort.Label")); @@ -573,7 +579,8 @@ private void setupProxyPortLine(ModifyListener lsMod, int middle, int margin, Gr wProxyPort.setLayoutData(fdProxyPort); } - private void setupProxyServerLine(ModifyListener lsMod, int middle, int margin, Group wAuthentication) { + private void setupProxyServerLine( + ModifyListener lsMod, int middle, int margin, Group wAuthentication) { // ProxyServer line Label wlProxyServer = new Label(wAuthentication, SWT.RIGHT); wlProxyServer.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyHost.Label")); @@ -594,7 +601,8 @@ private void setupProxyServerLine(ModifyListener lsMod, int middle, int margin, wProxyServer.setLayoutData(fdProxyServer); } - private void setupPasswordLine(ModifyListener lsMod, int middle, int margin, Group wAuthentication) { + private void setupPasswordLine( + ModifyListener lsMod, int middle, int margin, Group wAuthentication) { // Password line Label wlPassword = new Label(wAuthentication, SWT.RIGHT); wlPassword.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadPassword.Label")); @@ -615,7 +623,8 @@ private void setupPasswordLine(ModifyListener lsMod, int middle, int margin, Gro wPassword.setLayoutData(fdPassword); } - private void setupUsernameLine(ModifyListener lsMod, int middle, int margin, Group wAuthentication) { + private void setupUsernameLine( + ModifyListener lsMod, int middle, int margin, Group wAuthentication) { // UserName line Label wlUserName = new Label(wAuthentication, SWT.RIGHT); wlUserName.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadUser.Label")); @@ -648,7 +657,8 @@ private Group setupAuthGroup(Composite wGeneralComp) { return wAuthentication; } - private void setupDestFileLine(ModifyListener lsMod, int middle, int margin, Composite wGeneralComp) { + private void setupDestFileLine( + ModifyListener lsMod, int middle, int margin, Composite wGeneralComp) { // FieldTarget line wlFieldTarget = new Label(wGeneralComp, SWT.RIGHT); wlFieldTarget.setText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldDest.Label")); @@ -669,7 +679,8 @@ private void setupDestFileLine(ModifyListener lsMod, int middle, int margin, Com wFieldTarget.setLayoutData(fdFieldTarget); } - private void setupUploadFileLine(ModifyListener lsMod, int middle, int margin, Composite wGeneralComp) { + private void setupUploadFileLine( + ModifyListener lsMod, int middle, int margin, Composite wGeneralComp) { // FieldUpload line wlFieldUpload = new Label(wGeneralComp, SWT.RIGHT); wlFieldUpload.setText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldUpload.Label")); @@ -690,7 +701,8 @@ private void setupUploadFileLine(ModifyListener lsMod, int middle, int margin, C wFieldUpload.setLayoutData(fdFieldUpload); } - private void setupUrlFieldLine(ModifyListener lsMod, int middle, int margin, Composite wGeneralComp) { + private void setupUrlFieldLine( + ModifyListener lsMod, int middle, int margin, Composite wGeneralComp) { // FieldURL line wlFieldURL = new Label(wGeneralComp, SWT.RIGHT); wlFieldURL.setText(BaseMessages.getString(PKG, "ActionHTTP.InputField.Label")); diff --git a/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpLoadSaveTest.java b/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpLoadSaveTest.java index bd508626560..4ec5333d03f 100644 --- a/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpLoadSaveTest.java +++ b/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.http; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -24,12 +29,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class ActionHttpLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -41,24 +40,24 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "url", - "targetFilename", - "fileAppended", - "dateTimeAdded", - "targetFilenameExtension", - "uploadFilename", - "runForEveryRow", - "urlFieldname", - "uploadFieldname", - "destinationFieldname", - "username", - "password", - "proxyHostname", - "proxyPort", - "nonProxyHosts", - "addFilenameToResult", - "headerName", - "headerValue"); + "url", + "targetFilename", + "fileAppended", + "dateTimeAdded", + "targetFilenameExtension", + "uploadFilename", + "runForEveryRow", + "urlFieldname", + "uploadFieldname", + "destinationFieldname", + "username", + "password", + "proxyHostname", + "proxyPort", + "nonProxyHosts", + "addFilenameToResult", + "headerName", + "headerValue"); } @Override diff --git a/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpTest.java b/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpTest.java index a53bf79a79a..76ccebfe16e 100644 --- a/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpTest.java +++ b/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttpTest.java @@ -16,6 +16,8 @@ */ package org.apache.hop.workflow.actions.http; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -27,8 +29,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertTrue; - public class ActionHttpTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttp_PDI208_Test.java b/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttp_PDI208_Test.java index 4d229ac57a9..162ecc391a8 100644 --- a/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttp_PDI208_Test.java +++ b/plugins/actions/http/src/test/java/org/apache/hop/workflow/actions/http/ActionHttp_PDI208_Test.java @@ -17,8 +17,18 @@ package org.apache.hop.workflow.actions.http; +import static org.junit.Assert.assertTrue; + import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpServer; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import org.apache.commons.io.FileUtils; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.Result; @@ -33,17 +43,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static org.junit.Assert.assertTrue; - public class ActionHttp_PDI208_Test { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMail.java b/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMail.java index 1998261d17a..0054612cf28 100644 --- a/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMail.java +++ b/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMail.java @@ -30,6 +30,15 @@ import jakarta.mail.internet.MimeBodyPart; import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.MimeMultipart; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.Const; @@ -58,16 +67,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.w3c.dom.Node; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.Properties; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - /** Describes a Mail Workflow Entry. */ @Action( id = "MAIL", @@ -479,7 +478,7 @@ public void setAuthenticationPassword(String authenticationPassword) { this.authenticationPassword = authenticationPassword; } - public void setUseXOAUTH2( boolean usexoauth2 ) { + public void setUseXOAUTH2(boolean usexoauth2) { this.usexoauth2 = usexoauth2; } diff --git a/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMailDialog.java b/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMailDialog.java index 8499138849d..723e753b6fd 100644 --- a/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMailDialog.java +++ b/plugins/actions/mail/src/main/java/org/apache/hop/workflow/actions/mail/ActionMailDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow.actions.mail; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Random; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.ResultFile; @@ -59,10 +62,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Random; - /** Dialog that allows you to edit a ActionMail object. */ public class ActionMailDialog extends ActionDialog implements IActionDialog { private static final Class PKG = ActionMail.class; // For Translator @@ -515,22 +514,22 @@ public void widgetSelected(SelectionEvent e) { }); // USE connection with XOAUTH2 - wlUseXOAUTH2 = new Label( wAuthentificationGroup, SWT.RIGHT ); - wlUseXOAUTH2.setText( BaseMessages.getString( PKG, "ActionMail.UseXOAUTH2Mails.Label" ) ); - PropsUi.setLook( wlUseXOAUTH2 ); + wlUseXOAUTH2 = new Label(wAuthentificationGroup, SWT.RIGHT); + wlUseXOAUTH2.setText(BaseMessages.getString(PKG, "ActionMail.UseXOAUTH2Mails.Label")); + PropsUi.setLook(wlUseXOAUTH2); FormData fdlUseXOAUTH2 = new FormData(); - fdlUseXOAUTH2.left = new FormAttachment( 0, 0 ); - fdlUseXOAUTH2.top = new FormAttachment( wUseAuth, margin ); - fdlUseXOAUTH2.right = new FormAttachment( middle, -margin ); - wlUseXOAUTH2.setLayoutData( fdlUseXOAUTH2 ); - wUseXOAUTH2 = new Button( wAuthentificationGroup, SWT.CHECK ); - PropsUi.setLook( wUseXOAUTH2 ); + fdlUseXOAUTH2.left = new FormAttachment(0, 0); + fdlUseXOAUTH2.top = new FormAttachment(wUseAuth, margin); + fdlUseXOAUTH2.right = new FormAttachment(middle, -margin); + wlUseXOAUTH2.setLayoutData(fdlUseXOAUTH2); + wUseXOAUTH2 = new Button(wAuthentificationGroup, SWT.CHECK); + PropsUi.setLook(wUseXOAUTH2); FormData fdUseXOAUTH2 = new FormData(); - wUseXOAUTH2.setToolTipText( BaseMessages.getString( PKG, "ActionMail.UseXOAUTH2Mails.Tooltip" ) ); - fdUseXOAUTH2.left = new FormAttachment( middle, margin ); - fdUseXOAUTH2.top = new FormAttachment( wlUseXOAUTH2, 0 , SWT.CENTER); - fdUseXOAUTH2.right = new FormAttachment( 100, 0 ); - wUseXOAUTH2.setLayoutData( fdUseXOAUTH2 ); + wUseXOAUTH2.setToolTipText(BaseMessages.getString(PKG, "ActionMail.UseXOAUTH2Mails.Tooltip")); + fdUseXOAUTH2.left = new FormAttachment(middle, margin); + fdUseXOAUTH2.top = new FormAttachment(wlUseXOAUTH2, 0, SWT.CENTER); + fdUseXOAUTH2.right = new FormAttachment(100, 0); + wUseXOAUTH2.setLayoutData(fdUseXOAUTH2); // AuthUser line wAuthUser = diff --git a/plugins/actions/mail/src/test/java/org/apache/hop/workflow/actions/mail/WorkflowActionMailLoadSaveTest.java b/plugins/actions/mail/src/test/java/org/apache/hop/workflow/actions/mail/WorkflowActionMailLoadSaveTest.java index ec3fee8ec1d..4e8d29fd154 100644 --- a/plugins/actions/mail/src/test/java/org/apache/hop/workflow/actions/mail/WorkflowActionMailLoadSaveTest.java +++ b/plugins/actions/mail/src/test/java/org/apache/hop/workflow/actions/mail/WorkflowActionMailLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.mail; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.core.ResultFile; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; @@ -27,12 +32,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionMailLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -44,37 +43,37 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "server", - "port", - "destination", - "destinationCc", - "destinationBCc", - "replyAddress", - "replyName", - "subject", - "includeDate", - "contactPerson", - "contactPhone", - "comment", - "includingFiles", - "zipFiles", - "zipFilename", - "usingAuthentication", - "usingSecureAuthentication", - "authenticationUser", - "authenticationPassword", - "onlySendComment", - "useHTML", - "usePriority", - "encoding", - "priority", - "importance", - "sensitivity", - "secureConnectionType", - "replyToAddresses", - "fileType", - "embeddedimages", - "contentids"); + "server", + "port", + "destination", + "destinationCc", + "destinationBCc", + "replyAddress", + "replyName", + "subject", + "includeDate", + "contactPerson", + "contactPhone", + "comment", + "includingFiles", + "zipFiles", + "zipFilename", + "usingAuthentication", + "usingSecureAuthentication", + "authenticationUser", + "authenticationPassword", + "onlySendComment", + "useHTML", + "usePriority", + "encoding", + "priority", + "importance", + "sensitivity", + "secureConnectionType", + "replyToAddresses", + "fileType", + "embeddedimages", + "contentids"); } @Override diff --git a/plugins/actions/movefiles/src/main/java/org/apache/hop/workflow/actions/movefiles/ActionMoveFiles.java b/plugins/actions/movefiles/src/main/java/org/apache/hop/workflow/actions/movefiles/ActionMoveFiles.java index 999950f37fa..3f8a38573be 100644 --- a/plugins/actions/movefiles/src/main/java/org/apache/hop/workflow/actions/movefiles/ActionMoveFiles.java +++ b/plugins/actions/movefiles/src/main/java/org/apache/hop/workflow/actions/movefiles/ActionMoveFiles.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.actions.movefiles; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -45,13 +51,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'move files' action. */ @Action( id = "MOVE_FILES", @@ -758,8 +757,7 @@ public boolean includeFile(FileSelectInfo info) { return entrystatus; } - private boolean moveFile - ( + private boolean moveFile( String shortfilename, FileObject sourcefilename, FileObject destinationfilename, @@ -774,9 +772,9 @@ public boolean includeFile(FileSelectInfo info) { if (includeSubfolders) { // Check if - FileObject destinationFilePath = HopVfs.getFileObject(destinationfilename.getName().getParent().toString()); - if (!destinationFilePath.exists()) - destinationFilePath.createFolder(); + FileObject destinationFilePath = + HopVfs.getFileObject(destinationfilename.getName().getParent().toString()); + if (!destinationFilePath.exists()) destinationFilePath.createFolder(); } if (!simulate) { diff --git a/plugins/actions/movefiles/src/test/java/org/apache/hop/workflow/actions/movefiles/WorkflowActionMoveFilesTest.java b/plugins/actions/movefiles/src/test/java/org/apache/hop/workflow/actions/movefiles/WorkflowActionMoveFilesTest.java index 5ff87ab1b6a..95bb5d14fe3 100644 --- a/plugins/actions/movefiles/src/test/java/org/apache/hop/workflow/actions/movefiles/WorkflowActionMoveFilesTest.java +++ b/plugins/actions/movefiles/src/test/java/org/apache/hop/workflow/actions/movefiles/WorkflowActionMoveFilesTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.movefiles; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionMoveFilesTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/msgboxinfo/src/main/java/org/apache/hop/workflow/actions/msgboxinfo/ActionMsgBoxInfo.java b/plugins/actions/msgboxinfo/src/main/java/org/apache/hop/workflow/actions/msgboxinfo/ActionMsgBoxInfo.java index 81d0a03de7b..4d0d0fd3d2c 100644 --- a/plugins/actions/msgboxinfo/src/main/java/org/apache/hop/workflow/actions/msgboxinfo/ActionMsgBoxInfo.java +++ b/plugins/actions/msgboxinfo/src/main/java/org/apache/hop/workflow/actions/msgboxinfo/ActionMsgBoxInfo.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.msgboxinfo; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -33,8 +34,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.w3c.dom.Node; -import java.util.List; - /** Action type to display a message box. */ @Action( id = "MSGBOX_INFO", diff --git a/plugins/actions/msgboxinfo/src/test/java/org/apache/hop/workflow/actions/msgboxinfo/WorkflowActionMsgBoxInfoTest.java b/plugins/actions/msgboxinfo/src/test/java/org/apache/hop/workflow/actions/msgboxinfo/WorkflowActionMsgBoxInfoTest.java index bc9c63c205d..5fae91bebe0 100644 --- a/plugins/actions/msgboxinfo/src/test/java/org/apache/hop/workflow/actions/msgboxinfo/WorkflowActionMsgBoxInfoTest.java +++ b/plugins/actions/msgboxinfo/src/test/java/org/apache/hop/workflow/actions/msgboxinfo/WorkflowActionMsgBoxInfoTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.msgboxinfo; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionMsgBoxInfoTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/mssqlbulkload/src/main/java/org/apache/hop/workflow/actions/mssqlbulkload/ActionMssqlBulkLoad.java b/plugins/actions/mssqlbulkload/src/main/java/org/apache/hop/workflow/actions/mssqlbulkload/ActionMssqlBulkLoad.java index 7c49653d8d7..4f28ee4f9be 100644 --- a/plugins/actions/mssqlbulkload/src/main/java/org/apache/hop/workflow/actions/mssqlbulkload/ActionMssqlBulkLoad.java +++ b/plugins/actions/mssqlbulkload/src/main/java/org/apache/hop/workflow/actions/mssqlbulkload/ActionMssqlBulkLoad.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.mssqlbulkload; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.provider.local.LocalFile; import org.apache.hop.core.Const; @@ -48,11 +52,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - /** This defines a MSSQL Bulk action. */ @Action( id = "MSSQL_BULK_LOAD", @@ -514,7 +513,7 @@ public Result execute(Result previousResult, int nr) { logError("An error occurred executing this action : " + je.getMessage(), je); } catch (HopFileException e) { logError("An error occurred executing this action : " + e.getMessage(), e); - result.setNrErrors(1); + result.setNrErrors(1); } } else { // Of course, the table should have been created already before the bulk load diff --git a/plugins/actions/mssqlbulkload/src/test/java/org/apache/hop/workflow/actions/mssqlbulkload/WorkflowActionMssqlBulkLoadLoadSaveTest.java b/plugins/actions/mssqlbulkload/src/test/java/org/apache/hop/workflow/actions/mssqlbulkload/WorkflowActionMssqlBulkLoadLoadSaveTest.java index 8ed7297656f..18894504eda 100644 --- a/plugins/actions/mssqlbulkload/src/test/java/org/apache/hop/workflow/actions/mssqlbulkload/WorkflowActionMssqlBulkLoadLoadSaveTest.java +++ b/plugins/actions/mssqlbulkload/src/test/java/org/apache/hop/workflow/actions/mssqlbulkload/WorkflowActionMssqlBulkLoadLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.mssqlbulkload; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionMssqlBulkLoadLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -36,31 +35,31 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "schemaname", - "tablename", - "filename", - "dataFileType", - "fieldTerminator", - "lineterminated", - "codePage", - "specificCodePage", - "formatFilename", - "fireTriggers", - "checkConstraints", - "keepNulls", - "keepIdentity", - "tablock", - "startFile", - "endFile", - "orderBy", - "orderDirection", - "maxErrors", - "batchSize", - "rowsPerBatch", - "errorFilename", - "addDatetime", - "addFileToResult", - "truncate", - "database"); + "schemaname", + "tablename", + "filename", + "dataFileType", + "fieldTerminator", + "lineterminated", + "codePage", + "specificCodePage", + "formatFilename", + "fireTriggers", + "checkConstraints", + "keepNulls", + "keepIdentity", + "tablock", + "startFile", + "endFile", + "orderBy", + "orderDirection", + "maxErrors", + "batchSize", + "rowsPerBatch", + "errorFilename", + "addDatetime", + "addFileToResult", + "truncate", + "database"); } } diff --git a/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFile.java b/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFile.java index 6fc06874d85..5cc5412bb23 100644 --- a/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFile.java +++ b/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFile.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.mysqlbulkfile; +import java.io.File; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -44,11 +48,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.w3c.dom.Node; -import java.io.File; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.List; - /** This defines an MYSQL Bulk file action. */ @Action( id = "MYSQL_BULK_FILE", diff --git a/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFileDialog.java b/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFileDialog.java index 075ffa8843e..2ce41e947f3 100644 --- a/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFileDialog.java +++ b/plugins/actions/mysqlbulkfile/src/main/java/org/apache/hop/workflow/actions/mysqlbulkfile/ActionMysqlBulkFileDialog.java @@ -644,7 +644,7 @@ private void getListColumns() { if (!Utils.isEmpty(wTableName.getText())) { DatabaseMeta databaseMeta = getWorkflowMeta().findDatabase(wConnection.getText(), variables); if (databaseMeta != null) { - + try (Database database = new Database(loggingObject, variables, databaseMeta)) { database.connect(); IRowMeta row = database.getTableFieldsMeta(wSchemaName.getText(), wTableName.getText()); diff --git a/plugins/actions/mysqlbulkfile/src/test/java/org/apache/hop/workflow/actions/mysqlbulkfile/WorkflowActionMysqlBulkFileLoadSaveTest.java b/plugins/actions/mysqlbulkfile/src/test/java/org/apache/hop/workflow/actions/mysqlbulkfile/WorkflowActionMysqlBulkFileLoadSaveTest.java index 28a5c96c8cd..0da6edc6ddc 100644 --- a/plugins/actions/mysqlbulkfile/src/test/java/org/apache/hop/workflow/actions/mysqlbulkfile/WorkflowActionMysqlBulkFileLoadSaveTest.java +++ b/plugins/actions/mysqlbulkfile/src/test/java/org/apache/hop/workflow/actions/mysqlbulkfile/WorkflowActionMysqlBulkFileLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.mysqlbulkfile; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionMysqlBulkFileLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -36,19 +35,19 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "schemaName", - "tableName", - "filename", - "separator", - "enclosed", - "optionEnclosed", - "lineTerminated", - "limitLines", - "listColumn", - "highPriority", - "outDumpValue", - "ifFileExists", - "addFileToResult", - "database"); + "schemaName", + "tableName", + "filename", + "separator", + "enclosed", + "optionEnclosed", + "lineTerminated", + "limitLines", + "listColumn", + "highPriority", + "outDumpValue", + "ifFileExists", + "addFileToResult", + "database"); } } diff --git a/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoad.java b/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoad.java index 93e34955285..73e4a9d917d 100644 --- a/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoad.java +++ b/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoad.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.mysqlbulkload; +import java.io.File; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.provider.local.LocalFile; import org.apache.hop.core.Const; @@ -48,9 +50,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.io.File; -import java.util.List; - /** This defines a MySQL action. */ @Action( id = "MYSQL_BULK_LOAD", @@ -250,8 +249,8 @@ public Result execute(Result previousResult, int nr) { } if (connection != null) { - // User has specified a connection, We can continue ... - try ( Database db = new Database(this, this, connection)) { + // User has specified a connection, We can continue ... + try (Database db = new Database(this, this, connection)) { db.connect(); // Get schemaname String realSchemaname = resolve(schemaname); diff --git a/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoadDialog.java b/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoadDialog.java index d49eac8d41c..8627a26a9a8 100644 --- a/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoadDialog.java +++ b/plugins/actions/mysqlbulkload/src/main/java/org/apache/hop/workflow/actions/mysqlbulkload/ActionMysqlBulkLoadDialog.java @@ -678,7 +678,7 @@ private void getTableName() { private void getListColumns() { if (!Utils.isEmpty(wTablename.getText())) { DatabaseMeta databaseMeta = getWorkflowMeta().findDatabase(wConnection.getText(), variables); - if (databaseMeta != null) { + if (databaseMeta != null) { try (Database database = new Database(loggingObject, variables, databaseMeta)) { database.connect(); String schemaTable = diff --git a/plugins/actions/mysqlbulkload/src/test/java/org/apache/hop/workflow/actions/mysqlbulkload/WorkflowActionMysqlBulkLoadLoadSaveTest.java b/plugins/actions/mysqlbulkload/src/test/java/org/apache/hop/workflow/actions/mysqlbulkload/WorkflowActionMysqlBulkLoadLoadSaveTest.java index 67cd0865385..b412f52bffb 100644 --- a/plugins/actions/mysqlbulkload/src/test/java/org/apache/hop/workflow/actions/mysqlbulkload/WorkflowActionMysqlBulkLoadLoadSaveTest.java +++ b/plugins/actions/mysqlbulkload/src/test/java/org/apache/hop/workflow/actions/mysqlbulkload/WorkflowActionMysqlBulkLoadLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.mysqlbulkload; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionMysqlBulkLoadLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -36,20 +35,20 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "schemaname", - "tablename", - "filename", - "separator", - "enclosed", - "escaped", - "linestarted", - "lineterminated", - "replacedata", - "ignorelines", - "listattribut", - "localInfile", - "prorityvalue", - "addFileToResult", - "database"); + "schemaname", + "tablename", + "filename", + "separator", + "enclosed", + "escaped", + "linestarted", + "lineterminated", + "replacedata", + "ignorelines", + "listattribut", + "localInfile", + "prorityvalue", + "addFileToResult", + "database"); } } diff --git a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpdecryptfiles/ActionPGPDecryptFiles.java b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpdecryptfiles/ActionPGPDecryptFiles.java index 5b9583a7b95..86d9d5f7324 100644 --- a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpdecryptfiles/ActionPGPDecryptFiles.java +++ b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpdecryptfiles/ActionPGPDecryptFiles.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.actions.pgpdecryptfiles; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -47,13 +53,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'PGP decrypt files' action. */ @Action( id = "PGP_DECRYPT_FILES", diff --git a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/ActionPGPEncryptFiles.java b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/ActionPGPEncryptFiles.java index 4729ee1f973..d76bed285ee 100644 --- a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/ActionPGPEncryptFiles.java +++ b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/ActionPGPEncryptFiles.java @@ -17,6 +17,12 @@ package org.apache.hop.workflow.actions.pgpencryptfiles; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -45,13 +51,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'PGP decrypt files' action. */ @Action( id = "PGP_ENCRYPT_FILES", diff --git a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/GPG.java b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/GPG.java index 354b3fe73e2..8a9706d9b42 100644 --- a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/GPG.java +++ b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpencryptfiles/GPG.java @@ -17,6 +17,13 @@ package org.apache.hop.workflow.actions.pgpencryptfiles; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.Const; @@ -26,14 +33,6 @@ import org.apache.hop.core.vfs.HopVfs; import org.apache.hop.i18n.BaseMessages; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; - /** This defines a GnuPG wrapper class. */ public class GPG { diff --git a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpverify/ActionPGPVerify.java b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpverify/ActionPGPVerify.java index 2188312432d..afd86bedce3 100644 --- a/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpverify/ActionPGPVerify.java +++ b/plugins/actions/pgpfiles/src/main/java/org/apache/hop/workflow/actions/pgpverify/ActionPGPVerify.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.pgpverify; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -42,9 +44,6 @@ import org.apache.hop.workflow.actions.pgpencryptfiles.GPG; import org.w3c.dom.Node; -import java.util.List; -import java.util.Map; - /** This defines a PGP verify action. */ @Action( id = "PGP_VERIFY_FILES", diff --git a/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpdecryptfiles/WorkflowActionPGPDecryptFilesLoadSaveTest.java b/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpdecryptfiles/WorkflowActionPGPDecryptFilesLoadSaveTest.java index 542d9625d9d..238f090fbd4 100644 --- a/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpdecryptfiles/WorkflowActionPGPDecryptFilesLoadSaveTest.java +++ b/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpdecryptfiles/WorkflowActionPGPDecryptFilesLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.pgpdecryptfiles; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -24,12 +29,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionPGPDecryptFilesLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -42,33 +41,33 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "gpgLocation", - "argFromPrevious", - "includeSubFolders", - "addResultFilenames", - "destinationIsAFile", - "createDestinationFolder", - "addDate", - "addTime", - "specifyFormat", - "dateTimeFormat", - "nrErrorsLessThan", - "successCondition", - "addDateBeforeExtension", - "doNotKeepFolderStructure", - "ifFileExists", - "destinationFolder", - "ifMovedFileExists", - "movedDateTimeFormat", - "createMoveToFolder", - "addMovedDate", - "addMovedTime", - "specifyMoveFormat", - "addMovedDateBeforeExtension", - "sourceFileFolder", - "passphrase", - "destinationFileFolder", - "wildcard"); + "gpgLocation", + "argFromPrevious", + "includeSubFolders", + "addResultFilenames", + "destinationIsAFile", + "createDestinationFolder", + "addDate", + "addTime", + "specifyFormat", + "dateTimeFormat", + "nrErrorsLessThan", + "successCondition", + "addDateBeforeExtension", + "doNotKeepFolderStructure", + "ifFileExists", + "destinationFolder", + "ifMovedFileExists", + "movedDateTimeFormat", + "createMoveToFolder", + "addMovedDate", + "addMovedTime", + "specifyMoveFormat", + "addMovedDateBeforeExtension", + "sourceFileFolder", + "passphrase", + "destinationFileFolder", + "wildcard"); } @Override diff --git a/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpencryptfiles/WorkflowActionPGPEncryptFilesLoadSaveTest.java b/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpencryptfiles/WorkflowActionPGPEncryptFilesLoadSaveTest.java index dd310a3d1f1..214fdc83237 100644 --- a/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpencryptfiles/WorkflowActionPGPEncryptFilesLoadSaveTest.java +++ b/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpencryptfiles/WorkflowActionPGPEncryptFilesLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.pgpencryptfiles; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; @@ -26,12 +31,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionPGPEncryptFilesLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -44,35 +43,35 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "gpgLocation", - "argFromPrevious", - "includeSubFolders", - "addResultFileNames", - "destinationIsAFile", - "createDestinationFolder", - "addDate", - "addTime", - "specifyFormat", - "dateTimeFormat", - "nrErrorsLessThan", - "successCondition", - "addDateBeforeExtension", - "doNotKeepFolderStructure", - "ifFileExists", - "destinationFolder", - "ifMovedFileExists", - "movedDateTimeFormat", - "createMoveToFolder", - "addMovedDate", - "addMovedTime", - "specifyMoveFormat", - "addMovedDateBeforeExtension", - "asciiMode", - "actionType", - "sourceFileFolder", - "userId", - "destinationFileFolder", - "wildcard"); + "gpgLocation", + "argFromPrevious", + "includeSubFolders", + "addResultFileNames", + "destinationIsAFile", + "createDestinationFolder", + "addDate", + "addTime", + "specifyFormat", + "dateTimeFormat", + "nrErrorsLessThan", + "successCondition", + "addDateBeforeExtension", + "doNotKeepFolderStructure", + "ifFileExists", + "destinationFolder", + "ifMovedFileExists", + "movedDateTimeFormat", + "createMoveToFolder", + "addMovedDate", + "addMovedTime", + "specifyMoveFormat", + "addMovedDateBeforeExtension", + "asciiMode", + "actionType", + "sourceFileFolder", + "userId", + "destinationFileFolder", + "wildcard"); } @Override diff --git a/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpverify/WorkflowActionPGPVerifyTest.java b/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpverify/WorkflowActionPGPVerifyTest.java index 992b2891911..2e19cf1267a 100644 --- a/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpverify/WorkflowActionPGPVerifyTest.java +++ b/plugins/actions/pgpfiles/src/test/java/org/apache/hop/workflow/actions/pgpverify/WorkflowActionPGPVerifyTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.pgpverify; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionPGPVerifyTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPing.java b/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPing.java index 029cc24a42c..85213c19cdb 100644 --- a/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPing.java +++ b/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPing.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.ping; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.InetAddress; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -37,12 +42,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.w3c.dom.Node; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.InetAddress; -import java.util.List; - /** This defines a ping action. */ @Action( id = "PING", diff --git a/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPingDialog.java b/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPingDialog.java index 946f9150160..7d972e1893a 100644 --- a/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPingDialog.java +++ b/plugins/actions/ping/src/main/java/org/apache/hop/workflow/actions/ping/ActionPingDialog.java @@ -212,8 +212,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); getData(); setPingType(); diff --git a/plugins/actions/ping/src/test/java/org/apache/hop/workflow/actions/ping/WorkflowActionPingTest.java b/plugins/actions/ping/src/test/java/org/apache/hop/workflow/actions/ping/WorkflowActionPingTest.java index 4371a9db9c3..1edf1473d8e 100644 --- a/plugins/actions/ping/src/test/java/org/apache/hop/workflow/actions/ping/WorkflowActionPingTest.java +++ b/plugins/actions/ping/src/test/java/org/apache/hop/workflow/actions/ping/WorkflowActionPingTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.ping; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionPingTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/ActionPipelineGuiPlugin.java b/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/ActionPipelineGuiPlugin.java index 785f7b68b77..fff986427c0 100644 --- a/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/ActionPipelineGuiPlugin.java +++ b/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/ActionPipelineGuiPlugin.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.pipeline; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.extension.ExtensionPointHandler; @@ -39,8 +40,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.action.ActionMeta; -import java.util.List; - /** * This is a convenient way to add a pipeline you just designed to a workflow in the form of an * action. @@ -112,11 +111,9 @@ public void copyAsActionToClipboard(HopGuiPipelineContext context) { StringBuilder xml = new StringBuilder(5000).append(XmlHandler.getXmlHeader()); xml.append(XmlHandler.openTag(HopGuiWorkflowClipboardDelegate.XML_TAG_WORKFLOW_ACTIONS)) .append(Const.CR); - xml.append(XmlHandler.openTag(WorkflowMeta.XML_TAG_ACTIONS)) - .append(Const.CR); + xml.append(XmlHandler.openTag(WorkflowMeta.XML_TAG_ACTIONS)).append(Const.CR); xml.append(actionMeta.getXml()); - xml.append(XmlHandler.closeTag(WorkflowMeta.XML_TAG_ACTIONS)) - .append(Const.CR); + xml.append(XmlHandler.closeTag(WorkflowMeta.XML_TAG_ACTIONS)).append(Const.CR); xml.append(XmlHandler.closeTag(HopGuiWorkflowClipboardDelegate.XML_TAG_WORKFLOW_ACTIONS)) .append(Const.CR); diff --git a/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/HopGuiWorkflowHplFilenamePastedExtensionPoint.java b/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/HopGuiWorkflowHplFilenamePastedExtensionPoint.java index d8f8b662575..529516a1111 100644 --- a/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/HopGuiWorkflowHplFilenamePastedExtensionPoint.java +++ b/plugins/actions/pipeline/src/main/java/org/apache/hop/workflow/actions/pipeline/HopGuiWorkflowHplFilenamePastedExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.pipeline; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -31,8 +32,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.action.ActionMeta; -import java.util.List; - @ExtensionPoint( id = "HopGuiWorkflowHplFilenamePastedExtensionPoint", extensionPointId = "HopGuiWorkflowClipboardFilePaste", diff --git a/plugins/actions/pipeline/src/test/java/org/apache/hop/workflow/actions/pipeline/WorkflowEntryPipelineDialogTest.java b/plugins/actions/pipeline/src/test/java/org/apache/hop/workflow/actions/pipeline/WorkflowEntryPipelineDialogTest.java index a225af740fd..00cf3b45a94 100644 --- a/plugins/actions/pipeline/src/test/java/org/apache/hop/workflow/actions/pipeline/WorkflowEntryPipelineDialogTest.java +++ b/plugins/actions/pipeline/src/test/java/org/apache/hop/workflow/actions/pipeline/WorkflowEntryPipelineDialogTest.java @@ -17,13 +17,13 @@ package org.apache.hop.workflow.actions.pipeline; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; +import org.junit.Test; + public class WorkflowEntryPipelineDialogTest { private static final String FILE_NAME = "TestPipeline.hpl"; diff --git a/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/ParameterDetails.java b/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/ParameterDetails.java index 9443833b108..4a05a6b9a3b 100644 --- a/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/ParameterDetails.java +++ b/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/ParameterDetails.java @@ -37,7 +37,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -51,7 +53,9 @@ public String getField() { return field; } - /** @param field The field to set */ + /** + * @param field The field to set + */ public void setField(String field) { this.field = field; } diff --git a/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/Repeat.java b/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/Repeat.java index 904e2784864..d8e545df159 100644 --- a/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/Repeat.java +++ b/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/Repeat.java @@ -17,6 +17,13 @@ package org.apache.hop.workflow.actions.repeat; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.base.AbstractMeta; import org.apache.hop.core.Const; @@ -48,14 +55,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @Action( id = "Repeat", name = "i18n::Repeat.Name", @@ -173,8 +172,7 @@ public Result execute(Result prevResult, int nr) throws HopException { int repetitionNr = 0; while (repeat && !parentWorkflow.isStopped()) { repetitionNr++; - executionResult = - executePipelineOrWorkflow(realFilename, nr, executionResult, repetitionNr); + executionResult = executePipelineOrWorkflow(realFilename, nr, executionResult, repetitionNr); Result result = executionResult.result; if (!result.getResult() || result.getNrErrors() > 0 || result.isStopped()) { log.logError( @@ -595,7 +593,8 @@ public String exportResources( } String proposedNewFilename = - ((IResourceExport) pipelineOrWorkflow).exportResources(variables, definitions, namingInterface, metadataProvider); + ((IResourceExport) pipelineOrWorkflow) + .exportResources(variables, definitions, namingInterface, metadataProvider); String newFilename = "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER + "}/" + proposedNewFilename; pipelineOrWorkflow.setFilename(newFilename); @@ -666,7 +665,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -680,7 +681,9 @@ public List getParameters() { return parameters; } - /** @param parameters The parameters to set */ + /** + * @param parameters The parameters to set + */ public void setParameters(List parameters) { this.parameters = parameters; } @@ -694,7 +697,9 @@ public String getVariableName() { return variableName; } - /** @param variableName The variableName to set */ + /** + * @param variableName The variableName to set + */ public void setVariableName(String variableName) { this.variableName = variableName; } @@ -708,7 +713,9 @@ public String getVariableValue() { return variableValue; } - /** @param variableValue The variableValue to set */ + /** + * @param variableValue The variableValue to set + */ public void setVariableValue(String variableValue) { this.variableValue = variableValue; } @@ -722,7 +729,9 @@ public String getDelay() { return delay; } - /** @param delay The delay to set */ + /** + * @param delay The delay to set + */ public void setDelay(String delay) { this.delay = delay; } @@ -736,7 +745,9 @@ public boolean isKeepingValues() { return keepingValues; } - /** @param keepingValues The keepingValues to set */ + /** + * @param keepingValues The keepingValues to set + */ public void setKeepingValues(boolean keepingValues) { this.keepingValues = keepingValues; } @@ -750,7 +761,9 @@ public boolean isLogFileEnabled() { return logFileEnabled; } - /** @param logFileEnabled The logFileEnabled to set */ + /** + * @param logFileEnabled The logFileEnabled to set + */ public void setLogFileEnabled(boolean logFileEnabled) { this.logFileEnabled = logFileEnabled; } @@ -764,7 +777,9 @@ public String getLogFileBase() { return logFileBase; } - /** @param logFileBase The logFileBase to set */ + /** + * @param logFileBase The logFileBase to set + */ public void setLogFileBase(String logFileBase) { this.logFileBase = logFileBase; } @@ -778,7 +793,9 @@ public String getLogFileExtension() { return logFileExtension; } - /** @param logFileExtension The logFileExtension to set */ + /** + * @param logFileExtension The logFileExtension to set + */ public void setLogFileExtension(String logFileExtension) { this.logFileExtension = logFileExtension; } @@ -792,7 +809,9 @@ public boolean isLogFileAppended() { return logFileAppended; } - /** @param logFileAppended The logFileAppended to set */ + /** + * @param logFileAppended The logFileAppended to set + */ public void setLogFileAppended(boolean logFileAppended) { this.logFileAppended = logFileAppended; } @@ -806,7 +825,9 @@ public boolean isLogFileDateAdded() { return logFileDateAdded; } - /** @param logFileDateAdded The logFileDateAdded to set */ + /** + * @param logFileDateAdded The logFileDateAdded to set + */ public void setLogFileDateAdded(boolean logFileDateAdded) { this.logFileDateAdded = logFileDateAdded; } @@ -820,7 +841,9 @@ public boolean isLogFileTimeAdded() { return logFileTimeAdded; } - /** @param logFileTimeAdded The logFileTimeAdded to set */ + /** + * @param logFileTimeAdded The logFileTimeAdded to set + */ public void setLogFileTimeAdded(boolean logFileTimeAdded) { this.logFileTimeAdded = logFileTimeAdded; } @@ -834,7 +857,9 @@ public boolean isLogFileRepetitionAdded() { return logFileRepetitionAdded; } - /** @param logFileRepetitionAdded The logFileRepetitionAdded to set */ + /** + * @param logFileRepetitionAdded The logFileRepetitionAdded to set + */ public void setLogFileRepetitionAdded(boolean logFileRepetitionAdded) { this.logFileRepetitionAdded = logFileRepetitionAdded; } @@ -848,7 +873,9 @@ public String getLogFileUpdateInterval() { return logFileUpdateInterval; } - /** @param logFileUpdateInterval The logFileUpdateInterval to set */ + /** + * @param logFileUpdateInterval The logFileUpdateInterval to set + */ public void setLogFileUpdateInterval(String logFileUpdateInterval) { this.logFileUpdateInterval = logFileUpdateInterval; } @@ -862,7 +889,9 @@ public String getRunConfigurationName() { return runConfigurationName; } - /** @param runConfigurationName The runConfigurationName to set */ + /** + * @param runConfigurationName The runConfigurationName to set + */ public void setRunConfigurationName(String runConfigurationName) { this.runConfigurationName = runConfigurationName; } diff --git a/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/RepeatDialog.java b/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/RepeatDialog.java index cef5cdbdc9b..4dcc3bf8e45 100644 --- a/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/RepeatDialog.java +++ b/plugins/actions/repeat/src/main/java/org/apache/hop/workflow/actions/repeat/RepeatDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow.actions.repeat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; @@ -52,10 +55,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class RepeatDialog extends ActionDialog implements IActionDialog { private static final Class PKG = RepeatDialog.class; // For Translator @@ -350,7 +349,8 @@ public IAction open() { lastLogControl = wlLogFileTimeAdded; wlLogFileRepetitionAdded = new Label(wLogFileGroup, SWT.RIGHT); - wlLogFileRepetitionAdded.setText(BaseMessages.getString(PKG, "Repeat.AddReptNumToFilename.Label")); + wlLogFileRepetitionAdded.setText( + BaseMessages.getString(PKG, "Repeat.AddReptNumToFilename.Label")); PropsUi.setLook(wlLogFileRepetitionAdded); FormData fdlLogFileRepetitionAdded = new FormData(); fdlLogFileRepetitionAdded.left = new FormAttachment(0, 0); @@ -384,7 +384,8 @@ public IAction open() { lastLogControl = wlLogFileAppended; wlLogFileUpdateInterval = new Label(wLogFileGroup, SWT.RIGHT); - wlLogFileUpdateInterval.setText(BaseMessages.getString(PKG, "Repeat.LogFileUpdateInterval.Label")); + wlLogFileUpdateInterval.setText( + BaseMessages.getString(PKG, "Repeat.LogFileUpdateInterval.Label")); PropsUi.setLook(wlLogFileUpdateInterval); FormData fdlLogFileUpdateInterval = new FormData(); fdlLogFileUpdateInterval.left = new FormAttachment(0, 0); @@ -442,8 +443,16 @@ public IAction open() { ColumnInfo[] columnInfos = new ColumnInfo[] { - new ColumnInfo(BaseMessages.getString(PKG, "Repeat.ParmsVarGroup.Name.Column.Header"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), - new ColumnInfo(BaseMessages.getString(PKG, "Repeat.ParmsVarGroup.Value.Column.Header"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), + new ColumnInfo( + BaseMessages.getString(PKG, "Repeat.ParmsVarGroup.Name.Column.Header"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false), + new ColumnInfo( + BaseMessages.getString(PKG, "Repeat.ParmsVarGroup.Value.Column.Header"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false), }; columnInfos[1].setUsingVariables(true); @@ -548,9 +557,11 @@ private void getData() { // Get the run configurations for both pipelines and workflows // MetadataManager prcManager = - new MetadataManager<>(variables, getMetadataProvider(), PipelineRunConfiguration.class, shell); + new MetadataManager<>( + variables, getMetadataProvider(), PipelineRunConfiguration.class, shell); MetadataManager wrcManager = - new MetadataManager<>(variables, getMetadataProvider(), WorkflowRunConfiguration.class, shell); + new MetadataManager<>( + variables, getMetadataProvider(), WorkflowRunConfiguration.class, shell); List entries = new ArrayList<>(); try { prcManager.getNames().forEach(name -> entries.add("Pipeline" + COLON_SEPARATOR + name)); diff --git a/plugins/actions/sendnagiospassivecheck/src/main/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/ActionSendNagiosPassiveCheck.java b/plugins/actions/sendnagiospassivecheck/src/main/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/ActionSendNagiosPassiveCheck.java index 2b4889afea9..539ec03b2fc 100644 --- a/plugins/actions/sendnagiospassivecheck/src/main/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/ActionSendNagiosPassiveCheck.java +++ b/plugins/actions/sendnagiospassivecheck/src/main/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/ActionSendNagiosPassiveCheck.java @@ -24,6 +24,7 @@ import com.googlecode.jsendnsca.builders.MessagePayloadBuilder; import com.googlecode.jsendnsca.builders.NagiosSettingsBuilder; import com.googlecode.jsendnsca.encryption.Encryption; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -45,8 +46,6 @@ import org.apache.hop.workflow.action.validator.AndValidator; import org.w3c.dom.Node; -import java.util.List; - /** This defines an SendNagiosPassiveCheck action. */ @Action( id = "SEND_NAGIOS_PASSIVE_CHECK", @@ -262,42 +261,58 @@ public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVari } } - /** @return Returns the serverName. */ + /** + * @return Returns the serverName. + */ public String getServerName() { return serverName; } - /** @param serverName The serverName to set. */ + /** + * @param serverName The serverName to set. + */ public void setServerName(String serverName) { this.serverName = serverName; } - /** @return Returns the senderServerName. */ + /** + * @return Returns the senderServerName. + */ public String getSenderServerName() { return senderServerName; } - /** @param senderServerName The senderServerName to set. */ + /** + * @param senderServerName The senderServerName to set. + */ public void setSenderServerName(String senderServerName) { this.senderServerName = senderServerName; } - /** @return Returns the senderServiceName. */ + /** + * @return Returns the senderServiceName. + */ public String getSenderServiceName() { return senderServiceName; } - /** @param senderServiceName The senderServiceName to set. */ + /** + * @param senderServiceName The senderServiceName to set. + */ public void setSenderServiceName(String senderServiceName) { this.senderServiceName = senderServiceName; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } @@ -318,42 +333,58 @@ public void setLevel(int levelMode) { this.level = levelMode; } - /** @param message The message to set. */ + /** + * @param message The message to set. + */ public void setMessage(String message) { this.message = message; } - /** @return Returns the comString. */ + /** + * @return Returns the comString. + */ public String getMessage() { return message; } - /** @return Returns the port. */ + /** + * @return Returns the port. + */ public String getPort() { return port; } - /** @param port The port to set. */ + /** + * @param port The port to set. + */ public void setPort(String port) { this.port = port; } - /** @param responseTimeOut The responseTimeOut to set. */ + /** + * @param responseTimeOut The responseTimeOut to set. + */ public void setResponseTimeOut(String responseTimeOut) { this.responseTimeOut = responseTimeOut; } - /** @return Returns the responseTimeOut. */ + /** + * @return Returns the responseTimeOut. + */ public String getResponseTimeOut() { return responseTimeOut; } - /** @param connectionTimeOut The connectionTimeOut to set. */ + /** + * @param connectionTimeOut The connectionTimeOut to set. + */ public void setConnectionTimeOut(String connectionTimeOut) { this.connectionTimeOut = connectionTimeOut; } - /** @return Returns the connectionTimeOut. */ + /** + * @return Returns the connectionTimeOut. + */ public String getConnectionTimeOut() { return connectionTimeOut; } diff --git a/plugins/actions/sendnagiospassivecheck/src/test/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/WorkflowActionSendNagiosPassiveCheckTest.java b/plugins/actions/sendnagiospassivecheck/src/test/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/WorkflowActionSendNagiosPassiveCheckTest.java index 82201911f67..f4b0171879d 100644 --- a/plugins/actions/sendnagiospassivecheck/src/test/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/WorkflowActionSendNagiosPassiveCheckTest.java +++ b/plugins/actions/sendnagiospassivecheck/src/test/java/org/apache/hop/workflow/actions/sendnagiospassivecheck/WorkflowActionSendNagiosPassiveCheckTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.sendnagiospassivecheck; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionSendNagiosPassiveCheckTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/shell/src/main/java/org/apache/hop/workflow/actions/shell/ActionShell.java b/plugins/actions/shell/src/main/java/org/apache/hop/workflow/actions/shell/ActionShell.java index 4af325cd5f9..24d8e661c04 100644 --- a/plugins/actions/shell/src/main/java/org/apache/hop/workflow/actions/shell/ActionShell.java +++ b/plugins/actions/shell/src/main/java/org/apache/hop/workflow/actions/shell/ActionShell.java @@ -18,6 +18,15 @@ package org.apache.hop.workflow.actions.shell; import com.google.common.annotations.VisibleForTesting; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -50,16 +59,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - /** Shell type of Workflow Entry. You can define shell scripts to be executed in a Workflow. */ @Action( id = "SHELL", diff --git a/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellLoadSaveTest.java b/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellLoadSaveTest.java index 8a249808901..53222eccfcb 100644 --- a/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellLoadSaveTest.java +++ b/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellLoadSaveTest.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.shell; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.logging.LogLevel; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.EnumLoadSaveValidator; @@ -24,11 +28,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class WorkflowActionShellLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -41,20 +40,20 @@ protected Class getActionClass() { @Override protected List listAttributes() { return Arrays.asList( - "filename", - "workDirectory", - "argFromPrevious", - "execPerRow", - "setLogfile", - "logfile", - "setAppendLogfile", - "logext", - "addDate", - "addTime", - "insertScript", - "script", - "logFileLevel", - "arguments"); + "filename", + "workDirectory", + "argFromPrevious", + "execPerRow", + "setLogfile", + "logfile", + "setAppendLogfile", + "logext", + "addDate", + "addTime", + "insertScript", + "script", + "logFileLevel", + "arguments"); } @Override diff --git a/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellTest.java b/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellTest.java index 1969d3481c7..350b6861b5b 100644 --- a/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellTest.java +++ b/plugins/actions/shell/src/test/java/org/apache/hop/workflow/actions/shell/WorkflowActionShellTest.java @@ -16,16 +16,16 @@ */ package org.apache.hop.workflow.actions.shell; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.verify; + import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.verify; - public class WorkflowActionShellTest { @Mock private ActionShell jobEntryShellMock; diff --git a/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java b/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java index 381f61b2ab8..4d086e7d1b8 100644 --- a/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java +++ b/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.simpleeval; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Pattern; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.RowMetaAndData; @@ -31,10 +35,6 @@ import org.apache.hop.metadata.api.IEnumHasCodeAndDescription; import org.apache.hop.workflow.action.ActionBase; import org.apache.hop.workflow.action.IAction; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Pattern; /** This defines a 'simple evaluation' action. */ @Action( @@ -47,7 +47,7 @@ documentationUrl = "/workflow/actions/simpleeval.html") public class ActionSimpleEval extends ActionBase implements Cloneable, IAction { private static final Class PKG = ActionSimpleEval.class; // For Translator - + public enum ValueType implements IEnumHasCodeAndDescription { FIELD("field", BaseMessages.getString(PKG, "ActionSimpleEval.EvalPreviousField.Label")), VARIABLE("variable", BaseMessages.getString(PKG, "ActionSimpleEval.EvalVariable.Label")); @@ -85,16 +85,24 @@ public String getDescription() { public enum SuccessStringCondition implements IEnumHasCodeAndDescription { EQUAL("equal", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenEqual.Label")), - DIFFERENT("different",BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenDifferent.Label")), + DIFFERENT( + "different", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenDifferent.Label")), CONTAINS("contains", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenContains.Label")), - NOT_CONTAINS("notcontains", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotContains.Label")), - START_WITH("startswith", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenStartWith.Label")), - NOT_START_WITH("notstatwith", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotStartWith.Label")), + NOT_CONTAINS( + "notcontains", + BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotContains.Label")), + START_WITH( + "startswith", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenStartWith.Label")), + NOT_START_WITH( + "notstatwith", + BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotStartWith.Label")), END_WITH("endswith", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenEndWith.Label")), - NOT_END_WITH("notendwith", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotEndWith.Label")), + NOT_END_WITH( + "notendwith", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotEndWith.Label")), REGEX("regexp", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenRegExp.Label")), IN_LIST("inlist", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenInList.Label")), - NOT_IN_LIST("notinlist", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotInList.Label")); + NOT_IN_LIST( + "notinlist", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotInList.Label")); private final String code; private final String description; @@ -109,7 +117,8 @@ public static String[] getDescriptions() { } public static SuccessStringCondition lookupDescription(String description) { - return IEnumHasCodeAndDescription.lookupDescription(SuccessStringCondition.class, description, EQUAL); + return IEnumHasCodeAndDescription.lookupDescription( + SuccessStringCondition.class, description, EQUAL); } public static SuccessStringCondition lookupCode(String code) { @@ -176,14 +185,21 @@ public String getDescription() { public enum SuccessNumberCondition implements IEnumHasCodeAndDescription { EQUAL("equal", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenEqual.Label")), - DIFFERENT("different", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenDifferent.Label")), + DIFFERENT( + "different", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenDifferent.Label")), SMALLER("smaller", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenSmallThan.Label")), - SMALLER_EQUAL("smallequal", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenSmallOrEqualThan.Label")), - GREATER("greater", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenGreaterThan.Label")), - GREATER_EQUAL("greaterequal", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenGreaterOrEqualThan.Label")), + SMALLER_EQUAL( + "smallequal", + BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenSmallOrEqualThan.Label")), + GREATER( + "greater", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenGreaterThan.Label")), + GREATER_EQUAL( + "greaterequal", + BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenGreaterOrEqualThan.Label")), BETWEEN("between", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessBetween.Label")), IN_LIST("inlist", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenInList.Label")), - NOT_IN_LIST("notinlist", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotInList.Label")); + NOT_IN_LIST( + "notinlist", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenNotInList.Label")); private final String code; private final String description; @@ -198,7 +214,8 @@ public static String[] getDescriptions() { } public static SuccessNumberCondition lookupDescription(String description) { - return IEnumHasCodeAndDescription.lookupDescription(SuccessNumberCondition.class, description, EQUAL); + return IEnumHasCodeAndDescription.lookupDescription( + SuccessNumberCondition.class, description, EQUAL); } public static SuccessNumberCondition lookupCode(String code) { @@ -215,7 +232,7 @@ public String getDescription() { return description; } } - + public enum SuccessBooleanCondition implements IEnumHasCodeAndDescription { TRUE("true", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenTrue.Label")), FALSE("false", BaseMessages.getString(PKG, "ActionSimpleEval.SuccessWhenFalse.Label")); @@ -233,7 +250,8 @@ public static String[] getDescriptions() { } public static SuccessBooleanCondition lookupDescription(String description) { - return IEnumHasCodeAndDescription.lookupDescription(SuccessBooleanCondition.class, description, TRUE); + return IEnumHasCodeAndDescription.lookupDescription( + SuccessBooleanCondition.class, description, TRUE); } public static SuccessBooleanCondition lookupCode(String code) { @@ -250,32 +268,43 @@ public String getDescription() { return description; } } - + @HopMetadataProperty(key = "valuetype", storeWithCode = true) private ValueType valueType; + @HopMetadataProperty(key = "fieldtype", storeWithCode = true) private FieldType fieldType; + @HopMetadataProperty(key = "fieldname") private String fieldName; + @HopMetadataProperty(key = "variablename") private String variableName; + @HopMetadataProperty(key = "mask") private String mask; + @HopMetadataProperty(key = "comparevalue") private String compareValue; + @HopMetadataProperty(key = "minvalue") private String minValue; + @HopMetadataProperty(key = "maxvalue") private String maxValue; + @HopMetadataProperty(key = "successcondition", storeWithCode = true) private SuccessStringCondition successStringCondition; - @HopMetadataProperty(key = "successwhenvarset") - private boolean successWhenVarSet; + + @HopMetadataProperty(key = "successwhenvarset") + private boolean successWhenVarSet; + @HopMetadataProperty(key = "successbooleancondition", storeWithCode = true) private SuccessBooleanCondition successBooleanCondition; + @HopMetadataProperty(key = "successnumbercondition", storeWithCode = true) private SuccessNumberCondition successNumberCondition; - + public ActionSimpleEval(String n) { super(n, ""); valueType = ValueType.FIELD; diff --git a/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalDialog.java b/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalDialog.java index 45ead479ec8..1a5f68b9759 100644 --- a/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalDialog.java +++ b/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalDialog.java @@ -266,7 +266,12 @@ public IAction open() { fdFieldType.top = new FormAttachment(wVariableName, margin); fdFieldType.right = new FormAttachment(100, 0); wFieldType.setLayoutData(fdFieldType); - wFieldType.addListener(SWT.Selection, e -> {refresh(); action.setChanged();}); + wFieldType.addListener( + SWT.Selection, + e -> { + refresh(); + action.setChanged(); + }); // Mask wlMask = new Label(wSource, SWT.RIGHT); @@ -330,7 +335,12 @@ public IAction open() { fdSuccessWhenSet.top = new FormAttachment(wlSuccessWhenSet, 0, SWT.CENTER); fdSuccessWhenSet.right = new FormAttachment(100, 0); wSuccessWhenSet.setLayoutData(fdSuccessWhenSet); - wSuccessWhenSet.addListener(SWT.Selection, e -> {refresh(); action.setChanged();}); + wSuccessWhenSet.addListener( + SWT.Selection, + e -> { + refresh(); + action.setChanged(); + }); // Success String Condition wlSuccessStringCondition = new Label(wSuccessOn, SWT.RIGHT); @@ -352,7 +362,12 @@ public IAction open() { fdSuccessStringCondition.top = new FormAttachment(wSuccessWhenSet, margin); fdSuccessStringCondition.right = new FormAttachment(100, 0); wSuccessStringCondition.setLayoutData(fdSuccessStringCondition); - wSuccessStringCondition.addListener(SWT.Selection, e -> {refresh(); action.setChanged();}); + wSuccessStringCondition.addListener( + SWT.Selection, + e -> { + refresh(); + action.setChanged(); + }); // Success Number or Date Condition wlSuccessNumberCondition = new Label(wSuccessOn, SWT.RIGHT); @@ -375,7 +390,12 @@ public IAction open() { fdSuccessNumberCondition.top = new FormAttachment(wSuccessWhenSet, margin); fdSuccessNumberCondition.right = new FormAttachment(100, 0); wSuccessNumberCondition.setLayoutData(fdSuccessNumberCondition); - wSuccessNumberCondition.addListener(SWT.Selection, e -> {refresh(); action.setChanged();}); + wSuccessNumberCondition.addListener( + SWT.Selection, + e -> { + refresh(); + action.setChanged(); + }); // Success Boolean Condition wlSuccessBooleanCondition = new Label(wSuccessOn, SWT.RIGHT); @@ -398,7 +418,12 @@ public IAction open() { fdSuccessBooleanCondition.top = new FormAttachment(wSuccessWhenSet, margin); fdSuccessBooleanCondition.right = new FormAttachment(100, 0); wSuccessBooleanCondition.setLayoutData(fdSuccessBooleanCondition); - wSuccessBooleanCondition.addListener(SWT.Selection, e -> {refresh(); action.setChanged();}); + wSuccessBooleanCondition.addListener( + SWT.Selection, + e -> { + refresh(); + action.setChanged(); + }); // Compare with value wlCompareValue = new Label(wSuccessOn, SWT.RIGHT); @@ -423,7 +448,7 @@ public IAction open() { fdCompareValue.right = new FormAttachment(100, -margin); wCompareValue.setLayoutData(fdCompareValue); wCompareValue.addListener(SWT.Modify, e -> action.setChanged()); - + // Min value wlMinValue = new Label(wSuccessOn, SWT.RIGHT); wlMinValue.setText(BaseMessages.getString(PKG, "ActionSimpleEval.MinValue.Label")); @@ -447,7 +472,7 @@ public IAction open() { fdMinValue.right = new FormAttachment(100, -margin); wMinValue.setLayoutData(fdMinValue); wMinValue.addListener(SWT.Modify, e -> action.setChanged()); - + // Maximum value wlMaxValue = new Label(wSuccessOn, SWT.RIGHT); wlMaxValue.setText(BaseMessages.getString(PKG, "ActionSimpleEval.MaxValue.Label")); @@ -471,7 +496,7 @@ public IAction open() { fdMaxValue.right = new FormAttachment(100, -margin); wMaxValue.setLayoutData(fdMaxValue); wMaxValue.addListener(SWT.Modify, e -> action.setChanged()); - + FormData fdSuccessOn = new FormData(); fdSuccessOn.left = new FormAttachment(0, margin); fdSuccessOn.top = new FormAttachment(wSource, margin); @@ -534,8 +559,10 @@ public void getData() { } private void refresh() { - boolean evaluatepreviousRowField = ValueType.lookupDescription(wValueType.getText()) == ValueType.FIELD; - boolean evaluateVariable = ValueType.lookupDescription(wValueType.getText()) == ValueType.VARIABLE; + boolean evaluatepreviousRowField = + ValueType.lookupDescription(wValueType.getText()) == ValueType.FIELD; + boolean evaluateVariable = + ValueType.lookupDescription(wValueType.getText()) == ValueType.VARIABLE; wlVariableName.setVisible(evaluateVariable); wVariableName.setVisible(evaluateVariable); wlFieldName.setVisible(evaluatepreviousRowField); @@ -548,7 +575,8 @@ private void refresh() { wlFieldType.setVisible(!successWhenSet); wFieldType.setVisible(!successWhenSet); - boolean valueTypeDate = FieldType.lookupDescription(wFieldType.getText()) == FieldType.DATE_TIME; + boolean valueTypeDate = + FieldType.lookupDescription(wFieldType.getText()) == FieldType.DATE_TIME; wlMask.setVisible(!successWhenSet && valueTypeDate); wMask.setVisible(!successWhenSet && valueTypeDate); @@ -556,19 +584,22 @@ private void refresh() { wlSuccessStringCondition.setVisible(!successWhenSet && valueTypeString); wSuccessStringCondition.setVisible(!successWhenSet && valueTypeString); - boolean valueTypeNumber = FieldType.lookupDescription(wFieldType.getText()) == FieldType.NUMBER + boolean valueTypeNumber = + FieldType.lookupDescription(wFieldType.getText()) == FieldType.NUMBER || FieldType.lookupDescription(wFieldType.getText()) == FieldType.DATE_TIME; wlSuccessNumberCondition.setVisible(!successWhenSet && valueTypeNumber); wSuccessNumberCondition.setVisible(!successWhenSet && valueTypeNumber); - boolean valueTypeBoolean = FieldType.lookupDescription(wFieldType.getText()) == FieldType.BOOLEAN; + boolean valueTypeBoolean = + FieldType.lookupDescription(wFieldType.getText()) == FieldType.BOOLEAN; wlSuccessBooleanCondition.setVisible(!successWhenSet && valueTypeBoolean); wSuccessBooleanCondition.setVisible(!successWhenSet && valueTypeBoolean); boolean compareValue = valueTypeString || (!valueTypeString - && SuccessNumberCondition.lookupDescription(wSuccessNumberCondition.getText()) != SuccessNumberCondition.BETWEEN); + && SuccessNumberCondition.lookupDescription(wSuccessNumberCondition.getText()) + != SuccessNumberCondition.BETWEEN); wlCompareValue.setVisible(!successWhenSet && compareValue && !valueTypeBoolean); wCompareValue.setVisible(!successWhenSet && compareValue && !valueTypeBoolean); wlMinValue.setVisible(!successWhenSet && !compareValue && !valueTypeBoolean); @@ -602,9 +633,12 @@ private void ok() { action.setCompareValue(wCompareValue.getText()); action.setMinValue(wMinValue.getText()); action.setMaxValue(wMaxValue.getText()); - action.setSuccessStringCondition(SuccessStringCondition.lookupDescription(wSuccessStringCondition.getText())); - action.setSuccessNumberCondition(SuccessNumberCondition.lookupDescription(wSuccessNumberCondition.getText())); - action.setSuccessBooleanCondition(SuccessBooleanCondition.lookupDescription(wSuccessBooleanCondition.getText())); + action.setSuccessStringCondition( + SuccessStringCondition.lookupDescription(wSuccessStringCondition.getText())); + action.setSuccessNumberCondition( + SuccessNumberCondition.lookupDescription(wSuccessNumberCondition.getText())); + action.setSuccessBooleanCondition( + SuccessBooleanCondition.lookupDescription(wSuccessBooleanCondition.getText())); action.setSuccessWhenVarSet(wSuccessWhenSet.getSelection()); dispose(); } diff --git a/plugins/actions/simpleeval/src/test/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalTest.java b/plugins/actions/simpleeval/src/test/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalTest.java index 7c4ce138a81..4cc152e037c 100644 --- a/plugins/actions/simpleeval/src/test/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalTest.java +++ b/plugins/actions/simpleeval/src/test/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; @@ -54,10 +55,10 @@ public void testSerialization() throws Exception { assertEquals(SuccessStringCondition.EQUAL, action.getSuccessStringCondition()); assertEquals(SuccessNumberCondition.BETWEEN, action.getSuccessNumberCondition()); assertEquals(SuccessBooleanCondition.FALSE, action.getSuccessBooleanCondition()); - + assertEquals("100", action.getMinValue()); assertEquals("200", action.getMaxValue()); - + assertFalse(action.isSuccessWhenVarSet()); } -} \ No newline at end of file +} diff --git a/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrap.java b/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrap.java index 0823f34d508..aa151736c29 100644 --- a/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrap.java +++ b/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrap.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.snmptrap; +import java.net.InetAddress; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -48,8 +49,6 @@ import org.snmp4j.smi.VariableBinding; import org.snmp4j.transport.DefaultUdpTransportMapping; -import java.net.InetAddress; - /** This defines an SNMPTrap action. */ @Action( id = "SNMP_TRAP", @@ -64,24 +63,34 @@ public class ActionSNMPTrap extends ActionBase implements Cloneable, IAction { @HopMetadataProperty(key = "servername") private String serverName; + @HopMetadataProperty(key = "port") private String port; + @HopMetadataProperty(key = "timeout") private String timeout; + @HopMetadataProperty(key = "nrretry") private String nrretry; + @HopMetadataProperty(key = "comstring") private String comString; + @HopMetadataProperty(key = "message") private String message; + @HopMetadataProperty(key = "oid") private String oid; + @HopMetadataProperty(key = "targettype") private String targettype; + @HopMetadataProperty(key = "user") private String user; + @HopMetadataProperty(key = "passphrase") private String passphrase; + @HopMetadataProperty(key = "engineid") private String engineid; @@ -142,62 +151,86 @@ public String getTargetTypeCode(String tt) { } } - /** @return Returns the serverName. */ + /** + * @return Returns the serverName. + */ public String getServerName() { return serverName; } - /** @param serverName The serverName to set. */ + /** + * @param serverName The serverName to set. + */ public void setServerName(String serverName) { this.serverName = serverName; } - /** @return Returns the OID. */ + /** + * @return Returns the OID. + */ public String getOid() { return oid; } - /** @param oid The oid to set. */ + /** + * @param oid The oid to set. + */ public void setOid(String oid) { this.oid = oid; } - /** @return Returns the comString. */ + /** + * @return Returns the comString. + */ public String getComString() { return comString; } - /** @param comString The comString to set. */ + /** + * @param comString The comString to set. + */ public void setComString(String comString) { this.comString = comString; } - /** @param user The user to set. */ + /** + * @param user The user to set. + */ public void setUser(String user) { this.user = user; } - /** @return Returns the user. */ + /** + * @return Returns the user. + */ public String getUser() { return user; } - /** @param passphrase The passphrase to set. */ + /** + * @param passphrase The passphrase to set. + */ public void setPassphrase(String passphrase) { this.passphrase = passphrase; } - /** @return Returns the passphrase. */ + /** + * @return Returns the passphrase. + */ public String getPassphrase() { return passphrase; } - /** @param engineid The engineid to set. */ + /** + * @param engineid The engineid to set. + */ public void setEngineid(String engineid) { this.engineid = engineid; } - /** @return Returns the engineid. */ + /** + * @return Returns the engineid. + */ public String getEngineid() { return engineid; } @@ -210,42 +243,58 @@ public void setTargettype(String targettypein) { this.targettype = getTargetTypeCode(targettypein); } - /** @param message The message to set. */ + /** + * @param message The message to set. + */ public void setMessage(String message) { this.message = message; } - /** @return Returns the message. */ + /** + * @return Returns the message. + */ public String getMessage() { return message; } - /** @return Returns the port. */ + /** + * @return Returns the port. + */ public String getPort() { return port; } - /** @param port The port to set. */ + /** + * @param port The port to set. + */ public void setPort(String port) { this.port = port; } - /** @param timeout The timeout to set. */ + /** + * @param timeout The timeout to set. + */ public void setTimeout(String timeout) { this.timeout = timeout; } - /** @return Returns the timeout. */ + /** + * @return Returns the timeout. + */ public String getTimeout() { return timeout; } - /** @param nrretry The nrretry to set. */ + /** + * @param nrretry The nrretry to set. + */ public void setNrretry(String nrretry) { this.nrretry = nrretry; } - /** @return Returns the nrretry. */ + /** + * @return Returns the nrretry. + */ public String getNrretry() { return nrretry; } @@ -361,7 +410,7 @@ public Result execute(Result previousResult, int nr) { } if (response != null && log.isDebug()) { - logDebug("Received response from: " + response.getPeerAddress() + response.toString()); + logDebug("Received response from: " + response.getPeerAddress() + response.toString()); } result.setNrErrors(0); diff --git a/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapDialog.java b/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapDialog.java index 7aa52118815..cab26e574ef 100644 --- a/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapDialog.java +++ b/plugins/actions/snmptrap/src/main/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.snmptrap; +import java.net.InetAddress; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.util.Utils; @@ -53,8 +54,6 @@ import org.snmp4j.UserTarget; import org.snmp4j.smi.UdpAddress; -import java.net.InetAddress; - /** This dialog allows you to edit the SNMPTrap action settings. */ public class ActionSNMPTrapDialog extends ActionDialog implements IActionDialog { private static final Class PKG = ActionSNMPTrap.class; // For Translator diff --git a/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapTest.java b/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapTest.java index 544f084e02f..60e94ffbd70 100644 --- a/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapTest.java +++ b/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapTest.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.snmptrap; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.workflow.WorkflowMeta; @@ -29,8 +31,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class ActionSNMPTrapTest { private IWorkflowEngine workflow; @@ -58,8 +58,8 @@ public void testSerialization() throws Exception { HopClientEnvironment.init(); ActionSNMPTrap action = - ActionSerializationTestUtil. testSerialization( - "/snmp-trap-action.xml", ActionSNMPTrap.class); + ActionSerializationTestUtil.testSerialization( + "/snmp-trap-action.xml", ActionSNMPTrap.class); assertEquals("awesomeserver", action.getServerName()); assertEquals("5000", action.getTimeout()); diff --git a/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/WorkflowActionSNMPTrapTest.java b/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/WorkflowActionSNMPTrapTest.java index 0c08efc2056..dccfb00c6a0 100644 --- a/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/WorkflowActionSNMPTrapTest.java +++ b/plugins/actions/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/WorkflowActionSNMPTrapTest.java @@ -16,6 +16,9 @@ */ package org.apache.hop.workflow.actions.snmptrap; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -27,10 +30,6 @@ import org.junit.BeforeClass; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - public class WorkflowActionSNMPTrapTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManager.java b/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManager.java index 40eb49230a4..0859fb9b0ad 100644 --- a/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManager.java +++ b/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManager.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.snowflake; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.andValidator; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.notBlankValidator; +import static org.apache.hop.workflow.action.validator.AndValidator.putValidators; + +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -35,12 +40,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.util.List; - -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.andValidator; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.notBlankValidator; -import static org.apache.hop.workflow.action.validator.AndValidator.putValidators; - @Action( id = "SnowflakeWarehouseManager", image = "snowflake-whm.svg", @@ -63,6 +62,7 @@ public class WarehouseManager extends ActionBase implements Cloneable, IAction { public static final String COMMENT = "comment"; public static final String RESOURCE_MONITOR = "resourceMonitor"; public static final String CONNECTION = "connection"; + /** The type of management actions this action supports */ private static final String[] MANAGEMENT_ACTIONS = { "create", "drop", "resume", "suspend", "alter" @@ -78,12 +78,14 @@ public class WarehouseManager extends ActionBase implements Cloneable, IAction { private static final String[] WAREHOUSE_SIZES = { "XSMALL", "SMALL", "MEDIUM", "LARGE", "XLARGE", "XXLARGE", "XXXLARGE" }; + /** The valid warehouse types */ private static final String[] WAREHOUSE_TYPES = {"Standard", "Enterprise"}; public static final String FAIL_IF_NOT_EXISTS = "failIfNotExists"; private static final Class PKG = WarehouseManager.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$ + /** The database to connect to. */ private DatabaseMeta databaseMeta; diff --git a/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManagerDialog.java b/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManagerDialog.java index b09765416ec..78f73c7f82d 100644 --- a/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManagerDialog.java +++ b/plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManagerDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.snowflake; +import java.sql.ResultSet; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -56,8 +57,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.sql.ResultSet; - public class WarehouseManagerDialog extends ActionDialog implements IActionDialog { private static final Class PKG = diff --git a/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSql.java b/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSql.java index e769f384ebd..3f102a0dfa1 100644 --- a/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSql.java +++ b/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSql.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.sql; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,11 +44,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.List; /** This defines an SQL action. */ @Action( @@ -59,14 +59,19 @@ public class ActionSql extends ActionBase implements Cloneable, IAction { @HopMetadataProperty(key = "sql") private String sql; + @HopMetadataProperty(key = "connection") private String connection; + @HopMetadataProperty(key = "useVariableSubstitution") private boolean useVariableSubstitution = false; + @HopMetadataProperty(key = "sqlfromfile") private boolean sqlFromFile = false; + @HopMetadataProperty(key = "sqlfilename") private String sqlFilename; + @HopMetadataProperty(key = "sendOneStatement") private boolean sendOneStatement = false; @@ -254,7 +259,9 @@ public List getResourceDependencies( DatabaseMeta databaseMeta = parentWorkflowMeta.findDatabase(connection, getVariables()); if (databaseMeta != null) { ResourceReference reference = new ResourceReference(this); - reference.getEntries().add(new ResourceEntry(databaseMeta.getHostname(), ResourceType.SERVER)); + reference + .getEntries() + .add(new ResourceEntry(databaseMeta.getHostname(), ResourceType.SERVER)); reference .getEntries() .add(new ResourceEntry(databaseMeta.getDatabaseName(), ResourceType.DATABASENAME)); diff --git a/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java b/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java index 9e1552faca5..92298dfbeb9 100644 --- a/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java +++ b/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java @@ -156,10 +156,12 @@ public IAction open() { fdSqlFromFile.top = new FormAttachment(wlSqlFromFile, 0, SWT.CENTER); fdSqlFromFile.right = new FormAttachment(100, 0); wSqlFromFile.setLayoutData(fdSqlFromFile); - wSqlFromFile.addListener(SWT.Selection, e -> { - activeSqlFromFile(); - action.setChanged(); - }); + wSqlFromFile.addListener( + SWT.Selection, + e -> { + activeSqlFromFile(); + action.setChanged(); + }); // Filename line wlFilename = new Label(shell, SWT.RIGHT); @@ -240,10 +242,12 @@ public IAction open() { fdUseSubs.top = new FormAttachment(wlUseSubs, 0, SWT.CENTER); fdUseSubs.right = new FormAttachment(100, 0); wUseSubs.setLayoutData(fdUseSubs); - wUseSubs.addListener(SWT.Selection, e -> { - action.setUseVariableSubstitution(!action.isUseVariableSubstitution()); - action.setChanged(); - }); + wUseSubs.addListener( + SWT.Selection, + e -> { + action.setUseVariableSubstitution(!action.isUseVariableSubstitution()); + action.setChanged(); + }); wlPosition = new Label(shell, SWT.NONE); wlPosition.setText(BaseMessages.getString(PKG, "ActionSQL.LineNr.Label", "0")); @@ -340,7 +344,7 @@ private void ok() { action.setUseVariableSubstitution(wUseSubs.getSelection()); action.setSqlFromFile(wSqlFromFile.getSelection()); action.setSqlFilename(wFilename.getText()); - action.setSendOneStatement(wSendOneStatement.getSelection()); + action.setSendOneStatement(wSendOneStatement.getSelection()); action.setChanged(); dispose(); diff --git a/plugins/actions/sql/src/test/java/org/apache/hop/workflow/actions/sql/WorkflowActionSqlTest.java b/plugins/actions/sql/src/test/java/org/apache/hop/workflow/actions/sql/WorkflowActionSqlTest.java index 64978a06e9d..c06f8ba5363 100644 --- a/plugins/actions/sql/src/test/java/org/apache/hop/workflow/actions/sql/WorkflowActionSqlTest.java +++ b/plugins/actions/sql/src/test/java/org/apache/hop/workflow/actions/sql/WorkflowActionSqlTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.sql; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionSqlTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/success/src/main/java/org/apache/hop/workflow/actions/success/ActionSuccess.java b/plugins/actions/success/src/main/java/org/apache/hop/workflow/actions/success/ActionSuccess.java index 51f75c06281..5576a9b7c46 100644 --- a/plugins/actions/success/src/main/java/org/apache/hop/workflow/actions/success/ActionSuccess.java +++ b/plugins/actions/success/src/main/java/org/apache/hop/workflow/actions/success/ActionSuccess.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.success; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -26,8 +27,6 @@ import org.apache.hop.workflow.action.ActionBase; import org.apache.hop.workflow.action.IAction; -import java.util.List; - /** Action type to success a workflow. */ @Action( id = "SUCCESS", diff --git a/plugins/actions/tableexists/src/main/java/org/apache/hop/workflow/actions/tableexists/ActionTableExistsDialog.java b/plugins/actions/tableexists/src/main/java/org/apache/hop/workflow/actions/tableexists/ActionTableExistsDialog.java index 9eec18c3530..d21649a2a9e 100644 --- a/plugins/actions/tableexists/src/main/java/org/apache/hop/workflow/actions/tableexists/ActionTableExistsDialog.java +++ b/plugins/actions/tableexists/src/main/java/org/apache/hop/workflow/actions/tableexists/ActionTableExistsDialog.java @@ -277,7 +277,7 @@ private void getSchemaNames() { shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "System.Dialog.AvailableSchemas.ConnectionError"), - e); + e); } } } diff --git a/plugins/actions/tableexists/src/test/java/org/apache/hop/workflow/actions/tableexists/WorkflowActionTableExistsLoadSaveTest.java b/plugins/actions/tableexists/src/test/java/org/apache/hop/workflow/actions/tableexists/WorkflowActionTableExistsLoadSaveTest.java index 15d3839ece5..e87d9cec67d 100644 --- a/plugins/actions/tableexists/src/test/java/org/apache/hop/workflow/actions/tableexists/WorkflowActionTableExistsLoadSaveTest.java +++ b/plugins/actions/tableexists/src/test/java/org/apache/hop/workflow/actions/tableexists/WorkflowActionTableExistsLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.tableexists; +import java.util.Arrays; +import java.util.List; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.List; - public class WorkflowActionTableExistsLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/telnet/src/main/java/org/apache/hop/workflow/actions/telnet/ActionTelnet.java b/plugins/actions/telnet/src/main/java/org/apache/hop/workflow/actions/telnet/ActionTelnet.java index 16c622615c0..cb67ca67edf 100644 --- a/plugins/actions/telnet/src/main/java/org/apache/hop/workflow/actions/telnet/ActionTelnet.java +++ b/plugins/actions/telnet/src/main/java/org/apache/hop/workflow/actions/telnet/ActionTelnet.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.telnet; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -36,8 +37,6 @@ import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.List; - /** This defines a Telnet action. */ @Action( id = "TELNET", @@ -49,10 +48,13 @@ documentationUrl = "/workflow/actions/telnet.html") public class ActionTelnet extends ActionBase implements Cloneable, IAction { private static final Class PKG = ActionTelnet.class; // For Translator + @HopMetadataProperty(key = "hostname") private String hostname; + @HopMetadataProperty(key = "port") private String port; + @HopMetadataProperty(key = "timeout") private String timeout; diff --git a/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/ActionTelnetTest.java b/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/ActionTelnetTest.java index 961f33c0b71..dd78129d1f6 100644 --- a/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/ActionTelnetTest.java +++ b/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/ActionTelnetTest.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.telnet; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.workflow.WorkflowMeta; @@ -29,8 +31,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class ActionTelnetTest { private IWorkflowEngine workflow; diff --git a/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/WorkflowActionTelnetLoadSaveTest.java b/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/WorkflowActionTelnetLoadSaveTest.java index 909b53cfb72..60a2be552fd 100644 --- a/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/WorkflowActionTelnetLoadSaveTest.java +++ b/plugins/actions/telnet/src/test/java/org/apache/hop/workflow/actions/telnet/WorkflowActionTelnetLoadSaveTest.java @@ -17,13 +17,12 @@ package org.apache.hop.workflow.actions.telnet; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionTelnetLoadSaveTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/truncatetables/src/test/java/org/apache/hop/workflow/actions/truncatetables/ActionTruncateTablesLoadSaveTest.java b/plugins/actions/truncatetables/src/test/java/org/apache/hop/workflow/actions/truncatetables/ActionTruncateTablesLoadSaveTest.java index 0f35feffbf9..df07ca48712 100644 --- a/plugins/actions/truncatetables/src/test/java/org/apache/hop/workflow/actions/truncatetables/ActionTruncateTablesLoadSaveTest.java +++ b/plugins/actions/truncatetables/src/test/java/org/apache/hop/workflow/actions/truncatetables/ActionTruncateTablesLoadSaveTest.java @@ -77,38 +77,37 @@ protected Map> createAttributeValidatorsMap() Map> validators = new HashMap<>(); validators.put( - "items", new ListLoadSaveValidator(new TruncateTableItemLoadSaveValidator())); + "items", + new ListLoadSaveValidator(new TruncateTableItemLoadSaveValidator())); return validators; } public class TruncateTableItemLoadSaveValidator - implements IFieldLoadSaveValidator { + implements IFieldLoadSaveValidator { final Random rand = new Random(); @Override public TruncateTableItem getTestObject() { TruncateTableItem field = - new TruncateTableItem( - UUID.randomUUID().toString(), - UUID.randomUUID().toString()); + new TruncateTableItem(UUID.randomUUID().toString(), UUID.randomUUID().toString()); return field; } @Override public boolean validateTestObject(TruncateTableItem testObject, Object actual) { - + if (!(actual instanceof TruncateTableItem)) { return false; } - + TruncateTableItem another = (TruncateTableItem) actual; return new EqualsBuilder() - .append(testObject.getSchemaName(), another.getSchemaName()) - .append(testObject.getTableName(), another.getTableName()) - .isEquals(); + .append(testObject.getSchemaName(), another.getSchemaName()) + .append(testObject.getTableName(), another.getTableName()) + .isEquals(); } } } diff --git a/plugins/actions/unzip/src/main/java/org/apache/hop/workflow/actions/unzip/ActionUnZip.java b/plugins/actions/unzip/src/main/java/org/apache/hop/workflow/actions/unzip/ActionUnZip.java index 385afdfe8f8..4e5c520798a 100644 --- a/plugins/actions/unzip/src/main/java/org/apache/hop/workflow/actions/unzip/ActionUnZip.java +++ b/plugins/actions/unzip/src/main/java/org/apache/hop/workflow/actions/unzip/ActionUnZip.java @@ -17,6 +17,15 @@ package org.apache.hop.workflow.actions.unzip; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -46,16 +55,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'unzip' action. Its main use would be to unzip files in a directory */ @Action( id = "UNZIP", @@ -1179,7 +1178,9 @@ public static final String getIfFileExistsCode(int i) { return typeIfFileExistsCode[i]; } - /** @return Returns the iffileexist. */ + /** + * @return Returns the iffileexist. + */ public int getIfFileExist() { return iffileexist; } diff --git a/plugins/actions/unzip/src/test/java/org/apache/hop/workflow/actions/unzip/WorkflowActionUnZipTest.java b/plugins/actions/unzip/src/test/java/org/apache/hop/workflow/actions/unzip/WorkflowActionUnZipTest.java index 0a18b1bc18d..fa0812ad205 100644 --- a/plugins/actions/unzip/src/test/java/org/apache/hop/workflow/actions/unzip/WorkflowActionUnZipTest.java +++ b/plugins/actions/unzip/src/test/java/org/apache/hop/workflow/actions/unzip/WorkflowActionUnZipTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.workflow.actions.unzip; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -24,11 +28,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - public class WorkflowActionUnZipTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFile.java b/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFile.java index 7f8dfece2e6..a528e537718 100644 --- a/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFile.java +++ b/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFile.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.waitforfile; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.Const; @@ -38,7 +39,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.util.List; /** This defines a 'wait for file' action. Its use is to wait for a file to appear. */ @Action( @@ -54,19 +54,24 @@ public class ActionWaitForFile extends ActionBase implements Cloneable, IAction @HopMetadataProperty(key = "filename") private String filename; + /** Maximum timeout in seconds */ @HopMetadataProperty(key = "maximum_timeout") - private String maximumTimeout; + private String maximumTimeout; + /** cycle time in seconds */ @HopMetadataProperty(key = "check_cycle_time") - private String checkCycleTime; + private String checkCycleTime; + @HopMetadataProperty(key = "success_on_timeout") private boolean successOnTimeout; + @HopMetadataProperty(key = "file_size_check") private boolean fileSizeCheck; + @HopMetadataProperty(key = "add_filename_result") private boolean addFilenameToResult; - + // infinite timeout private static String DEFAULT_MAXIMUM_TIMEOUT = "0"; diff --git a/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFileDialog.java b/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFileDialog.java index 1f95cfc8ab7..47a2806a8da 100644 --- a/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFileDialog.java +++ b/plugins/actions/waitforfile/src/main/java/org/apache/hop/workflow/actions/waitforfile/ActionWaitForFileDialog.java @@ -283,8 +283,7 @@ public void widgetSelected(SelectionEvent e) { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, 2 * margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, 2 * margin, null); getData(); diff --git a/plugins/actions/waitforfile/src/test/java/org/apache/hop/workflow/actions/waitforfile/WorkflowActionWaitForFileTest.java b/plugins/actions/waitforfile/src/test/java/org/apache/hop/workflow/actions/waitforfile/WorkflowActionWaitForFileTest.java index 97a2bbc8de1..c3627d140ae 100644 --- a/plugins/actions/waitforfile/src/test/java/org/apache/hop/workflow/actions/waitforfile/WorkflowActionWaitForFileTest.java +++ b/plugins/actions/waitforfile/src/test/java/org/apache/hop/workflow/actions/waitforfile/WorkflowActionWaitForFileTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.waitforfile; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionWaitForFileTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java b/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java index 0c90ea86162..fb9798e060c 100644 --- a/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java +++ b/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java @@ -666,7 +666,7 @@ private void getSql() { mb.setMessage(BaseMessages.getString(PKG, "ActionWaitForSQL.ConnectionNoLongerAvailable")); mb.setText(BaseMessages.getString(PKG, "ActionWaitForSQL.DialogCaptionError4")); mb.open(); - } + } } public void setPosition() { @@ -750,8 +750,9 @@ private void ok() { private void getTableName() { DatabaseMeta databaseMeta = workflowMeta.findDatabase(wConnection.getText(), variables); if (databaseMeta != null) { - DatabaseExplorerDialog std = new DatabaseExplorerDialog(shell, SWT.NONE, variables, - databaseMeta, getWorkflowMeta().getDatabases()); + DatabaseExplorerDialog std = + new DatabaseExplorerDialog( + shell, SWT.NONE, variables, databaseMeta, getWorkflowMeta().getDatabases()); std.setSelectedSchemaAndTable(wSchemaname.getText(), wTablename.getText()); if (std.open()) { wTablename.setText(Const.NVL(std.getTableName(), "")); diff --git a/plugins/actions/waitforsql/src/test/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlTest.java b/plugins/actions/waitforsql/src/test/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlTest.java index 2d9bcdc0559..5398a22fbb0 100644 --- a/plugins/actions/waitforsql/src/test/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlTest.java +++ b/plugins/actions/waitforsql/src/test/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; @@ -29,7 +30,7 @@ /** Unit tests for wait for sql action. */ public class ActionWaitForSqlTest { - + @Test public void testSerialization() throws Exception { HopClientEnvironment.init(); diff --git a/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailable.java b/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailable.java index 06d668c6916..7daec88285a 100644 --- a/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailable.java +++ b/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailable.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow.actions.webserviceavailable; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -30,10 +33,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; - /** This defines a webservice available action. */ @Action( id = "WEBSERVICE_AVAILABLE", @@ -89,7 +88,8 @@ public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVari } catch (HopXmlException xe) { throw new HopXmlException( BaseMessages.getString( - PKG, "ActionWebServiceAvailable.ERROR_0001_Cannot_Load_Workflow_Action_From_Xml_Node"), + PKG, + "ActionWebServiceAvailable.ERROR_0001_Cannot_Load_Workflow_Action_From_Xml_Node"), xe); } } diff --git a/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailableDialog.java b/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailableDialog.java index e58bf6abf66..3d80f61e3b2 100644 --- a/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailableDialog.java +++ b/plugins/actions/webserviceavailable/src/main/java/org/apache/hop/workflow/actions/webserviceavailable/ActionWebServiceAvailableDialog.java @@ -189,8 +189,8 @@ public IAction open() { Button wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); getData(); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); + getData(); BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); diff --git a/plugins/actions/webserviceavailable/src/test/java/org/apache/hop/workflow/actions/webserviceavailable/WorkflowActionWebServiceAvailableTest.java b/plugins/actions/webserviceavailable/src/test/java/org/apache/hop/workflow/actions/webserviceavailable/WorkflowActionWebServiceAvailableTest.java index ecff5ff7cfc..f047bf51254 100644 --- a/plugins/actions/webserviceavailable/src/test/java/org/apache/hop/workflow/actions/webserviceavailable/WorkflowActionWebServiceAvailableTest.java +++ b/plugins/actions/webserviceavailable/src/test/java/org/apache/hop/workflow/actions/webserviceavailable/WorkflowActionWebServiceAvailableTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.webserviceavailable; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionWebServiceAvailableTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowGuiPlugin.java b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowGuiPlugin.java index c0e2da17073..1cd6f694a98 100644 --- a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowGuiPlugin.java +++ b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowGuiPlugin.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.workflow; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.extension.ExtensionPointHandler; @@ -39,8 +40,6 @@ import org.apache.hop.workflow.action.ActionMeta; import org.apache.hop.workflow.config.WorkflowRunConfiguration; -import java.util.List; - /** * This is a convenient way to add a workflow you just designed to another workflow in the form of * an action. @@ -113,11 +112,9 @@ public void copyAsActionToClipboard(HopGuiWorkflowContext context) { StringBuilder xml = new StringBuilder(5000).append(XmlHandler.getXmlHeader()); xml.append(XmlHandler.openTag(HopGuiWorkflowClipboardDelegate.XML_TAG_WORKFLOW_ACTIONS)) .append(Const.CR); - xml.append(XmlHandler.openTag(WorkflowMeta.XML_TAG_ACTIONS)) - .append(Const.CR); + xml.append(XmlHandler.openTag(WorkflowMeta.XML_TAG_ACTIONS)).append(Const.CR); xml.append(actionMeta.getXml()); - xml.append(XmlHandler.closeTag(WorkflowMeta.XML_TAG_ACTIONS)) - .append(Const.CR); + xml.append(XmlHandler.closeTag(WorkflowMeta.XML_TAG_ACTIONS)).append(Const.CR); xml.append(XmlHandler.closeTag(HopGuiWorkflowClipboardDelegate.XML_TAG_WORKFLOW_ACTIONS)) .append(Const.CR); diff --git a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java index 8949304338c..8bec56dbdff 100644 --- a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java +++ b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java @@ -72,22 +72,30 @@ public void run() { finished = true; } - /** @param result The result to set. */ + /** + * @param result The result to set. + */ public void setResult(Result result) { this.result = result; } - /** @return Returns the result. */ + /** + * @return Returns the result. + */ public Result getResult() { return result; } - /** @return Returns the log. */ + /** + * @return Returns the log. + */ public ILogChannel getLog() { return log; } - /** @param log The log to set. */ + /** + * @param log The log to set. + */ public void setLog(ILogChannel log) { this.log = log; } @@ -101,22 +109,30 @@ public IWorkflowEngine getWorkflow() { return workflow; } - /** @param workflow The workflow to set */ + /** + * @param workflow The workflow to set + */ public void setWorkflow(IWorkflowEngine workflow) { this.workflow = workflow; } - /** @return Returns the entryNr. */ + /** + * @return Returns the entryNr. + */ public int getEntryNr() { return entryNr; } - /** @param entryNr The entryNr to set. */ + /** + * @param entryNr The entryNr to set. + */ public void setEntryNr(int entryNr) { this.entryNr = entryNr; } - /** @return Returns the finished. */ + /** + * @return Returns the finished. + */ public boolean isFinished() { return finished; } diff --git a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/HopGuiWorkflowHwfFilenamePastedExtensionPoint.java b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/HopGuiWorkflowHwfFilenamePastedExtensionPoint.java index 397239b6ded..f3f2ea78d05 100644 --- a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/HopGuiWorkflowHwfFilenamePastedExtensionPoint.java +++ b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/HopGuiWorkflowHwfFilenamePastedExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.workflow; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -31,8 +32,6 @@ import org.apache.hop.workflow.action.ActionMeta; import org.apache.hop.workflow.config.WorkflowRunConfiguration; -import java.util.List; - @ExtensionPoint( id = "HopGuiWorkflowHwfFilenamePastedExtensionPoint", extensionPointId = "HopGuiWorkflowClipboardFilePaste", diff --git a/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFile.java b/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFile.java index 1857420c99f..55023f92b0d 100644 --- a/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFile.java +++ b/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFile.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow.actions.writetofile; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -36,9 +39,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.action.validator.ActionValidatorUtils; import org.apache.hop.workflow.action.validator.AndValidator; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.util.List; /** * This defines a 'write to file' action. Its main use would be to create empty trigger files that @@ -57,12 +57,16 @@ public class ActionWriteToFile extends ActionBase implements Cloneable, IAction @HopMetadataProperty(key = "filename") private String filename; + @HopMetadataProperty(key = "createParentFolder") private boolean createParentFolder; + @HopMetadataProperty(key = "appendFile") private boolean appendFile; + @HopMetadataProperty(key = "content") private String content; + @HopMetadataProperty(key = "encoding") private String encoding; diff --git a/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFileDialog.java b/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFileDialog.java index 2f628a35de9..b4f0ee6d832 100644 --- a/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFileDialog.java +++ b/plugins/actions/writetofile/src/main/java/org/apache/hop/workflow/actions/writetofile/ActionWriteToFileDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.workflow.actions.writetofile; +import java.nio.charset.Charset; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.util.Utils; @@ -48,9 +50,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; - /** This dialog allows you to edit the Write to file action settings. */ public class ActionWriteToFileDialog extends ActionDialog implements IActionDialog { private static final Class PKG = ActionWriteToFile.class; // For Translator diff --git a/plugins/actions/writetofile/src/test/java/org/apache/hop/workflow/actions/writetofile/WorkflowActionWriteToFileTest.java b/plugins/actions/writetofile/src/test/java/org/apache/hop/workflow/actions/writetofile/WorkflowActionWriteToFileTest.java index 7a956f65135..e36b70ea38f 100644 --- a/plugins/actions/writetofile/src/test/java/org/apache/hop/workflow/actions/writetofile/WorkflowActionWriteToFileTest.java +++ b/plugins/actions/writetofile/src/test/java/org/apache/hop/workflow/actions/writetofile/WorkflowActionWriteToFileTest.java @@ -16,13 +16,12 @@ */ package org.apache.hop.workflow.actions.writetofile; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; -import org.junit.ClassRule; - import java.util.Arrays; import java.util.List; import java.util.Map; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; +import org.junit.ClassRule; public class WorkflowActionWriteToFileTest extends WorkflowActionLoadSaveTestSupport { diff --git a/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLog.java b/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLog.java index ea707980003..838e006a705 100644 --- a/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLog.java +++ b/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLog.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.writetolog; +import java.util.Date; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -30,7 +31,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.workflow.action.ActionBase; import org.apache.hop.workflow.action.IAction; -import java.util.Date; /** Action type to output message to the workflow log. */ @Action( @@ -45,12 +45,12 @@ public class ActionWriteToLog extends ActionBase implements Cloneable, IAction { private static final Class PKG = ActionWriteToLog.class; // For Translator /** The log level with which the message should be logged. */ - @HopMetadataProperty(key = "loglevel", storeWithCode=true) + @HopMetadataProperty(key = "loglevel", storeWithCode = true) private LogLevel actionLogLevel; - + @HopMetadataProperty(key = "logsubject") private String logSubject; - + @HopMetadataProperty(key = "logmessage") private String logMessage; @@ -126,7 +126,9 @@ public LogLevel getLogLevel() { return logLevel; } - /** @return the execution container object id */ + /** + * @return the execution container object id + */ @Override public String getContainerId() { return containerObjectId; @@ -161,7 +163,8 @@ public void setForcingSeparateLogging(boolean forcingSeparateLogging) { protected ILogChannel createLogChannel() { String subject = Const.nullToEmpty(resolve(getLogSubject())); - LogWriterObject logWriterObject = new LogWriterObject(subject, this, parentWorkflow.getLogLevel()); + LogWriterObject logWriterObject = + new LogWriterObject(subject, this, parentWorkflow.getLogLevel()); return logWriterObject.getLogChannel(); } diff --git a/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLogDialog.java b/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLogDialog.java index 872301f213f..fb4c0753d73 100644 --- a/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLogDialog.java +++ b/plugins/actions/writetolog/src/main/java/org/apache/hop/workflow/actions/writetolog/ActionWriteToLogDialog.java @@ -34,7 +34,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.action.IActionDialog; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; @@ -168,7 +167,7 @@ public IAction open() { fdlLogMessage.top = new FormAttachment(wLogSubject, margin); fdlLogMessage.right = new FormAttachment(middle, -margin); wlLogMessage.setLayoutData(fdlLogMessage); - + wLogMessage = new TextVar( variables, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); diff --git a/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogLoadSaveTest.java b/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogLoadSaveTest.java index 6adef7147b4..939fc3d49de 100644 --- a/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogLoadSaveTest.java +++ b/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogLoadSaveTest.java @@ -17,6 +17,11 @@ package org.apache.hop.workflow.actions.writetolog; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.core.logging.LogLevel; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.validator.EnumLoadSaveValidator; @@ -24,12 +29,6 @@ import org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WorkflowActionWriteToLogLoadSaveTest extends WorkflowActionLoadSaveTestSupport { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogTest.java b/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogTest.java index a5110444c64..63af273bc35 100644 --- a/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogTest.java +++ b/plugins/actions/writetolog/src/test/java/org/apache/hop/workflow/actions/writetolog/WorkflowActionWriteToLogTest.java @@ -16,6 +16,13 @@ */ package org.apache.hop.workflow.actions.writetolog; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.logging.HopLogStore; @@ -29,13 +36,6 @@ import org.junit.Test; import org.mockito.verification.VerificationMode; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - public class WorkflowActionWriteToLogTest { private IWorkflowEngine parentWorkflow; diff --git a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidator.java b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidator.java index bcb7c511963..494ee526dab 100644 --- a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidator.java +++ b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidator.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.xml.dtdvalidator; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -36,8 +37,6 @@ import org.apache.hop.workflow.action.validator.ValidatorContext; import org.w3c.dom.Node; -import java.util.List; - /** This defines a 'dtdvalidator' job entry. */ @Action( id = "DTD_VALIDATOR", diff --git a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidatorUtil.java b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidatorUtil.java index 0b07543ac0c..9eca02f24eb 100644 --- a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidatorUtil.java +++ b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/dtdvalidator/DtdValidatorUtil.java @@ -17,6 +17,14 @@ package org.apache.hop.workflow.actions.xml.dtdvalidator; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.logging.ILogChannel; @@ -28,15 +36,6 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; - public class DtdValidatorUtil { private static final Class PKG = DtdValidator.class; // For Translator diff --git a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xmlwellformed/XmlWellFormed.java b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xmlwellformed/XmlWellFormed.java index 54597260860..74674d8f0d8 100644 --- a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xmlwellformed/XmlWellFormed.java +++ b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xmlwellformed/XmlWellFormed.java @@ -17,6 +17,10 @@ package org.apache.hop.workflow.actions.xml.xmlwellformed; +import java.io.IOException; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -47,11 +51,6 @@ import org.w3c.dom.Node; import org.xml.sax.helpers.DefaultHandler; -import java.io.IOException; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** This defines a 'xml well formed' workflow action. */ @Action( id = "XML_WELL_FORMED", @@ -72,17 +71,29 @@ public class XmlWellFormed extends ActionBase implements Cloneable, IAction { public static final String ADD_WELL_FORMED_FILES_ONLY = "only_well_formed_filenames"; public static final String ADD_BAD_FORMED_FILES_ONLY = "only_bad_formed_filenames"; - /** @Deprecated no longer used */ - @Deprecated(since="2.0") public boolean argFromPrevious; - - /** @Deprecated no longer used */ - @Deprecated(since="2.0") public boolean includeSubfolders; - - /** @Deprecated no longer used */ - @Deprecated(since="2.0") public String[] sourceFileFolders; - - /** @Deprecated no longer used */ - @Deprecated(since="2.0") public String[] wildcard; + /** + * @Deprecated no longer used + */ + @Deprecated(since = "2.0") + public boolean argFromPrevious; + + /** + * @Deprecated no longer used + */ + @Deprecated(since = "2.0") + public boolean includeSubfolders; + + /** + * @Deprecated no longer used + */ + @Deprecated(since = "2.0") + public String[] sourceFileFolders; + + /** + * @Deprecated no longer used + */ + @Deprecated(since = "2.0") + public String[] wildcard; private String nrErrorsLessThan; private String successCondition; diff --git a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xsdvalidator/XsdValidator.java b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xsdvalidator/XsdValidator.java index ee5b3a7cd26..159b1d5eb7a 100644 --- a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xsdvalidator/XsdValidator.java +++ b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xsdvalidator/XsdValidator.java @@ -17,6 +17,20 @@ package org.apache.hop.workflow.actions.xml.xsdvalidator; +import static org.apache.hop.workflow.action.validator.AbstractFileValidator.putVariableSpace; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.andValidator; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.fileExistsValidator; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.notBlankValidator; +import static org.apache.hop.workflow.action.validator.AndValidator.putValidators; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; import org.apache.commons.lang3.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -41,21 +55,6 @@ import org.w3c.dom.Node; import org.xml.sax.SAXException; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; -import java.io.File; -import java.io.IOException; -import java.util.List; - -import static org.apache.hop.workflow.action.validator.AbstractFileValidator.putVariableSpace; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.andValidator; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.fileExistsValidator; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.notBlankValidator; -import static org.apache.hop.workflow.action.validator.AndValidator.putValidators; - /** This defines a 'xsdvalidator' job entry. */ @Action( id = "XSD_VALIDATOR", @@ -170,7 +169,7 @@ public Result execute(Result previousResult, int nr) { File xsdFile = new File(HopVfs.getFilename(xsdfile)); schemaXSD = factorytXSDValidator1.newSchema(xsdFile); - } else {//not specifying filename + } else { // not specifying filename schemaXSD = factorytXSDValidator1.newSchema(); } @@ -179,8 +178,7 @@ public Result execute(Result previousResult, int nr) { if (!isAllowExternalEntities()) { xsdValidator.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); xsdValidator.setFeature("http://xml.org/sax/features/external-general-entities", false); - xsdValidator.setFeature( - "http://xml.org/sax/features/external-parameter-entities", false); + xsdValidator.setFeature("http://xml.org/sax/features/external-parameter-entities", false); xsdValidator.setProperty( "http://apache.org/xml/properties/internal/entity-resolver", (XMLEntityResolver) @@ -219,7 +217,9 @@ public Result execute(Result previousResult, int nr) { } } catch (IOException e) { - logError(BaseMessages.getString(PKG, "ActionXSDValidator.ErrorCloseFile.Label") + e.getMessage()); + logError( + BaseMessages.getString(PKG, "ActionXSDValidator.ErrorCloseFile.Label") + + e.getMessage()); result.setNrErrors(1); } } @@ -228,7 +228,7 @@ public Result execute(Result previousResult, int nr) { } private void validateNonNullFileName(String filename, String key, Result result) { - if(StringUtils.isEmpty(filename)){ + if (StringUtils.isEmpty(filename)) { logError(BaseMessages.getString(PKG, key)); result.setNrErrors(1); } diff --git a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xslt/Xslt.java b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xslt/Xslt.java index eef07b5fd55..e9d02524079 100644 --- a/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xslt/Xslt.java +++ b/plugins/actions/xml/src/main/java/org/apache/hop/workflow/actions/xml/xslt/Xslt.java @@ -17,6 +17,23 @@ package org.apache.hop.workflow.actions.xml.xslt; +import static org.apache.hop.workflow.action.validator.AbstractFileValidator.putVariableSpace; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.andValidator; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.fileExistsValidator; +import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.notBlankValidator; +import static org.apache.hop.workflow.action.validator.AndValidator.putValidators; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Properties; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -43,24 +60,6 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.w3c.dom.Node; -import javax.xml.transform.Source; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Properties; - -import static org.apache.hop.workflow.action.validator.AbstractFileValidator.putVariableSpace; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.andValidator; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.fileExistsValidator; -import static org.apache.hop.workflow.action.validator.ActionValidatorUtils.notBlankValidator; -import static org.apache.hop.workflow.action.validator.AndValidator.putValidators; - /** This defines a 'xslt' job entry. */ @Action( id = "XSLT", @@ -633,37 +632,51 @@ public void check( andValidator().validate(this, "outputFilename", remarks, putValidators(notBlankValidator())); } - /** @return Returns the OutputPropertyName. */ + /** + * @return Returns the OutputPropertyName. + */ public String[] getOutputPropertyName() { return outputPropertyName; } - /** @param argumentDirection The OutputPropertyName to set. */ + /** + * @param argumentDirection The OutputPropertyName to set. + */ public void setOutputPropertyName(String[] argumentDirection) { this.outputPropertyName = argumentDirection; } - /** @return Returns the OutputPropertyField. */ + /** + * @return Returns the OutputPropertyField. + */ public String[] getOutputPropertyValue() { return outputPropertyValue; } - /** @param argumentDirection The outputPropertyValue to set. */ + /** + * @param argumentDirection The outputPropertyValue to set. + */ public void setOutputPropertyValue(String[] argumentDirection) { this.outputPropertyValue = argumentDirection; } - /** @return Returns the parameterName. */ + /** + * @return Returns the parameterName. + */ public String[] getParameterName() { return parameterName; } - /** @param argumentDirection The parameterName to set. */ + /** + * @param argumentDirection The parameterName to set. + */ public void setParameterName(String[] argumentDirection) { this.parameterName = argumentDirection; } - /** @return Returns the parameterField. */ + /** + * @return Returns the parameterField. + */ public String[] getParameterField() { return parameterField; } diff --git a/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ActioZipFileTest.java b/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ActioZipFileTest.java index 7992b22db90..484c4982121 100644 --- a/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ActioZipFileTest.java +++ b/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ActioZipFileTest.java @@ -18,20 +18,15 @@ package org.apache.hop.workflow.actions.zipfile; -import org.apache.hop.core.Const; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; -import org.apache.hop.workflow.action.ActionMeta; import org.apache.hop.workflow.action.ActionSerializationTestUtil; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class ActioZipFileTest { @Test diff --git a/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ZipWorkflowEntryPatternFileSelectorTest.java b/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ZipWorkflowEntryPatternFileSelectorTest.java index dee4f2b7427..0b9ff3dc0e0 100644 --- a/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ZipWorkflowEntryPatternFileSelectorTest.java +++ b/plugins/actions/zipfile/src/test/java/org/apache/hop/workflow/actions/zipfile/ZipWorkflowEntryPatternFileSelectorTest.java @@ -17,6 +17,7 @@ package org.apache.hop.workflow.actions.zipfile; +import java.util.regex.Pattern; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -28,8 +29,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.util.regex.Pattern; - public class ZipWorkflowEntryPatternFileSelectorTest { private FileSelector fileSelector; diff --git a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutput.java b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutput.java index ba4ed0c8e36..3fefe063f97 100644 --- a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutput.java +++ b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutput.java @@ -23,6 +23,10 @@ import com.healthmarketscience.jackcess.Database.FileFormat; import com.healthmarketscience.jackcess.DatabaseBuilder; import com.healthmarketscience.jackcess.TableBuilder; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -38,11 +42,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - public class AccessOutput extends BaseTransform { private static final Class PKG = AccessOutput.class; // for i18n purposes, needed by Translator2!! @@ -323,10 +322,10 @@ public List prepareTableColumns(IRowMeta row) { column.setLength(DataType.SHORT_DATE_TIME.getFixedSize()); break; case IValueMeta.TYPE_STRING: - if (length < DataType.TEXT.getMaxSize()/DataType.TEXT.getUnitSize() ) { + if (length < DataType.TEXT.getMaxSize() / DataType.TEXT.getUnitSize()) { column.setType(DataType.TEXT); } else { - column.setType(DataType.MEMO); + column.setType(DataType.MEMO); } column.setLength(length); break; diff --git a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputData.java b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputData.java index 8733af85c0b..5f4a30d1585 100644 --- a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputData.java +++ b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputData.java @@ -18,13 +18,12 @@ import com.healthmarketscience.jackcess.Database; import com.healthmarketscience.jackcess.Table; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.List; - public class AccessOutputData extends BaseTransformData implements ITransformData { public Database db; public Table table; diff --git a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputDialog.java b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputDialog.java index 2ad783aadf6..cdac7722124 100644 --- a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputDialog.java +++ b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputDialog.java @@ -18,6 +18,8 @@ import com.healthmarketscience.jackcess.Database; import com.healthmarketscience.jackcess.DatabaseBuilder; +import java.io.File; +import java.util.Set; import org.apache.commons.io.FileUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -44,9 +46,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.io.File; -import java.util.Set; - public class AccessOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = AccessOutputDialog.class; // for i18n purposes, needed by Translator2!! diff --git a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputMeta.java b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputMeta.java index 5dd408deec4..bb3f48e3dd9 100644 --- a/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputMeta.java +++ b/plugins/databases/access/src/main/java/org/apache/hop/pipeline/transforms/accessoutput/AccessOutputMeta.java @@ -20,6 +20,10 @@ import com.healthmarketscience.jackcess.Database; import com.healthmarketscience.jackcess.DatabaseBuilder; import com.healthmarketscience.jackcess.Table; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -44,12 +48,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.io.File; -import java.io.IOException; -import java.sql.SQLException; -import java.util.List; -import java.util.Map; - @Transform( id = "AccessOutput", name = "i18n::AccessOutput.Name", diff --git a/plugins/databases/access/src/test/java/org/apache/hop/databases/access/AccessDatabaseMetaTest.java b/plugins/databases/access/src/test/java/org/apache/hop/databases/access/AccessDatabaseMetaTest.java index 88b231328dc..a2f4f44736e 100644 --- a/plugins/databases/access/src/test/java/org/apache/hop/databases/access/AccessDatabaseMetaTest.java +++ b/plugins/databases/access/src/test/java/org/apache/hop/databases/access/AccessDatabaseMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.databases.access; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.row.value.ValueMetaBigNumber; @@ -32,10 +36,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - public class AccessDatabaseMetaTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); @@ -56,91 +56,94 @@ public void testSettings() throws Exception { assertEquals(8388607, nativeMeta.getMaxTextFieldLength()); assertEquals( "jdbc:ucanaccess://e://Dir//Contacts.accdb;showSchema=true;newDatabaseVersion=V2010", - nativeMeta.getURL(null, null, "e://Dir//Contacts.accdb")); // note - MS Access driver ignores the server and port + nativeMeta.getURL( + null, + null, + "e://Dir//Contacts.accdb")); // note - MS Access driver ignores the server and port String[] expectedReservedWords = new String[] { - "AND", - "ANY", - "AS", - "ALL", - "AT", - "AVG", - "BETWEEN", - "BOTH", - "BY", - "CALL", - "CASE", - "CAST", - "COALESCE", - "CONSTRAINT", - "CORRESPONDING", - "CONVERT", - "COUNT", - "CREATE", - "CROSS", - "DEFAULT", - "DISTINCT", - "DO", - "DROP", - "ELSE", - "EVERY", - "EXISTS", - "EXCEPT", - "FOR", - "FROM", - "FULL", - "GRANT", - "GROUP", - "HAVING", - "IN", - "INNER", - "INTERSECT", - "INTO", - "IS", - "JOIN", - "LEFT", - "LEADING", - "LIKE", - "MAX", - "MIN", - "NATURAL", - "NOT", - "NULLIF", - "ON", - "ORDER", - "OR", - "OUTER", - "PRIMARY", - "REFERENCES", - "RIGHT", - "SELECT", - "SET", - "SOME", - "STDDEV_POP", - "STDDEV_SAMP", - "SUM", - "TABLE", - "THEN", - "TO", - "TRAILING", - "TRIGGER", - "UNION", - "UNIQUE", - "USING", - "USER", - "VALUES", - "VAR_POP", - "VAR_SAMP", - "WHEN", - "WHERE", - "WITH", - "END" + "AND", + "ANY", + "AS", + "ALL", + "AT", + "AVG", + "BETWEEN", + "BOTH", + "BY", + "CALL", + "CASE", + "CAST", + "COALESCE", + "CONSTRAINT", + "CORRESPONDING", + "CONVERT", + "COUNT", + "CREATE", + "CROSS", + "DEFAULT", + "DISTINCT", + "DO", + "DROP", + "ELSE", + "EVERY", + "EXISTS", + "EXCEPT", + "FOR", + "FROM", + "FULL", + "GRANT", + "GROUP", + "HAVING", + "IN", + "INNER", + "INTERSECT", + "INTO", + "IS", + "JOIN", + "LEFT", + "LEADING", + "LIKE", + "MAX", + "MIN", + "NATURAL", + "NOT", + "NULLIF", + "ON", + "ORDER", + "OR", + "OUTER", + "PRIMARY", + "REFERENCES", + "RIGHT", + "SELECT", + "SET", + "SOME", + "STDDEV_POP", + "STDDEV_SAMP", + "SUM", + "TABLE", + "THEN", + "TO", + "TRAILING", + "TRIGGER", + "UNION", + "UNIQUE", + "USING", + "USER", + "VALUES", + "VAR_POP", + "VAR_SAMP", + "WHEN", + "WHERE", + "WITH", + "END" }; assertArrayEquals(expectedReservedWords, nativeMeta.getReservedWords()); assertFalse(nativeMeta.isSupportsFloatRoundingOnUpdate()); assertEquals(255, nativeMeta.getMaxVARCHARLength()); - assertFalse(nativeMeta.isSupportsSequences()); + assertFalse(nativeMeta.isSupportsSequences()); } @Test @@ -196,7 +199,8 @@ public void testGetFieldDefinition() { false, false)); - assertEquals("TEXT", + assertEquals( + "TEXT", nativeMeta.getFieldDefinition( new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() - 1, 0), "", diff --git a/plugins/databases/as400/src/main/java/org/apache/hop/databases/as400/AS400DatabaseMeta.java b/plugins/databases/as400/src/main/java/org/apache/hop/databases/as400/AS400DatabaseMeta.java index b71c2ecffce..f254f0e4af2 100644 --- a/plugins/databases/as400/src/main/java/org/apache/hop/databases/as400/AS400DatabaseMeta.java +++ b/plugins/databases/as400/src/main/java/org/apache/hop/databases/as400/AS400DatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains AS/400 specific information through static final members - */ -@DatabaseMetaPlugin(type = "AS/400", typeDescription = "AS/400", documentationUrl = "/database/databases/as400.html") +/** Contains AS/400 specific information through static final members */ +@DatabaseMetaPlugin( + type = "AS/400", + typeDescription = "AS/400", + documentationUrl = "/database/databases/as400.html") @GuiPlugin(id = "GUI-AS400DatabaseMeta") public class AS400DatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -523,7 +524,9 @@ public int getMaxVARCHARLength() { return 32672; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return true; diff --git a/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400DatabaseMetaTest.java b/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400DatabaseMetaTest.java index 317234459a8..2680f2dcaa9 100644 --- a/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400DatabaseMetaTest.java +++ b/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400DatabaseMetaTest.java @@ -1,496 +1,496 @@ -/* - * 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 org.apache.hop.databases.as400; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class AS400DatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - AS400DatabaseMeta nativeMeta; - - @Before - public void setupOnce() throws Exception { - nativeMeta = new AS400DatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - HopClientEnvironment.init(); - } - - @Test - public void testSettings() throws Exception { - int[] aTypes = new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; - assertArrayEquals(aTypes, nativeMeta.getAccessTypeList()); - assertEquals("com.ibm.as400.access.AS400JDBCDriver", nativeMeta.getDriverClass()); - assertEquals(65536, nativeMeta.getMaxTextFieldLength()); - assertEquals( - "jdbc:as400://foo/bar", - nativeMeta.getURL("foo", "1500", "bar")); // note - AS400 driver ignores the port - String[] expectedReservedWords = - new String[] { - // http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp - // This is the list of currently reserved DB2 UDB for iSeries words. Words may be added at - // any time. - // For a list of additional words that may become reserved in the future, see the IBM SQL - // and - // ANSI reserved words in the IBM SQL Reference Version 1 SC26-3255. - "ACTIVATE", - "ADD", - "ALIAS", - "ALL", - "ALLOCATE", - "ALLOW", - "ALTER", - "AND", - "ANY", - "AS", - "ASENSITIVE", - "AT", - "ATTRIBUTES", - "AUTHORIZATION", - "BEGIN", - "BETWEEN", - "BINARY", - "BY", - "CACHE", - "CALL", - "CALLED", - "CARDINALITY", - "CASE", - "CAST", - "CCSID", - "CHAR", - "CHARACTER", - "CHECK", - "CLOSE", - "COLLECTION", - "COLUMN", - "COMMENT", - "COMMIT", - "CONCAT", - "CONDITION", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONTAINS", - "CONTINUE", - "COUNT", - "COUNT_BIG", - "CREATE", - "CROSS", - "CURRENT", - "CURRENT_DATE", - "CURRENT_PATH", - "CURRENT_SCHEMA", - "CURRENT_SERVER", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_TIMEZONE", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DATABASE", - "DATAPARTITIONNAME", - "DATAPARTITIONNUM", - "DATE", - "DAY", - "DAYS", - "DBINFO", - "DBPARTITIONNAME", - "DBPARTITIONNUM", - "DB2GENERAL", - "DB2GENRL", - "DB2SQL", - "DEALLOCATE", - "DECLARE", - "DEFAULT", - "DEFAULTS", - "DEFINITION", - "DELETE", - "DENSERANK", - "DENSE_RANK", - "DESCRIBE", - "DESCRIPTOR", - "DETERMINISTIC", - "DIAGNOSTICS", - "DISABLE", - "DISALLOW", - "DISCONNECT", - "DISTINCT", - "DO", - "DOUBLE", - "DROP", - "DYNAMIC", - "EACH", - "ELSE", - "ELSEIF", - "ENABLE", - "ENCRYPTION", - "END", - "ENDING", - "END-EXEC", - "ESCAPE", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXCLUDING", - "EXCLUSIVE", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERNAL", - "EXTRACT", - "FENCED", - "FETCH", - "FILE", - "FINAL", - "FOR", - "FOREIGN", - "FREE", - "FROM", - "FULL", - "FUNCTION", - "GENERAL", - "GENERATED", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GRAPHIC", - "GROUP", - "HANDLER", - "HASH", - "HASHED_VALUE", - "HAVING", - "HINT", - "HOLD", - "HOUR", - "HOURS", - "IDENTITY", - "IF", - "IMMEDIATE", - "IN", - "INCLUDING", - "INCLUSIVE", - "INCREMENT", - "INDEX", - "INDICATOR", - "INHERIT", - "INNER", - "INOUT", - "INSENSITIVE", - "INSERT", - "INTEGRITY", - "INTERSECT", - "INTO", - "IS", - "ISOLATION", - "ITERATE", - "JAVA", - "JOIN", - "KEY", - "LABEL", - "LANGUAGE", - "LATERAL", - "LEAVE", - "LEFT", - "LIKE", - "LINKTYPE", - "LOCAL", - "LOCALDATE", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCK", - "LONG", - "LOOP", - "MAINTAINED", - "MATERIALIZED", - "MAXVALUE", - "MICROSECOND", - "MICROSECONDS", - "MINUTE", - "MINUTES", - "MINVALUE", - "MODE", - "MODIFIES", - "MONTH", - "MONTHS", - "NEW", - "NEW_TABLE", - "NEXTVAL", - "NO", - "NOCACHE", - "NOCYCLE", - "NODENAME", - "NODENUMBER", - "NOMAXVALUE", - "NOMINVALUE", - "NOORDER", - "NORMALIZED", - "NOT", - "NULL", - "OF", - "OLD", - "OLD_TABLE", - "ON", - "OPEN", - "OPTIMIZE", - "OPTION", - "OR", - "ORDER", - "OUT", - "OUTER", - "OVER", - "OVERRIDING", - "PACKAGE", - "PAGESIZE", - "PARAMETER", - "PART", - "PARTITION", - "PARTITIONING", - "PARTITIONS", - "PASSWORD", - "PATH", - "POSITION", - "PREPARE", - "PREVVAL", - "PRIMARY", - "PRIVILEGES", - "PROCEDURE", - "PROGRAM", - "QUERY", - "RANGE", - "RANK", - "READ", - "READS", - "RECOVERY", - "REFERENCES", - "REFERENCING", - "REFRESH", - "RELEASE", - "RENAME", - "REPEAT", - "RESET", - "RESIGNAL", - "RESTART", - "RESULT", - "RETURN", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLLBACK", - "ROUTINE", - "ROW", - "ROWNUMBER", - "ROW_NUMBER", - "ROWS", - "RRN", - "RUN", - "SAVEPOINT", - "SCHEMA", - "SCRATCHPAD", - "SCROLL", - "SEARCH", - "SECOND", - "SECONDS", - "SELECT", - "SENSITIVE", - "SEQUENCE", - "SESSION", - "SESSION_USER", - "SET", - "SIGNAL", - "SIMPLE", - "SOME", - "SOURCE", - "SPECIFIC", - "SQL", - "SQLID", - "STACKED", - "START", - "STARTING", - "STATEMENT", - "STATIC", - "SUBSTRING", - "SUMMARY", - "SYNONYM", - "SYSTEM_USER", - "TABLE", - "THEN", - "TIME", - "TIMESTAMP", - "TO", - "TRANSACTION", - "TRIGGER", - "TRIM", - "TYPE", - "UNDO", - "UNION", - "UNIQUE", - "UNTIL", - "UPDATE", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARIABLE", - "VARIANT", - "VERSION", - "VIEW", - "VOLATILE", - "WHEN", - "WHERE", - "WHILE", - "WITH", - "WITHOUT", - "WRITE", - "YEAR", - "YEARS" - }; - - assertArrayEquals(expectedReservedWords, nativeMeta.getReservedWords()); - assertFalse(nativeMeta.isSupportsFloatRoundingOnUpdate()); - assertEquals(32672, nativeMeta.getMaxVARCHARLength()); - assertTrue(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); - } - - @Test - public void testSqlStatements() { - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(100)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 100, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR SET TIMESTAMP", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals("SELECT SEQNAME FROM SYSCAT.SEQUENCES", nativeMeta.getSqlListOfSequences()); - assertEquals( - "SELECT * FROM SYSCAT.SEQUENCES WHERE SEQNAME = 'FOO'", - nativeMeta.getSqlSequenceExists("FOO")); - assertEquals( - "SELECT PREVIOUS VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", - nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals( - "SELECT NEXT VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", - nativeMeta.getSqlNextSequenceValue("FOO")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "DOUBLE", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); - assertEquals( - "DECIMAL(5)", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); - assertEquals( - "DECIMAL(5, 3)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 5, 3), "", "", false, false, false)); - - assertEquals( - "DECIMAL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 0, 3), "", "", false, false, false)); // This is a bug - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - String.format("VARCHAR(%d)", (nativeMeta.getMaxVARCHARLength() - 1)), - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() - 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() + 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH - 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.as400; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +public class AS400DatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + AS400DatabaseMeta nativeMeta; + + @Before + public void setupOnce() throws Exception { + nativeMeta = new AS400DatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + HopClientEnvironment.init(); + } + + @Test + public void testSettings() throws Exception { + int[] aTypes = new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; + assertArrayEquals(aTypes, nativeMeta.getAccessTypeList()); + assertEquals("com.ibm.as400.access.AS400JDBCDriver", nativeMeta.getDriverClass()); + assertEquals(65536, nativeMeta.getMaxTextFieldLength()); + assertEquals( + "jdbc:as400://foo/bar", + nativeMeta.getURL("foo", "1500", "bar")); // note - AS400 driver ignores the port + String[] expectedReservedWords = + new String[] { + // http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp + // This is the list of currently reserved DB2 UDB for iSeries words. Words may be added at + // any time. + // For a list of additional words that may become reserved in the future, see the IBM SQL + // and + // ANSI reserved words in the IBM SQL Reference Version 1 SC26-3255. + "ACTIVATE", + "ADD", + "ALIAS", + "ALL", + "ALLOCATE", + "ALLOW", + "ALTER", + "AND", + "ANY", + "AS", + "ASENSITIVE", + "AT", + "ATTRIBUTES", + "AUTHORIZATION", + "BEGIN", + "BETWEEN", + "BINARY", + "BY", + "CACHE", + "CALL", + "CALLED", + "CARDINALITY", + "CASE", + "CAST", + "CCSID", + "CHAR", + "CHARACTER", + "CHECK", + "CLOSE", + "COLLECTION", + "COLUMN", + "COMMENT", + "COMMIT", + "CONCAT", + "CONDITION", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONTAINS", + "CONTINUE", + "COUNT", + "COUNT_BIG", + "CREATE", + "CROSS", + "CURRENT", + "CURRENT_DATE", + "CURRENT_PATH", + "CURRENT_SCHEMA", + "CURRENT_SERVER", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_TIMEZONE", + "CURRENT_USER", + "CURSOR", + "CYCLE", + "DATABASE", + "DATAPARTITIONNAME", + "DATAPARTITIONNUM", + "DATE", + "DAY", + "DAYS", + "DBINFO", + "DBPARTITIONNAME", + "DBPARTITIONNUM", + "DB2GENERAL", + "DB2GENRL", + "DB2SQL", + "DEALLOCATE", + "DECLARE", + "DEFAULT", + "DEFAULTS", + "DEFINITION", + "DELETE", + "DENSERANK", + "DENSE_RANK", + "DESCRIBE", + "DESCRIPTOR", + "DETERMINISTIC", + "DIAGNOSTICS", + "DISABLE", + "DISALLOW", + "DISCONNECT", + "DISTINCT", + "DO", + "DOUBLE", + "DROP", + "DYNAMIC", + "EACH", + "ELSE", + "ELSEIF", + "ENABLE", + "ENCRYPTION", + "END", + "ENDING", + "END-EXEC", + "ESCAPE", + "EVERY", + "EXCEPT", + "EXCEPTION", + "EXCLUDING", + "EXCLUSIVE", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERNAL", + "EXTRACT", + "FENCED", + "FETCH", + "FILE", + "FINAL", + "FOR", + "FOREIGN", + "FREE", + "FROM", + "FULL", + "FUNCTION", + "GENERAL", + "GENERATED", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GRAPHIC", + "GROUP", + "HANDLER", + "HASH", + "HASHED_VALUE", + "HAVING", + "HINT", + "HOLD", + "HOUR", + "HOURS", + "IDENTITY", + "IF", + "IMMEDIATE", + "IN", + "INCLUDING", + "INCLUSIVE", + "INCREMENT", + "INDEX", + "INDICATOR", + "INHERIT", + "INNER", + "INOUT", + "INSENSITIVE", + "INSERT", + "INTEGRITY", + "INTERSECT", + "INTO", + "IS", + "ISOLATION", + "ITERATE", + "JAVA", + "JOIN", + "KEY", + "LABEL", + "LANGUAGE", + "LATERAL", + "LEAVE", + "LEFT", + "LIKE", + "LINKTYPE", + "LOCAL", + "LOCALDATE", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCK", + "LONG", + "LOOP", + "MAINTAINED", + "MATERIALIZED", + "MAXVALUE", + "MICROSECOND", + "MICROSECONDS", + "MINUTE", + "MINUTES", + "MINVALUE", + "MODE", + "MODIFIES", + "MONTH", + "MONTHS", + "NEW", + "NEW_TABLE", + "NEXTVAL", + "NO", + "NOCACHE", + "NOCYCLE", + "NODENAME", + "NODENUMBER", + "NOMAXVALUE", + "NOMINVALUE", + "NOORDER", + "NORMALIZED", + "NOT", + "NULL", + "OF", + "OLD", + "OLD_TABLE", + "ON", + "OPEN", + "OPTIMIZE", + "OPTION", + "OR", + "ORDER", + "OUT", + "OUTER", + "OVER", + "OVERRIDING", + "PACKAGE", + "PAGESIZE", + "PARAMETER", + "PART", + "PARTITION", + "PARTITIONING", + "PARTITIONS", + "PASSWORD", + "PATH", + "POSITION", + "PREPARE", + "PREVVAL", + "PRIMARY", + "PRIVILEGES", + "PROCEDURE", + "PROGRAM", + "QUERY", + "RANGE", + "RANK", + "READ", + "READS", + "RECOVERY", + "REFERENCES", + "REFERENCING", + "REFRESH", + "RELEASE", + "RENAME", + "REPEAT", + "RESET", + "RESIGNAL", + "RESTART", + "RESULT", + "RETURN", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLLBACK", + "ROUTINE", + "ROW", + "ROWNUMBER", + "ROW_NUMBER", + "ROWS", + "RRN", + "RUN", + "SAVEPOINT", + "SCHEMA", + "SCRATCHPAD", + "SCROLL", + "SEARCH", + "SECOND", + "SECONDS", + "SELECT", + "SENSITIVE", + "SEQUENCE", + "SESSION", + "SESSION_USER", + "SET", + "SIGNAL", + "SIMPLE", + "SOME", + "SOURCE", + "SPECIFIC", + "SQL", + "SQLID", + "STACKED", + "START", + "STARTING", + "STATEMENT", + "STATIC", + "SUBSTRING", + "SUMMARY", + "SYNONYM", + "SYSTEM_USER", + "TABLE", + "THEN", + "TIME", + "TIMESTAMP", + "TO", + "TRANSACTION", + "TRIGGER", + "TRIM", + "TYPE", + "UNDO", + "UNION", + "UNIQUE", + "UNTIL", + "UPDATE", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARIABLE", + "VARIANT", + "VERSION", + "VIEW", + "VOLATILE", + "WHEN", + "WHERE", + "WHILE", + "WITH", + "WITHOUT", + "WRITE", + "YEAR", + "YEARS" + }; + + assertArrayEquals(expectedReservedWords, nativeMeta.getReservedWords()); + assertFalse(nativeMeta.isSupportsFloatRoundingOnUpdate()); + assertEquals(32672, nativeMeta.getMaxVARCHARLength()); + assertTrue(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); + } + + @Test + public void testSqlStatements() { + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(100)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 100, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR SET TIMESTAMP", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals("SELECT SEQNAME FROM SYSCAT.SEQUENCES", nativeMeta.getSqlListOfSequences()); + assertEquals( + "SELECT * FROM SYSCAT.SEQUENCES WHERE SEQNAME = 'FOO'", + nativeMeta.getSqlSequenceExists("FOO")); + assertEquals( + "SELECT PREVIOUS VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", + nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals( + "SELECT NEXT VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", + nativeMeta.getSqlNextSequenceValue("FOO")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "DOUBLE", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); + assertEquals( + "DECIMAL(5)", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); + assertEquals( + "DECIMAL(5, 3)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 5, 3), "", "", false, false, false)); + + assertEquals( + "DECIMAL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 0, 3), "", "", false, false, false)); // This is a bug + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + String.format("VARCHAR(%d)", (nativeMeta.getMaxVARCHARLength() - 1)), + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() - 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() + 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH - 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400SequenceAndReleaseSavePointTest.java b/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400SequenceAndReleaseSavePointTest.java index 629b4286510..9cb3f004ef6 100644 --- a/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400SequenceAndReleaseSavePointTest.java +++ b/plugins/databases/as400/src/test/java/org/apache/hop/databases/as400/AS400SequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.as400; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class AS400SequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/cache/src/main/java/org/apache/hop/databases/cache/CacheDatabaseMeta.java b/plugins/databases/cache/src/main/java/org/apache/hop/databases/cache/CacheDatabaseMeta.java index b2d07472a1f..49075befcdf 100644 --- a/plugins/databases/cache/src/main/java/org/apache/hop/databases/cache/CacheDatabaseMeta.java +++ b/plugins/databases/cache/src/main/java/org/apache/hop/databases/cache/CacheDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains InterSystems Cache specific information through static final members - */ -@DatabaseMetaPlugin(type = "CACHE", typeDescription = "InterSystems Cache", documentationUrl = "/database/databases/cache.html") +/** Contains InterSystems Cache specific information through static final members */ +@DatabaseMetaPlugin( + type = "CACHE", + typeDescription = "InterSystems Cache", + documentationUrl = "/database/databases/cache.html") @GuiPlugin(id = "GUI-CacheDatabaseMeta") public class CacheDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -54,7 +55,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; @@ -198,7 +201,9 @@ public boolean isRequiresCreateTablePrimaryKeyAppend() { return true; } - /** @return true if the database supports newlines in a SQL statements. */ + /** + * @return true if the database supports newlines in a SQL statements. + */ @Override public boolean isSupportsNewLinesInSql() { return false; diff --git a/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheDatabaseMetaTest.java b/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheDatabaseMetaTest.java index 79b9ae07a10..22cb33b7085 100644 --- a/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheDatabaseMetaTest.java +++ b/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheDatabaseMetaTest.java @@ -1,102 +1,102 @@ -/* - * 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 org.apache.hop.databases.cache; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class CacheDatabaseMetaTest { - private CacheDatabaseMeta cdm; - - @Before - public void setupBefore() { - cdm = new CacheDatabaseMeta(); - cdm.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, cdm.getAccessTypeList()); - assertEquals(1972, cdm.getDefaultDatabasePort()); - assertFalse(cdm.isSupportsSetCharacterStream()); - assertFalse(cdm.isFetchSizeSupported()); - assertFalse(cdm.isSupportsAutoInc()); - assertEquals("com.intersys.jdbc.CacheDriver", cdm.getDriverClass()); - assertEquals("jdbc:Cache://FOO:BAR/WIBBLE", cdm.getURL("FOO", "BAR", "WIBBLE")); - assertTrue(cdm.isRequiresCreateTablePrimaryKeyAppend()); - assertFalse(cdm.isSupportsNewLinesInSql()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR VARCHAR(15) ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR TIMESTAMP ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR TIMESTAMP ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR CHAR(1) ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR INT ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR DOUBLE ) ", - cdm.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "", false, "", false)); // I believe this is a bug! - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR DOUBLE ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", 10, -7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR DOUBLE ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR DECIMAL(5, 7) ) ", - cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN ( BAR UNKNOWN ) ", - cdm.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, - cdm.getDropColumnStatement("FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", - cdm.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - } -} +/* + * 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 org.apache.hop.databases.cache; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class CacheDatabaseMetaTest { + private CacheDatabaseMeta cdm; + + @Before + public void setupBefore() { + cdm = new CacheDatabaseMeta(); + cdm.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, cdm.getAccessTypeList()); + assertEquals(1972, cdm.getDefaultDatabasePort()); + assertFalse(cdm.isSupportsSetCharacterStream()); + assertFalse(cdm.isFetchSizeSupported()); + assertFalse(cdm.isSupportsAutoInc()); + assertEquals("com.intersys.jdbc.CacheDriver", cdm.getDriverClass()); + assertEquals("jdbc:Cache://FOO:BAR/WIBBLE", cdm.getURL("FOO", "BAR", "WIBBLE")); + assertTrue(cdm.isRequiresCreateTablePrimaryKeyAppend()); + assertFalse(cdm.isSupportsNewLinesInSql()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR VARCHAR(15) ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR TIMESTAMP ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR TIMESTAMP ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR CHAR(1) ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR INT ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR DOUBLE ) ", + cdm.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "", false, "", false)); // I believe this is a bug! + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR DOUBLE ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", 10, -7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR DOUBLE ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR DECIMAL(5, 7) ) ", + cdm.getAddColumnStatement("FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN ( BAR UNKNOWN ) ", + cdm.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, + cdm.getDropColumnStatement("FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", + cdm.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + } +} diff --git a/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheSequenceAndReleaseSavePointTest.java b/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheSequenceAndReleaseSavePointTest.java index b6b2e08666a..b64c6640920 100644 --- a/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/cache/src/test/java/org/apache/hop/databases/cache/CacheSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.cache; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class CacheSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/clickhouse/src/main/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMeta.java b/plugins/databases/clickhouse/src/main/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMeta.java index e4a664e9a59..afa99c0114f 100644 --- a/plugins/databases/clickhouse/src/main/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMeta.java +++ b/plugins/databases/clickhouse/src/main/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMeta.java @@ -33,7 +33,10 @@ * *

https://clickhouse.tech/docs/en/sql-reference/ */ -@DatabaseMetaPlugin(type = "CLICKHOUSE", typeDescription = "ClickHouse", documentationUrl = "/database/databases/clickhouse.html") +@DatabaseMetaPlugin( + type = "CLICKHOUSE", + typeDescription = "ClickHouse", + documentationUrl = "/database/databases/clickhouse.html") @GuiPlugin(id = "GUI-ClickhouseDatabaseMeta") public class ClickhouseDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @@ -264,31 +267,41 @@ public String getExtraOptionSeparator() { return "&"; } - /** @return true if all fields should always be quoted in db */ + /** + * @return true if all fields should always be quoted in db + */ @Override public boolean isQuoteAllFields() { return false; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "?"; } - /** @return true if the database supports schemas */ + /** + * @return true if the database supports schemas + */ @Override public boolean isSupportsSchemas() { return false; } - /** @return true if the database supports transactions. */ + /** + * @return true if the database supports transactions. + */ @Override public boolean isSupportsTransactions() { return false; } - /** @return true if the database supports views */ + /** + * @return true if the database supports views + */ @Override public boolean isSupportsViews() { return true; diff --git a/plugins/databases/clickhouse/src/test/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMetaTest.java b/plugins/databases/clickhouse/src/test/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMetaTest.java index a5c4f8edc80..0fc6a25bde1 100644 --- a/plugins/databases/clickhouse/src/test/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMetaTest.java +++ b/plugins/databases/clickhouse/src/test/java/org/apache/hop/databases/clickhouse/ClickhouseDatabaseMetaTest.java @@ -18,6 +18,12 @@ package org.apache.hop.databases.clickhouse; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.junit.rules.RestoreHopEnvironment; @@ -25,12 +31,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - public class ClickhouseDatabaseMetaTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/cockroachdb/src/main/java/org/apache/hop/databases/cockroachdb/CockroachDatabaseMeta.java b/plugins/databases/cockroachdb/src/main/java/org/apache/hop/databases/cockroachdb/CockroachDatabaseMeta.java index e155736c201..767952b27cc 100644 --- a/plugins/databases/cockroachdb/src/main/java/org/apache/hop/databases/cockroachdb/CockroachDatabaseMeta.java +++ b/plugins/databases/cockroachdb/src/main/java/org/apache/hop/databases/cockroachdb/CockroachDatabaseMeta.java @@ -22,9 +22,10 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; -/** - * Contains PostgreSQL specific information through static final members - */ -@DatabaseMetaPlugin(type = "COCKROACHDB", typeDescription = "CockroachDB", documentationUrl = "/database/databases/postgresql.html") +/** Contains PostgreSQL specific information through static final members */ +@DatabaseMetaPlugin( + type = "COCKROACHDB", + typeDescription = "CockroachDB", + documentationUrl = "/database/databases/postgresql.html") @GuiPlugin(id = "GUI-CockroachDatabaseMeta") public class CockroachDatabaseMeta extends PostgreSqlDatabaseMeta implements IDatabase {} diff --git a/plugins/databases/cratedb/src/main/java/org/apache/hop/databases/cratedb/CrateDbDatabaseMeta.java b/plugins/databases/cratedb/src/main/java/org/apache/hop/databases/cratedb/CrateDbDatabaseMeta.java index 144505b6fda..f3edf652084 100644 --- a/plugins/databases/cratedb/src/main/java/org/apache/hop/databases/cratedb/CrateDbDatabaseMeta.java +++ b/plugins/databases/cratedb/src/main/java/org/apache/hop/databases/cratedb/CrateDbDatabaseMeta.java @@ -22,240 +22,242 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; -@DatabaseMetaPlugin(type = "CRATEDB", typeDescription = "CrateDB", documentationUrl = "/database/databases/cratedb.html") +@DatabaseMetaPlugin( + type = "CRATEDB", + typeDescription = "CrateDB", + documentationUrl = "/database/databases/cratedb.html") @GuiPlugin(id = "GUI-CrateDBDatabaseMeta") public class CrateDbDatabaseMeta extends PostgreSqlDatabaseMeta { - private static final String SEQUENCES_NOT_SUPPORTED = "CrateDB does not support sequences"; + private static final String SEQUENCES_NOT_SUPPORTED = "CrateDB does not support sequences"; - @Override - public String getDriverClass() { - return "io.crate.client.jdbc.CrateDriver"; - } + @Override + public String getDriverClass() { + return "io.crate.client.jdbc.CrateDriver"; + } - @Override - public String getURL(String hostname, String port, String databaseName) { - return "jdbc:crate://" + hostname + ":" + port + "/" + databaseName; - } + @Override + public String getURL(String hostname, String port, String databaseName) { + return "jdbc:crate://" + hostname + ":" + port + "/" + databaseName; + } + /** + * As of the time of writing (Apr 2024), CrateDB does not natively support sequence generators + * like the CREATE SEQUENCE command in PostgreSQL and some other SQL databases. CrateDB is built + * to be distributed and massively scalable. Certain features found in traditional single-node SQL + * databases, like sequence generators, are not directly translatable to a distributed system + * because they can become bottlenecks in a distributed environment due to the need for + * synchronization between nodes + */ + @Override + public boolean isSupportsSequences() { + return false; + } - /** - * As of the time of writing (Apr 2024), CrateDB does not natively support sequence generators like the CREATE SEQUENCE command in PostgreSQL and some other SQL databases. - * CrateDB is built to be distributed and massively scalable. - * Certain features found in traditional single-node SQL databases, like sequence generators, - * are not directly translatable to a distributed system because they can become bottlenecks in a distributed environment - * due to the need for synchronization between nodes - */ - @Override - public boolean isSupportsSequences() { - return false; - } + @Override + public boolean isSupportsSequenceNoMaxValueOption() { + return false; + } - @Override - public boolean isSupportsSequenceNoMaxValueOption() { - return false; - } + /** + * CrateDB doesn't have a direct equivalent of PostgreSQL's SERIAL data type due to its + * distributed nature. But you can achieve a similar outcome by using generated columns that + * produce a unique UUID. Since UUIDs cannot be sorted, they can't be incremented, as there's no + * concept of ordering. + */ + @Override + public boolean isSupportsAutoInc() { + return false; + } + @Override + public String[] getReservedWords() { /** - * CrateDB doesn't have a direct equivalent of PostgreSQL's SERIAL data type due to its distributed nature. - * But you can achieve a similar outcome by using generated columns that produce a unique UUID. - * Since UUIDs cannot be sorted, they can't be incremented, as there's no concept of ordering. + * This list of reserved words has been obtained as per docs + * (https://cratedb.com/docs/crate/reference/en/5.6/sql/general/lexical-structure.html#reserved-words) + * from the following query against CrateDB 5.6: SELECT word FROM pg_catalog.pg_get_keywords() + * WHERE catcode = 'R' ORDER BY 1 */ - @Override - public boolean isSupportsAutoInc() { - return false; - } + return new String[] { + "ADD", + "ALL", + "ALTER", + "AND", + "ANY", + "ARRAY", + "AS", + "ASC", + "BETWEEN", + "BY", + "CALLED", + "CASE", + "CAST", + "COLUMN", + "CONSTRAINT", + "COSTS", + "CREATE", + "CROSS", + "CURRENT_DATE", + "CURRENT_SCHEMA", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "DEFAULT", + "DELETE", + "DENY", + "DESC", + "DESCRIBE", + "DIRECTORY", + "DISTINCT", + "DROP", + "ELSE", + "END", + "ESCAPE", + "EXCEPT", + "EXISTS", + "EXTRACT", + "FALSE", + "FIRST", + "FOR", + "FROM", + "FULL", + "FUNCTION", + "GRANT", + "GROUP", + "HAVING", + "IF", + "IN", + "INDEX", + "INNER", + "INPUT", + "INSERT", + "INTERSECT", + "INTO", + "IS", + "JOIN", + "LAST", + "LEFT", + "LIKE", + "LIMIT", + "MATCH", + "NATURAL", + "NOT", + "NULL", + "NULLS", + "OBJECT", + "OFFSET", + "ON", + "OR", + "ORDER", + "OUTER", + "PERSISTENT", + "RECURSIVE", + "RESET", + "RETURNS", + "REVOKE", + "RIGHT", + "SELECT", + "SESSION_USER", + "SET", + "SOME", + "STRATIFY", + "TABLE", + "THEN", + "TRANSIENT", + "TRUE", + "TRY_CAST", + "UNBOUNDED", + "UNION", + "UPDATE", + "USER", + "USING", + "WHEN", + "WHERE", + "WITH" + }; + } - @Override - public String[] getReservedWords() { - /** - * This list of reserved words has been obtained as per docs - * (https://cratedb.com/docs/crate/reference/en/5.6/sql/general/lexical-structure.html#reserved-words) - * from the following query against CrateDB 5.6: - * SELECT word FROM pg_catalog.pg_get_keywords() WHERE catcode = 'R' ORDER BY 1 - */ + @Override + public String getExtraOptionsHelpText() { + return "https://cratedb.com/docs/jdbc/en/latest/connect.html#connection-properties"; + } - return new String[]{ - "ADD", - "ALL", - "ALTER", - "AND", - "ANY", - "ARRAY", - "AS", - "ASC", - "BETWEEN", - "BY", - "CALLED", - "CASE", - "CAST", - "COLUMN", - "CONSTRAINT", - "COSTS", - "CREATE", - "CROSS", - "CURRENT_DATE", - "CURRENT_SCHEMA", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "DEFAULT", - "DELETE", - "DENY", - "DESC", - "DESCRIBE", - "DIRECTORY", - "DISTINCT", - "DROP", - "ELSE", - "END", - "ESCAPE", - "EXCEPT", - "EXISTS", - "EXTRACT", - "FALSE", - "FIRST", - "FOR", - "FROM", - "FULL", - "FUNCTION", - "GRANT", - "GROUP", - "HAVING", - "IF", - "IN", - "INDEX", - "INNER", - "INPUT", - "INSERT", - "INTERSECT", - "INTO", - "IS", - "JOIN", - "LAST", - "LEFT", - "LIKE", - "LIMIT", - "MATCH", - "NATURAL", - "NOT", - "NULL", - "NULLS", - "OBJECT", - "OFFSET", - "ON", - "OR", - "ORDER", - "OUTER", - "PERSISTENT", - "RECURSIVE", - "RESET", - "RETURNS", - "REVOKE", - "RIGHT", - "SELECT", - "SESSION_USER", - "SET", - "SOME", - "STRATIFY", - "TABLE", - "THEN", - "TRANSIENT", - "TRUE", - "TRY_CAST", - "UNBOUNDED", - "UNION", - "UPDATE", - "USER", - "USING", - "WHEN", - "WHERE", - "WITH" - }; - } + @Override + public String getSqlListOfSequences() { + throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); + } - @Override - public String getExtraOptionsHelpText() { - return "https://cratedb.com/docs/jdbc/en/latest/connect.html#connection-properties"; - } + @Override + public String getSqlNextSequenceValue(String sequenceName) { + throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); + } - @Override - public String getSqlListOfSequences() { - throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); - } + @Override + public String getSqlCurrentSequenceValue(String sequenceName) { + throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); + } - @Override - public String getSqlNextSequenceValue(String sequenceName) { - throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); - } + @Override + public String getSqlSequenceExists(String sequenceName) { + throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); + } - @Override - public String getSqlCurrentSequenceValue(String sequenceName) { - throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); - } - - @Override - public String getSqlSequenceExists(String sequenceName) { - throw new UnsupportedOperationException(SEQUENCES_NOT_SUPPORTED); - } - - - @Override - public String getFieldDefinition(IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr) { + @Override + public String getFieldDefinition( + IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr) { - switch (v.getType()) { - case IValueMeta.TYPE_NUMBER: - case IValueMeta.TYPE_BIGNUMBER: - case IValueMeta.TYPE_INTEGER: - String retval = ""; - String fieldname = v.getName(); - int length = v.getLength(); - int precision = v.getPrecision(); + switch (v.getType()) { + case IValueMeta.TYPE_NUMBER: + case IValueMeta.TYPE_BIGNUMBER: + case IValueMeta.TYPE_INTEGER: + String retval = ""; + String fieldname = v.getName(); + int length = v.getLength(); + int precision = v.getPrecision(); - if (addFieldName) { - retval += fieldname + " "; - } - if (fieldname.equalsIgnoreCase(tk) - || // Technical key - fieldname.equalsIgnoreCase(pk) // Primary key - ) { - retval += "BIGSERIAL"; + if (addFieldName) { + retval += fieldname + " "; + } + if (fieldname.equalsIgnoreCase(tk) + || // Technical key + fieldname.equalsIgnoreCase(pk) // Primary key + ) { + retval += "BIGSERIAL"; + } else { + if (length > 0) { + if (precision > 0 || length > 18) { + // CrateDB doesn't support NUMERIC type + retval += "DOUBLE PRECISION"; + } else { + if (length > 9) { + retval += "BIGINT"; + } else { + if (length < 5) { + retval += "SMALLINT"; } else { - if (length > 0) { - if (precision > 0 || length > 18) { - //CrateDB doesn't support NUMERIC type - retval += "DOUBLE PRECISION"; - } else { - if (length > 9) { - retval += "BIGINT"; - } else { - if (length < 5) { - retval += "SMALLINT"; - } else { - retval += "INTEGER"; - } - } - } - - } else { - retval += "DOUBLE PRECISION"; - } + retval += "INTEGER"; } - return retval; + } + } - default: - return super.getFieldDefinition(v, tk, pk, useAutoinc, addFieldName, addCr); + } else { + retval += "DOUBLE PRECISION"; + } } + return retval; + default: + return super.getFieldDefinition(v, tk, pk, useAutoinc, addFieldName, addCr); } + } - @Override - public String getSqlLockTables(String[] tableNames) { - throw new UnsupportedOperationException("CrateDB does not support locking tables"); - } + @Override + public String getSqlLockTables(String[] tableNames) { + throw new UnsupportedOperationException("CrateDB does not support locking tables"); + } - @Override - public String getSqlUnlockTables(String[] tableName) { - throw new UnsupportedOperationException("CrateDB does not support locking tables"); - } + @Override + public String getSqlUnlockTables(String[] tableName) { + throw new UnsupportedOperationException("CrateDB does not support locking tables"); + } } diff --git a/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaIT.java b/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaIT.java index 22db263556c..6360d0cdbe0 100644 --- a/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaIT.java +++ b/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaIT.java @@ -185,7 +185,9 @@ public void addLongTextColumn() throws Exception { @Test public void doesNotSupportLockTables() throws Exception { - assertThrows(UnsupportedOperationException.class, ()->executeUpdate(nativeMeta.getSqlLockTables(new String[]{"FOO", "BAR"}))); + assertThrows( + UnsupportedOperationException.class, + () -> executeUpdate(nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"}))); } private int executeUpdate(String query) throws Exception { diff --git a/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaTest.java b/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaTest.java index a3344af830c..b43971d2675 100644 --- a/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaTest.java +++ b/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBDatabaseMetaTest.java @@ -19,7 +19,6 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; diff --git a/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBValueMetaBaseTest.java b/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBValueMetaBaseTest.java index 68e6f00465c..d7d8689a941 100644 --- a/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBValueMetaBaseTest.java +++ b/plugins/databases/cratedb/src/test/java/org/apache/hop/databases/cratedb/CrateDBValueMetaBaseTest.java @@ -61,8 +61,7 @@ import org.mockito.Spy; public class CrateDBValueMetaBaseTest { - @ClassRule - public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); private static final String TEST_NAME = "TEST_NAME"; private static final String LOG_FIELD = "LOG_FIELD"; diff --git a/plugins/databases/db2/src/main/java/org/apache/hop/databases/db2/DB2DatabaseMeta.java b/plugins/databases/db2/src/main/java/org/apache/hop/databases/db2/DB2DatabaseMeta.java index 656865a205e..8be692afbce 100644 --- a/plugins/databases/db2/src/main/java/org/apache/hop/databases/db2/DB2DatabaseMeta.java +++ b/plugins/databases/db2/src/main/java/org/apache/hop/databases/db2/DB2DatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains DB2 specific information through static final members - */ -@DatabaseMetaPlugin(type = "DB2", typeDescription = "DB2", documentationUrl = "/database/databases/db2.html") +/** Contains DB2 specific information through static final members */ +@DatabaseMetaPlugin( + type = "DB2", + typeDescription = "DB2", + documentationUrl = "/database/databases/db2.html") @GuiPlugin(id = "GUI-DB2DatabaseMeta") public class DB2DatabaseMeta extends BaseDatabaseMeta implements IDatabase { @@ -62,7 +63,9 @@ public String getURL(String hostname, String port, String databaseName) { return "jdbc:db2://" + hostname + ":" + port + "/" + databaseName; } - /** @return true if the database supports schemas, DB2 supports it (v7 and v8 for sure). */ + /** + * @return true if the database supports schemas, DB2 supports it (v7 and v8 for sure). + */ @Override public boolean isSupportsSchemas() { return true; @@ -728,7 +731,9 @@ public boolean isSupportsGetBlob() { return false; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return true; @@ -818,7 +823,9 @@ public boolean isDisplaySizeTwiceThePrecision() { return true; } - /** @return true if the database supports newlines in a SQL statements. */ + /** + * @return true if the database supports newlines in a SQL statements. + */ @Override public boolean isSupportsNewLinesInSql() { return false; diff --git a/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2DatabaseMetaTest.java b/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2DatabaseMetaTest.java index 139b21a0c8e..c97ffb7f8c9 100644 --- a/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2DatabaseMetaTest.java +++ b/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2DatabaseMetaTest.java @@ -1,708 +1,708 @@ -/* - * 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 org.apache.hop.databases.db2; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class DB2DatabaseMetaTest { - private DB2DatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new DB2DatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(50000, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsSetCharacterStream()); - assertEquals("com.ibm.db2.jcc.DB2Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:db2://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertTrue(nativeMeta.isSupportsSchemas()); - assertArrayEquals( - new String[] { - // http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0001095.htm - // For portability across the DB2 Universal Database products, the following should be - // considered reserved - // words. - // The following list also contains the ISO/ANSI SQL99 reserved words for future - // compatibility. - "ABSOLUTE", - "ACTION", - "ADD", - "ADMIN", - "AFTER", - "AGGREGATE", - "ALIAS", - "ALL", - "ALLOCATE", - "ALLOW", - "ALTER", - "AND", - "ANY", - "APPLICATION", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASSERTION", - "ASSOCIATE", - "ASUTIME", - "AT", - "AUDIT", - "AUTHORIZATION", - "AUX", - "AUXILIARY", - "BEFORE", - "BEGIN", - "BETWEEN", - "BINARY", - "BIT", - "BLOB", - "BOOLEAN", - "BOTH", - "BREADTH", - "BUFFERPOOL", - "BY", - "CACHE", - "CALL", - "CALLED", - "CAPTURE", - "CARDINALITY", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CCSID", - "CHAR", - "CHARACTER", - "CHECK", - "CLASS", - "CLOB", - "CLOSE", - "CLUSTER", - "COLLATE", - "COLLATION", - "COLLECTION", - "COLLID", - "COLUMN", - "COMMENT", - "COMMIT", - "COMPLETION", - "CONCAT", - "CONDITION", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRUCTOR", - "CONTAINS", - "CONTINUE", - "CORRESPONDING", - "COUNT", - "COUNT_BIG", - "CREATE", - "CROSS", - "CUBE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_LC_CTYPE", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_SERVER", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_TIMEZONE", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DATA", - "DATABASE", - "DATE", - "DAY", - "DAYS", - "DB2GENERAL", - "DB2GENRL", - "DB2SQL", - "DBINFO", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFAULTS", - "DEFERRABLE", - "DEFERRED", - "DEFINITION", - "DELETE", - "DEPTH", - "DEREF", - "DESC", - "DESCRIBE", - "DESCRIPTOR", - "DESTROY", - "DESTRUCTOR", - "DETERMINISTIC", - "DIAGNOSTICS", - "DICTIONARY", - "DISALLOW", - "DISCONNECT", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "DSNHATTR", - "DSSIZE", - "DYNAMIC", - "EACH", - "EDITPROC", - "ELSE", - "ELSEIF", - "ENCODING", - "END", - "END-EXEC", - "END-EXEC1", - "EQUALS", - "ERASE", - "ESCAPE", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXCLUDING", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERNAL", - "FALSE", - "FENCED", - "FETCH", - "FIELDPROC", - "FILE", - "FINAL", - "FIRST", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE", - "FROM", - "FULL", - "FUNCTION", - "GENERAL", - "GENERATED", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GRAPHIC", - "GROUP", - "GROUPING", - "HANDLER", - "HAVING", - "HOLD", - "HOST", - "HOUR", - "HOURS", - "IDENTITY", - "IF", - "IGNORE", - "IMMEDIATE", - "IN", - "INCLUDING", - "INCREMENT", - "INDEX", - "INDICATOR", - "INHERIT", - "INITIALIZE", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTEGRITY", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOBID", - "ISOLATION", - "ITERATE", - "JAR", - "JAVA", - "JOIN", - "KEY", - "LABEL", - "LANGUAGE", - "LARGE", - "LAST", - "LATERAL", - "LC_CTYPE", - "LEADING", - "LEAVE", - "LEFT", - "LESS", - "LEVEL", - "LIKE", - "LIMIT", - "LINKTYPE", - "LOCAL", - "LOCALE", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATOR", - "LOCATORS", - "LOCK", - "LOCKMAX", - "LOCKSIZE", - "LONG", - "LOOP", - "MAP", - "MATCH", - "MAXVALUE", - "MICROSECOND", - "MICROSECONDS", - "MINUTE", - "MINUTES", - "MINVALUE", - "MODE", - "MODIFIES", - "MODIFY", - "MODULE", - "MONTH", - "MONTHS", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NCLOB", - "NEW", - "NEW_TABLE", - "NEXT", - "NO", - "NOCACHE", - "NOCYCLE", - "NODENAME", - "NODENUMBER", - "NOMAXVALUE", - "NOMINVALUE", - "NONE", - "NOORDER", - "NOT", - "NULL", - "NULLS", - "NUMERIC", - "NUMPARTS", - "OBID", - "OBJECT", - "OF", - "OFF", - "OLD", - "OLD_TABLE", - "ON", - "ONLY", - "OPEN", - "OPERATION", - "OPTIMIZATION", - "OPTIMIZE", - "OPTION", - "OR", - "ORDER", - "ORDINALITY", - "OUT", - "OUTER", - "OUTPUT", - "OVERRIDING", - "PACKAGE", - "PAD", - "PARAMETER", - "PARAMETERS", - "PART", - "PARTIAL", - "PARTITION", - "PATH", - "PIECESIZE", - "PLAN", - "POSITION", - "POSTFIX", - "PRECISION", - "PREFIX", - "PREORDER", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIQTY", - "PRIVILEGES", - "PROCEDURE", - "PROGRAM", - "PSID", - "PUBLIC", - "QUERYNO", - "READ", - "READS", - "REAL", - "RECOVERY", - "RECURSIVE", - "REF", - "REFERENCES", - "REFERENCING", - "RELATIVE", - "RELEASE", - "RENAME", - "REPEAT", - "RESET", - "RESIGNAL", - "RESTART", - "RESTRICT", - "RESULT", - "RESULT_SET_LOCATOR", - "RETURN", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROW", - "ROWS", - "RRN", - "RUN", - "SAVEPOINT", - "SCHEMA", - "SCOPE", - "SCRATCHPAD", - "SCROLL", - "SEARCH", - "SECOND", - "SECONDS", - "SECQTY", - "SECTION", - "SECURITY", - "SELECT", - "SENSITIVE", - "SEQUENCE", - "SESSION", - "SESSION_USER", - "SET", - "SETS", - "SIGNAL", - "SIMPLE", - "SIZE", - "SMALLINT", - "SOME", - "SOURCE", - "SPACE", - "SPECIFIC", - "SPECIFICTYPE", - "SQL", - "SQLEXCEPTION", - "SQLID", - "SQLSTATE", - "SQLWARNING", - "STANDARD", - "START", - "STATE", - "STATEMENT", - "STATIC", - "STAY", - "STOGROUP", - "STORES", - "STRUCTURE", - "STYLE", - "SUBPAGES", - "SUBSTRING", - "SYNONYM", - "SYSFUN", - "SYSIBM", - "SYSPROC", - "SYSTEM", - "SYSTEM_USER", - "TABLE", - "TABLESPACE", - "TEMPORARY", - "TERMINATE", - "THAN", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRIM", - "TRUE", - "TYPE", - "UNDER", - "UNDO", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNNEST", - "UNTIL", - "UPDATE", - "USAGE", - "USER", - "USING", - "VALIDPROC", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARIANT", - "VARYING", - "VCAT", - "VIEW", - "VOLUMES", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WITH", - "WITHOUT", - "WLM", - "WORK", - "WRITE", - "YEAR", - "YEARS", - "ZONE" - }, - nativeMeta.getReservedWords()); - - assertEquals(32672, nativeMeta.getMaxVARCHARLength()); - assertTrue(nativeMeta.isSupportsBatchUpdates()); - assertFalse(nativeMeta.isSupportsGetBlob()); - assertTrue(nativeMeta.isSupportsSequences()); - assertEquals(":", nativeMeta.getExtraOptionIndicator()); - assertFalse(nativeMeta.isSupportsSequenceNoMaxValueOption()); - assertTrue(nativeMeta.isRequiresCastToVariousForIsNull()); - assertTrue(nativeMeta.isDisplaySizeTwiceThePrecision()); - assertFalse(nativeMeta.isSupportsNewLinesInSql()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE", - nativeMeta.getTruncateTableStatement("FOO")); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR CLOB", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BLOB(" + (nativeMeta.getMaxVARCHARLength() + 2) + ")", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaBinary("BAR", nativeMeta.getMaxVARCHARLength() + 2, 10), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BLOB", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBinary("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR CHAR(200) FOR BIT DATA", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBinary("BAR", 200, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - String lineSep = System.getProperty("line.separator"); - - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" - + lineSep - + ";" - + lineSep - + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "LOCK TABLE FOO IN SHARE MODE;" + lineSep + "LOCK TABLE BAR IN SHARE MODE;" + lineSep, - nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - - assertNull(nativeMeta.getSqlUnlockTables(new String[] {"FOO", "BAR"})); - assertEquals("SELECT SEQNAME FROM SYSCAT.SEQUENCES", nativeMeta.getSqlListOfSequences()); - assertEquals( - "SELECT * FROM SYSCAT.SEQUENCES WHERE SEQNAME = 'FOO'", - nativeMeta.getSqlSequenceExists("FOO")); - assertEquals( - "SELECT * FROM SYSCAT.SEQUENCES WHERE SEQSCHEMA = 'FOO' AND SEQNAME = 'BAR'", - nativeMeta.getSqlSequenceExists("FOO.BAR")); - assertEquals( - "SELECT PREVIOUS VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", - nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals( - "SELECT NEXT VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", - nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals( - "insert into FOO(FOOVERSION) values (1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - assertEquals( - "CHARACTER(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NOCACHE)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "FOO", "", true, false, false)); - - assertEquals( - "BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NOCACHE)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 12, 0), "FOO", "", true, false, false)); - assertEquals( - "INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NOCACHE)", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 12, 0), "FOO", "", true, false, false)); - - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "DECIMAL(12)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 12, 0), - "", - "", - false, - false, - false)); // Pretty sure this is a bug - should be an Integer here. - assertEquals( - "DECIMAL(12, 4)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 12, 4), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); - - int realMaxBeforeCLOB = Math.max(nativeMeta.getMaxVARCHARLength(), DatabaseMeta.CLOB_LENGTH); - - int realMinBeforeCLOB = Math.min(nativeMeta.getMaxVARCHARLength(), DatabaseMeta.CLOB_LENGTH); - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", realMaxBeforeCLOB + 1, 0), "", "", false, false, false)); - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", realMaxBeforeCLOB, 0), "", "", false, false, false)); - assertEquals( - String.format("VARCHAR(%d)", realMinBeforeCLOB - 1), - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", realMinBeforeCLOB - 1, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR()", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), - "", - "", - false, - false, - false)); // Definitely a bug here - VARCHAR() is not valid SQL anywhere . . . - - // Binary Stuff . . . - assertEquals( - String.format("BLOB(%d)", realMaxBeforeCLOB + 1), - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", realMaxBeforeCLOB + 1, 0), "", "", false, false, false)); - - assertEquals( - "BLOB", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "CHAR(150) FOR BIT DATA", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 150, 0), "", "", false, false, false)); - - // Then unknown . . . - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.db2; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class DB2DatabaseMetaTest { + private DB2DatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new DB2DatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(50000, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsSetCharacterStream()); + assertEquals("com.ibm.db2.jcc.DB2Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:db2://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertTrue(nativeMeta.isSupportsSchemas()); + assertArrayEquals( + new String[] { + // http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0001095.htm + // For portability across the DB2 Universal Database products, the following should be + // considered reserved + // words. + // The following list also contains the ISO/ANSI SQL99 reserved words for future + // compatibility. + "ABSOLUTE", + "ACTION", + "ADD", + "ADMIN", + "AFTER", + "AGGREGATE", + "ALIAS", + "ALL", + "ALLOCATE", + "ALLOW", + "ALTER", + "AND", + "ANY", + "APPLICATION", + "ARE", + "ARRAY", + "AS", + "ASC", + "ASSERTION", + "ASSOCIATE", + "ASUTIME", + "AT", + "AUDIT", + "AUTHORIZATION", + "AUX", + "AUXILIARY", + "BEFORE", + "BEGIN", + "BETWEEN", + "BINARY", + "BIT", + "BLOB", + "BOOLEAN", + "BOTH", + "BREADTH", + "BUFFERPOOL", + "BY", + "CACHE", + "CALL", + "CALLED", + "CAPTURE", + "CARDINALITY", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CCSID", + "CHAR", + "CHARACTER", + "CHECK", + "CLASS", + "CLOB", + "CLOSE", + "CLUSTER", + "COLLATE", + "COLLATION", + "COLLECTION", + "COLLID", + "COLUMN", + "COMMENT", + "COMMIT", + "COMPLETION", + "CONCAT", + "CONDITION", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONSTRUCTOR", + "CONTAINS", + "CONTINUE", + "CORRESPONDING", + "COUNT", + "COUNT_BIG", + "CREATE", + "CROSS", + "CUBE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_LC_CTYPE", + "CURRENT_PATH", + "CURRENT_ROLE", + "CURRENT_SERVER", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_TIMEZONE", + "CURRENT_USER", + "CURSOR", + "CYCLE", + "DATA", + "DATABASE", + "DATE", + "DAY", + "DAYS", + "DB2GENERAL", + "DB2GENRL", + "DB2SQL", + "DBINFO", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFAULTS", + "DEFERRABLE", + "DEFERRED", + "DEFINITION", + "DELETE", + "DEPTH", + "DEREF", + "DESC", + "DESCRIBE", + "DESCRIPTOR", + "DESTROY", + "DESTRUCTOR", + "DETERMINISTIC", + "DIAGNOSTICS", + "DICTIONARY", + "DISALLOW", + "DISCONNECT", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "DSNHATTR", + "DSSIZE", + "DYNAMIC", + "EACH", + "EDITPROC", + "ELSE", + "ELSEIF", + "ENCODING", + "END", + "END-EXEC", + "END-EXEC1", + "EQUALS", + "ERASE", + "ESCAPE", + "EVERY", + "EXCEPT", + "EXCEPTION", + "EXCLUDING", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERNAL", + "FALSE", + "FENCED", + "FETCH", + "FIELDPROC", + "FILE", + "FINAL", + "FIRST", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE", + "FROM", + "FULL", + "FUNCTION", + "GENERAL", + "GENERATED", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GRAPHIC", + "GROUP", + "GROUPING", + "HANDLER", + "HAVING", + "HOLD", + "HOST", + "HOUR", + "HOURS", + "IDENTITY", + "IF", + "IGNORE", + "IMMEDIATE", + "IN", + "INCLUDING", + "INCREMENT", + "INDEX", + "INDICATOR", + "INHERIT", + "INITIALIZE", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTEGRITY", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOBID", + "ISOLATION", + "ITERATE", + "JAR", + "JAVA", + "JOIN", + "KEY", + "LABEL", + "LANGUAGE", + "LARGE", + "LAST", + "LATERAL", + "LC_CTYPE", + "LEADING", + "LEAVE", + "LEFT", + "LESS", + "LEVEL", + "LIKE", + "LIMIT", + "LINKTYPE", + "LOCAL", + "LOCALE", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATOR", + "LOCATORS", + "LOCK", + "LOCKMAX", + "LOCKSIZE", + "LONG", + "LOOP", + "MAP", + "MATCH", + "MAXVALUE", + "MICROSECOND", + "MICROSECONDS", + "MINUTE", + "MINUTES", + "MINVALUE", + "MODE", + "MODIFIES", + "MODIFY", + "MODULE", + "MONTH", + "MONTHS", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NCLOB", + "NEW", + "NEW_TABLE", + "NEXT", + "NO", + "NOCACHE", + "NOCYCLE", + "NODENAME", + "NODENUMBER", + "NOMAXVALUE", + "NOMINVALUE", + "NONE", + "NOORDER", + "NOT", + "NULL", + "NULLS", + "NUMERIC", + "NUMPARTS", + "OBID", + "OBJECT", + "OF", + "OFF", + "OLD", + "OLD_TABLE", + "ON", + "ONLY", + "OPEN", + "OPERATION", + "OPTIMIZATION", + "OPTIMIZE", + "OPTION", + "OR", + "ORDER", + "ORDINALITY", + "OUT", + "OUTER", + "OUTPUT", + "OVERRIDING", + "PACKAGE", + "PAD", + "PARAMETER", + "PARAMETERS", + "PART", + "PARTIAL", + "PARTITION", + "PATH", + "PIECESIZE", + "PLAN", + "POSITION", + "POSTFIX", + "PRECISION", + "PREFIX", + "PREORDER", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIQTY", + "PRIVILEGES", + "PROCEDURE", + "PROGRAM", + "PSID", + "PUBLIC", + "QUERYNO", + "READ", + "READS", + "REAL", + "RECOVERY", + "RECURSIVE", + "REF", + "REFERENCES", + "REFERENCING", + "RELATIVE", + "RELEASE", + "RENAME", + "REPEAT", + "RESET", + "RESIGNAL", + "RESTART", + "RESTRICT", + "RESULT", + "RESULT_SET_LOCATOR", + "RETURN", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROLLUP", + "ROUTINE", + "ROW", + "ROWS", + "RRN", + "RUN", + "SAVEPOINT", + "SCHEMA", + "SCOPE", + "SCRATCHPAD", + "SCROLL", + "SEARCH", + "SECOND", + "SECONDS", + "SECQTY", + "SECTION", + "SECURITY", + "SELECT", + "SENSITIVE", + "SEQUENCE", + "SESSION", + "SESSION_USER", + "SET", + "SETS", + "SIGNAL", + "SIMPLE", + "SIZE", + "SMALLINT", + "SOME", + "SOURCE", + "SPACE", + "SPECIFIC", + "SPECIFICTYPE", + "SQL", + "SQLEXCEPTION", + "SQLID", + "SQLSTATE", + "SQLWARNING", + "STANDARD", + "START", + "STATE", + "STATEMENT", + "STATIC", + "STAY", + "STOGROUP", + "STORES", + "STRUCTURE", + "STYLE", + "SUBPAGES", + "SUBSTRING", + "SYNONYM", + "SYSFUN", + "SYSIBM", + "SYSPROC", + "SYSTEM", + "SYSTEM_USER", + "TABLE", + "TABLESPACE", + "TEMPORARY", + "TERMINATE", + "THAN", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATION", + "TREAT", + "TRIGGER", + "TRIM", + "TRUE", + "TYPE", + "UNDER", + "UNDO", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNNEST", + "UNTIL", + "UPDATE", + "USAGE", + "USER", + "USING", + "VALIDPROC", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARIANT", + "VARYING", + "VCAT", + "VIEW", + "VOLUMES", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WITH", + "WITHOUT", + "WLM", + "WORK", + "WRITE", + "YEAR", + "YEARS", + "ZONE" + }, + nativeMeta.getReservedWords()); + + assertEquals(32672, nativeMeta.getMaxVARCHARLength()); + assertTrue(nativeMeta.isSupportsBatchUpdates()); + assertFalse(nativeMeta.isSupportsGetBlob()); + assertTrue(nativeMeta.isSupportsSequences()); + assertEquals(":", nativeMeta.getExtraOptionIndicator()); + assertFalse(nativeMeta.isSupportsSequenceNoMaxValueOption()); + assertTrue(nativeMeta.isRequiresCastToVariousForIsNull()); + assertTrue(nativeMeta.isDisplaySizeTwiceThePrecision()); + assertFalse(nativeMeta.isSupportsNewLinesInSql()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE", + nativeMeta.getTruncateTableStatement("FOO")); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR CLOB", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BLOB(" + (nativeMeta.getMaxVARCHARLength() + 2) + ")", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaBinary("BAR", nativeMeta.getMaxVARCHARLength() + 2, 10), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BLOB", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBinary("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR CHAR(200) FOR BIT DATA", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBinary("BAR", 200, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + String lineSep = System.getProperty("line.separator"); + + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + + lineSep + + ";" + + lineSep + + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "LOCK TABLE FOO IN SHARE MODE;" + lineSep + "LOCK TABLE BAR IN SHARE MODE;" + lineSep, + nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + + assertNull(nativeMeta.getSqlUnlockTables(new String[] {"FOO", "BAR"})); + assertEquals("SELECT SEQNAME FROM SYSCAT.SEQUENCES", nativeMeta.getSqlListOfSequences()); + assertEquals( + "SELECT * FROM SYSCAT.SEQUENCES WHERE SEQNAME = 'FOO'", + nativeMeta.getSqlSequenceExists("FOO")); + assertEquals( + "SELECT * FROM SYSCAT.SEQUENCES WHERE SEQSCHEMA = 'FOO' AND SEQNAME = 'BAR'", + nativeMeta.getSqlSequenceExists("FOO.BAR")); + assertEquals( + "SELECT PREVIOUS VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", + nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals( + "SELECT NEXT VALUE FOR FOO FROM SYSIBM.SYSDUMMY1", + nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals( + "insert into FOO(FOOVERSION) values (1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + assertEquals( + "CHARACTER(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NOCACHE)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "FOO", "", true, false, false)); + + assertEquals( + "BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NOCACHE)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 12, 0), "FOO", "", true, false, false)); + assertEquals( + "INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NOCACHE)", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 12, 0), "FOO", "", true, false, false)); + + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "DECIMAL(12)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 12, 0), + "", + "", + false, + false, + false)); // Pretty sure this is a bug - should be an Integer here. + assertEquals( + "DECIMAL(12, 4)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 12, 4), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); + + int realMaxBeforeCLOB = Math.max(nativeMeta.getMaxVARCHARLength(), DatabaseMeta.CLOB_LENGTH); + + int realMinBeforeCLOB = Math.min(nativeMeta.getMaxVARCHARLength(), DatabaseMeta.CLOB_LENGTH); + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", realMaxBeforeCLOB + 1, 0), "", "", false, false, false)); + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", realMaxBeforeCLOB, 0), "", "", false, false, false)); + assertEquals( + String.format("VARCHAR(%d)", realMinBeforeCLOB - 1), + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", realMinBeforeCLOB - 1, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR()", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), + "", + "", + false, + false, + false)); // Definitely a bug here - VARCHAR() is not valid SQL anywhere . . . + + // Binary Stuff . . . + assertEquals( + String.format("BLOB(%d)", realMaxBeforeCLOB + 1), + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", realMaxBeforeCLOB + 1, 0), "", "", false, false, false)); + + assertEquals( + "BLOB", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "CHAR(150) FOR BIT DATA", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 150, 0), "", "", false, false, false)); + + // Then unknown . . . + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2SequenceAndReleaseSavePointTest.java b/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2SequenceAndReleaseSavePointTest.java index 2851c02bde4..9ce5efc730f 100644 --- a/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2SequenceAndReleaseSavePointTest.java +++ b/plugins/databases/db2/src/test/java/org/apache/hop/databases/db2/DB2SequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.db2; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class DB2SequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/derby/src/main/java/org/apache/hop/databases/derby/DerbyDatabaseMeta.java b/plugins/databases/derby/src/main/java/org/apache/hop/databases/derby/DerbyDatabaseMeta.java index abac25342f1..f58d4f51f9c 100644 --- a/plugins/databases/derby/src/main/java/org/apache/hop/databases/derby/DerbyDatabaseMeta.java +++ b/plugins/databases/derby/src/main/java/org/apache/hop/databases/derby/DerbyDatabaseMeta.java @@ -26,10 +26,11 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; -/** - * Contains Apache Derby Database Connection information through static final members - */ -@DatabaseMetaPlugin(type = "DERBY", typeDescription = "Apache Derby", documentationUrl = "/database/databases/derby.html") +/** Contains Apache Derby Database Connection information through static final members */ +@DatabaseMetaPlugin( + type = "DERBY", + typeDescription = "Apache Derby", + documentationUrl = "/database/databases/derby.html") @GuiPlugin(id = "GUI-DerbyDatabaseMeta") public class DerbyDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -37,7 +38,9 @@ public int[] getAccessTypeList() { return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { @@ -79,7 +82,9 @@ public boolean isFetchSizeSupported() { return true; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; diff --git a/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbyDatabaseMetaTest.java b/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbyDatabaseMetaTest.java index 413c1307a63..4bee1131add 100644 --- a/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbyDatabaseMetaTest.java +++ b/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbyDatabaseMetaTest.java @@ -1,418 +1,418 @@ -/* - * 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 org.apache.hop.databases.derby; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class DerbyDatabaseMetaTest { - private DerbyDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new DerbyDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - - assertEquals("org.apache.derby.jdbc.EmbeddedDriver", nativeMeta.getDriverClass()); - nativeMeta.setHostname("FOOHOST"); - assertEquals("org.apache.derby.client.ClientAutoloadedDriver", nativeMeta.getDriverClass()); - - assertEquals("jdbc:derby://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); - assertEquals("jdbc:derby://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals("jdbc:derby:FOO", nativeMeta.getURL("", "", "FOO")); - - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertEquals(1527, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsGetBlob()); - assertEquals( - "http://db.apache.org/derby/papers/DerbyClientSpec.html", - nativeMeta.getExtraOptionsHelpText()); - assertEquals( - new String[] { - "ADD", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "AS", - "ASC", - "ASSERTION", - "AT", - "AUTHORIZATION", - "AVG", - "BEGIN", - "BETWEEN", - "BIT", - "BOOLEAN", - "BOTH", - "BY", - "CALL", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CHAR", - "CHARACTER", - "CHECK", - "CLOSE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONTINUE", - "CONVERT", - "CORRESPONDING", - "COUNT", - "CREATE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "CURSOR", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DESC", - "DESCRIBE", - "DIAGNOSTICS", - "DISCONNECT", - "DISTINCT", - "DOUBLE", - "DROP", - "ELSE", - "END", - "ENDEXEC", - "ESCAPE", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXPLAIN", - "EXTERNAL", - "FALSE", - "FETCH", - "FIRST", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FROM", - "FULL", - "FUNCTION", - "GET", - "GET_CURRENT_CONNECTION", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "HAVING", - "HOUR", - "IDENTITY", - "IMMEDIATE", - "IN", - "INDICATOR", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTO", - "IS", - "ISOLATION", - "JOIN", - "KEY", - "LAST", - "LEFT", - "LIKE", - "LONGINT", - "LOWER", - "LTRIM", - "MATCH", - "MAX", - "MIN", - "MINUTE", - "NATIONAL", - "NATURAL", - "NCHAR", - "NVARCHAR", - "NEXT", - "NO", - "NOT", - "NULL", - "NULLIF", - "NUMERIC", - "OF", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OR", - "ORDER", - "OUT", - "OUTER", - "OUTPUT", - "OVERLAPS", - "PAD", - "PARTIAL", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "PUBLIC", - "READ", - "REAL", - "REFERENCES", - "RELATIVE", - "RESTRICT", - "REVOKE", - "RIGHT", - "ROLLBACK", - "ROWS", - "RTRIM", - "SCHEMA", - "SCROLL", - "SECOND", - "SELECT", - "SESSION_USER", - "SET", - "SMALLINT", - "SOME", - "SPACE", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLSTATE", - "SUBSTR", - "SUBSTRING", - "SUM", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATE", - "TRANSLATION", - "TRUE", - "UNION", - "UNIQUE", - "UNKNOWN", - "UPDATE", - "UPPER", - "USER", - "USING", - "VALUES", - "VARCHAR", - "VARYING", - "VIEW", - "WHENEVER", - "WHERE", - "WITH", - "WORK", - "WRITE", - "XML", - "XMLEXISTS", - "XMLPARSE", - "XMLSERIALIZE", - "YEAR" - }, - nativeMeta.getReservedWords()); - } - - @Test - public void testSqlStatements() { - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR CHAR(1)", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR SMALLINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR INTEGER", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR FLOAT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR FLOAT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(21, 4)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR CLOB", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BLOB", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaBinary("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BLOB", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBinary("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BLOB", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBinary("BAR", 200, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR FLOAT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, -7), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(22, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR FLOAT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR FLOAT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR UNKNOWN", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); - - String lineSep = System.getProperty("line.separator"); - - assertEquals( - "ALTER TABLE FOO DROP BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ALTER BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "insert into FOO(FOOVERSION) values (1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } -} +/* + * 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 org.apache.hop.databases.derby; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class DerbyDatabaseMetaTest { + private DerbyDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new DerbyDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + + assertEquals("org.apache.derby.jdbc.EmbeddedDriver", nativeMeta.getDriverClass()); + nativeMeta.setHostname("FOOHOST"); + assertEquals("org.apache.derby.client.ClientAutoloadedDriver", nativeMeta.getDriverClass()); + + assertEquals("jdbc:derby://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); + assertEquals("jdbc:derby://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals("jdbc:derby:FOO", nativeMeta.getURL("", "", "FOO")); + + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertEquals(1527, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsGetBlob()); + assertEquals( + "http://db.apache.org/derby/papers/DerbyClientSpec.html", + nativeMeta.getExtraOptionsHelpText()); + assertEquals( + new String[] { + "ADD", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "AS", + "ASC", + "ASSERTION", + "AT", + "AUTHORIZATION", + "AVG", + "BEGIN", + "BETWEEN", + "BIT", + "BOOLEAN", + "BOTH", + "BY", + "CALL", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CHAR", + "CHARACTER", + "CHECK", + "CLOSE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONTINUE", + "CONVERT", + "CORRESPONDING", + "COUNT", + "CREATE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "CURSOR", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DESC", + "DESCRIBE", + "DIAGNOSTICS", + "DISCONNECT", + "DISTINCT", + "DOUBLE", + "DROP", + "ELSE", + "END", + "ENDEXEC", + "ESCAPE", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXPLAIN", + "EXTERNAL", + "FALSE", + "FETCH", + "FIRST", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FROM", + "FULL", + "FUNCTION", + "GET", + "GET_CURRENT_CONNECTION", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "HAVING", + "HOUR", + "IDENTITY", + "IMMEDIATE", + "IN", + "INDICATOR", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTO", + "IS", + "ISOLATION", + "JOIN", + "KEY", + "LAST", + "LEFT", + "LIKE", + "LONGINT", + "LOWER", + "LTRIM", + "MATCH", + "MAX", + "MIN", + "MINUTE", + "NATIONAL", + "NATURAL", + "NCHAR", + "NVARCHAR", + "NEXT", + "NO", + "NOT", + "NULL", + "NULLIF", + "NUMERIC", + "OF", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OR", + "ORDER", + "OUT", + "OUTER", + "OUTPUT", + "OVERLAPS", + "PAD", + "PARTIAL", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "PUBLIC", + "READ", + "REAL", + "REFERENCES", + "RELATIVE", + "RESTRICT", + "REVOKE", + "RIGHT", + "ROLLBACK", + "ROWS", + "RTRIM", + "SCHEMA", + "SCROLL", + "SECOND", + "SELECT", + "SESSION_USER", + "SET", + "SMALLINT", + "SOME", + "SPACE", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLSTATE", + "SUBSTR", + "SUBSTRING", + "SUM", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATE", + "TRANSLATION", + "TRUE", + "UNION", + "UNIQUE", + "UNKNOWN", + "UPDATE", + "UPPER", + "USER", + "USING", + "VALUES", + "VARCHAR", + "VARYING", + "VIEW", + "WHENEVER", + "WHERE", + "WITH", + "WORK", + "WRITE", + "XML", + "XMLEXISTS", + "XMLPARSE", + "XMLSERIALIZE", + "YEAR" + }, + nativeMeta.getReservedWords()); + } + + @Test + public void testSqlStatements() { + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR CHAR(1)", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR SMALLINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR INTEGER", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR FLOAT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR FLOAT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(21, 4)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR CLOB", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BLOB", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaBinary("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BLOB", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBinary("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BLOB", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBinary("BAR", 200, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR FLOAT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, -7), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(22, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR FLOAT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR FLOAT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR UNKNOWN", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); + + String lineSep = System.getProperty("line.separator"); + + assertEquals( + "ALTER TABLE FOO DROP BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ALTER BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "insert into FOO(FOOVERSION) values (1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } +} diff --git a/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbySequenceAndReleaseSavePointTest.java b/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbySequenceAndReleaseSavePointTest.java index cb68db9cbb9..595ed4690b9 100644 --- a/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbySequenceAndReleaseSavePointTest.java +++ b/plugins/databases/derby/src/test/java/org/apache/hop/databases/derby/DerbySequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.derby; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class DerbySequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/doris/src/main/java/org/apache/hop/databases/doris/DorisDatabaseMeta.java b/plugins/databases/doris/src/main/java/org/apache/hop/databases/doris/DorisDatabaseMeta.java index 50877e8445d..a25bd9ac99f 100644 --- a/plugins/databases/doris/src/main/java/org/apache/hop/databases/doris/DorisDatabaseMeta.java +++ b/plugins/databases/doris/src/main/java/org/apache/hop/databases/doris/DorisDatabaseMeta.java @@ -23,108 +23,111 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.databases.mysql.MySqlDatabaseMeta; -@DatabaseMetaPlugin(type = "DORIS", typeDescription = "Apache Doris", documentationUrl = "/database/databases/doris.html") +@DatabaseMetaPlugin( + type = "DORIS", + typeDescription = "Apache Doris", + documentationUrl = "/database/databases/doris.html") @GuiPlugin(id = "GUI-DorisDatabaseMeta") public class DorisDatabaseMeta extends MySqlDatabaseMeta { - @Override - public String getFieldDefinition( - IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCR) { - String retval = ""; + @Override + public String getFieldDefinition( + IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCR) { + String retval = ""; - String fieldname = v.getName(); - if (v.getLength() == DatabaseMeta.CLOB_LENGTH) { - v.setLength(getMaxTextFieldLength()); - } - int length = v.getLength(); - int precision = v.getPrecision(); - - if (addFieldName) { - retval += fieldname + " "; - } + String fieldname = v.getName(); + if (v.getLength() == DatabaseMeta.CLOB_LENGTH) { + v.setLength(getMaxTextFieldLength()); + } + int length = v.getLength(); + int precision = v.getPrecision(); - int type = v.getType(); - switch (type) { - case IValueMeta.TYPE_TIMESTAMP: - case IValueMeta.TYPE_DATE: - retval += "DATETIME"; - break; - case IValueMeta.TYPE_BOOLEAN: - if (isSupportsBooleanDataType()) { - retval += "BOOLEAN"; - } else { - retval += "CHAR(1)"; - } - break; + if (addFieldName) { + retval += fieldname + " "; + } - case IValueMeta.TYPE_NUMBER: - case IValueMeta.TYPE_INTEGER: - case IValueMeta.TYPE_BIGNUMBER: - if (fieldname.equalsIgnoreCase(tk) - || // Technical key - fieldname.equalsIgnoreCase(pk) // Primary key - ) { - if (useAutoinc) { - retval += "BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY"; - } else { - retval += "BIGINT NOT NULL PRIMARY KEY"; - } - } else { - // Integer values... - if (precision == 0) { - if (length > 9) { - if (length < 19) { - // can hold signed values between -9223372036854775808 and 9223372036854775807 - // 18 significant digits - retval += "BIGINT"; - } else { - retval += "DECIMAL(" + length + ")"; - } - } else { - retval += "INT"; - } - } else { - // Floating point values... - if (length > 15) { - retval += "DECIMAL(" + length; - if (precision > 0) { - retval += ", " + precision; - } - retval += ")"; - } else { - // A double-precision floating-point number is accurate to approximately 15 decimal - // places. - // http://mysql.mirrors-r-us.net/doc/refman/5.1/en/numeric-type-overview.html - retval += "DOUBLE"; - } - } - } - break; - case IValueMeta.TYPE_STRING: - if (length > 0) { - if (length == 1) { - retval += "CHAR(1)"; - } else if (length < 65533) { - retval += "VARCHAR(" + length + ")"; - } else { - retval += "STRING"; - } - } else { - retval += "STRING"; - } - break; - case IValueMeta.TYPE_BINARY: - retval += "BITMAP"; - break; - default: - retval += " UNKNOWN"; - break; + int type = v.getType(); + switch (type) { + case IValueMeta.TYPE_TIMESTAMP: + case IValueMeta.TYPE_DATE: + retval += "DATETIME"; + break; + case IValueMeta.TYPE_BOOLEAN: + if (isSupportsBooleanDataType()) { + retval += "BOOLEAN"; + } else { + retval += "CHAR(1)"; } + break; - if (addCR) { - retval += Const.CR; + case IValueMeta.TYPE_NUMBER: + case IValueMeta.TYPE_INTEGER: + case IValueMeta.TYPE_BIGNUMBER: + if (fieldname.equalsIgnoreCase(tk) + || // Technical key + fieldname.equalsIgnoreCase(pk) // Primary key + ) { + if (useAutoinc) { + retval += "BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY"; + } else { + retval += "BIGINT NOT NULL PRIMARY KEY"; + } + } else { + // Integer values... + if (precision == 0) { + if (length > 9) { + if (length < 19) { + // can hold signed values between -9223372036854775808 and 9223372036854775807 + // 18 significant digits + retval += "BIGINT"; + } else { + retval += "DECIMAL(" + length + ")"; + } + } else { + retval += "INT"; + } + } else { + // Floating point values... + if (length > 15) { + retval += "DECIMAL(" + length; + if (precision > 0) { + retval += ", " + precision; + } + retval += ")"; + } else { + // A double-precision floating-point number is accurate to approximately 15 decimal + // places. + // http://mysql.mirrors-r-us.net/doc/refman/5.1/en/numeric-type-overview.html + retval += "DOUBLE"; + } + } + } + break; + case IValueMeta.TYPE_STRING: + if (length > 0) { + if (length == 1) { + retval += "CHAR(1)"; + } else if (length < 65533) { + retval += "VARCHAR(" + length + ")"; + } else { + retval += "STRING"; + } + } else { + retval += "STRING"; } + break; + case IValueMeta.TYPE_BINARY: + retval += "BITMAP"; + break; + default: + retval += " UNKNOWN"; + break; + } - return retval; + if (addCR) { + retval += Const.CR; } + + return retval; + } } diff --git a/plugins/databases/duckdb/src/main/java/org/apache/hop/databases/duckdb/DuckDBDatabaseMeta.java b/plugins/databases/duckdb/src/main/java/org/apache/hop/databases/duckdb/DuckDBDatabaseMeta.java index dc6d0c02eb7..711e4f68392 100644 --- a/plugins/databases/duckdb/src/main/java/org/apache/hop/databases/duckdb/DuckDBDatabaseMeta.java +++ b/plugins/databases/duckdb/src/main/java/org/apache/hop/databases/duckdb/DuckDBDatabaseMeta.java @@ -23,174 +23,189 @@ import org.apache.hop.core.database.DatabaseMetaPlugin; import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.gui.plugin.GuiElementType; import org.apache.hop.core.gui.plugin.GuiPlugin; -import org.apache.hop.core.gui.plugin.GuiWidgetElement; import org.apache.hop.core.row.IValueMeta; @DatabaseMetaPlugin( - type="DuckDB", - typeDescription = "DuckDB", - documentationUrl = "/database/databases/duckdb.html" -) + type = "DuckDB", + typeDescription = "DuckDB", + documentationUrl = "/database/databases/duckdb.html") @GuiPlugin(id = "GUI-DuckDBDatabaseMeta") public class DuckDBDatabaseMeta extends BaseDatabaseMeta implements IDatabase { - private static final Class PKG = DuckDBDatabaseMeta.class; // For Translator - - @Override - public String getCreateTableStatement() { - return super.getCreateTableStatement(); + private static final Class PKG = DuckDBDatabaseMeta.class; // For Translator + + @Override + public String getCreateTableStatement() { + return super.getCreateTableStatement(); + } + + @Override + public String getFieldDefinition( + IValueMeta v, + String tk, + String pk, + boolean useAutoIncrement, + boolean addFieldName, + boolean addCr) { + // https://duckdb.org/docs/sql/data_types/overview.html + String retval = ""; + + String fieldname = v.getName(); + int length = v.getLength(); + int precision = v.getPrecision(); + + if (addFieldName) { + retval += fieldname + " "; + } else { + retval += fieldname + " TYPE "; } - @Override - public String getFieldDefinition(IValueMeta v, String tk, String pk, boolean useAutoIncrement, boolean addFieldName, boolean addCr) { - // https://duckdb.org/docs/sql/data_types/overview.html - String retval = ""; - - String fieldname = v.getName(); - int length = v.getLength(); - int precision = v.getPrecision(); - - if (addFieldName) { - retval += fieldname + " "; - } else { - retval += fieldname + " TYPE "; - } - - int type = v.getType(); - switch (type) { - case IValueMeta.TYPE_TIMESTAMP: - case IValueMeta.TYPE_DATE: - retval += "TIMESTAMP"; - break; - case IValueMeta.TYPE_BOOLEAN: - if (isSupportsBooleanDataType()) { - retval += "BOOLEAN"; - } else { - retval += "CHAR(1)"; - } - break; - case IValueMeta.TYPE_NUMBER: - case IValueMeta.TYPE_INTEGER: - case IValueMeta.TYPE_BIGNUMBER: - if (fieldname.equalsIgnoreCase(tk) - || // Technical key - fieldname.equalsIgnoreCase(pk) // Primary key - ) { - retval += "IDENTITY"; - } else { - if (length > 0) { - if (precision > 0 || length > 18) { - retval += "DECIMAL(" + length + ", " + precision + ")"; - } else { - if (length > 9) { - retval += "BIGINT"; - } else { - if (length < 5) { - if (length < 3) { - retval += "TINYINT"; - } else { - retval += "SMALLINT"; - } - } else { - retval += "INTEGER"; - } - } - } - - } else { - retval += "DOUBLE"; - } - } - break; - case IValueMeta.TYPE_STRING: - if (length >= DatabaseMeta.CLOB_LENGTH) { - retval += "TEXT"; + int type = v.getType(); + switch (type) { + case IValueMeta.TYPE_TIMESTAMP: + case IValueMeta.TYPE_DATE: + retval += "TIMESTAMP"; + break; + case IValueMeta.TYPE_BOOLEAN: + if (isSupportsBooleanDataType()) { + retval += "BOOLEAN"; + } else { + retval += "CHAR(1)"; + } + break; + case IValueMeta.TYPE_NUMBER: + case IValueMeta.TYPE_INTEGER: + case IValueMeta.TYPE_BIGNUMBER: + if (fieldname.equalsIgnoreCase(tk) + || // Technical key + fieldname.equalsIgnoreCase(pk) // Primary key + ) { + retval += "IDENTITY"; + } else { + if (length > 0) { + if (precision > 0 || length > 18) { + retval += "DECIMAL(" + length + ", " + precision + ")"; + } else { + if (length > 9) { + retval += "BIGINT"; + } else { + if (length < 5) { + if (length < 3) { + retval += "TINYINT"; + } else { + retval += "SMALLINT"; + } } else { - retval += "VARCHAR"; - if (length > 0) { - retval += "(" + length; - } else { - retval += "(" + Integer.MAX_VALUE; - } - retval += ")"; + retval += "INTEGER"; } - break; - case IValueMeta.TYPE_BINARY: - retval += "BLOB"; - break; - default: - retval += "UNKNOWN"; - break; - } + } + } - if (addCr) { - retval += Const.CR; + } else { + retval += "DOUBLE"; + } } - - return retval; - } - - @Override - public int[] getAccessTypeList() { - return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; - } - - @Override - public String getDriverClass() { - return "org.duckdb.DuckDBDriver"; - } - - @Override - public boolean isDuckDbVariant() { - return true; - } - - @Override - public String getURL(String hostname, String port, String databaseName) throws HopDatabaseException { - return "jdbc:duckdb:" + (databaseName.equals("memory") ? "" : databaseName); - } - - @Override - public String getAddColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoIncrement, String pk, boolean semicolon) { - return "ALTER TABLE " - + tableName - + " ADD COLUMN " - + getFieldDefinition(v, tk, pk, useAutoIncrement,true, false); - } - - @Override - public String getModifyColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoIncrement, String pk, boolean semicolon) { - return "ALTER TABLE " - + tableName - + " ALTER COLUMN " - + getFieldDefinition(v, tk, pk, useAutoIncrement,false, false); - } - - @Override - public boolean isSupportsBooleanDataType() { - return true; - } - - @Override - public boolean isSupportsTimestampDataType() { - return true; - } - - @Override - public boolean isSupportsOptionsInURL() { - return false; - } - - @Override - public String getSqlListOfSchemas() { - return "SELECT CONCAT(catalog_name, '.', schema_name) AS name FROM information_schema.schemata ORDER BY catalog_name, schema_name"; + break; + case IValueMeta.TYPE_STRING: + if (length >= DatabaseMeta.CLOB_LENGTH) { + retval += "TEXT"; + } else { + retval += "VARCHAR"; + if (length > 0) { + retval += "(" + length; + } else { + retval += "(" + Integer.MAX_VALUE; + } + retval += ")"; + } + break; + case IValueMeta.TYPE_BINARY: + retval += "BLOB"; + break; + default: + retval += "UNKNOWN"; + break; } - @Override - public String[] getTableTypes() { - return new String[] {"BASE TABLE", "LOCAL TEMPORARY"}; + if (addCr) { + retval += Const.CR; } + return retval; + } + + @Override + public int[] getAccessTypeList() { + return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; + } + + @Override + public String getDriverClass() { + return "org.duckdb.DuckDBDriver"; + } + + @Override + public boolean isDuckDbVariant() { + return true; + } + + @Override + public String getURL(String hostname, String port, String databaseName) + throws HopDatabaseException { + return "jdbc:duckdb:" + (databaseName.equals("memory") ? "" : databaseName); + } + + @Override + public String getAddColumnStatement( + String tableName, + IValueMeta v, + String tk, + boolean useAutoIncrement, + String pk, + boolean semicolon) { + return "ALTER TABLE " + + tableName + + " ADD COLUMN " + + getFieldDefinition(v, tk, pk, useAutoIncrement, true, false); + } + + @Override + public String getModifyColumnStatement( + String tableName, + IValueMeta v, + String tk, + boolean useAutoIncrement, + String pk, + boolean semicolon) { + return "ALTER TABLE " + + tableName + + " ALTER COLUMN " + + getFieldDefinition(v, tk, pk, useAutoIncrement, false, false); + } + + @Override + public boolean isSupportsBooleanDataType() { + return true; + } + + @Override + public boolean isSupportsTimestampDataType() { + return true; + } + + @Override + public boolean isSupportsOptionsInURL() { + return false; + } + + @Override + public String getSqlListOfSchemas() { + return "SELECT CONCAT(catalog_name, '.', schema_name) AS name FROM information_schema.schemata ORDER BY catalog_name, schema_name"; + } + + @Override + public String[] getTableTypes() { + return new String[] {"BASE TABLE", "LOCAL TEMPORARY"}; + } } diff --git a/plugins/databases/exasol4/src/main/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMeta.java b/plugins/databases/exasol4/src/main/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMeta.java index 996706870bf..47e729a8a0a 100644 --- a/plugins/databases/exasol4/src/main/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMeta.java +++ b/plugins/databases/exasol4/src/main/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMeta.java @@ -27,10 +27,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Exasol 4 specific information through static final members - */ -@DatabaseMetaPlugin(type = "EXASOL4", typeDescription = "Exasol", documentationUrl = "/database/databases/exasol.html") +/** Contains Exasol 4 specific information through static final members */ +@DatabaseMetaPlugin( + type = "EXASOL4", + typeDescription = "Exasol", + documentationUrl = "/database/databases/exasol.html") @GuiPlugin(id = "GUI-ExasolDatabaseMeta") public class Exasol4DatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -46,7 +47,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { // Exasol does support the identity column type, but does not support returning generated @@ -54,7 +57,9 @@ public boolean isSupportsAutoInc() { return false; } - /** @see IDatabase#getLimitClause(int) */ + /** + * @see IDatabase#getLimitClause(int) + */ @Override public String getLimitClause(int nrRows) { return " WHERE ROWNUM <= " + nrRows; @@ -106,7 +111,9 @@ public boolean isSupportsOptionsInURL() { return true; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return false; @@ -121,7 +128,9 @@ public boolean useSchemaNameForTableList() { return true; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; @@ -692,7 +701,9 @@ public String[] getReservedWords() { }; } - /** @return extra help text on the supported options on the selected database platform. */ + /** + * @return extra help text on the supported options on the selected database platform. + */ @Override public String getExtraOptionsHelpText() { return "http://www.exasol.com/knowledge-center.html"; @@ -735,7 +746,9 @@ public boolean isSupportsPreparedStatementMetadataRetrieval() { return false; } - /** @return The maximum number of columns in a database, <=0 means: no known limit */ + /** + * @return The maximum number of columns in a database, <=0 means: no known limit + */ @Override public int getMaxColumnsInIndex() { return -1; diff --git a/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMetaTest.java b/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMetaTest.java index b1679cfa5ea..eb64e2e4ad0 100644 --- a/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMetaTest.java +++ b/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4DatabaseMetaTest.java @@ -1,591 +1,591 @@ -/* - * 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 org.apache.hop.databases.exasol4; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class Exasol4DatabaseMetaTest { - Exasol4DatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new Exasol4DatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(8563, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertEquals("com.exasol.jdbc.EXADriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:exa:FOO:BAR", nativeMeta.getURL("FOO", "BAR", "IGNORED")); - assertTrue(nativeMeta.isSupportsOptionsInURL()); - assertFalse(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.useSchemaNameForTableList()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertEquals( - new String[] { - "ABSOLUTE", - "ACTION", - "ADD", - "AFTER", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "APPEND", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASENSITIVE", - "ASSERTION", - "AT", - "ATTRIBUTE", - "AUTHID", - "AUTHORIZATION", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIGINT", - "BINARY", - "BIT", - "BLOB", - "BLOCKED", - "BOOL", - "BOOLEAN", - "BOTH", - "BY", - "BYTE", - "CALL", - "CALLED", - "CARDINALITY", - "CASCADE", - "CASCADED", - "CASE", - "CASESPECIFIC", - "CAST", - "CATALOG", - "CHAIN", - "CHAR", - "CHARACTER", - "CHARACTERISTICS", - "CHARACTER_SET_CATALOG", - "CHARACTER_SET_NAME", - "CHARACTER_SET_SCHEMA", - "CHECK", - "CHECKED", - "CLOSE", - "COALESCE", - "COLLATE", - "COLLATION", - "COLLATION_CATALOG", - "COLLATION_NAME", - "COLLATION_SCHEMA", - "COLUMN", - "COMMIT", - "CONDITION", - "CONNECTION", - "CONSTANT", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRUCTOR", - "CONTAINS", - "CONTINUE", - "CONTROL", - "CONVERT", - "CORRESPONDING", - "CREATE", - "CS", - "CSV", - "CUBE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_SCHEMA", - "CURRENT_SESSION", - "CURRENT_STATEMENT", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DATA", - "DATALINK", - "DATE", - "DATETIME_INTERVAL_CODE", - "DATETIME_INTERVAL_PRECISION", - "DAY", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DEFINED", - "DEFINER", - "DELETE", - "DEREF", - "DERIVED", - "DESC", - "DESCRIBE", - "DESCRIPTOR", - "DETERMINISTIC", - "DISABLE", - "DISABLED", - "DISCONNECT", - "DISPATCH", - "DISTINCT", - "DLURLCOMPLETE", - "DLURLPATH", - "DLURLPATHONLY", - "DLURLSCHEME", - "DLURLSERVER", - "DLVALUE", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "DYNAMIC", - "DYNAMIC_FUNCTION", - "DYNAMIC_FUNCTION_CODE", - "EACH", - "ELSE", - "ELSEIF", - "ELSIF", - "ENABLE", - "ENABLED", - "END", - "END-EXEC", - "ENFORCE", - "EQUALS", - "ERRORS", - "ESCAPE", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXPORT", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FBV", - "FETCH", - "FILE", - "FINAL", - "FIRST", - "FLOAT", - "FOLLOWING", - "FOR", - "FORALL", - "FORCE", - "FORMAT", - "FOUND", - "FREE", - "FROM", - "FS", - "FULL", - "FUNCTION", - "GENERAL", - "GENERATED", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GRANTED", - "GROUP", - "GROUPING", - "GROUP_CONCAT", - "HAVING", - "HOLD", - "HOUR", - "IDENTITY", - "IF", - "IFNULL", - "IMMEDIATE", - "IMPLEMENTATION", - "IMPORT", - "IN", - "INDEX", - "INDICATOR", - "INNER", - "INOUT", - "INPUT", - "INSENSITIVE", - "INSERT", - "INSTANCE", - "INSTANTIABLE", - "INT", - "INTEGER", - "INTEGRITY", - "INTERSECT", - "INTERVAL", - "INTO", - "INVOKER", - "IS", - "ITERATE", - "JOIN", - "KEY_MEMBER", - "KEY_TYPE", - "LARGE", - "LAST", - "LATERAL", - "LEADING", - "LEAVE", - "LEFT", - "LIKE", - "LIMIT", - "LOCAL", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATOR", - "LOG", - "LONGVARCHAR", - "LOOP", - "MAP", - "MATCH", - "MATCHED", - "MERGE", - "METHOD", - "MINUS", - "MINUTE", - "MOD", - "MODIFIES", - "MODIFY", - "MODULE", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NCLOB", - "NEW", - "NEXT", - "NLS_DATE_FORMAT", - "NLS_DATE_LANGUAGE", - "NLS_NUMERIC_CHARACTERS", - "NLS_TIMESTAMP_FORMAT", - "NO", - "NOLOGGING", - "NONE", - "NOT", - "NULL", - "NULLIF", - "NUMBER", - "NUMERIC", - "OBJECT", - "OF", - "OFF", - "OLD", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OPTIONS", - "OR", - "ORDER", - "ORDERING", - "ORDINALITY", - "OTHERS", - "OUT", - "OUTER", - "OUTPUT", - "OVER", - "OVERLAPS", - "OVERLAY", - "OVERRIDING", - "PAD", - "PARALLEL_ENABLE", - "PARAMETER", - "PARAMETER_SPECIFIC_CATALOG", - "PARAMETER_SPECIFIC_NAME", - "PARAMETER_SPECIFIC_SCHEMA", - "PARTIAL", - "PATH", - "PERMISSION", - "PLACING", - "POSITION", - "PRECEDING", - "PREPARE", - "PRESERVE", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "RANDOM", - "RANGE", - "READ", - "READS", - "REAL", - "RECOVERY", - "RECURSIVE", - "REF", - "REFERENCES", - "REFERENCING", - "REGEXP_LIKE", - "RELATIVE", - "RELEASE", - "RENAME", - "REPEAT", - "REPLACE", - "RESTORE", - "RESTRICT", - "RESULT", - "RETURN", - "RETURNED_LENGTH", - "RETURNED_OCTET_LENGTH", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROW", - "ROWS", - "ROWTYPE", - "SAVEPOINT", - "SCHEMA", - "SCOPE", - "SCRIPT", - "SCROLL", - "SEARCH", - "SECOND", - "SECTION", - "SECURITY", - "SELECT", - "SELECTIVE", - "SELF", - "SENSITIVE", - "SEPARATOR", - "SEQUENCE", - "SESSION", - "SESSION_USER", - "SET", - "SETS", - "SHORTINT", - "SIMILAR", - "SMALLINT", - "SOURCE", - "SPACE", - "SPECIFIC", - "SPECIFICTYPE", - "SQL", - "SQLEXCEPTION", - "SQLSTATE", - "SQLWARNING", - "SQL_BIGINT", - "SQL_BIT", - "SQL_CHAR", - "SQL_DATE", - "SQL_DECIMAL", - "SQL_DOUBLE", - "SQL_FLOAT", - "SQL_INTEGER", - "SQL_LONGVARCHAR", - "SQL_NUMERIC", - "SQL_REAL", - "SQL_SMALLINT", - "SQL_TIMESTAMP", - "SQL_TINYINT", - "SQL_TYPE_DATE", - "SQL_TYPE_TIMESTAMP", - "SQL_VARCHAR", - "START", - "STATE", - "STATEMENT", - "STATIC", - "STRUCTURE", - "STYLE", - "SUBSTRING", - "SUBTYPE", - "SYSDATE", - "SYSTEM", - "SYSTEM_USER", - "SYSTIMESTAMP", - "TABLE", - "TEMPORARY", - "TEXT", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TINYINT", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSFORM", - "TRANSFORMS", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRIM", - "TRUE", - "TRUNCATE", - "UNDER", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNLINK", - "UNNEST", - "UNTIL", - "UPDATE", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARCHAR2", - "VARRAY", - "VERIFY", - "VIEW", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WINDOW", - "WITH", - "WITHIN", - "WITHOUT", - "WORK", - "YEAR", - "YES", - "ZONE" - }, - nativeMeta.getReservedWords()); - assertEquals( - "http://www.exasol.com/knowledge-center.html", nativeMeta.getExtraOptionsHelpText()); - assertTrue( - nativeMeta.hasIndex( - null, "NOT-THERE", "NOT-THERE", null)); // Always returns true - this is a bug IMO - assertFalse(nativeMeta.isRequiresCreateTablePrimaryKeyAppend()); - assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); - assertEquals(-1, nativeMeta.getMaxColumnsInIndex()); - assertFalse(nativeMeta.isReleaseSavepoint()); - assertFalse(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); - } - - @Test - public void testSqlStatements() { - assertEquals(" WHERE ROWNUM <= 15", nativeMeta.getLimitClause(15)); - assertEquals( - "SELECT /*+FIRST_ROWS*/ * FROM FOO WHERE 1=0", nativeMeta.getSqlQueryFields("FOO")); - assertEquals( - "SELECT /*+FIRST_ROWS*/ * FROM FOO WHERE 1=0", nativeMeta.getSqlTableExists("FOO")); - - assertEquals( - "SELECT /*+FIRST_ROWS*/ FOO FROM BAR WHERE 1=0", - nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - assertEquals( - "SELECT /*+FIRST_ROWS*/ FOO FROM BAR WHERE 1=0", - nativeMeta.getSqlColumnExists("FOO", "BAR")); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR TIMESTAMP ) ", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( BAR TIMESTAMP ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR BOOLEAN ) ", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR DECIMAL ) ", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaNumber("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( BAR DECIMAL ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR DECIMAL(15) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( BAR DECIMAL(15) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR DECIMAL(15, 5) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 15, 5), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( BAR DECIMAL(15, 5) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 15, 5), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR INTEGER ) ", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaInteger("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR VARCHAR(15) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR VARCHAR(2000000) ) ", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 15, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR UNKNOWN ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD ( BAR BIGINT NOT NULL PRIMARY KEY ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); - } -} +/* + * 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 org.apache.hop.databases.exasol4; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class Exasol4DatabaseMetaTest { + Exasol4DatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new Exasol4DatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(8563, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertEquals("com.exasol.jdbc.EXADriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:exa:FOO:BAR", nativeMeta.getURL("FOO", "BAR", "IGNORED")); + assertTrue(nativeMeta.isSupportsOptionsInURL()); + assertFalse(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.useSchemaNameForTableList()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertEquals( + new String[] { + "ABSOLUTE", + "ACTION", + "ADD", + "AFTER", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "APPEND", + "ARE", + "ARRAY", + "AS", + "ASC", + "ASENSITIVE", + "ASSERTION", + "AT", + "ATTRIBUTE", + "AUTHID", + "AUTHORIZATION", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIGINT", + "BINARY", + "BIT", + "BLOB", + "BLOCKED", + "BOOL", + "BOOLEAN", + "BOTH", + "BY", + "BYTE", + "CALL", + "CALLED", + "CARDINALITY", + "CASCADE", + "CASCADED", + "CASE", + "CASESPECIFIC", + "CAST", + "CATALOG", + "CHAIN", + "CHAR", + "CHARACTER", + "CHARACTERISTICS", + "CHARACTER_SET_CATALOG", + "CHARACTER_SET_NAME", + "CHARACTER_SET_SCHEMA", + "CHECK", + "CHECKED", + "CLOSE", + "COALESCE", + "COLLATE", + "COLLATION", + "COLLATION_CATALOG", + "COLLATION_NAME", + "COLLATION_SCHEMA", + "COLUMN", + "COMMIT", + "CONDITION", + "CONNECTION", + "CONSTANT", + "CONSTRAINT", + "CONSTRAINTS", + "CONSTRUCTOR", + "CONTAINS", + "CONTINUE", + "CONTROL", + "CONVERT", + "CORRESPONDING", + "CREATE", + "CS", + "CSV", + "CUBE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_PATH", + "CURRENT_ROLE", + "CURRENT_SCHEMA", + "CURRENT_SESSION", + "CURRENT_STATEMENT", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "CURSOR", + "CYCLE", + "DATA", + "DATALINK", + "DATE", + "DATETIME_INTERVAL_CODE", + "DATETIME_INTERVAL_PRECISION", + "DAY", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DEFINED", + "DEFINER", + "DELETE", + "DEREF", + "DERIVED", + "DESC", + "DESCRIBE", + "DESCRIPTOR", + "DETERMINISTIC", + "DISABLE", + "DISABLED", + "DISCONNECT", + "DISPATCH", + "DISTINCT", + "DLURLCOMPLETE", + "DLURLPATH", + "DLURLPATHONLY", + "DLURLSCHEME", + "DLURLSERVER", + "DLVALUE", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "DYNAMIC", + "DYNAMIC_FUNCTION", + "DYNAMIC_FUNCTION_CODE", + "EACH", + "ELSE", + "ELSEIF", + "ELSIF", + "ENABLE", + "ENABLED", + "END", + "END-EXEC", + "ENFORCE", + "EQUALS", + "ERRORS", + "ESCAPE", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXPORT", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FBV", + "FETCH", + "FILE", + "FINAL", + "FIRST", + "FLOAT", + "FOLLOWING", + "FOR", + "FORALL", + "FORCE", + "FORMAT", + "FOUND", + "FREE", + "FROM", + "FS", + "FULL", + "FUNCTION", + "GENERAL", + "GENERATED", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GRANTED", + "GROUP", + "GROUPING", + "GROUP_CONCAT", + "HAVING", + "HOLD", + "HOUR", + "IDENTITY", + "IF", + "IFNULL", + "IMMEDIATE", + "IMPLEMENTATION", + "IMPORT", + "IN", + "INDEX", + "INDICATOR", + "INNER", + "INOUT", + "INPUT", + "INSENSITIVE", + "INSERT", + "INSTANCE", + "INSTANTIABLE", + "INT", + "INTEGER", + "INTEGRITY", + "INTERSECT", + "INTERVAL", + "INTO", + "INVOKER", + "IS", + "ITERATE", + "JOIN", + "KEY_MEMBER", + "KEY_TYPE", + "LARGE", + "LAST", + "LATERAL", + "LEADING", + "LEAVE", + "LEFT", + "LIKE", + "LIMIT", + "LOCAL", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATOR", + "LOG", + "LONGVARCHAR", + "LOOP", + "MAP", + "MATCH", + "MATCHED", + "MERGE", + "METHOD", + "MINUS", + "MINUTE", + "MOD", + "MODIFIES", + "MODIFY", + "MODULE", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NCLOB", + "NEW", + "NEXT", + "NLS_DATE_FORMAT", + "NLS_DATE_LANGUAGE", + "NLS_NUMERIC_CHARACTERS", + "NLS_TIMESTAMP_FORMAT", + "NO", + "NOLOGGING", + "NONE", + "NOT", + "NULL", + "NULLIF", + "NUMBER", + "NUMERIC", + "OBJECT", + "OF", + "OFF", + "OLD", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OPTIONS", + "OR", + "ORDER", + "ORDERING", + "ORDINALITY", + "OTHERS", + "OUT", + "OUTER", + "OUTPUT", + "OVER", + "OVERLAPS", + "OVERLAY", + "OVERRIDING", + "PAD", + "PARALLEL_ENABLE", + "PARAMETER", + "PARAMETER_SPECIFIC_CATALOG", + "PARAMETER_SPECIFIC_NAME", + "PARAMETER_SPECIFIC_SCHEMA", + "PARTIAL", + "PATH", + "PERMISSION", + "PLACING", + "POSITION", + "PRECEDING", + "PREPARE", + "PRESERVE", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "RANDOM", + "RANGE", + "READ", + "READS", + "REAL", + "RECOVERY", + "RECURSIVE", + "REF", + "REFERENCES", + "REFERENCING", + "REGEXP_LIKE", + "RELATIVE", + "RELEASE", + "RENAME", + "REPEAT", + "REPLACE", + "RESTORE", + "RESTRICT", + "RESULT", + "RETURN", + "RETURNED_LENGTH", + "RETURNED_OCTET_LENGTH", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLLBACK", + "ROLLUP", + "ROUTINE", + "ROW", + "ROWS", + "ROWTYPE", + "SAVEPOINT", + "SCHEMA", + "SCOPE", + "SCRIPT", + "SCROLL", + "SEARCH", + "SECOND", + "SECTION", + "SECURITY", + "SELECT", + "SELECTIVE", + "SELF", + "SENSITIVE", + "SEPARATOR", + "SEQUENCE", + "SESSION", + "SESSION_USER", + "SET", + "SETS", + "SHORTINT", + "SIMILAR", + "SMALLINT", + "SOURCE", + "SPACE", + "SPECIFIC", + "SPECIFICTYPE", + "SQL", + "SQLEXCEPTION", + "SQLSTATE", + "SQLWARNING", + "SQL_BIGINT", + "SQL_BIT", + "SQL_CHAR", + "SQL_DATE", + "SQL_DECIMAL", + "SQL_DOUBLE", + "SQL_FLOAT", + "SQL_INTEGER", + "SQL_LONGVARCHAR", + "SQL_NUMERIC", + "SQL_REAL", + "SQL_SMALLINT", + "SQL_TIMESTAMP", + "SQL_TINYINT", + "SQL_TYPE_DATE", + "SQL_TYPE_TIMESTAMP", + "SQL_VARCHAR", + "START", + "STATE", + "STATEMENT", + "STATIC", + "STRUCTURE", + "STYLE", + "SUBSTRING", + "SUBTYPE", + "SYSDATE", + "SYSTEM", + "SYSTEM_USER", + "SYSTIMESTAMP", + "TABLE", + "TEMPORARY", + "TEXT", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TINYINT", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSFORM", + "TRANSFORMS", + "TRANSLATION", + "TREAT", + "TRIGGER", + "TRIM", + "TRUE", + "TRUNCATE", + "UNDER", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNLINK", + "UNNEST", + "UNTIL", + "UPDATE", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARCHAR2", + "VARRAY", + "VERIFY", + "VIEW", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WINDOW", + "WITH", + "WITHIN", + "WITHOUT", + "WORK", + "YEAR", + "YES", + "ZONE" + }, + nativeMeta.getReservedWords()); + assertEquals( + "http://www.exasol.com/knowledge-center.html", nativeMeta.getExtraOptionsHelpText()); + assertTrue( + nativeMeta.hasIndex( + null, "NOT-THERE", "NOT-THERE", null)); // Always returns true - this is a bug IMO + assertFalse(nativeMeta.isRequiresCreateTablePrimaryKeyAppend()); + assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); + assertEquals(-1, nativeMeta.getMaxColumnsInIndex()); + assertFalse(nativeMeta.isReleaseSavepoint()); + assertFalse(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); + } + + @Test + public void testSqlStatements() { + assertEquals(" WHERE ROWNUM <= 15", nativeMeta.getLimitClause(15)); + assertEquals( + "SELECT /*+FIRST_ROWS*/ * FROM FOO WHERE 1=0", nativeMeta.getSqlQueryFields("FOO")); + assertEquals( + "SELECT /*+FIRST_ROWS*/ * FROM FOO WHERE 1=0", nativeMeta.getSqlTableExists("FOO")); + + assertEquals( + "SELECT /*+FIRST_ROWS*/ FOO FROM BAR WHERE 1=0", + nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + assertEquals( + "SELECT /*+FIRST_ROWS*/ FOO FROM BAR WHERE 1=0", + nativeMeta.getSqlColumnExists("FOO", "BAR")); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR TIMESTAMP ) ", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( BAR TIMESTAMP ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR BOOLEAN ) ", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR DECIMAL ) ", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaNumber("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( BAR DECIMAL ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR DECIMAL(15) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( BAR DECIMAL(15) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR DECIMAL(15, 5) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 15, 5), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( BAR DECIMAL(15, 5) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 15, 5), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR INTEGER ) ", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaInteger("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR VARCHAR(15) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR VARCHAR(2000000) ) ", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 15, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR UNKNOWN ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD ( BAR BIGINT NOT NULL PRIMARY KEY ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); + } +} diff --git a/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4SequenceAndReleaseSavePointTest.java b/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4SequenceAndReleaseSavePointTest.java index 2085bfa6df9..690c61fda78 100644 --- a/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4SequenceAndReleaseSavePointTest.java +++ b/plugins/databases/exasol4/src/test/java/org/apache/hop/databases/exasol4/Exasol4SequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.exasol4; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class Exasol4SequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/firebird/src/main/java/org/apache/hop/databases/firebird/FirebirdDatabaseMeta.java b/plugins/databases/firebird/src/main/java/org/apache/hop/databases/firebird/FirebirdDatabaseMeta.java index e0eacfac31e..b825186162c 100644 --- a/plugins/databases/firebird/src/main/java/org/apache/hop/databases/firebird/FirebirdDatabaseMeta.java +++ b/plugins/databases/firebird/src/main/java/org/apache/hop/databases/firebird/FirebirdDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Firebird specific information through static final members - */ -@DatabaseMetaPlugin(type = "FIREBIRD", typeDescription = "Firebird SQL", documentationUrl = "/database/databases/firebird.html") +/** Contains Firebird specific information through static final members */ +@DatabaseMetaPlugin( + type = "FIREBIRD", + typeDescription = "Firebird SQL", + documentationUrl = "/database/databases/firebird.html") @GuiPlugin(id = "GUI-FirebirdDatabaseMeta") public class FirebirdDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -44,7 +45,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; @@ -60,13 +63,17 @@ public String getURL(String hostname, String port, String databaseName) { return "jdbc:firebirdsql://" + hostname + ":" + port + "/" + databaseName; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; @@ -918,13 +925,17 @@ public String getSqlListOfProcedures() { + "' "; } - /** @return The extra option separator in database URL for this platform. */ + /** + * @return The extra option separator in database URL for this platform. + */ @Override public String getExtraOptionSeparator() { return "&"; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "?"; diff --git a/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdDatabaseMetaTest.java b/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdDatabaseMetaTest.java index dd7321a77e9..e9d992346e9 100644 --- a/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdDatabaseMetaTest.java +++ b/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdDatabaseMetaTest.java @@ -1,873 +1,873 @@ -/* - * 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 org.apache.hop.databases.firebird; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -public class FirebirdDatabaseMetaTest { - - private FirebirdDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new FirebirdDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(3050, nativeMeta.getDefaultDatabasePort()); - - assertEquals("&", nativeMeta.getExtraOptionSeparator()); - assertEquals("?", nativeMeta.getExtraOptionIndicator()); - assertEquals("org.firebirdsql.jdbc.FBDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:firebirdsql://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:firebirdsql://FOO:/WIBBLE", - nativeMeta.getURL("FOO", "", "WIBBLE")); // This is a bug I believe - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertFalse(nativeMeta.isSupportsAutoInc()); - - assertArrayEquals( - new String[] { - "ABSOLUTE", - "ACTION", - "ACTIVE", - "ADD", - "ADMIN", - "AFTER", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "AS", - "ASC", - "ASCENDING", - "ASSERTION", - "AT", - "AUTHORIZATION", - "AUTO", - "AUTODDL", - "AVG", - "BASED", - "BASENAME", - "BASE_NAME", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIT", - "BIT_LENGTH", - "BLOB", - "BLOBEDIT", - "BOTH", - "BUFFER", - "BY", - "CACHE", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CHAR", - "CHARACTER", - "CHAR_LENGTH", - "CHARACTER_LENGTH", - "CHECK", - "CHECK_POINT_LEN", - "CHECK_POINT_LENGTH", - "CLOSE", - "COALESCE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "COMMITTED", - "COMPILETIME", - "COMPUTED", - "CONDITIONAL", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONTAINING", - "CONTINUE", - "CONVERT", - "CORRESPONDING", - "COUNT", - "CREATE", - "CROSS", - "CSTRING", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "DATABASE", - "DATE", - "DAY", - "DB_KEY", - "DEALLOCATE", - "DEBUG", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DESC", - "DESCENDING", - "DESCRIBE", - "DESCRIPTOR", - "DIAGNOSTICS", - "DISCONNECT", - "DISPLAY", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "ECHO", - "EDIT", - "ELSE", - "END", - "END-EXEC", - "ENTRY_POINT", - "ESCAPE", - "EVENT", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FILE", - "FILTER", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE_IT", - "FROM", - "FULL", - "FUNCTION", - "GDSCODE", - "GENERATOR", - "GEN_ID", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "GROUP_COMMIT_WAIT", - "GROUP_COMMIT_WAIT_TIME", - "HAVING", - "HELP", - "HOUR", - "IDENTITY", - "IF", - "IMMEDIATE", - "IN", - "INACTIVE", - "INDEX", - "INDICATOR", - "INIT", - "INITIALLY", - "INNER", - "INPUT", - "INPUT_TYPE", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOLATION", - "ISQL", - "JOIN", - "KEY", - "LANGUAGE", - "LAST", - "LC_MESSAGES", - "LC_TYPE", - "LEADING", - "LEFT", - "LENGTH", - "LEV", - "LEVEL", - "LIKE", - "LOCAL", - "LOGFILE", - "LOG_BUFFER_SIZE", - "LOG_BUF_SIZE", - "LONG", - "LOWER", - "MANUAL", - "MATCH", - "MAX", - "MAXIMUM", - "MAXIMUM_SEGMENT", - "MAX_SEGMENT", - "MERGE", - "MESSAGE", - "MIN", - "MINIMUM", - "MINUTE", - "MODULE", - "MODULE_NAME", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NEXT", - "NO", - "NOAUTO", - "NOT", - "NULL", - "NULLIF", - "NUM_LOG_BUFS", - "NUM_LOG_BUFFERS", - "NUMERIC", - "OCTET_LENGTH", - "OF", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OR", - "ORDER", - "OUTER", - "OUTPUT", - "OUTPUT_TYPE", - "OVERFLOW", - "OVERLAPS", - "PAD", - "PAGE", - "PAGELENGTH", - "PAGES", - "PAGE_SIZE", - "PARAMETER", - "PARTIAL", - "PASSWORD", - "PLAN", - "POSITION", - "POST_EVENT", - "PRECISION", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "PUBLIC", - "QUIT", - "RAW_PARTITIONS", - "RDB$DB_KEY", - "READ", - "REAL", - "RECORD_VERSION", - "REFERENCES", - "RELATIVE", - "RELEASE", - "RESERV", - "RESERVING", - "RESTRICT", - "RETAIN", - "RETURN", - "RETURNING_VALUES", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROWS", - "RUNTIME", - "SCHEMA", - "SCROLL", - "SECOND", - "SECTION", - "SELECT", - "SESSION", - "SESSION_USER", - "SET", - "SHADOW", - "SHARED", - "SHELL", - "SHOW", - "SINGULAR", - "SIZE", - "SMALLINT", - "SNAPSHOT", - "SOME", - "SORT", - "SPACE", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLSTATE", - "SQLWARNING", - "STABILITY", - "STARTING", - "STARTS", - "STATEMENT", - "STATIC", - "STATISTICS", - "SUB_TYPE", - "SUBSTRING", - "SUM", - "SUSPEND", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TERMINATOR", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATE", - "TRANSLATION", - "TRIGGER", - "TRIM", - "TRUE", - "TYPE", - "UNCOMMITTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UPDATE", - "UPPER", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VERSION", - "VIEW", - "WAIT", - "WEEKDAY", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WITH", - "WORK", - "WRITE", - "YEAR", - "YEARDAY", - "ZONE", - "ABSOLUTE", - "ACTION", - "ACTIVE", - "ADD", - "ADMIN", - "AFTER", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "AS", - "ASC", - "ASCENDING", - "ASSERTION", - "AT", - "AUTHORIZATION", - "AUTO", - "AUTODDL", - "AVG", - "BASED", - "BASENAME", - "BASE_NAME", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIT", - "BIT_LENGTH", - "BLOB", - "BLOBEDIT", - "BOTH", - "BUFFER", - "BY", - "CACHE", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CHAR", - "CHARACTER", - "CHAR_LENGTH", - "CHARACTER_LENGTH", - "CHECK", - "CHECK_POINT_LEN", - "CHECK_POINT_LENGTH", - "CLOSE", - "COALESCE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "COMMITTED", - "COMPILETIME", - "COMPUTED", - "CONDITIONAL", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONTAINING", - "CONTINUE", - "CONVERT", - "CORRESPONDING", - "COUNT", - "CREATE", - "CROSS", - "CSTRING", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "DATABASE", - "DATE", - "DAY", - "DB_KEY", - "DEALLOCATE", - "DEBUG", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DESC", - "DESCENDING", - "DESCRIBE", - "DESCRIPTOR", - "DIAGNOSTICS", - "DISCONNECT", - "DISPLAY", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "ECHO", - "EDIT", - "ELSE", - "END", - "END-EXEC", - "ENTRY_POINT", - "ESCAPE", - "EVENT", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FILE", - "FILTER", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE_IT", - "FROM", - "FULL", - "FUNCTION", - "GDSCODE", - "GENERATOR", - "GEN_ID", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "GROUP_COMMIT_WAIT", - "GROUP_COMMIT_WAIT_TIME", - "HAVING", - "HELP", - "HOUR", - "IDENTITY", - "IF", - "IMMEDIATE", - "IN", - "INACTIVE", - "INDEX", - "INDICATOR", - "INIT", - "INITIALLY", - "INNER", - "INPUT", - "INPUT_TYPE", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOLATION", - "ISQL", - "JOIN", - "KEY", - "LANGUAGE", - "LAST", - "LC_MESSAGES", - "LC_TYPE", - "LEADING", - "LEFT", - "LENGTH", - "LEV", - "LEVEL", - "LIKE", - "LOCAL", - "LOGFILE", - "LOG_BUFFER_SIZE", - "LOG_BUF_SIZE", - "LONG", - "LOWER", - "MANUAL", - "MATCH", - "MAX", - "MAXIMUM", - "MAXIMUM_SEGMENT", - "MAX_SEGMENT", - "MERGE", - "MESSAGE", - "MIN", - "MINIMUM", - "MINUTE", - "MODULE", - "MODULE_NAME", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NEXT", - "NO", - "NOAUTO", - "NOT", - "NULL", - "NULLIF", - "NUM_LOG_BUFS", - "NUM_LOG_BUFFERS", - "NUMERIC", - "OCTET_LENGTH", - "OF", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OR", - "ORDER", - "OUTER", - "OUTPUT", - "OUTPUT_TYPE", - "OVERFLOW", - "OVERLAPS", - "PAD", - "PAGE", - "PAGELENGTH", - "PAGES", - "PAGE_SIZE", - "PARAMETER", - "PARTIAL", - "PASSWORD", - "PLAN", - "POSITION", - "POST_EVENT", - "PRECISION", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "PUBLIC", - "QUIT", - "RAW_PARTITIONS", - "RDB$DB_KEY", - "READ", - "REAL", - "RECORD_VERSION", - "REFERENCES", - "RELATIVE", - "RELEASE", - "RESERV", - "RESERVING", - "RESTRICT", - "RETAIN", - "RETURN", - "RETURNING_VALUES", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROWS", - "RUNTIME", - "SCHEMA", - "SCROLL", - "SECOND", - "SECTION", - "SELECT", - "SESSION", - "SESSION_USER", - "SET", - "SHADOW", - "SHARED", - "SHELL", - "SHOW", - "SINGULAR", - "SIZE", - "SMALLINT", - "SNAPSHOT", - "SOME", - "SORT", - "SPACE", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLSTATE", - "SQLWARNING", - "STABILITY", - "STARTING", - "STARTS", - "STATEMENT", - "STATIC", - "STATISTICS", - "SUB_TYPE", - "SUBSTRING", - "SUM", - "SUSPEND", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TERMINATOR", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATE", - "TRANSLATION", - "TRIGGER", - "TRIM", - "TRUE", - "TYPE", - "UNCOMMITTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UPDATE", - "UPPER", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VERSION", - "VIEW", - "WAIT", - "WEEKDAY", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WITH", - "WORK", - "WRITE", - "YEAR", - "YEARDAY", - "ZONE" - }, - nativeMeta.getReservedWords()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR TYPE TIMESTAMP", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, true, false)); - - assertEquals( - "\"SELECT\"VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("SELECT", 15, 0), - "", - "", - false, - true, - false)); // Missing variables between quote is a bug - - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "BIGINT NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); - assertEquals( - "BIGINT NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); - - assertEquals( - "DECIMAL(20)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 20, 0), "", "", false, false, false)); - assertEquals( - "DECIMAL(7, 4)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 7, 4), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 7, 0), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 8, 0), "", "", false, false, false)); - - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 4, 0), "", "", false, false, false)); - - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 1, 0), "", "", false, false, false)); - - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); - - assertEquals( - "DOUBLE", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", -7, 33), "", "", false, false, false)); - - assertEquals( - "VARCHAR(8000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(50)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 50, 0), "", "", false, false, false)); - - assertEquals( - "BLOB SUB_TYPE TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32721, 0), "", "", false, false, false)); - - assertEquals( - "BLOB", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 32721, 0), "", "", false, false, false)); - - assertEquals( - "UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - "UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.firebird; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class FirebirdDatabaseMetaTest { + + private FirebirdDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new FirebirdDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(3050, nativeMeta.getDefaultDatabasePort()); + + assertEquals("&", nativeMeta.getExtraOptionSeparator()); + assertEquals("?", nativeMeta.getExtraOptionIndicator()); + assertEquals("org.firebirdsql.jdbc.FBDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:firebirdsql://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:firebirdsql://FOO:/WIBBLE", + nativeMeta.getURL("FOO", "", "WIBBLE")); // This is a bug I believe + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertFalse(nativeMeta.isSupportsAutoInc()); + + assertArrayEquals( + new String[] { + "ABSOLUTE", + "ACTION", + "ACTIVE", + "ADD", + "ADMIN", + "AFTER", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "AS", + "ASC", + "ASCENDING", + "ASSERTION", + "AT", + "AUTHORIZATION", + "AUTO", + "AUTODDL", + "AVG", + "BASED", + "BASENAME", + "BASE_NAME", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIT", + "BIT_LENGTH", + "BLOB", + "BLOBEDIT", + "BOTH", + "BUFFER", + "BY", + "CACHE", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CHAR", + "CHARACTER", + "CHAR_LENGTH", + "CHARACTER_LENGTH", + "CHECK", + "CHECK_POINT_LEN", + "CHECK_POINT_LENGTH", + "CLOSE", + "COALESCE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "COMMITTED", + "COMPILETIME", + "COMPUTED", + "CONDITIONAL", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONTAINING", + "CONTINUE", + "CONVERT", + "CORRESPONDING", + "COUNT", + "CREATE", + "CROSS", + "CSTRING", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "DATABASE", + "DATE", + "DAY", + "DB_KEY", + "DEALLOCATE", + "DEBUG", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DESC", + "DESCENDING", + "DESCRIBE", + "DESCRIPTOR", + "DIAGNOSTICS", + "DISCONNECT", + "DISPLAY", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "ECHO", + "EDIT", + "ELSE", + "END", + "END-EXEC", + "ENTRY_POINT", + "ESCAPE", + "EVENT", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FILE", + "FILTER", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE_IT", + "FROM", + "FULL", + "FUNCTION", + "GDSCODE", + "GENERATOR", + "GEN_ID", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "GROUP_COMMIT_WAIT", + "GROUP_COMMIT_WAIT_TIME", + "HAVING", + "HELP", + "HOUR", + "IDENTITY", + "IF", + "IMMEDIATE", + "IN", + "INACTIVE", + "INDEX", + "INDICATOR", + "INIT", + "INITIALLY", + "INNER", + "INPUT", + "INPUT_TYPE", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOLATION", + "ISQL", + "JOIN", + "KEY", + "LANGUAGE", + "LAST", + "LC_MESSAGES", + "LC_TYPE", + "LEADING", + "LEFT", + "LENGTH", + "LEV", + "LEVEL", + "LIKE", + "LOCAL", + "LOGFILE", + "LOG_BUFFER_SIZE", + "LOG_BUF_SIZE", + "LONG", + "LOWER", + "MANUAL", + "MATCH", + "MAX", + "MAXIMUM", + "MAXIMUM_SEGMENT", + "MAX_SEGMENT", + "MERGE", + "MESSAGE", + "MIN", + "MINIMUM", + "MINUTE", + "MODULE", + "MODULE_NAME", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NEXT", + "NO", + "NOAUTO", + "NOT", + "NULL", + "NULLIF", + "NUM_LOG_BUFS", + "NUM_LOG_BUFFERS", + "NUMERIC", + "OCTET_LENGTH", + "OF", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OR", + "ORDER", + "OUTER", + "OUTPUT", + "OUTPUT_TYPE", + "OVERFLOW", + "OVERLAPS", + "PAD", + "PAGE", + "PAGELENGTH", + "PAGES", + "PAGE_SIZE", + "PARAMETER", + "PARTIAL", + "PASSWORD", + "PLAN", + "POSITION", + "POST_EVENT", + "PRECISION", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "PUBLIC", + "QUIT", + "RAW_PARTITIONS", + "RDB$DB_KEY", + "READ", + "REAL", + "RECORD_VERSION", + "REFERENCES", + "RELATIVE", + "RELEASE", + "RESERV", + "RESERVING", + "RESTRICT", + "RETAIN", + "RETURN", + "RETURNING_VALUES", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROWS", + "RUNTIME", + "SCHEMA", + "SCROLL", + "SECOND", + "SECTION", + "SELECT", + "SESSION", + "SESSION_USER", + "SET", + "SHADOW", + "SHARED", + "SHELL", + "SHOW", + "SINGULAR", + "SIZE", + "SMALLINT", + "SNAPSHOT", + "SOME", + "SORT", + "SPACE", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLSTATE", + "SQLWARNING", + "STABILITY", + "STARTING", + "STARTS", + "STATEMENT", + "STATIC", + "STATISTICS", + "SUB_TYPE", + "SUBSTRING", + "SUM", + "SUSPEND", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TERMINATOR", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATE", + "TRANSLATION", + "TRIGGER", + "TRIM", + "TRUE", + "TYPE", + "UNCOMMITTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UPDATE", + "UPPER", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VERSION", + "VIEW", + "WAIT", + "WEEKDAY", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WITH", + "WORK", + "WRITE", + "YEAR", + "YEARDAY", + "ZONE", + "ABSOLUTE", + "ACTION", + "ACTIVE", + "ADD", + "ADMIN", + "AFTER", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "AS", + "ASC", + "ASCENDING", + "ASSERTION", + "AT", + "AUTHORIZATION", + "AUTO", + "AUTODDL", + "AVG", + "BASED", + "BASENAME", + "BASE_NAME", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIT", + "BIT_LENGTH", + "BLOB", + "BLOBEDIT", + "BOTH", + "BUFFER", + "BY", + "CACHE", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CHAR", + "CHARACTER", + "CHAR_LENGTH", + "CHARACTER_LENGTH", + "CHECK", + "CHECK_POINT_LEN", + "CHECK_POINT_LENGTH", + "CLOSE", + "COALESCE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "COMMITTED", + "COMPILETIME", + "COMPUTED", + "CONDITIONAL", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONTAINING", + "CONTINUE", + "CONVERT", + "CORRESPONDING", + "COUNT", + "CREATE", + "CROSS", + "CSTRING", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "DATABASE", + "DATE", + "DAY", + "DB_KEY", + "DEALLOCATE", + "DEBUG", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DESC", + "DESCENDING", + "DESCRIBE", + "DESCRIPTOR", + "DIAGNOSTICS", + "DISCONNECT", + "DISPLAY", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "ECHO", + "EDIT", + "ELSE", + "END", + "END-EXEC", + "ENTRY_POINT", + "ESCAPE", + "EVENT", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FILE", + "FILTER", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE_IT", + "FROM", + "FULL", + "FUNCTION", + "GDSCODE", + "GENERATOR", + "GEN_ID", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "GROUP_COMMIT_WAIT", + "GROUP_COMMIT_WAIT_TIME", + "HAVING", + "HELP", + "HOUR", + "IDENTITY", + "IF", + "IMMEDIATE", + "IN", + "INACTIVE", + "INDEX", + "INDICATOR", + "INIT", + "INITIALLY", + "INNER", + "INPUT", + "INPUT_TYPE", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOLATION", + "ISQL", + "JOIN", + "KEY", + "LANGUAGE", + "LAST", + "LC_MESSAGES", + "LC_TYPE", + "LEADING", + "LEFT", + "LENGTH", + "LEV", + "LEVEL", + "LIKE", + "LOCAL", + "LOGFILE", + "LOG_BUFFER_SIZE", + "LOG_BUF_SIZE", + "LONG", + "LOWER", + "MANUAL", + "MATCH", + "MAX", + "MAXIMUM", + "MAXIMUM_SEGMENT", + "MAX_SEGMENT", + "MERGE", + "MESSAGE", + "MIN", + "MINIMUM", + "MINUTE", + "MODULE", + "MODULE_NAME", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NEXT", + "NO", + "NOAUTO", + "NOT", + "NULL", + "NULLIF", + "NUM_LOG_BUFS", + "NUM_LOG_BUFFERS", + "NUMERIC", + "OCTET_LENGTH", + "OF", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OR", + "ORDER", + "OUTER", + "OUTPUT", + "OUTPUT_TYPE", + "OVERFLOW", + "OVERLAPS", + "PAD", + "PAGE", + "PAGELENGTH", + "PAGES", + "PAGE_SIZE", + "PARAMETER", + "PARTIAL", + "PASSWORD", + "PLAN", + "POSITION", + "POST_EVENT", + "PRECISION", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "PUBLIC", + "QUIT", + "RAW_PARTITIONS", + "RDB$DB_KEY", + "READ", + "REAL", + "RECORD_VERSION", + "REFERENCES", + "RELATIVE", + "RELEASE", + "RESERV", + "RESERVING", + "RESTRICT", + "RETAIN", + "RETURN", + "RETURNING_VALUES", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROWS", + "RUNTIME", + "SCHEMA", + "SCROLL", + "SECOND", + "SECTION", + "SELECT", + "SESSION", + "SESSION_USER", + "SET", + "SHADOW", + "SHARED", + "SHELL", + "SHOW", + "SINGULAR", + "SIZE", + "SMALLINT", + "SNAPSHOT", + "SOME", + "SORT", + "SPACE", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLSTATE", + "SQLWARNING", + "STABILITY", + "STARTING", + "STARTS", + "STATEMENT", + "STATIC", + "STATISTICS", + "SUB_TYPE", + "SUBSTRING", + "SUM", + "SUSPEND", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TERMINATOR", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATE", + "TRANSLATION", + "TRIGGER", + "TRIM", + "TRUE", + "TYPE", + "UNCOMMITTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UPDATE", + "UPPER", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VERSION", + "VIEW", + "WAIT", + "WEEKDAY", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WITH", + "WORK", + "WRITE", + "YEAR", + "YEARDAY", + "ZONE" + }, + nativeMeta.getReservedWords()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR TYPE TIMESTAMP", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, true, false)); + + assertEquals( + "\"SELECT\"VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("SELECT", 15, 0), + "", + "", + false, + true, + false)); // Missing variables between quote is a bug + + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "BIGINT NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); + assertEquals( + "BIGINT NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); + + assertEquals( + "DECIMAL(20)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 20, 0), "", "", false, false, false)); + assertEquals( + "DECIMAL(7, 4)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 7, 4), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 7, 0), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 8, 0), "", "", false, false, false)); + + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 4, 0), "", "", false, false, false)); + + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 1, 0), "", "", false, false, false)); + + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); + + assertEquals( + "DOUBLE", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", -7, 33), "", "", false, false, false)); + + assertEquals( + "VARCHAR(8000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(50)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 50, 0), "", "", false, false, false)); + + assertEquals( + "BLOB SUB_TYPE TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32721, 0), "", "", false, false, false)); + + assertEquals( + "BLOB", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 32721, 0), "", "", false, false, false)); + + assertEquals( + "UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + "UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdSequenceAndReleaseSavePointTest.java b/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdSequenceAndReleaseSavePointTest.java index 54d5d065ed0..f30f7e98de2 100644 --- a/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/firebird/src/test/java/org/apache/hop/databases/firebird/FirebirdSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.firebird; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class FirebirdSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/generic/src/main/java/org/apache/hop/databases/generic/GenericDatabaseMeta.java b/plugins/databases/generic/src/main/java/org/apache/hop/databases/generic/GenericDatabaseMeta.java index 611fc6e3eef..af49032c345 100644 --- a/plugins/databases/generic/src/main/java/org/apache/hop/databases/generic/GenericDatabaseMeta.java +++ b/plugins/databases/generic/src/main/java/org/apache/hop/databases/generic/GenericDatabaseMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.databases.generic; +import java.sql.SQLException; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.DatabaseMeta; @@ -28,13 +30,11 @@ import org.apache.hop.core.gui.plugin.GuiWidgetElement; import org.apache.hop.core.row.IValueMeta; -import java.sql.SQLException; -import java.util.Map; - -/** - * Contains Generic Database Connection information through static final members - */ -@DatabaseMetaPlugin(type = "GENERIC", typeDescription = "Generic database", documentationUrl = "/database/databases.html") +/** Contains Generic Database Connection information through static final members */ +@DatabaseMetaPlugin( + type = "GENERIC", + typeDescription = "Generic database", + documentationUrl = "/database/databases.html") @GuiPlugin(description = "Generic database GUI Plugin") public class GenericDatabaseMeta extends BaseDatabaseMeta implements IDatabase { public static final String ATRRIBUTE_CUSTOM_DRIVER_CLASS = "CUSTOM_DRIVER_CLASS"; @@ -71,7 +71,9 @@ public class GenericDatabaseMeta extends BaseDatabaseMeta implements IDatabase { parentId = DatabaseMeta.GUI_PLUGIN_ELEMENT_PARENT_ID) protected String driverClass; - /** @param driverClass The driverClass to set */ + /** + * @param driverClass The driverClass to set + */ public void setDriverClass(String driverClass) { getAttributes().put(ATRRIBUTE_CUSTOM_DRIVER_CLASS, driverClass); } @@ -94,7 +96,9 @@ public int[] getAccessTypeList() { return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoIncrement) { if (isSupportsAutoInc() && useAutoIncrement) { @@ -118,7 +122,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; diff --git a/plugins/databases/generic/src/test/java/org/apache/hop/databases/generic/GenericDatabaseMetaTest.java b/plugins/databases/generic/src/test/java/org/apache/hop/databases/generic/GenericDatabaseMetaTest.java index d70a2ee460a..7e1cb571081 100644 --- a/plugins/databases/generic/src/test/java/org/apache/hop/databases/generic/GenericDatabaseMetaTest.java +++ b/plugins/databases/generic/src/test/java/org/apache/hop/databases/generic/GenericDatabaseMetaTest.java @@ -1,266 +1,265 @@ -/* - * 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 org.apache.hop.databases.generic; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -@RunWith(PowerMockRunner.class) -public class GenericDatabaseMetaTest { - GenericDatabaseMeta nativeMeta; - - @Mock GenericDatabaseMeta mockedMeta; - - @Before - public void setupBefore() { - nativeMeta = new GenericDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - Map attrs = new HashMap<>(); - attrs.put(GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS, "foo.bar.wibble"); - nativeMeta.setManualUrl("jdbc:foo:bar://foodb"); - nativeMeta.setAttributes(attrs); - assertEquals("foo.bar.wibble", nativeMeta.getDriverClass()); - assertEquals("jdbc:foo:bar://foodb", nativeMeta.getURL("NOT", "GOINGTO", "BEUSED")); - assertFalse(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); - } - - @Test - public void testSqlStatements() { - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals("SELECT * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT 1 FROM FOO", nativeMeta.getSqlTableExists("FOO")); - - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR CHAR(1)", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE PRECISION", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR INTEGER", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR NUMERIC(10, 3)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR NUMERIC(10, 3)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR NUMERIC(21, 4)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR TEXT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaNumber("BAR", 10, -7), - "", - false, - "", - false)); // Bug here - invalid SQL - - assertEquals( - "ALTER TABLE FOO ADD BAR NUMERIC(22, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE PRECISION", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR NUMERIC(5, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR UNKNOWN", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGSERIAL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGSERIAL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR()", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR"), "", false, "", true)); // I think this is a bug .. - - assertEquals( - "ALTER TABLE FOO ADD BAR SMALLINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGSERIAL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR NUMERIC(22, 0)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(1)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 1, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR TEXT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 16777250, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR UNKNOWN", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBinary("BAR", 16777250, 0), "", false, "", false)); - - assertEquals( - "insert into FOO(FOOVERSION) values (1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } - - @Test - @PrepareForTest(DatabaseMeta.class) - public void testSettingDialect() { - String dialect = "testDialect"; - IDatabase[] dbInterfaces = new IDatabase[] {mockedMeta}; - PowerMockito.mockStatic(DatabaseMeta.class); - PowerMockito.when(DatabaseMeta.getDatabaseInterfaces()).thenReturn(dbInterfaces); - Mockito.when(mockedMeta.getPluginName()).thenReturn(dialect); - nativeMeta.addAttribute("DATABASE_DIALECT_ID", dialect); - assertEquals(mockedMeta, Whitebox.getInternalState(nativeMeta, "databaseDialect")); - } - - @Test - public void testSequence() { - final String sequenceName = "sequence_name"; - - IDatabase iDatabase = new GenericDatabaseMeta(); - assertEquals("", iDatabase.getSqlNextSequenceValue(sequenceName)); - assertEquals("", iDatabase.getSqlCurrentSequenceValue(sequenceName)); - } - - @Test - public void testReleaseSavepoint() { - assertTrue(nativeMeta.isReleaseSavepoint()); - } -} +/* + * 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 org.apache.hop.databases.generic; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.reflect.Whitebox; + +@RunWith(PowerMockRunner.class) +public class GenericDatabaseMetaTest { + GenericDatabaseMeta nativeMeta; + + @Mock GenericDatabaseMeta mockedMeta; + + @Before + public void setupBefore() { + nativeMeta = new GenericDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + Map attrs = new HashMap<>(); + attrs.put(GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS, "foo.bar.wibble"); + nativeMeta.setManualUrl("jdbc:foo:bar://foodb"); + nativeMeta.setAttributes(attrs); + assertEquals("foo.bar.wibble", nativeMeta.getDriverClass()); + assertEquals("jdbc:foo:bar://foodb", nativeMeta.getURL("NOT", "GOINGTO", "BEUSED")); + assertFalse(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); + } + + @Test + public void testSqlStatements() { + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals("SELECT * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT 1 FROM FOO", nativeMeta.getSqlTableExists("FOO")); + + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR CHAR(1)", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE PRECISION", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR INTEGER", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR NUMERIC(10, 3)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR NUMERIC(10, 3)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR NUMERIC(21, 4)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR TEXT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaNumber("BAR", 10, -7), + "", + false, + "", + false)); // Bug here - invalid SQL + + assertEquals( + "ALTER TABLE FOO ADD BAR NUMERIC(22, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE PRECISION", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR NUMERIC(5, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR UNKNOWN", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGSERIAL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGSERIAL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR()", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR"), "", false, "", true)); // I think this is a bug .. + + assertEquals( + "ALTER TABLE FOO ADD BAR SMALLINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGSERIAL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR NUMERIC(22, 0)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(1)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 1, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR TEXT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 16777250, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR UNKNOWN", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBinary("BAR", 16777250, 0), "", false, "", false)); + + assertEquals( + "insert into FOO(FOOVERSION) values (1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } + + @Test + @PrepareForTest(DatabaseMeta.class) + public void testSettingDialect() { + String dialect = "testDialect"; + IDatabase[] dbInterfaces = new IDatabase[] {mockedMeta}; + PowerMockito.mockStatic(DatabaseMeta.class); + PowerMockito.when(DatabaseMeta.getDatabaseInterfaces()).thenReturn(dbInterfaces); + Mockito.when(mockedMeta.getPluginName()).thenReturn(dialect); + nativeMeta.addAttribute("DATABASE_DIALECT_ID", dialect); + assertEquals(mockedMeta, Whitebox.getInternalState(nativeMeta, "databaseDialect")); + } + + @Test + public void testSequence() { + final String sequenceName = "sequence_name"; + + IDatabase iDatabase = new GenericDatabaseMeta(); + assertEquals("", iDatabase.getSqlNextSequenceValue(sequenceName)); + assertEquals("", iDatabase.getSqlCurrentSequenceValue(sequenceName)); + } + + @Test + public void testReleaseSavepoint() { + assertTrue(nativeMeta.isReleaseSavepoint()); + } +} diff --git a/plugins/databases/googlebigquery/src/main/java/org/apache/hop/databases/googlebigquery/GoogleBigQueryDatabaseMeta.java b/plugins/databases/googlebigquery/src/main/java/org/apache/hop/databases/googlebigquery/GoogleBigQueryDatabaseMeta.java index 542a720fc2f..b55d6e5a1d9 100644 --- a/plugins/databases/googlebigquery/src/main/java/org/apache/hop/databases/googlebigquery/GoogleBigQueryDatabaseMeta.java +++ b/plugins/databases/googlebigquery/src/main/java/org/apache/hop/databases/googlebigquery/GoogleBigQueryDatabaseMeta.java @@ -27,7 +27,10 @@ import org.apache.hop.core.util.StringUtil; import org.apache.hop.i18n.BaseMessages; -@DatabaseMetaPlugin(type = "GOOGLEBIGQUERY", typeDescription = "Google BigQuery", documentationUrl = "/database/databases/googlebigquery.html") +@DatabaseMetaPlugin( + type = "GOOGLEBIGQUERY", + typeDescription = "Google BigQuery", + documentationUrl = "/database/databases/googlebigquery.html") @GuiPlugin(id = "GUI-GoogleBigQueryDatabaseMeta") public class GoogleBigQueryDatabaseMeta extends BaseDatabaseMeta implements IDatabase { diff --git a/plugins/databases/googlebigquery/src/test/java/org/apache/hop/databases/googlebigquery/GoogleBigQuerySequenceAndReleaseSavePointTest.java b/plugins/databases/googlebigquery/src/test/java/org/apache/hop/databases/googlebigquery/GoogleBigQuerySequenceAndReleaseSavePointTest.java index f43a199135c..d1592bda9a9 100644 --- a/plugins/databases/googlebigquery/src/test/java/org/apache/hop/databases/googlebigquery/GoogleBigQuerySequenceAndReleaseSavePointTest.java +++ b/plugins/databases/googlebigquery/src/test/java/org/apache/hop/databases/googlebigquery/GoogleBigQuerySequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.googlebigquery; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class GoogleBigQuerySequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/greenplum/src/main/java/org/apache/hop/databases/greenplum/GreenplumDatabaseMeta.java b/plugins/databases/greenplum/src/main/java/org/apache/hop/databases/greenplum/GreenplumDatabaseMeta.java index 361448f8943..bb1b5e2c023 100644 --- a/plugins/databases/greenplum/src/main/java/org/apache/hop/databases/greenplum/GreenplumDatabaseMeta.java +++ b/plugins/databases/greenplum/src/main/java/org/apache/hop/databases/greenplum/GreenplumDatabaseMeta.java @@ -22,10 +22,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; -/** - * Contains PostgreSQL specific information through static final members - */ -@DatabaseMetaPlugin(type = "GREENPLUM", typeDescription = "Greenplum", documentationUrl = "/database/databases/greenplum.html") +/** Contains PostgreSQL specific information through static final members */ +@DatabaseMetaPlugin( + type = "GREENPLUM", + typeDescription = "Greenplum", + documentationUrl = "/database/databases/greenplum.html") @GuiPlugin(id = "GUI-GreenplumDatabaseMeta") public class GreenplumDatabaseMeta extends PostgreSqlDatabaseMeta implements IDatabase { @Override diff --git a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreenplumValueMetaBaseTest.java b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreenplumValueMetaBaseTest.java index 55f15c8f402..e49498d957f 100644 --- a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreenplumValueMetaBaseTest.java +++ b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreenplumValueMetaBaseTest.java @@ -17,6 +17,18 @@ package org.apache.hop.databases.greenplum; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.DatabasePluginType; import org.apache.hop.core.exception.HopDatabaseException; @@ -38,19 +50,6 @@ import org.junit.Test; import org.mockito.Spy; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - public class GreenplumValueMetaBaseTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreeplumDatabaseMetaTest.java b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreeplumDatabaseMetaTest.java index 5a645219807..79e729851eb 100644 --- a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreeplumDatabaseMetaTest.java +++ b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/GreeplumDatabaseMetaTest.java @@ -1,39 +1,39 @@ -/* - * 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 org.apache.hop.databases.greenplum; - -import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; -import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMetaTest; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class GreeplumDatabaseMetaTest extends PostgreSqlDatabaseMetaTest { - - @Test - public void testPostgresqlOverrides() throws Exception { - PostgreSqlDatabaseMeta meta1 = new PostgreSqlDatabaseMeta(); - GreenplumDatabaseMeta meta2 = new GreenplumDatabaseMeta(); - String[] meta1Reserved = meta1.getReservedWords(); - String[] meta2Reserved = meta2.getReservedWords(); - assertTrue((meta1Reserved.length + 1) == (meta2Reserved.length)); // adds ERRORS - assertEquals("ERRORS", meta2Reserved[meta2Reserved.length - 1]); - assertFalse(meta2.IsSupportsErrorHandlingOnBatchUpdates()); - } -} +/* + * 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 org.apache.hop.databases.greenplum; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; +import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMetaTest; +import org.junit.Test; + +public class GreeplumDatabaseMetaTest extends PostgreSqlDatabaseMetaTest { + + @Test + public void testPostgresqlOverrides() throws Exception { + PostgreSqlDatabaseMeta meta1 = new PostgreSqlDatabaseMeta(); + GreenplumDatabaseMeta meta2 = new GreenplumDatabaseMeta(); + String[] meta1Reserved = meta1.getReservedWords(); + String[] meta2Reserved = meta2.getReservedWords(); + assertTrue((meta1Reserved.length + 1) == (meta2Reserved.length)); // adds ERRORS + assertEquals("ERRORS", meta2Reserved[meta2Reserved.length - 1]); + assertFalse(meta2.IsSupportsErrorHandlingOnBatchUpdates()); + } +} diff --git a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/ReleaseSavePointTest.java b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/ReleaseSavePointTest.java index 0f0053df9aa..4b27b94213d 100644 --- a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/ReleaseSavePointTest.java +++ b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/ReleaseSavePointTest.java @@ -17,11 +17,11 @@ package org.apache.hop.databases.greenplum; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.junit.Test; -import static org.junit.Assert.assertTrue; - public class ReleaseSavePointTest { IDatabase[] support = diff --git a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/SequenceMetaTest.java b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/SequenceMetaTest.java index bd07a81266e..90e57c029af 100644 --- a/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/SequenceMetaTest.java +++ b/plugins/databases/greenplum/src/test/java/org/apache/hop/databases/greenplum/SequenceMetaTest.java @@ -17,14 +17,14 @@ package org.apache.hop.databases.greenplum; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.util.Utils; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.util.Utils; +import org.junit.Test; + public class SequenceMetaTest { @Test diff --git a/plugins/databases/h2/src/main/java/org/apache/hop/databases/h2/H2DatabaseMeta.java b/plugins/databases/h2/src/main/java/org/apache/hop/databases/h2/H2DatabaseMeta.java index ee679ffe315..a0671e1fb28 100644 --- a/plugins/databases/h2/src/main/java/org/apache/hop/databases/h2/H2DatabaseMeta.java +++ b/plugins/databases/h2/src/main/java/org/apache/hop/databases/h2/H2DatabaseMeta.java @@ -26,10 +26,11 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; -/** - * Contains H2 specific information through static final members - */ -@DatabaseMetaPlugin(type = "H2", typeDescription = "H2", documentationUrl = "/database/databases/h2.html") +/** Contains H2 specific information through static final members */ +@DatabaseMetaPlugin( + type = "H2", + typeDescription = "H2", + documentationUrl = "/database/databases/h2.html") @GuiPlugin(id = "GUI-H2DatabaseMeta") public class H2DatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -37,7 +38,9 @@ public int[] getAccessTypeList() { return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { return super.getNotFoundTK(useAutoinc); @@ -80,7 +83,9 @@ public boolean isFetchSizeSupported() { return true; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; diff --git a/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2BaseDatabaseMetaTest.java b/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2BaseDatabaseMetaTest.java index 1db509aeb27..5546b2f4244 100644 --- a/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2BaseDatabaseMetaTest.java +++ b/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2BaseDatabaseMetaTest.java @@ -16,6 +16,9 @@ */ package org.apache.hop.databases.h2; +import static org.junit.Assert.assertTrue; + +import java.util.List; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.SqlScriptStatement; @@ -24,10 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertTrue; - public class H2BaseDatabaseMetaTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); BaseDatabaseMeta nativeMeta; diff --git a/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2DatabaseMetaTest.java b/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2DatabaseMetaTest.java index cc464cd48f9..8a727143476 100644 --- a/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2DatabaseMetaTest.java +++ b/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2DatabaseMetaTest.java @@ -1,282 +1,282 @@ -/* - * 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 org.apache.hop.databases.h2; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class H2DatabaseMetaTest { - H2DatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new H2DatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertEquals(8082, nativeMeta.getDefaultDatabasePort()); - assertEquals("org.h2.Driver", nativeMeta.getDriverClass()); - - assertEquals("jdbc:h2:WIBBLE", nativeMeta.getURL("", "", "WIBBLE")); - assertEquals("jdbc:h2:tcp://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - - assertEquals("jdbc:h2:WIBBLE", nativeMeta.getURL("", "-1", "WIBBLE")); - assertEquals("jdbc:h2:mem:WIBBLE", nativeMeta.getURL("", "", "mem:WIBBLE")); - - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - - assertArrayEquals( - new String[] { - "CURRENT_TIMESTAMP", - "CURRENT_TIME", - "CURRENT_DATE", - "CROSS", - "DISTINCT", - "EXCEPT", - "EXISTS", - "FROM", - "FOR", - "FALSE", - "FULL", - "GROUP", - "HAVING", - "INNER", - "INTERSECT", - "IS", - "JOIN", - "LIKE", - "MINUS", - "NATURAL", - "NOT", - "NULL", - "ON", - "ORDER", - "PRIMARY", - "ROWNUM", - "SELECT", - "SYSDATE", - "SYSTIME", - "SYSTIMESTAMP", - "TODAY", - "TRUE", - "UNION", - "WHERE" - }, - nativeMeta.getReservedWords()); - - assertTrue(nativeMeta.isFetchSizeSupported()); - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertTrue(nativeMeta.isSupportsGetBlob()); - assertFalse(nativeMeta.isSupportsSetCharacterStream()); - assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); - } - - @Test - public void testSqlStatements() { - assertEquals("TRUNCATE TABLE FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals("SELECT * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT 1 FROM FOO", nativeMeta.getSqlTableExists("FOO")); - - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR TIMESTAMP", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR CHAR(1)", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR INTEGER", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(10, 3)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(10, 3)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(21, 4)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR TEXT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaNumber("BAR", 10, -7), - "", - false, - "", - false)); // Bug here - invalid SQL - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(22, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(5, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR UNKNOWN", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR IDENTITY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR IDENTITY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR IDENTITY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 26, 8), "", true, "BAR", false)); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ALTER BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ALTER BAR VARCHAR(2147483647)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR"), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ADD BAR SMALLINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR TINYINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 2, 0), "", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR IDENTITY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(22, 0)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(1)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 1, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR TEXT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 16777250, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR BLOB", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBinary("BAR", 16777250, 0), "", false, "", false)); - - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } -} +/* + * 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 org.apache.hop.databases.h2; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class H2DatabaseMetaTest { + H2DatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new H2DatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertEquals(8082, nativeMeta.getDefaultDatabasePort()); + assertEquals("org.h2.Driver", nativeMeta.getDriverClass()); + + assertEquals("jdbc:h2:WIBBLE", nativeMeta.getURL("", "", "WIBBLE")); + assertEquals("jdbc:h2:tcp://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + + assertEquals("jdbc:h2:WIBBLE", nativeMeta.getURL("", "-1", "WIBBLE")); + assertEquals("jdbc:h2:mem:WIBBLE", nativeMeta.getURL("", "", "mem:WIBBLE")); + + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + + assertArrayEquals( + new String[] { + "CURRENT_TIMESTAMP", + "CURRENT_TIME", + "CURRENT_DATE", + "CROSS", + "DISTINCT", + "EXCEPT", + "EXISTS", + "FROM", + "FOR", + "FALSE", + "FULL", + "GROUP", + "HAVING", + "INNER", + "INTERSECT", + "IS", + "JOIN", + "LIKE", + "MINUS", + "NATURAL", + "NOT", + "NULL", + "ON", + "ORDER", + "PRIMARY", + "ROWNUM", + "SELECT", + "SYSDATE", + "SYSTIME", + "SYSTIMESTAMP", + "TODAY", + "TRUE", + "UNION", + "WHERE" + }, + nativeMeta.getReservedWords()); + + assertTrue(nativeMeta.isFetchSizeSupported()); + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertTrue(nativeMeta.isSupportsGetBlob()); + assertFalse(nativeMeta.isSupportsSetCharacterStream()); + assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); + } + + @Test + public void testSqlStatements() { + assertEquals("TRUNCATE TABLE FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals("SELECT * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT 1 FROM FOO", nativeMeta.getSqlTableExists("FOO")); + + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR TIMESTAMP", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR CHAR(1)", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR INTEGER", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(10, 3)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(10, 3)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(21, 4)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR TEXT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaNumber("BAR", 10, -7), + "", + false, + "", + false)); // Bug here - invalid SQL + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(22, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(5, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR UNKNOWN", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR IDENTITY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR IDENTITY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR IDENTITY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 26, 8), "", true, "BAR", false)); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ALTER BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ALTER BAR VARCHAR(2147483647)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR"), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ADD BAR SMALLINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR TINYINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 2, 0), "", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR IDENTITY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(22, 0)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(1)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 1, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR TEXT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 16777250, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR BLOB", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBinary("BAR", 16777250, 0), "", false, "", false)); + + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } +} diff --git a/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2SequenceAndReleaseSavePointTest.java b/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2SequenceAndReleaseSavePointTest.java index 6d1fe0554ed..03e5ad61183 100644 --- a/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2SequenceAndReleaseSavePointTest.java +++ b/plugins/databases/h2/src/test/java/org/apache/hop/databases/h2/H2SequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.h2; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class H2SequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/hive/src/main/java/org/apache/hop/databases/hive/HiveDatabaseMeta.java b/plugins/databases/hive/src/main/java/org/apache/hop/databases/hive/HiveDatabaseMeta.java index e9340a86506..55e2632ee0e 100644 --- a/plugins/databases/hive/src/main/java/org/apache/hop/databases/hive/HiveDatabaseMeta.java +++ b/plugins/databases/hive/src/main/java/org/apache/hop/databases/hive/HiveDatabaseMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.databases.hive; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; @@ -30,9 +32,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.ArrayList; -import java.util.List; - /** Contains MySQL specific information through static final members */ @DatabaseMetaPlugin( type = "HIVE", @@ -53,9 +52,8 @@ public class HiveDatabaseMeta extends BaseDatabaseMeta implements IDatabase { private String tablePartitions; /** - * We can generate the PARTITION clause here. - * We take the tablePartitions field and look for the table. - * In there we'll TABLE1(field1) which we'll turn into PARTITION(field1). + * We can generate the PARTITION clause here. We take the tablePartitions field and look for the + * table. In there we'll TABLE1(field1) which we'll turn into PARTITION(field1). * * @param schemaTable The schema-table name combination (Fully qualified table name) to generate * the clause for. @@ -73,7 +71,7 @@ public String getSqlInsertClauseBeforeFields(IVariables variables, String schema if (tablePart.startsWith(prefix)) { // This is the part we want: PARTITION(field) // - return "PARTITION"+tablePart.substring(prefix.length()-1); + return "PARTITION" + tablePart.substring(prefix.length() - 1); } } return null; diff --git a/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveDatabaseMetaTest.java b/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveDatabaseMetaTest.java index 0c6114a7bef..b7b2905b981 100644 --- a/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveDatabaseMetaTest.java +++ b/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveDatabaseMetaTest.java @@ -17,6 +17,21 @@ */ package org.apache.hop.databases.hive; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.DatabasePluginType; @@ -43,22 +58,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class HiveDatabaseMetaTest { HiveDatabaseMeta nativeMeta; @@ -86,7 +85,9 @@ public void testSettings() throws Exception { assertEquals(0, nativeMeta.getNotFoundTK(false)); assertEquals("org.apache.hive.jdbc.HiveDriver", nativeMeta.getDriverClass()); assertEquals("jdbc:hive2://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals("jdbc:hive2://FOO1:BAR1,FOO2:BAR2/WIBBLE", nativeMeta.getURL("FOO1,FOO2", "BAR1,BAR2", "WIBBLE")); + assertEquals( + "jdbc:hive2://FOO1:BAR1,FOO2:BAR2/WIBBLE", + nativeMeta.getURL("FOO1,FOO2", "BAR1,BAR2", "WIBBLE")); assertEquals("jdbc:hive2://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); assertEquals("&", nativeMeta.getExtraOptionSeparator()); assertEquals("?", nativeMeta.getExtraOptionIndicator()); @@ -96,141 +97,141 @@ public void testSettings() throws Exception { assertFalse(nativeMeta.isSupportsSynonyms()); assertArrayEquals( new String[] { - "ALL", - "ALTER", - "AND", - "ARRAY", - "AS", - "AUTHORIZATION", - "BETWEEN", - "BIGINT", - "BINARY", - "BOOLEAN", - "BOTH", - "BY", - "CACHE", - "CASE", - "CAST", - "CHAR", - "COLUMN", - "COMMIT", - "CONF", - "CONSTRAINT", - "CREATE", - "CROSS", - "CUBE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIMESTAMP", - "CURSOR", - "DATABASE", - "DATE", - "DAYOFWEEK", - "DECIMAL", - "DELETE", - "DESCRIBE", - "DISTINCT", - "DOUBLE", - "DROP", - "ELSE", - "END", - "EXCHANGE", - "EXISTS", - "EXTENDED", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FLOAT", - "FLOOR", - "FOLLOWING", - "FOR", - "FOREIGN", - "FROM", - "FULL", - "FUNCTION", - "GRANT", - "GROUP", - "GROUPING", - "HAVING", - "IF", - "IMPORT", - "IN", - "INNER", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "JOIN", - "LATERAL", - "LEFT", - "LESS", - "LIKE", - "LOCAL", - "MACRO", - "MAP", - "MORE", - "NONE", - "NOT", - "NULL", - "OF", - "ON", - "ONLY", - "OR", - "ORDER", - "OUT", - "OUTER", - "OVER", - "PARTIALSCAN", - "PARTITION", - "PERCENT", - "PRECEDING", - "PRECISION", - "PRESERVE", - "PRIMARY", - "PROCEDURE", - "RANGE", - "READS", - "REDUCE", - "REFERENCES", - "REGEXP", - "REVOKE", - "RIGHT", - "RLIKE", - "ROLLBACK", - "ROLLUP", - "ROW", - "ROWS", - "SELECT", - "SET", - "SMALLINT", - "START", - "TABLE", - "TABLESAMPLE", - "THEN", - "TIMESTAMP", - "TO", - "TRANSFORM", - "TRIGGER", - "TRUE", - "TRUNCATE", - "UNBOUNDED", - "UNION", - "UNIQUEJOIN", - "UPDATE", - "USER", - "USING", - "UTC_TMESTAMP", - "VALUES", - "VARCHAR", - "VIEWS", - "WHEN", - "WHERE", - "WINDOW", - "WITH", + "ALL", + "ALTER", + "AND", + "ARRAY", + "AS", + "AUTHORIZATION", + "BETWEEN", + "BIGINT", + "BINARY", + "BOOLEAN", + "BOTH", + "BY", + "CACHE", + "CASE", + "CAST", + "CHAR", + "COLUMN", + "COMMIT", + "CONF", + "CONSTRAINT", + "CREATE", + "CROSS", + "CUBE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIMESTAMP", + "CURSOR", + "DATABASE", + "DATE", + "DAYOFWEEK", + "DECIMAL", + "DELETE", + "DESCRIBE", + "DISTINCT", + "DOUBLE", + "DROP", + "ELSE", + "END", + "EXCHANGE", + "EXISTS", + "EXTENDED", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FLOAT", + "FLOOR", + "FOLLOWING", + "FOR", + "FOREIGN", + "FROM", + "FULL", + "FUNCTION", + "GRANT", + "GROUP", + "GROUPING", + "HAVING", + "IF", + "IMPORT", + "IN", + "INNER", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "JOIN", + "LATERAL", + "LEFT", + "LESS", + "LIKE", + "LOCAL", + "MACRO", + "MAP", + "MORE", + "NONE", + "NOT", + "NULL", + "OF", + "ON", + "ONLY", + "OR", + "ORDER", + "OUT", + "OUTER", + "OVER", + "PARTIALSCAN", + "PARTITION", + "PERCENT", + "PRECEDING", + "PRECISION", + "PRESERVE", + "PRIMARY", + "PROCEDURE", + "RANGE", + "READS", + "REDUCE", + "REFERENCES", + "REGEXP", + "REVOKE", + "RIGHT", + "RLIKE", + "ROLLBACK", + "ROLLUP", + "ROW", + "ROWS", + "SELECT", + "SET", + "SMALLINT", + "START", + "TABLE", + "TABLESAMPLE", + "THEN", + "TIMESTAMP", + "TO", + "TRANSFORM", + "TRIGGER", + "TRUE", + "TRUNCATE", + "UNBOUNDED", + "UNION", + "UNIQUEJOIN", + "UPDATE", + "USER", + "USING", + "UTC_TMESTAMP", + "VALUES", + "VARCHAR", + "VIEWS", + "WHEN", + "WHERE", + "WINDOW", + "WITH", }, nativeMeta.getReservedWords()); @@ -460,7 +461,6 @@ private ResultSetMetaData getResultSetMetaDataException() throws Exception { return resultSetMetaData; } - @Test public void testReleaseSavepoint() { assertFalse(nativeMeta.isReleaseSavepoint()); diff --git a/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveValueMetaBaseTest.java b/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveValueMetaBaseTest.java index b8b00e42beb..a7703eb280e 100644 --- a/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveValueMetaBaseTest.java +++ b/plugins/databases/hive/src/test/java/org/apache/hop/databases/hive/HiveValueMetaBaseTest.java @@ -18,6 +18,18 @@ package org.apache.hop.databases.hive; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Types; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.DatabasePluginType; @@ -39,19 +51,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Types; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class HiveValueMetaBaseTest { protected static final String TEST_NAME = "TEST_NAME"; protected static final String LOG_FIELD = "LOG_FIELD"; @@ -86,7 +85,7 @@ protected void initValueMeta(BaseDatabaseMeta dbMeta, int length, Object data) databaseMeta.setIDatabase(dbMeta); valueMetaString.setPreparedStatementValue(databaseMeta, preparedStatementMock, 0, data); } - + @Test public void testGetValueFromSqlTypeBinaryHive() throws Exception { @@ -118,5 +117,4 @@ public void testMetaDataPreviewSqlVarBinaryToHopBinaryUsingHiveVariant() assertTrue(valueMeta.isBinary()); assertEquals(-1, valueMeta.getLength()); } - } diff --git a/plugins/databases/hypersonic/src/main/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMeta.java b/plugins/databases/hypersonic/src/main/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMeta.java index 928fec14eda..ea48e6e5266 100644 --- a/plugins/databases/hypersonic/src/main/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMeta.java +++ b/plugins/databases/hypersonic/src/main/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMeta.java @@ -26,10 +26,11 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; -/** - * Contains Hypersonic specific information through static final members - */ -@DatabaseMetaPlugin(type = "HYPERSONIC", typeDescription = "Hypersonic", documentationUrl = "/database/databases/hypersonic.html" ) +/** Contains Hypersonic specific information through static final members */ +@DatabaseMetaPlugin( + type = "HYPERSONIC", + typeDescription = "Hypersonic", + documentationUrl = "/database/databases/hypersonic.html") @GuiPlugin(id = "GUI-HypersonicDatabaseMeta") public class HypersonicDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -61,7 +62,9 @@ public String getURL(String hostname, String port, String databaseName) { } } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; @@ -530,7 +533,9 @@ public String[] getReservedWords() { }; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return true; diff --git a/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMetaTest.java b/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMetaTest.java index 538ae0d6722..6db6dc8f248 100644 --- a/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMetaTest.java +++ b/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicDatabaseMetaTest.java @@ -17,6 +17,11 @@ package org.apache.hop.databases.hypersonic; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaBigNumber; @@ -30,11 +35,6 @@ import org.apache.hop.core.row.value.ValueMetaTimestamp; import org.junit.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - /** User: Dzmitry Stsiapanau Date: 1/14/14 Time: 5:08 PM */ public class HypersonicDatabaseMetaTest { private HypersonicDatabaseMeta hypersonicDatabaseMeta; diff --git a/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicSequenceAndReleaseSavePointTest.java b/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicSequenceAndReleaseSavePointTest.java index 6a85db8e6b3..a0eebe01145 100644 --- a/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/hypersonic/src/test/java/org/apache/hop/databases/hypersonic/HypersonicSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.hypersonic; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class HypersonicSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/infobright/src/main/java/org/apache/hop/databases/infobright/InfobrightDatabaseMeta.java b/plugins/databases/infobright/src/main/java/org/apache/hop/databases/infobright/InfobrightDatabaseMeta.java index 3dcc19dd736..e9e2d7af983 100644 --- a/plugins/databases/infobright/src/main/java/org/apache/hop/databases/infobright/InfobrightDatabaseMeta.java +++ b/plugins/databases/infobright/src/main/java/org/apache/hop/databases/infobright/InfobrightDatabaseMeta.java @@ -22,7 +22,10 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.databases.mysql.MySqlDatabaseMeta; -@DatabaseMetaPlugin(type = "INFOBRIGHT", typeDescription = "Infobright", documentationUrl = "/database/databases/infobright.html") +@DatabaseMetaPlugin( + type = "INFOBRIGHT", + typeDescription = "Infobright", + documentationUrl = "/database/databases/infobright.html") @GuiPlugin(id = "GUI-InfobrightDatabaseMeta") public class InfobrightDatabaseMeta extends MySqlDatabaseMeta { diff --git a/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightDatabaseMetaTest.java b/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightDatabaseMetaTest.java index 8c617bcc98f..93a73c9a408 100644 --- a/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightDatabaseMetaTest.java +++ b/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightDatabaseMetaTest.java @@ -1,92 +1,91 @@ -/* - * 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 org.apache.hop.databases.infobright; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class InfobrightDatabaseMetaTest { - - @Before - public void setup() throws HopException { - HopClientEnvironment.init(); - DatabasePluginType.getInstance().registerClassPathPlugin(InfobrightDatabaseMeta.class); - } - - @Test - public void mysqlTestOverrides() throws Exception { - InfobrightDatabaseMeta idm = new InfobrightDatabaseMeta(); - idm.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - assertEquals(5029, idm.getDefaultDatabasePort()); - } - - @Test - public void testAddOptionsInfobright() { - DatabaseMeta databaseMeta = - new DatabaseMeta("", "Infobright", "JDBC", null, "stub:stub", null, null, null); - Map options = databaseMeta.getExtraOptions(); - if (!options.keySet().contains("INFOBRIGHT.characterEncoding")) { - fail(); - } - } - - @Test - public void testAttributesVariable() throws HopDatabaseException { - IVariables variables = new Variables(); - DatabaseMeta databaseMeta = - new DatabaseMeta("", "Infobright", "JDBC", null, "stub:stub", null, null, null); - variables.setVariable("someVar", "someValue"); - databaseMeta.setAttributes(new HashMap<>()); - Map props = databaseMeta.getAttributes(); - props.put("EXTRA_OPTION_Infobright.additional_param", "${someVar}"); - databaseMeta.getURL(variables); - assertTrue(databaseMeta.getURL(variables).contains("someValue")); - } - - @Test - public void testfindDatabase() throws HopDatabaseException { - List databases = new ArrayList<>(); - databases.add( - new DatabaseMeta(" 1", "Infobright", "JDBC", null, "stub:stub", null, null, null)); - databases.add( - new DatabaseMeta(" 1 ", "Infobright", "JDBC", null, "stub:stub", null, null, null)); - databases.add( - new DatabaseMeta("1 ", "Infobright", "JDBC", null, "stub:stub", null, null, null)); - Assert.assertNotNull(DatabaseMeta.findDatabase(databases, "1")); - Assert.assertNotNull(DatabaseMeta.findDatabase(databases, "1 ")); - Assert.assertNotNull(DatabaseMeta.findDatabase(databases, " 1")); - Assert.assertNotNull(DatabaseMeta.findDatabase(databases, " 1 ")); - } -} +/* + * 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 org.apache.hop.databases.infobright; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class InfobrightDatabaseMetaTest { + + @Before + public void setup() throws HopException { + HopClientEnvironment.init(); + DatabasePluginType.getInstance().registerClassPathPlugin(InfobrightDatabaseMeta.class); + } + + @Test + public void mysqlTestOverrides() throws Exception { + InfobrightDatabaseMeta idm = new InfobrightDatabaseMeta(); + idm.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + assertEquals(5029, idm.getDefaultDatabasePort()); + } + + @Test + public void testAddOptionsInfobright() { + DatabaseMeta databaseMeta = + new DatabaseMeta("", "Infobright", "JDBC", null, "stub:stub", null, null, null); + Map options = databaseMeta.getExtraOptions(); + if (!options.keySet().contains("INFOBRIGHT.characterEncoding")) { + fail(); + } + } + + @Test + public void testAttributesVariable() throws HopDatabaseException { + IVariables variables = new Variables(); + DatabaseMeta databaseMeta = + new DatabaseMeta("", "Infobright", "JDBC", null, "stub:stub", null, null, null); + variables.setVariable("someVar", "someValue"); + databaseMeta.setAttributes(new HashMap<>()); + Map props = databaseMeta.getAttributes(); + props.put("EXTRA_OPTION_Infobright.additional_param", "${someVar}"); + databaseMeta.getURL(variables); + assertTrue(databaseMeta.getURL(variables).contains("someValue")); + } + + @Test + public void testfindDatabase() throws HopDatabaseException { + List databases = new ArrayList<>(); + databases.add( + new DatabaseMeta(" 1", "Infobright", "JDBC", null, "stub:stub", null, null, null)); + databases.add( + new DatabaseMeta(" 1 ", "Infobright", "JDBC", null, "stub:stub", null, null, null)); + databases.add( + new DatabaseMeta("1 ", "Infobright", "JDBC", null, "stub:stub", null, null, null)); + Assert.assertNotNull(DatabaseMeta.findDatabase(databases, "1")); + Assert.assertNotNull(DatabaseMeta.findDatabase(databases, "1 ")); + Assert.assertNotNull(DatabaseMeta.findDatabase(databases, " 1")); + Assert.assertNotNull(DatabaseMeta.findDatabase(databases, " 1 ")); + } +} diff --git a/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightSequenceAndReleaseSavePointTest.java b/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightSequenceAndReleaseSavePointTest.java index d72df9b86ea..b9082852dc4 100644 --- a/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/infobright/src/test/java/org/apache/hop/databases/infobright/InfobrightSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.infobright; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class InfobrightSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/informix/src/main/java/org/apache/hop/databases/informix/InformixDatabaseMeta.java b/plugins/databases/informix/src/main/java/org/apache/hop/databases/informix/InformixDatabaseMeta.java index 7804750e4d0..55bc09527e5 100644 --- a/plugins/databases/informix/src/main/java/org/apache/hop/databases/informix/InformixDatabaseMeta.java +++ b/plugins/databases/informix/src/main/java/org/apache/hop/databases/informix/InformixDatabaseMeta.java @@ -27,11 +27,11 @@ import org.apache.hop.core.gui.plugin.GuiWidgetElement; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Informix specific information through static final members - - */ -@DatabaseMetaPlugin(type = "INFORMIX", typeDescription = "Informix", documentationUrl = "/database/databases/informix.html") +/** Contains Informix specific information through static final members */ +@DatabaseMetaPlugin( + type = "INFORMIX", + typeDescription = "Informix", + documentationUrl = "/database/databases/informix.html") @GuiPlugin(id = "GUI-InformixDatabaseMeta") public class InformixDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @@ -57,7 +57,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { diff --git a/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixDatabaseMetaTest.java b/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixDatabaseMetaTest.java index 91db21c470f..55ef478c47e 100644 --- a/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixDatabaseMetaTest.java +++ b/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixDatabaseMetaTest.java @@ -1,200 +1,200 @@ -/* - * 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 org.apache.hop.databases.informix; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class InformixDatabaseMetaTest { - - private InformixDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new InformixDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(1526, nativeMeta.getDefaultDatabasePort()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - nativeMeta.setServername("FOODBNAME"); - assertEquals("com.informix.jdbc.IfxDriver", nativeMeta.getDriverClass()); - assertEquals( - "jdbc:informix-sqli://FOO:BAR/WIBBLE:INFORMIXSERVER=FOODBNAME;DELIMIDENT=Y", - nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:informix-sqli://FOO:/WIBBLE:INFORMIXSERVER=FOODBNAME;DELIMIDENT=Y", - nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) - assertTrue(nativeMeta.isNeedsPlaceHolder()); - assertTrue(nativeMeta.isFetchSizeSupported()); - assertTrue(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - } - - @Test - public void testSqlStatements() { - assertEquals("SELECT FIRST 1 * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT FIRST 1 * FROM FOO", nativeMeta.getSqlTableExists("FOO")); - assertEquals("SELECT FIRST 1 FOO FROM BAR", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - assertEquals("SELECT FIRST 1 FOO FROM BAR", nativeMeta.getSqlColumnExists("FOO", "BAR")); - assertEquals("TRUNCATE TABLE FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (1, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "LOCK TABLE FOO IN EXCLUSIVE MODE;" - + lineSep - + "LOCK TABLE BAR IN EXCLUSIVE MODE;" - + lineSep, - nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - - assertNull(nativeMeta.getSqlUnlockTables(new String[] {"FOO", "BAR"})); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATETIME YEAR to FRACTION", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "DATETIME", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - - // Simple hack to prevent duplication of code. Checking the case of supported boolean type - // both supported and unsupported. Should return BOOLEAN if supported, or CHAR(1) if not. - String[] typeCk = new String[] {"CHAR(1)", "BOOLEAN", "CHAR(1)"}; - int i = (nativeMeta.isSupportsBooleanDataType() ? 1 : 0); - assertEquals( - typeCk[i], - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "SERIAL8", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", true, false, false)); - assertEquals( - "INTEGER PRIMARY KEY", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "INTEGER PRIMARY KEY", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); - - // Note - ValueMetaInteger returns zero always from the precision - so this avoids the weirdness - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", -8, -3), - "", - "", - false, - false, - false)); // Weird if statement - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", -8, -3), - "", - "", - false, - false, - false)); // Weird if statement ( length and precision less than zero) - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 3), "", "", false, false, false)); // Weird if statement - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); // Weird if statement - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 9, 0), "", "", false, false, false)); // Weird if statement - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - "VARCHAR(10)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(255)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 255, 0), "", "", false, false, false)); - assertEquals( - "LVARCHAR", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 256, 0), "", "", false, false, false)); - assertEquals( - "LVARCHAR", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32767, 0), "", "", false, false, false)); - assertEquals( - "TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32768, 0), "", "", false, false, false)); - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.informix; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class InformixDatabaseMetaTest { + + private InformixDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new InformixDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(1526, nativeMeta.getDefaultDatabasePort()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + nativeMeta.setServername("FOODBNAME"); + assertEquals("com.informix.jdbc.IfxDriver", nativeMeta.getDriverClass()); + assertEquals( + "jdbc:informix-sqli://FOO:BAR/WIBBLE:INFORMIXSERVER=FOODBNAME;DELIMIDENT=Y", + nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:informix-sqli://FOO:/WIBBLE:INFORMIXSERVER=FOODBNAME;DELIMIDENT=Y", + nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) + assertTrue(nativeMeta.isNeedsPlaceHolder()); + assertTrue(nativeMeta.isFetchSizeSupported()); + assertTrue(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + } + + @Test + public void testSqlStatements() { + assertEquals("SELECT FIRST 1 * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT FIRST 1 * FROM FOO", nativeMeta.getSqlTableExists("FOO")); + assertEquals("SELECT FIRST 1 FOO FROM BAR", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + assertEquals("SELECT FIRST 1 FOO FROM BAR", nativeMeta.getSqlColumnExists("FOO", "BAR")); + assertEquals("TRUNCATE TABLE FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (1, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "LOCK TABLE FOO IN EXCLUSIVE MODE;" + + lineSep + + "LOCK TABLE BAR IN EXCLUSIVE MODE;" + + lineSep, + nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + + assertNull(nativeMeta.getSqlUnlockTables(new String[] {"FOO", "BAR"})); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATETIME YEAR to FRACTION", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "DATETIME", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + + // Simple hack to prevent duplication of code. Checking the case of supported boolean type + // both supported and unsupported. Should return BOOLEAN if supported, or CHAR(1) if not. + String[] typeCk = new String[] {"CHAR(1)", "BOOLEAN", "CHAR(1)"}; + int i = (nativeMeta.isSupportsBooleanDataType() ? 1 : 0); + assertEquals( + typeCk[i], + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "SERIAL8", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", true, false, false)); + assertEquals( + "INTEGER PRIMARY KEY", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "INTEGER PRIMARY KEY", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); + + // Note - ValueMetaInteger returns zero always from the precision - so this avoids the weirdness + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", -8, -3), + "", + "", + false, + false, + false)); // Weird if statement + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", -8, -3), + "", + "", + false, + false, + false)); // Weird if statement ( length and precision less than zero) + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 3), "", "", false, false, false)); // Weird if statement + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); // Weird if statement + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 9, 0), "", "", false, false, false)); // Weird if statement + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + "VARCHAR(10)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(255)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 255, 0), "", "", false, false, false)); + assertEquals( + "LVARCHAR", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 256, 0), "", "", false, false, false)); + assertEquals( + "LVARCHAR", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32767, 0), "", "", false, false, false)); + assertEquals( + "TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32768, 0), "", "", false, false, false)); + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixSequenceAndReleaseSavePointTest.java b/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixSequenceAndReleaseSavePointTest.java index c44b21d4b6c..736416828c6 100644 --- a/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/informix/src/test/java/org/apache/hop/databases/informix/InformixSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.informix; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class InformixSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/ingres/src/main/java/org/apache/hop/databases/ingres/IngresDatabaseMeta.java b/plugins/databases/ingres/src/main/java/org/apache/hop/databases/ingres/IngresDatabaseMeta.java index 72d354a99fe..239abd256bb 100644 --- a/plugins/databases/ingres/src/main/java/org/apache/hop/databases/ingres/IngresDatabaseMeta.java +++ b/plugins/databases/ingres/src/main/java/org/apache/hop/databases/ingres/IngresDatabaseMeta.java @@ -26,10 +26,11 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; -/** - * Contains Computer Associates Ingres specific information through static final members - */ -@DatabaseMetaPlugin(type = "INGRES", typeDescription = "Ingres", documentationUrl = "/database/databases/ingres.html") +/** Contains Computer Associates Ingres specific information through static final members */ +@DatabaseMetaPlugin( + type = "INGRES", + typeDescription = "Ingres", + documentationUrl = "/database/databases/ingres.html") @GuiPlugin(id = "GUI-IngresDatabaseMeta") public class IngresDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -59,13 +60,17 @@ public String getURL(String hostname, String port, String databaseName) { } } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; diff --git a/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresDatabaseMetaTest.java b/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresDatabaseMetaTest.java index ffb4555b501..a5327e51dbc 100644 --- a/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresDatabaseMetaTest.java +++ b/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresDatabaseMetaTest.java @@ -1,166 +1,166 @@ -/* - * 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 org.apache.hop.databases.ingres; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class IngresDatabaseMetaTest { - - private IngresDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new IngresDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals( - -1, nativeMeta.getDefaultDatabasePort()); // pretty sure this is a bug - should be 21064 ( - // http://community.actian.com/wiki/Ingres_TCP_Ports ) - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("com.ingres.jdbc.IngresDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:ingres://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals("jdbc:ingres://FOO:II7/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); - - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertFalse(nativeMeta.isSupportsGetBlob()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + System.getProperty("line.separator"), - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATE", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "BIGINT PRIMARY KEY IDENTITY(0,1)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", true, false, false)); - assertEquals( - "BIGINT PRIMARY KEY IDENTITY(0,1)", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "FOO", true, false, false)); - assertEquals( - "BIGINT PRIMARY KEY NOT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "FOO", "", false, false, false)); - assertEquals( - "BIGINT PRIMARY KEY NOT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); - - // Integer tests - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 6, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 3, 0), "", "", false, false, false)); - assertEquals( - "INTEGER1", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 2, 0), "", "", false, false, false)); - - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 6, 3), "", "", false, false, false)); - - // String Types - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(2000)", - nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", true, false, false)); - assertEquals( - "VARCHAR(2000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(2000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -34, 0), "", "", false, false, false)); - - // Unknown - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.ingres; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class IngresDatabaseMetaTest { + + private IngresDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new IngresDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals( + -1, nativeMeta.getDefaultDatabasePort()); // pretty sure this is a bug - should be 21064 ( + // http://community.actian.com/wiki/Ingres_TCP_Ports ) + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("com.ingres.jdbc.IngresDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:ingres://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals("jdbc:ingres://FOO:II7/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); + + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertFalse(nativeMeta.isSupportsGetBlob()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + System.getProperty("line.separator"), + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATE", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "BIGINT PRIMARY KEY IDENTITY(0,1)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", true, false, false)); + assertEquals( + "BIGINT PRIMARY KEY IDENTITY(0,1)", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "FOO", true, false, false)); + assertEquals( + "BIGINT PRIMARY KEY NOT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "FOO", "", false, false, false)); + assertEquals( + "BIGINT PRIMARY KEY NOT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); + + // Integer tests + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 6, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 3, 0), "", "", false, false, false)); + assertEquals( + "INTEGER1", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 2, 0), "", "", false, false, false)); + + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 6, 3), "", "", false, false, false)); + + // String Types + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(2000)", + nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", true, false, false)); + assertEquals( + "VARCHAR(2000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(2000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -34, 0), "", "", false, false, false)); + + // Unknown + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresSequenceAndReleaseSavePointTest.java b/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresSequenceAndReleaseSavePointTest.java index c1ac5aecc96..218c73bc494 100644 --- a/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/ingres/src/test/java/org/apache/hop/databases/ingres/IngresSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.ingres; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class IngresSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/interbase/src/main/java/org/apache/hop/databases/interbase/InterbaseDatabaseMeta.java b/plugins/databases/interbase/src/main/java/org/apache/hop/databases/interbase/InterbaseDatabaseMeta.java index 0491efa871f..66da6944023 100644 --- a/plugins/databases/interbase/src/main/java/org/apache/hop/databases/interbase/InterbaseDatabaseMeta.java +++ b/plugins/databases/interbase/src/main/java/org/apache/hop/databases/interbase/InterbaseDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Interbase specific information through static final members - */ -@DatabaseMetaPlugin(type = "INTERBASE", typeDescription = "Borland Interbase", documentationUrl = "/database/databases/interbase.html") +/** Contains Interbase specific information through static final members */ +@DatabaseMetaPlugin( + type = "INTERBASE", + typeDescription = "Borland Interbase", + documentationUrl = "/database/databases/interbase.html") @GuiPlugin(id = "GUI-InterbaseDatabaseMeta") public class InterbaseDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -44,7 +45,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; @@ -60,13 +63,17 @@ public String getURL(String hostname, String port, String databaseName) { return "jdbc:interbase://" + hostname + ":" + port + "/" + databaseName; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; diff --git a/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseDatabaseMetaTest.java b/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseDatabaseMetaTest.java index 49b2fc1b600..5d7ee4729ac 100644 --- a/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseDatabaseMetaTest.java +++ b/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseDatabaseMetaTest.java @@ -1,840 +1,840 @@ -/* - * 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 org.apache.hop.databases.interbase; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class InterbaseDatabaseMetaTest { - - private InterbaseDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new InterbaseDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(3050, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("interbase.interclient.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:interbase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:interbase://FOO:/WIBBLE", - nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertArrayEquals( - new String[] { - "ABSOLUTE", - "ACTION", - "ACTIVE", - "ADD", - "ADMIN", - "AFTER", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "AS", - "ASC", - "ASCENDING", - "ASSERTION", - "AT", - "AUTHORIZATION", - "AUTO", - "AUTODDL", - "AVG", - "BASED", - "BASENAME", - "BASE_NAME", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIT", - "BIT_LENGTH", - "BLOB", - "BLOBEDIT", - "BOTH", - "BUFFER", - "BY", - "CACHE", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CHAR", - "CHARACTER", - "CHAR_LENGTH", - "CHARACTER_LENGTH", - "CHECK", - "CHECK_POINT_LEN", - "CHECK_POINT_LENGTH", - "CLOSE", - "COALESCE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "COMMITTED", - "COMPILETIME", - "COMPUTED", - "CONDITIONAL", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONTAINING", - "CONTINUE", - "CONVERT", - "CORRESPONDING", - "COUNT", - "CREATE", - "CROSS", - "CSTRING", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "DATABASE", - "DATE", - "DAY", - "DB_KEY", - "DEALLOCATE", - "DEBUG", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DESC", - "DESCENDING", - "DESCRIBE", - "DESCRIPTOR", - "DIAGNOSTICS", - "DISCONNECT", - "DISPLAY", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "ECHO", - "EDIT", - "ELSE", - "END", - "END-EXEC", - "ENTRY_POINT", - "ESCAPE", - "EVENT", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FILE", - "FILTER", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE_IT", - "FROM", - "FULL", - "FUNCTION", - "GDSCODE", - "GENERATOR", - "GEN_ID", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "GROUP_COMMIT_WAIT", - "GROUP_COMMIT_WAIT_TIME", - "HAVING", - "HELP", - "HOUR", - "IDENTITY", - "IF", - "IMMEDIATE", - "IN", - "INACTIVE", - "INDEX", - "INDICATOR", - "INIT", - "INITIALLY", - "INNER", - "INPUT", - "INPUT_TYPE", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOLATION", - "ISQL", - "JOIN", - "KEY", - "LANGUAGE", - "LAST", - "LC_MESSAGES", - "LC_TYPE", - "LEADING", - "LEFT", - "LENGTH", - "LEV", - "LEVEL", - "LIKE", - "LOCAL", - "LOGFILE", - "LOG_BUFFER_SIZE", - "LOG_BUF_SIZE", - "LONG", - "LOWER", - "MANUAL", - "MATCH", - "MAX", - "MAXIMUM", - "MAXIMUM_SEGMENT", - "MAX_SEGMENT", - "MERGE", - "MESSAGE", - "MIN", - "MINIMUM", - "MINUTE", - "MODULE", - "MODULE_NAME", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NEXT", - "NO", - "NOAUTO", - "NOT", - "NULL", - "NULLIF", - "NUM_LOG_BUFS", - "NUM_LOG_BUFFERS", - "NUMERIC", - "OCTET_LENGTH", - "OF", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OR", - "ORDER", - "OUTER", - "OUTPUT", - "OUTPUT_TYPE", - "OVERFLOW", - "OVERLAPS", - "PAD", - "PAGE", - "PAGELENGTH", - "PAGES", - "PAGE_SIZE", - "PARAMETER", - "PARTIAL", - "PASSWORD", - "PLAN", - "POSITION", - "POST_EVENT", - "PRECISION", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "PUBLIC", - "QUIT", - "RAW_PARTITIONS", - "RDB$DB_KEY", - "READ", - "REAL", - "RECORD_VERSION", - "REFERENCES", - "RELATIVE", - "RELEASE", - "RESERV", - "RESERVING", - "RESTRICT", - "RETAIN", - "RETURN", - "RETURNING_VALUES", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROWS", - "RUNTIME", - "SCHEMA", - "SCROLL", - "SECOND", - "SECTION", - "SELECT", - "SESSION", - "SESSION_USER", - "SET", - "SHADOW", - "SHARED", - "SHELL", - "SHOW", - "SINGULAR", - "SIZE", - "SMALLINT", - "SNAPSHOT", - "SOME", - "SORT", - "SPACE", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLSTATE", - "SQLWARNING", - "STABILITY", - "STARTING", - "STARTS", - "STATEMENT", - "STATIC", - "STATISTICS", - "SUB_TYPE", - "SUBSTRING", - "SUM", - "SUSPEND", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TERMINATOR", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATE", - "TRANSLATION", - "TRIGGER", - "TRIM", - "TRUE", - "TYPE", - "UNCOMMITTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UPDATE", - "UPPER", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VERSION", - "VIEW", - "WAIT", - "WEEKDAY", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WITH", - "WORK", - "WRITE", - "YEAR", - "YEARDAY", - "ZONE", - "ABSOLUTE", - "ACTION", - "ACTIVE", - "ADD", - "ADMIN", - "AFTER", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "AS", - "ASC", - "ASCENDING", - "ASSERTION", - "AT", - "AUTHORIZATION", - "AUTO", - "AUTODDL", - "AVG", - "BASED", - "BASENAME", - "BASE_NAME", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIT", - "BIT_LENGTH", - "BLOB", - "BLOBEDIT", - "BOTH", - "BUFFER", - "BY", - "CACHE", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CHAR", - "CHARACTER", - "CHAR_LENGTH", - "CHARACTER_LENGTH", - "CHECK", - "CHECK_POINT_LEN", - "CHECK_POINT_LENGTH", - "CLOSE", - "COALESCE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "COMMITTED", - "COMPILETIME", - "COMPUTED", - "CONDITIONAL", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONTAINING", - "CONTINUE", - "CONVERT", - "CORRESPONDING", - "COUNT", - "CREATE", - "CROSS", - "CSTRING", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "DATABASE", - "DATE", - "DAY", - "DB_KEY", - "DEALLOCATE", - "DEBUG", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DESC", - "DESCENDING", - "DESCRIBE", - "DESCRIPTOR", - "DIAGNOSTICS", - "DISCONNECT", - "DISPLAY", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "ECHO", - "EDIT", - "ELSE", - "END", - "END-EXEC", - "ENTRY_POINT", - "ESCAPE", - "EVENT", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FILE", - "FILTER", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE_IT", - "FROM", - "FULL", - "FUNCTION", - "GDSCODE", - "GENERATOR", - "GEN_ID", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "GROUP_COMMIT_WAIT", - "GROUP_COMMIT_WAIT_TIME", - "HAVING", - "HELP", - "HOUR", - "IDENTITY", - "IF", - "IMMEDIATE", - "IN", - "INACTIVE", - "INDEX", - "INDICATOR", - "INIT", - "INITIALLY", - "INNER", - "INPUT", - "INPUT_TYPE", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOLATION", - "ISQL", - "JOIN", - "KEY", - "LANGUAGE", - "LAST", - "LC_MESSAGES", - "LC_TYPE", - "LEADING", - "LEFT", - "LENGTH", - "LEV", - "LEVEL", - "LIKE", - "LOCAL", - "LOGFILE", - "LOG_BUFFER_SIZE", - "LOG_BUF_SIZE", - "LONG", - "LOWER", - "MANUAL", - "MATCH", - "MAX", - "MAXIMUM", - "MAXIMUM_SEGMENT", - "MAX_SEGMENT", - "MERGE", - "MESSAGE", - "MIN", - "MINIMUM", - "MINUTE", - "MODULE", - "MODULE_NAME", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NEXT", - "NO", - "NOAUTO", - "NOT", - "NULL", - "NULLIF", - "NUM_LOG_BUFS", - "NUM_LOG_BUFFERS", - "NUMERIC", - "OCTET_LENGTH", - "OF", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OR", - "ORDER", - "OUTER", - "OUTPUT", - "OUTPUT_TYPE", - "OVERFLOW", - "OVERLAPS", - "PAD", - "PAGE", - "PAGELENGTH", - "PAGES", - "PAGE_SIZE", - "PARAMETER", - "PARTIAL", - "PASSWORD", - "PLAN", - "POSITION", - "POST_EVENT", - "PRECISION", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "PUBLIC", - "QUIT", - "RAW_PARTITIONS", - "RDB$DB_KEY", - "READ", - "REAL", - "RECORD_VERSION", - "REFERENCES", - "RELATIVE", - "RELEASE", - "RESERV", - "RESERVING", - "RESTRICT", - "RETAIN", - "RETURN", - "RETURNING_VALUES", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROWS", - "RUNTIME", - "SCHEMA", - "SCROLL", - "SECOND", - "SECTION", - "SELECT", - "SESSION", - "SESSION_USER", - "SET", - "SHADOW", - "SHARED", - "SHELL", - "SHOW", - "SINGULAR", - "SIZE", - "SMALLINT", - "SNAPSHOT", - "SOME", - "SORT", - "SPACE", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLSTATE", - "SQLWARNING", - "STABILITY", - "STARTING", - "STARTS", - "STATEMENT", - "STATIC", - "STATISTICS", - "SUB_TYPE", - "SUBSTRING", - "SUM", - "SUSPEND", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TERMINATOR", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATE", - "TRANSLATION", - "TRIGGER", - "TRIM", - "TRUE", - "TYPE", - "UNCOMMITTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UPDATE", - "UPPER", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VERSION", - "VIEW", - "WAIT", - "WEEKDAY", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WITH", - "WORK", - "WRITE", - "YEAR", - "YEARDAY", - "ZONE" - }, - nativeMeta.getReservedWords()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - assertFalse(nativeMeta.isSupportsBatchUpdates()); - assertFalse(nativeMeta.isSupportsGetBlob()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR TYPE VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATE", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "DATE", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "INTEGER NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "INTEGER NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "", "FOO", false, false, false)); - - assertEquals( - "NUMERIC(10)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "NUMERIC(10)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "NUMERIC(10, 5)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 10, 5), "", "", false, false, false)); - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", -7, -2), "", "", false, false, false)); - - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(32663)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32663, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(32664)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -43, 0), "", "", false, false, false)); - assertEquals( - "BLOB SUB_TYPE TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32664, 0), "", "", false, false, false)); - assertEquals( - "BLOB SUB_TYPE TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32665, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.interbase; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.junit.Before; +import org.junit.Test; + +public class InterbaseDatabaseMetaTest { + + private InterbaseDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new InterbaseDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(3050, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("interbase.interclient.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:interbase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:interbase://FOO:/WIBBLE", + nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertArrayEquals( + new String[] { + "ABSOLUTE", + "ACTION", + "ACTIVE", + "ADD", + "ADMIN", + "AFTER", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "AS", + "ASC", + "ASCENDING", + "ASSERTION", + "AT", + "AUTHORIZATION", + "AUTO", + "AUTODDL", + "AVG", + "BASED", + "BASENAME", + "BASE_NAME", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIT", + "BIT_LENGTH", + "BLOB", + "BLOBEDIT", + "BOTH", + "BUFFER", + "BY", + "CACHE", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CHAR", + "CHARACTER", + "CHAR_LENGTH", + "CHARACTER_LENGTH", + "CHECK", + "CHECK_POINT_LEN", + "CHECK_POINT_LENGTH", + "CLOSE", + "COALESCE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "COMMITTED", + "COMPILETIME", + "COMPUTED", + "CONDITIONAL", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONTAINING", + "CONTINUE", + "CONVERT", + "CORRESPONDING", + "COUNT", + "CREATE", + "CROSS", + "CSTRING", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "DATABASE", + "DATE", + "DAY", + "DB_KEY", + "DEALLOCATE", + "DEBUG", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DESC", + "DESCENDING", + "DESCRIBE", + "DESCRIPTOR", + "DIAGNOSTICS", + "DISCONNECT", + "DISPLAY", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "ECHO", + "EDIT", + "ELSE", + "END", + "END-EXEC", + "ENTRY_POINT", + "ESCAPE", + "EVENT", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FILE", + "FILTER", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE_IT", + "FROM", + "FULL", + "FUNCTION", + "GDSCODE", + "GENERATOR", + "GEN_ID", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "GROUP_COMMIT_WAIT", + "GROUP_COMMIT_WAIT_TIME", + "HAVING", + "HELP", + "HOUR", + "IDENTITY", + "IF", + "IMMEDIATE", + "IN", + "INACTIVE", + "INDEX", + "INDICATOR", + "INIT", + "INITIALLY", + "INNER", + "INPUT", + "INPUT_TYPE", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOLATION", + "ISQL", + "JOIN", + "KEY", + "LANGUAGE", + "LAST", + "LC_MESSAGES", + "LC_TYPE", + "LEADING", + "LEFT", + "LENGTH", + "LEV", + "LEVEL", + "LIKE", + "LOCAL", + "LOGFILE", + "LOG_BUFFER_SIZE", + "LOG_BUF_SIZE", + "LONG", + "LOWER", + "MANUAL", + "MATCH", + "MAX", + "MAXIMUM", + "MAXIMUM_SEGMENT", + "MAX_SEGMENT", + "MERGE", + "MESSAGE", + "MIN", + "MINIMUM", + "MINUTE", + "MODULE", + "MODULE_NAME", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NEXT", + "NO", + "NOAUTO", + "NOT", + "NULL", + "NULLIF", + "NUM_LOG_BUFS", + "NUM_LOG_BUFFERS", + "NUMERIC", + "OCTET_LENGTH", + "OF", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OR", + "ORDER", + "OUTER", + "OUTPUT", + "OUTPUT_TYPE", + "OVERFLOW", + "OVERLAPS", + "PAD", + "PAGE", + "PAGELENGTH", + "PAGES", + "PAGE_SIZE", + "PARAMETER", + "PARTIAL", + "PASSWORD", + "PLAN", + "POSITION", + "POST_EVENT", + "PRECISION", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "PUBLIC", + "QUIT", + "RAW_PARTITIONS", + "RDB$DB_KEY", + "READ", + "REAL", + "RECORD_VERSION", + "REFERENCES", + "RELATIVE", + "RELEASE", + "RESERV", + "RESERVING", + "RESTRICT", + "RETAIN", + "RETURN", + "RETURNING_VALUES", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROWS", + "RUNTIME", + "SCHEMA", + "SCROLL", + "SECOND", + "SECTION", + "SELECT", + "SESSION", + "SESSION_USER", + "SET", + "SHADOW", + "SHARED", + "SHELL", + "SHOW", + "SINGULAR", + "SIZE", + "SMALLINT", + "SNAPSHOT", + "SOME", + "SORT", + "SPACE", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLSTATE", + "SQLWARNING", + "STABILITY", + "STARTING", + "STARTS", + "STATEMENT", + "STATIC", + "STATISTICS", + "SUB_TYPE", + "SUBSTRING", + "SUM", + "SUSPEND", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TERMINATOR", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATE", + "TRANSLATION", + "TRIGGER", + "TRIM", + "TRUE", + "TYPE", + "UNCOMMITTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UPDATE", + "UPPER", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VERSION", + "VIEW", + "WAIT", + "WEEKDAY", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WITH", + "WORK", + "WRITE", + "YEAR", + "YEARDAY", + "ZONE", + "ABSOLUTE", + "ACTION", + "ACTIVE", + "ADD", + "ADMIN", + "AFTER", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "AS", + "ASC", + "ASCENDING", + "ASSERTION", + "AT", + "AUTHORIZATION", + "AUTO", + "AUTODDL", + "AVG", + "BASED", + "BASENAME", + "BASE_NAME", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIT", + "BIT_LENGTH", + "BLOB", + "BLOBEDIT", + "BOTH", + "BUFFER", + "BY", + "CACHE", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CHAR", + "CHARACTER", + "CHAR_LENGTH", + "CHARACTER_LENGTH", + "CHECK", + "CHECK_POINT_LEN", + "CHECK_POINT_LENGTH", + "CLOSE", + "COALESCE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "COMMITTED", + "COMPILETIME", + "COMPUTED", + "CONDITIONAL", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONTAINING", + "CONTINUE", + "CONVERT", + "CORRESPONDING", + "COUNT", + "CREATE", + "CROSS", + "CSTRING", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "DATABASE", + "DATE", + "DAY", + "DB_KEY", + "DEALLOCATE", + "DEBUG", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DESC", + "DESCENDING", + "DESCRIBE", + "DESCRIPTOR", + "DIAGNOSTICS", + "DISCONNECT", + "DISPLAY", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "ECHO", + "EDIT", + "ELSE", + "END", + "END-EXEC", + "ENTRY_POINT", + "ESCAPE", + "EVENT", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FILE", + "FILTER", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE_IT", + "FROM", + "FULL", + "FUNCTION", + "GDSCODE", + "GENERATOR", + "GEN_ID", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "GROUP_COMMIT_WAIT", + "GROUP_COMMIT_WAIT_TIME", + "HAVING", + "HELP", + "HOUR", + "IDENTITY", + "IF", + "IMMEDIATE", + "IN", + "INACTIVE", + "INDEX", + "INDICATOR", + "INIT", + "INITIALLY", + "INNER", + "INPUT", + "INPUT_TYPE", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOLATION", + "ISQL", + "JOIN", + "KEY", + "LANGUAGE", + "LAST", + "LC_MESSAGES", + "LC_TYPE", + "LEADING", + "LEFT", + "LENGTH", + "LEV", + "LEVEL", + "LIKE", + "LOCAL", + "LOGFILE", + "LOG_BUFFER_SIZE", + "LOG_BUF_SIZE", + "LONG", + "LOWER", + "MANUAL", + "MATCH", + "MAX", + "MAXIMUM", + "MAXIMUM_SEGMENT", + "MAX_SEGMENT", + "MERGE", + "MESSAGE", + "MIN", + "MINIMUM", + "MINUTE", + "MODULE", + "MODULE_NAME", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NEXT", + "NO", + "NOAUTO", + "NOT", + "NULL", + "NULLIF", + "NUM_LOG_BUFS", + "NUM_LOG_BUFFERS", + "NUMERIC", + "OCTET_LENGTH", + "OF", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OR", + "ORDER", + "OUTER", + "OUTPUT", + "OUTPUT_TYPE", + "OVERFLOW", + "OVERLAPS", + "PAD", + "PAGE", + "PAGELENGTH", + "PAGES", + "PAGE_SIZE", + "PARAMETER", + "PARTIAL", + "PASSWORD", + "PLAN", + "POSITION", + "POST_EVENT", + "PRECISION", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "PUBLIC", + "QUIT", + "RAW_PARTITIONS", + "RDB$DB_KEY", + "READ", + "REAL", + "RECORD_VERSION", + "REFERENCES", + "RELATIVE", + "RELEASE", + "RESERV", + "RESERVING", + "RESTRICT", + "RETAIN", + "RETURN", + "RETURNING_VALUES", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROWS", + "RUNTIME", + "SCHEMA", + "SCROLL", + "SECOND", + "SECTION", + "SELECT", + "SESSION", + "SESSION_USER", + "SET", + "SHADOW", + "SHARED", + "SHELL", + "SHOW", + "SINGULAR", + "SIZE", + "SMALLINT", + "SNAPSHOT", + "SOME", + "SORT", + "SPACE", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLSTATE", + "SQLWARNING", + "STABILITY", + "STARTING", + "STARTS", + "STATEMENT", + "STATIC", + "STATISTICS", + "SUB_TYPE", + "SUBSTRING", + "SUM", + "SUSPEND", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TERMINATOR", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATE", + "TRANSLATION", + "TRIGGER", + "TRIM", + "TRUE", + "TYPE", + "UNCOMMITTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UPDATE", + "UPPER", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VERSION", + "VIEW", + "WAIT", + "WEEKDAY", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WITH", + "WORK", + "WRITE", + "YEAR", + "YEARDAY", + "ZONE" + }, + nativeMeta.getReservedWords()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + assertFalse(nativeMeta.isSupportsBatchUpdates()); + assertFalse(nativeMeta.isSupportsGetBlob()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR TYPE VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATE", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "DATE", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "INTEGER NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "INTEGER NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "", "FOO", false, false, false)); + + assertEquals( + "NUMERIC(10)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "NUMERIC(10)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "NUMERIC(10, 5)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 10, 5), "", "", false, false, false)); + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", -7, -2), "", "", false, false, false)); + + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(32663)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32663, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(32664)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -43, 0), "", "", false, false, false)); + assertEquals( + "BLOB SUB_TYPE TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32664, 0), "", "", false, false, false)); + assertEquals( + "BLOB SUB_TYPE TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32665, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseSequenceAndReleaseSavePointTest.java b/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseSequenceAndReleaseSavePointTest.java index 697429a8ae6..f089bae14b7 100644 --- a/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/interbase/src/test/java/org/apache/hop/databases/interbase/InterbaseSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.interbase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class InterbaseSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/iris/src/main/java/org/apache/hop/databases/iris/IrisDatabaseMeta.java b/plugins/databases/iris/src/main/java/org/apache/hop/databases/iris/IrisDatabaseMeta.java index 93e1210f8be..b98a4fdeb2f 100644 --- a/plugins/databases/iris/src/main/java/org/apache/hop/databases/iris/IrisDatabaseMeta.java +++ b/plugins/databases/iris/src/main/java/org/apache/hop/databases/iris/IrisDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains InterSystems Iris specific information through static final members - */ -@DatabaseMetaPlugin(type = "IRIS", typeDescription = "InterSystems Iris", documentationUrl = "/database/databases/iris.html") +/** Contains InterSystems Iris specific information through static final members */ +@DatabaseMetaPlugin( + type = "IRIS", + typeDescription = "InterSystems Iris", + documentationUrl = "/database/databases/iris.html") @GuiPlugin(id = "GUI-IrisDatabaseMeta") public class IrisDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -54,7 +55,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; @@ -198,7 +201,9 @@ public boolean isRequiresCreateTablePrimaryKeyAppend() { return true; } - /** @return true if the database supports newlines in a SQL statements. */ + /** + * @return true if the database supports newlines in a SQL statements. + */ @Override public boolean isSupportsNewLinesInSql() { return false; diff --git a/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisDatabaseMetaTest.java b/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisDatabaseMetaTest.java index 3e1d3a78b34..6556b8ab666 100644 --- a/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisDatabaseMetaTest.java +++ b/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisDatabaseMetaTest.java @@ -17,6 +17,11 @@ package org.apache.hop.databases.iris; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.row.value.ValueMetaBoolean; import org.apache.hop.core.row.value.ValueMetaDate; @@ -28,11 +33,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class IrisDatabaseMetaTest { private IrisDatabaseMeta cdm; diff --git a/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisSequenceAndReleaseSavePointTest.java b/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisSequenceAndReleaseSavePointTest.java index 27b2a5c4e10..0f5d37ca062 100644 --- a/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/iris/src/test/java/org/apache/hop/databases/iris/IrisSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.iris; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class IrisSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/kingbasees/src/main/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMeta.java b/plugins/databases/kingbasees/src/main/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMeta.java index f14147f4c65..26e8c3f7e9d 100644 --- a/plugins/databases/kingbasees/src/main/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMeta.java +++ b/plugins/databases/kingbasees/src/main/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMeta.java @@ -25,19 +25,24 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains KingbaseES specific information through static final members - */ -@DatabaseMetaPlugin(type = "KINGBASEES", typeDescription = "KingbaseES", documentationUrl = "/database/databases/kingbasees.html") +/** Contains KingbaseES specific information through static final members */ +@DatabaseMetaPlugin( + type = "KINGBASEES", + typeDescription = "KingbaseES", + documentationUrl = "/database/databases/kingbasees.html") @GuiPlugin(id = "GUI-KingbaseDatabaseMeta") public class KingbaseESDatabaseMeta extends BaseDatabaseMeta implements IDatabase { - /** @return The extra option separator in database URL for this platform */ + /** + * @return The extra option separator in database URL for this platform + */ @Override public String getExtraOptionSeparator() { return "&"; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "?"; @@ -76,13 +81,17 @@ public boolean isFetchSizeSupported() { return true; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; diff --git a/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMetaTest.java b/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMetaTest.java index d898b5474d2..9a2262186a6 100644 --- a/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMetaTest.java +++ b/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESDatabaseMetaTest.java @@ -1,833 +1,833 @@ -/* - * 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 org.apache.hop.databases.kingbasees; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class KingbaseESDatabaseMetaTest { - - private KingbaseESDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new KingbaseESDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(54321, nativeMeta.getDefaultDatabasePort()); - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("com.kingbase.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:kingbase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:kingbase://FOO:/WIBBLE", - nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) - - assertArrayEquals( - new String[] { - // http://www.postgresql.org/docs/8.1/static/sql-keywords-appendix.html - // added also non-reserved key words because there is progress from the Postgre developers - // to add them - "A", - "ABORT", - "ABS", - "ABSOLUTE", - "ACCESS", - "ACTION", - "ADA", - "ADD", - "ADMIN", - "AFTER", - "AGGREGATE", - "ALIAS", - "ALL", - "ALLOCATE", - "ALSO", - "ALTER", - "ALWAYS", - "ANALYSE", - "ANALYZE", - "AND", - "ANY", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASENSITIVE", - "ASSERTION", - "ASSIGNMENT", - "ASYMMETRIC", - "AT", - "ATOMIC", - "ATTRIBUTE", - "ATTRIBUTES", - "AUTHORIZATION", - "AVG", - "BACKWARD", - "BEFORE", - "BEGIN", - "BERNOULLI", - "BETWEEN", - "BIGINT", - "BINARY", - "BIT", - "BITVAR", - "BIT_LENGTH", - "BLOB", - "BOOLEAN", - "BOTH", - "BREADTH", - "BY", - "C", - "CACHE", - "CALL", - "CALLED", - "CARDINALITY", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CATALOG_NAME", - "CEIL", - "CEILING", - "CHAIN", - "CHAR", - "CHARACTER", - "CHARACTERISTICS", - "CHARACTERS", - "CHARACTER_LENGTH", - "CHARACTER_SET_CATALOG", - "CHARACTER_SET_NAME", - "CHARACTER_SET_SCHEMA", - "CHAR_LENGTH", - "CHECK", - "CHECKED", - "CHECKPOINT", - "CLASS", - "CLASS_ORIGIN", - "CLOB", - "CLOSE", - "CLUSTER", - "COALESCE", - "COBOL", - "COLLATE", - "COLLATION", - "COLLATION_CATALOG", - "COLLATION_NAME", - "COLLATION_SCHEMA", - "COLLECT", - "COLUMN", - "COLUMN_NAME", - "COMMAND_FUNCTION", - "COMMAND_FUNCTION_CODE", - "COMMENT", - "COMMIT", - "COMMITTED", - "COMPLETION", - "CONDITION", - "CONDITION_NUMBER", - "CONNECT", - "CONNECTION", - "CONNECTION_NAME", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRAINT_CATALOG", - "CONSTRAINT_NAME", - "CONSTRAINT_SCHEMA", - "CONSTRUCTOR", - "CONTAINS", - "CONTINUE", - "CONVERSION", - "CONVERT", - "COPY", - "CORR", - "CORRESPONDING", - "COUNT", - "COVAR_POP", - "COVAR_SAMP", - "CREATE", - "CREATEDB", - "CREATEROLE", - "CREATEUSER", - "CROSS", - "CSV", - "CUBE", - "CUME_DIST", - "CURRENT", - "CURRENT_DATE", - "CURRENT_DEFAULT_TRANSFORM_GROUP", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_TRANSFORM_GROUP_FOR_TYPE", - "CURRENT_USER", - "CURSOR", - "CURSOR_NAME", - "CYCLE", - "DATA", - "DATABASE", - "DATE", - "DATETIME_INTERVAL_CODE", - "DATETIME_INTERVAL_PRECISION", - "DAY", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFAULTS", - "DEFERRABLE", - "DEFERRED", - "DEFINED", - "DEFINER", - "DEGREE", - "DELETE", - "DELIMITER", - "DELIMITERS", - "DENSE_RANK", - "DEPTH", - "DEREF", - "DERIVED", - "DESC", - "DESCRIBE", - "DESCRIPTOR", - "DESTROY", - "DESTRUCTOR", - "DETERMINISTIC", - "DIAGNOSTICS", - "DICTIONARY", - "DISABLE", - "DISCONNECT", - "DISPATCH", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "DYNAMIC", - "DYNAMIC_FUNCTION", - "DYNAMIC_FUNCTION_CODE", - "EACH", - "ELEMENT", - "ELSE", - "ENABLE", - "ENCODING", - "ENCRYPTED", - "END", - "END-EXEC", - "EQUALS", - "ESCAPE", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXCLUDE", - "EXCLUDING", - "EXCLUSIVE", - "EXEC", - "EXECUTE", - "EXISTING", - "EXISTS", - "EXP", - "EXPLAIN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FILTER", - "FINAL", - "FIRST", - "FLOAT", - "FLOOR", - "FOLLOWING", - "FOR", - "FORCE", - "FOREIGN", - "FORTRAN", - "FORWARD", - "FOUND", - "FREE", - "FREEZE", - "FROM", - "FULL", - "FUNCTION", - "FUSION", - "G", - "GENERAL", - "GENERATED", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GRANTED", - "GREATEST", - "GROUP", - "GROUPING", - "HANDLER", - "HAVING", - "HEADER", - "HIERARCHY", - "HOLD", - "HOST", - "HOUR", - "IDENTITY", - "IGNORE", - "ILIKE", - "IMMEDIATE", - "IMMUTABLE", - "IMPLEMENTATION", - "IMPLICIT", - "IN", - "INCLUDING", - "INCREMENT", - "INDEX", - "INDICATOR", - "INFIX", - "INHERIT", - "INHERITS", - "INITIALIZE", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSENSITIVE", - "INSERT", - "INSTANCE", - "INSTANTIABLE", - "INSTEAD", - "INT", - "INTEGER", - "INTERSECT", - "INTERSECTION", - "INTERVAL", - "INTO", - "INVOKER", - "IS", - "ISNULL", - "ISOLATION", - "ITERATE", - "JOIN", - "K", - "KEY", - "KEY_MEMBER", - "KEY_TYPE", - "LANCOMPILER", - "LANGUAGE", - "LARGE", - "LAST", - "LATERAL", - "LEADING", - "LEAST", - "LEFT", - "LENGTH", - "LESS", - "LEVEL", - "LIKE", - "LIMIT", - "LISTEN", - "LN", - "LOAD", - "LOCAL", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATION", - "LOCATOR", - "LOCK", - "LOGIN", - "LOWER", - "M", - "MAP", - "MATCH", - "MATCHED", - "MAX", - "MAXVALUE", - "MEMBER", - "MERGE", - "MESSAGE_LENGTH", - "MESSAGE_OCTET_LENGTH", - "MESSAGE_TEXT", - "METHOD", - "MIN", - "MINUTE", - "MINVALUE", - "MOD", - "MODE", - "MODIFIES", - "MODIFY", - "MODULE", - "MONTH", - "MORE", - "MOVE", - "MULTISET", - "MUMPS", - "NAME", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NCLOB", - "NESTING", - "NEW", - "NEXT", - "NO", - "NOCREATEDB", - "NOCREATEROLE", - "NOCREATEUSER", - "NOINHERIT", - "NOLOGIN", - "NONE", - "NORMALIZE", - "NORMALIZED", - "NOSUPERUSER", - "NOT", - "NOTHING", - "NOTIFY", - "NOTNULL", - "NOWAIT", - "NULL", - "NULLABLE", - "NULLIF", - "NULLS", - "NUMBER", - "NUMERIC", - "OBJECT", - "OCTETS", - "OCTET_LENGTH", - "OF", - "OFF", - "OFFSET", - "OIDS", - "OLD", - "ON", - "ONLY", - "OPEN", - "OPERATION", - "OPERATOR", - "OPTION", - "OPTIONS", - "OR", - "ORDER", - "ORDERING", - "ORDINALITY", - "OTHERS", - "OUT", - "OUTER", - "OUTPUT", - "OVER", - "OVERLAPS", - "OVERLAY", - "OVERRIDING", - "OWNER", - "PAD", - "PARAMETER", - "PARAMETERS", - "PARAMETER_MODE", - "PARAMETER_NAME", - "PARAMETER_ORDINAL_POSITION", - "PARAMETER_SPECIFIC_CATALOG", - "PARAMETER_SPECIFIC_NAME", - "PARAMETER_SPECIFIC_SCHEMA", - "PARTIAL", - "PARTITION", - "PASCAL", - "PASSWORD", - "PATH", - "PERCENTILE_CONT", - "PERCENTILE_DISC", - "PERCENT_RANK", - "PLACING", - "PLI", - "POSITION", - "POSTFIX", - "POWER", - "PRECEDING", - "PRECISION", - "PREFIX", - "PREORDER", - "PREPARE", - "PREPARED", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURAL", - "PROCEDURE", - "PUBLIC", - "QUOTE", - "RANGE", - "RANK", - "READ", - "READS", - "REAL", - "RECHECK", - "RECURSIVE", - "REF", - "REFERENCES", - "REFERENCING", - "REGR_AVGX", - "REGR_AVGY", - "REGR_COUNT", - "REGR_INTERCEPT", - "REGR_R2", - "REGR_SLOPE", - "REGR_SXX", - "REGR_SXY", - "REGR_SYY", - "REINDEX", - "RELATIVE", - "RELEASE", - "RENAME", - "REPEATABLE", - "REPLACE", - "RESET", - "RESTART", - "RESTRICT", - "RESULT", - "RETURN", - "RETURNED_CARDINALITY", - "RETURNED_LENGTH", - "RETURNED_OCTET_LENGTH", - "RETURNED_SQLSTATE", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROUTINE_CATALOG", - "ROUTINE_NAME", - "ROUTINE_SCHEMA", - "ROW", - "ROWS", - "ROW_COUNT", - "ROW_NUMBER", - "RULE", - "SAVEPOINT", - "SCALE", - "SCHEMA", - "SCHEMA_NAME", - "SCOPE", - "SCOPE_CATALOG", - "SCOPE_NAME", - "SCOPE_SCHEMA", - "SCROLL", - "SEARCH", - "SECOND", - "SECTION", - "SECURITY", - "SELECT", - "SELF", - "SENSITIVE", - "SEQUENCE", - "SERIALIZABLE", - "SERVER_NAME", - "SESSION", - "SESSION_USER", - "SET", - "SETOF", - "SETS", - "SHARE", - "SHOW", - "SIMILAR", - "SIMPLE", - "SIZE", - "SMALLINT", - "SOME", - "SOURCE", - "SPACE", - "SPECIFIC", - "SPECIFICTYPE", - "SPECIFIC_NAME", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLEXCEPTION", - "SQLSTATE", - "SQLWARNING", - "SQRT", - "STABLE", - "START", - "STATE", - "STATEMENT", - "STATIC", - "STATISTICS", - "STDDEV_POP", - "STDDEV_SAMP", - "STDIN", - "STDOUT", - "STORAGE", - "STRICT", - "STRUCTURE", - "STYLE", - "SUBCLASS_ORIGIN", - "SUBLIST", - "SUBMULTISET", - "SUBSTRING", - "SUM", - "SUPERUSER", - "SYMMETRIC", - "SYSID", - "SYSTEM", - "SYSTEM_USER", - "TABLE", - "TABLESAMPLE", - "TABLESPACE", - "TABLE_NAME", - "TEMP", - "TEMPLATE", - "TEMPORARY", - "TERMINATE", - "THAN", - "THEN", - "TIES", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TOAST", - "TOP_LEVEL_COUNT", - "TRAILING", - "TRANSACTION", - "TRANSACTIONS_COMMITTED", - "TRANSACTIONS_ROLLED_BACK", - "TRANSACTION_ACTIVE", - "TRANSFORM", - "TRANSFORMS", - "TRANSLATE", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRIGGER_CATALOG", - "TRIGGER_NAME", - "TRIGGER_SCHEMA", - "TRIM", - "TRUE", - "TRUNCATE", - "TRUSTED", - "TYPE", - "UESCAPE", - "UNBOUNDED", - "UNCOMMITTED", - "UNDER", - "UNENCRYPTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNLISTEN", - "UNNAMED", - "UNNEST", - "UNTIL", - "UPDATE", - "UPPER", - "USAGE", - "USER", - "USER_DEFINED_TYPE_CATALOG", - "USER_DEFINED_TYPE_CODE", - "USER_DEFINED_TYPE_NAME", - "USER_DEFINED_TYPE_SCHEMA", - "USING", - "VACUUM", - "VALID", - "VALIDATOR", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VAR_POP", - "VAR_SAMP", - "VERBOSE", - "VIEW", - "VOLATILE", - "WHEN", - "WHENEVER", - "WHERE", - "WIDTH_BUCKET", - "WINDOW", - "WITH", - "WITHIN", - "WITHOUT", - "WORK", - "WRITE", - "YEAR", - "ZONE" - }, - nativeMeta.getReservedWords()); - - assertEquals("&", nativeMeta.getExtraOptionSeparator()); - assertEquals("?", nativeMeta.getExtraOptionIndicator()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertTrue(nativeMeta.isSupportsSequences()); - assertEquals(" limit 5", nativeMeta.getLimitClause(5)); - assertFalse(nativeMeta.isDefaultingToUppercase()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - } - - @Test - public void testSqlStatements() { - assertEquals("SELECT currval('FOO')", nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals("SELECT nextval('FOO')", nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals( - "SELECT relname AS sequence_name FROM sys_class WHERE relname = 'foo'", - nativeMeta.getSqlSequenceExists("FoO")); - assertEquals( - "SELECT relname AS sequence_name FROM sys_class", nativeMeta.getSqlListOfSequences()); - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" - + lineSep - + ";" - + lineSep - + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - - nativeMeta.setUsername("FOoUsEr"); - assertEquals( - "select proname from sys_proc, sys_user where sys_user.usesysid = sys_proc.proowner and upper(sys_user.usename) = 'FOOUSER'", - nativeMeta.getSqlListOfProcedures()); - assertEquals( - "LOCK TABLE FOO , BAR IN ACCESS EXCLUSIVE MODE;" + lineSep, - nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - assertNull(nativeMeta.getSqlUnlockTables(new String[] {})); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - // Simple hack to prevent duplication of code. Checking the case of supported boolean type - // both supported and unsupported. Should return BOOLEAN if supported, or CHAR(1) if not. - String[] typeCk = new String[] {"CHAR(1)", "BOOLEAN", "CHAR(1)"}; - int i = (nativeMeta.isSupportsBooleanDataType() ? 1 : 0); - assertEquals( - typeCk[i], - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "BIGSERIAL", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "BIGSERIAL", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 8, 0), "", "FOO", false, false, false)); - - assertEquals( - "NUMERIC(10, 5)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 10, 5), "", "", false, false, false)); - - assertEquals( - "NUMERIC(19, 0)", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 19, 0), "", "", false, false, false)); - - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 9, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 4, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); - - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", -7, -3), "", "", false, false, false)); - - assertEquals( - "TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), - "", - "", - false, - false, - false)); - assertEquals( - "TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "TEXT", - nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", false, false, false)); - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.kingbasees; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class KingbaseESDatabaseMetaTest { + + private KingbaseESDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new KingbaseESDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(54321, nativeMeta.getDefaultDatabasePort()); + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("com.kingbase.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:kingbase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:kingbase://FOO:/WIBBLE", + nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) + + assertArrayEquals( + new String[] { + // http://www.postgresql.org/docs/8.1/static/sql-keywords-appendix.html + // added also non-reserved key words because there is progress from the Postgre developers + // to add them + "A", + "ABORT", + "ABS", + "ABSOLUTE", + "ACCESS", + "ACTION", + "ADA", + "ADD", + "ADMIN", + "AFTER", + "AGGREGATE", + "ALIAS", + "ALL", + "ALLOCATE", + "ALSO", + "ALTER", + "ALWAYS", + "ANALYSE", + "ANALYZE", + "AND", + "ANY", + "ARE", + "ARRAY", + "AS", + "ASC", + "ASENSITIVE", + "ASSERTION", + "ASSIGNMENT", + "ASYMMETRIC", + "AT", + "ATOMIC", + "ATTRIBUTE", + "ATTRIBUTES", + "AUTHORIZATION", + "AVG", + "BACKWARD", + "BEFORE", + "BEGIN", + "BERNOULLI", + "BETWEEN", + "BIGINT", + "BINARY", + "BIT", + "BITVAR", + "BIT_LENGTH", + "BLOB", + "BOOLEAN", + "BOTH", + "BREADTH", + "BY", + "C", + "CACHE", + "CALL", + "CALLED", + "CARDINALITY", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CATALOG_NAME", + "CEIL", + "CEILING", + "CHAIN", + "CHAR", + "CHARACTER", + "CHARACTERISTICS", + "CHARACTERS", + "CHARACTER_LENGTH", + "CHARACTER_SET_CATALOG", + "CHARACTER_SET_NAME", + "CHARACTER_SET_SCHEMA", + "CHAR_LENGTH", + "CHECK", + "CHECKED", + "CHECKPOINT", + "CLASS", + "CLASS_ORIGIN", + "CLOB", + "CLOSE", + "CLUSTER", + "COALESCE", + "COBOL", + "COLLATE", + "COLLATION", + "COLLATION_CATALOG", + "COLLATION_NAME", + "COLLATION_SCHEMA", + "COLLECT", + "COLUMN", + "COLUMN_NAME", + "COMMAND_FUNCTION", + "COMMAND_FUNCTION_CODE", + "COMMENT", + "COMMIT", + "COMMITTED", + "COMPLETION", + "CONDITION", + "CONDITION_NUMBER", + "CONNECT", + "CONNECTION", + "CONNECTION_NAME", + "CONSTRAINT", + "CONSTRAINTS", + "CONSTRAINT_CATALOG", + "CONSTRAINT_NAME", + "CONSTRAINT_SCHEMA", + "CONSTRUCTOR", + "CONTAINS", + "CONTINUE", + "CONVERSION", + "CONVERT", + "COPY", + "CORR", + "CORRESPONDING", + "COUNT", + "COVAR_POP", + "COVAR_SAMP", + "CREATE", + "CREATEDB", + "CREATEROLE", + "CREATEUSER", + "CROSS", + "CSV", + "CUBE", + "CUME_DIST", + "CURRENT", + "CURRENT_DATE", + "CURRENT_DEFAULT_TRANSFORM_GROUP", + "CURRENT_PATH", + "CURRENT_ROLE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_TRANSFORM_GROUP_FOR_TYPE", + "CURRENT_USER", + "CURSOR", + "CURSOR_NAME", + "CYCLE", + "DATA", + "DATABASE", + "DATE", + "DATETIME_INTERVAL_CODE", + "DATETIME_INTERVAL_PRECISION", + "DAY", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFAULTS", + "DEFERRABLE", + "DEFERRED", + "DEFINED", + "DEFINER", + "DEGREE", + "DELETE", + "DELIMITER", + "DELIMITERS", + "DENSE_RANK", + "DEPTH", + "DEREF", + "DERIVED", + "DESC", + "DESCRIBE", + "DESCRIPTOR", + "DESTROY", + "DESTRUCTOR", + "DETERMINISTIC", + "DIAGNOSTICS", + "DICTIONARY", + "DISABLE", + "DISCONNECT", + "DISPATCH", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "DYNAMIC", + "DYNAMIC_FUNCTION", + "DYNAMIC_FUNCTION_CODE", + "EACH", + "ELEMENT", + "ELSE", + "ENABLE", + "ENCODING", + "ENCRYPTED", + "END", + "END-EXEC", + "EQUALS", + "ESCAPE", + "EVERY", + "EXCEPT", + "EXCEPTION", + "EXCLUDE", + "EXCLUDING", + "EXCLUSIVE", + "EXEC", + "EXECUTE", + "EXISTING", + "EXISTS", + "EXP", + "EXPLAIN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FILTER", + "FINAL", + "FIRST", + "FLOAT", + "FLOOR", + "FOLLOWING", + "FOR", + "FORCE", + "FOREIGN", + "FORTRAN", + "FORWARD", + "FOUND", + "FREE", + "FREEZE", + "FROM", + "FULL", + "FUNCTION", + "FUSION", + "G", + "GENERAL", + "GENERATED", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GRANTED", + "GREATEST", + "GROUP", + "GROUPING", + "HANDLER", + "HAVING", + "HEADER", + "HIERARCHY", + "HOLD", + "HOST", + "HOUR", + "IDENTITY", + "IGNORE", + "ILIKE", + "IMMEDIATE", + "IMMUTABLE", + "IMPLEMENTATION", + "IMPLICIT", + "IN", + "INCLUDING", + "INCREMENT", + "INDEX", + "INDICATOR", + "INFIX", + "INHERIT", + "INHERITS", + "INITIALIZE", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSENSITIVE", + "INSERT", + "INSTANCE", + "INSTANTIABLE", + "INSTEAD", + "INT", + "INTEGER", + "INTERSECT", + "INTERSECTION", + "INTERVAL", + "INTO", + "INVOKER", + "IS", + "ISNULL", + "ISOLATION", + "ITERATE", + "JOIN", + "K", + "KEY", + "KEY_MEMBER", + "KEY_TYPE", + "LANCOMPILER", + "LANGUAGE", + "LARGE", + "LAST", + "LATERAL", + "LEADING", + "LEAST", + "LEFT", + "LENGTH", + "LESS", + "LEVEL", + "LIKE", + "LIMIT", + "LISTEN", + "LN", + "LOAD", + "LOCAL", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATION", + "LOCATOR", + "LOCK", + "LOGIN", + "LOWER", + "M", + "MAP", + "MATCH", + "MATCHED", + "MAX", + "MAXVALUE", + "MEMBER", + "MERGE", + "MESSAGE_LENGTH", + "MESSAGE_OCTET_LENGTH", + "MESSAGE_TEXT", + "METHOD", + "MIN", + "MINUTE", + "MINVALUE", + "MOD", + "MODE", + "MODIFIES", + "MODIFY", + "MODULE", + "MONTH", + "MORE", + "MOVE", + "MULTISET", + "MUMPS", + "NAME", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NCLOB", + "NESTING", + "NEW", + "NEXT", + "NO", + "NOCREATEDB", + "NOCREATEROLE", + "NOCREATEUSER", + "NOINHERIT", + "NOLOGIN", + "NONE", + "NORMALIZE", + "NORMALIZED", + "NOSUPERUSER", + "NOT", + "NOTHING", + "NOTIFY", + "NOTNULL", + "NOWAIT", + "NULL", + "NULLABLE", + "NULLIF", + "NULLS", + "NUMBER", + "NUMERIC", + "OBJECT", + "OCTETS", + "OCTET_LENGTH", + "OF", + "OFF", + "OFFSET", + "OIDS", + "OLD", + "ON", + "ONLY", + "OPEN", + "OPERATION", + "OPERATOR", + "OPTION", + "OPTIONS", + "OR", + "ORDER", + "ORDERING", + "ORDINALITY", + "OTHERS", + "OUT", + "OUTER", + "OUTPUT", + "OVER", + "OVERLAPS", + "OVERLAY", + "OVERRIDING", + "OWNER", + "PAD", + "PARAMETER", + "PARAMETERS", + "PARAMETER_MODE", + "PARAMETER_NAME", + "PARAMETER_ORDINAL_POSITION", + "PARAMETER_SPECIFIC_CATALOG", + "PARAMETER_SPECIFIC_NAME", + "PARAMETER_SPECIFIC_SCHEMA", + "PARTIAL", + "PARTITION", + "PASCAL", + "PASSWORD", + "PATH", + "PERCENTILE_CONT", + "PERCENTILE_DISC", + "PERCENT_RANK", + "PLACING", + "PLI", + "POSITION", + "POSTFIX", + "POWER", + "PRECEDING", + "PRECISION", + "PREFIX", + "PREORDER", + "PREPARE", + "PREPARED", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURAL", + "PROCEDURE", + "PUBLIC", + "QUOTE", + "RANGE", + "RANK", + "READ", + "READS", + "REAL", + "RECHECK", + "RECURSIVE", + "REF", + "REFERENCES", + "REFERENCING", + "REGR_AVGX", + "REGR_AVGY", + "REGR_COUNT", + "REGR_INTERCEPT", + "REGR_R2", + "REGR_SLOPE", + "REGR_SXX", + "REGR_SXY", + "REGR_SYY", + "REINDEX", + "RELATIVE", + "RELEASE", + "RENAME", + "REPEATABLE", + "REPLACE", + "RESET", + "RESTART", + "RESTRICT", + "RESULT", + "RETURN", + "RETURNED_CARDINALITY", + "RETURNED_LENGTH", + "RETURNED_OCTET_LENGTH", + "RETURNED_SQLSTATE", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROLLUP", + "ROUTINE", + "ROUTINE_CATALOG", + "ROUTINE_NAME", + "ROUTINE_SCHEMA", + "ROW", + "ROWS", + "ROW_COUNT", + "ROW_NUMBER", + "RULE", + "SAVEPOINT", + "SCALE", + "SCHEMA", + "SCHEMA_NAME", + "SCOPE", + "SCOPE_CATALOG", + "SCOPE_NAME", + "SCOPE_SCHEMA", + "SCROLL", + "SEARCH", + "SECOND", + "SECTION", + "SECURITY", + "SELECT", + "SELF", + "SENSITIVE", + "SEQUENCE", + "SERIALIZABLE", + "SERVER_NAME", + "SESSION", + "SESSION_USER", + "SET", + "SETOF", + "SETS", + "SHARE", + "SHOW", + "SIMILAR", + "SIMPLE", + "SIZE", + "SMALLINT", + "SOME", + "SOURCE", + "SPACE", + "SPECIFIC", + "SPECIFICTYPE", + "SPECIFIC_NAME", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLEXCEPTION", + "SQLSTATE", + "SQLWARNING", + "SQRT", + "STABLE", + "START", + "STATE", + "STATEMENT", + "STATIC", + "STATISTICS", + "STDDEV_POP", + "STDDEV_SAMP", + "STDIN", + "STDOUT", + "STORAGE", + "STRICT", + "STRUCTURE", + "STYLE", + "SUBCLASS_ORIGIN", + "SUBLIST", + "SUBMULTISET", + "SUBSTRING", + "SUM", + "SUPERUSER", + "SYMMETRIC", + "SYSID", + "SYSTEM", + "SYSTEM_USER", + "TABLE", + "TABLESAMPLE", + "TABLESPACE", + "TABLE_NAME", + "TEMP", + "TEMPLATE", + "TEMPORARY", + "TERMINATE", + "THAN", + "THEN", + "TIES", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TOAST", + "TOP_LEVEL_COUNT", + "TRAILING", + "TRANSACTION", + "TRANSACTIONS_COMMITTED", + "TRANSACTIONS_ROLLED_BACK", + "TRANSACTION_ACTIVE", + "TRANSFORM", + "TRANSFORMS", + "TRANSLATE", + "TRANSLATION", + "TREAT", + "TRIGGER", + "TRIGGER_CATALOG", + "TRIGGER_NAME", + "TRIGGER_SCHEMA", + "TRIM", + "TRUE", + "TRUNCATE", + "TRUSTED", + "TYPE", + "UESCAPE", + "UNBOUNDED", + "UNCOMMITTED", + "UNDER", + "UNENCRYPTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNLISTEN", + "UNNAMED", + "UNNEST", + "UNTIL", + "UPDATE", + "UPPER", + "USAGE", + "USER", + "USER_DEFINED_TYPE_CATALOG", + "USER_DEFINED_TYPE_CODE", + "USER_DEFINED_TYPE_NAME", + "USER_DEFINED_TYPE_SCHEMA", + "USING", + "VACUUM", + "VALID", + "VALIDATOR", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VAR_POP", + "VAR_SAMP", + "VERBOSE", + "VIEW", + "VOLATILE", + "WHEN", + "WHENEVER", + "WHERE", + "WIDTH_BUCKET", + "WINDOW", + "WITH", + "WITHIN", + "WITHOUT", + "WORK", + "WRITE", + "YEAR", + "ZONE" + }, + nativeMeta.getReservedWords()); + + assertEquals("&", nativeMeta.getExtraOptionSeparator()); + assertEquals("?", nativeMeta.getExtraOptionIndicator()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertTrue(nativeMeta.isSupportsSequences()); + assertEquals(" limit 5", nativeMeta.getLimitClause(5)); + assertFalse(nativeMeta.isDefaultingToUppercase()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + } + + @Test + public void testSqlStatements() { + assertEquals("SELECT currval('FOO')", nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals("SELECT nextval('FOO')", nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals( + "SELECT relname AS sequence_name FROM sys_class WHERE relname = 'foo'", + nativeMeta.getSqlSequenceExists("FoO")); + assertEquals( + "SELECT relname AS sequence_name FROM sys_class", nativeMeta.getSqlListOfSequences()); + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + + lineSep + + ";" + + lineSep + + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + + nativeMeta.setUsername("FOoUsEr"); + assertEquals( + "select proname from sys_proc, sys_user where sys_user.usesysid = sys_proc.proowner and upper(sys_user.usename) = 'FOOUSER'", + nativeMeta.getSqlListOfProcedures()); + assertEquals( + "LOCK TABLE FOO , BAR IN ACCESS EXCLUSIVE MODE;" + lineSep, + nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + assertNull(nativeMeta.getSqlUnlockTables(new String[] {})); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + // Simple hack to prevent duplication of code. Checking the case of supported boolean type + // both supported and unsupported. Should return BOOLEAN if supported, or CHAR(1) if not. + String[] typeCk = new String[] {"CHAR(1)", "BOOLEAN", "CHAR(1)"}; + int i = (nativeMeta.isSupportsBooleanDataType() ? 1 : 0); + assertEquals( + typeCk[i], + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "BIGSERIAL", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "BIGSERIAL", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 8, 0), "", "FOO", false, false, false)); + + assertEquals( + "NUMERIC(10, 5)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 10, 5), "", "", false, false, false)); + + assertEquals( + "NUMERIC(19, 0)", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 19, 0), "", "", false, false, false)); + + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 9, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 4, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); + + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", -7, -3), "", "", false, false, false)); + + assertEquals( + "TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), + "", + "", + false, + false, + false)); + assertEquals( + "TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "TEXT", + nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", false, false, false)); + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESSequenceAndReleaseSavePointTest.java b/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESSequenceAndReleaseSavePointTest.java index a0e4bb1719f..e9f28d5c9a1 100644 --- a/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/kingbasees/src/test/java/org/apache/hop/databases/kingbasees/KingbaseESSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.kingbasees; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class KingbaseESSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/mariadb/src/main/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMeta.java b/plugins/databases/mariadb/src/main/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMeta.java index 5d72aecd798..ec421ca1794 100644 --- a/plugins/databases/mariadb/src/main/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMeta.java +++ b/plugins/databases/mariadb/src/main/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMeta.java @@ -1,96 +1,98 @@ -/* - * 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 org.apache.hop.databases.mariadb; - -import com.google.common.collect.Sets; -import org.apache.hop.core.database.DatabaseMetaPlugin; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.gui.plugin.GuiPlugin; -import org.apache.hop.core.util.Utils; -import org.apache.hop.databases.mysql.MySqlDatabaseMeta; -import org.apache.hop.i18n.BaseMessages; - -import java.sql.DatabaseMetaData; -import java.sql.ResultSetMetaData; -import java.util.Set; - -@DatabaseMetaPlugin(type = "MARIADB", typeDescription = "MariaDB", documentationUrl = "/database/databases/mariadb.html") -@GuiPlugin(id = "GUI-MariaDBDatabaseMeta") -public class MariaDBDatabaseMeta extends MySqlDatabaseMeta { - private static final Class PKG = MariaDBDatabaseMeta.class; // For Translator - - private static final Set SHORT_MESSAGE_EXCEPTIONS = - Sets.newHashSet("org.mariadb.jdbc.internal.stream.MaxAllowedPacketException"); - - @Override - public String getDriverClass() { - return "org.mariadb.jdbc.Driver"; - } - - @Override - public String getURL(String hostname, String port, String databaseName) { - if (Utils.isEmpty(port)) { - return "jdbc:mariadb://" + hostname + "/" + databaseName; - } else { - return "jdbc:mariadb://" + hostname + ":" + port + "/" + databaseName; - } - } - - @Override - public boolean isFullExceptionLog(Exception e) { - Throwable cause = (e == null ? null : e.getCause()); - return !(cause != null && SHORT_MESSAGE_EXCEPTIONS.contains(cause.getClass().getName())); - } - - /** - * Returns the column name for a MariaDB field. - * - * @param dbMetaData - * @param rsMetaData - * @param index - * @return The column label. - * @throws HopDatabaseException - */ - @Override - public String getLegacyColumnName( - DatabaseMetaData dbMetaData, ResultSetMetaData rsMetaData, int index) - throws HopDatabaseException { - if (dbMetaData == null) { - throw new HopDatabaseException( - BaseMessages.getString( - PKG, "MariaDBDatabaseMeta.Exception.LegacyColumnNameNoDBMetaDataException")); - } - - if (rsMetaData == null) { - throw new HopDatabaseException( - BaseMessages.getString( - PKG, "MariaDBDatabaseMeta.Exception.LegacyColumnNameNoRSMetaDataException")); - } - - try { - return rsMetaData.getColumnLabel(index); - } catch (Exception e) { - throw new HopDatabaseException( - String.format( - "%s: %s", - BaseMessages.getString( - PKG, "MariaDBDatabaseMeta.Exception.LegacyColumnNameException"), - e.getMessage()), - e); - } - } -} +/* + * 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 org.apache.hop.databases.mariadb; + +import com.google.common.collect.Sets; +import java.sql.DatabaseMetaData; +import java.sql.ResultSetMetaData; +import java.util.Set; +import org.apache.hop.core.database.DatabaseMetaPlugin; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.gui.plugin.GuiPlugin; +import org.apache.hop.core.util.Utils; +import org.apache.hop.databases.mysql.MySqlDatabaseMeta; +import org.apache.hop.i18n.BaseMessages; + +@DatabaseMetaPlugin( + type = "MARIADB", + typeDescription = "MariaDB", + documentationUrl = "/database/databases/mariadb.html") +@GuiPlugin(id = "GUI-MariaDBDatabaseMeta") +public class MariaDBDatabaseMeta extends MySqlDatabaseMeta { + private static final Class PKG = MariaDBDatabaseMeta.class; // For Translator + + private static final Set SHORT_MESSAGE_EXCEPTIONS = + Sets.newHashSet("org.mariadb.jdbc.internal.stream.MaxAllowedPacketException"); + + @Override + public String getDriverClass() { + return "org.mariadb.jdbc.Driver"; + } + + @Override + public String getURL(String hostname, String port, String databaseName) { + if (Utils.isEmpty(port)) { + return "jdbc:mariadb://" + hostname + "/" + databaseName; + } else { + return "jdbc:mariadb://" + hostname + ":" + port + "/" + databaseName; + } + } + + @Override + public boolean isFullExceptionLog(Exception e) { + Throwable cause = (e == null ? null : e.getCause()); + return !(cause != null && SHORT_MESSAGE_EXCEPTIONS.contains(cause.getClass().getName())); + } + + /** + * Returns the column name for a MariaDB field. + * + * @param dbMetaData + * @param rsMetaData + * @param index + * @return The column label. + * @throws HopDatabaseException + */ + @Override + public String getLegacyColumnName( + DatabaseMetaData dbMetaData, ResultSetMetaData rsMetaData, int index) + throws HopDatabaseException { + if (dbMetaData == null) { + throw new HopDatabaseException( + BaseMessages.getString( + PKG, "MariaDBDatabaseMeta.Exception.LegacyColumnNameNoDBMetaDataException")); + } + + if (rsMetaData == null) { + throw new HopDatabaseException( + BaseMessages.getString( + PKG, "MariaDBDatabaseMeta.Exception.LegacyColumnNameNoRSMetaDataException")); + } + + try { + return rsMetaData.getColumnLabel(index); + } catch (Exception e) { + throw new HopDatabaseException( + String.format( + "%s: %s", + BaseMessages.getString( + PKG, "MariaDBDatabaseMeta.Exception.LegacyColumnNameException"), + e.getMessage()), + e); + } + } +} diff --git a/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMetaTest.java b/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMetaTest.java index 4cd96675cf8..87a3dd733b4 100644 --- a/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMetaTest.java +++ b/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBDatabaseMetaTest.java @@ -1,171 +1,170 @@ -/* - * 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 org.apache.hop.databases.mariadb; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.sql.DatabaseMetaData; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.mockito.BDDMockito.doReturn; -import static org.mockito.BDDMockito.doThrow; -import static org.mockito.BDDMockito.mock; - -public class MariaDBDatabaseMetaTest { - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - } - - /** - * @return - * @throws Exception - */ - private ResultSetMetaData getResultSetMetaData() throws Exception { - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - - /** - * Fields setup around the following query: - * - *

select CUSTOMERNUMBER as NUMBER , CUSTOMERNAME as NAME , CONTACTLASTNAME as LAST_NAME , - * CONTACTFIRSTNAME as FIRST_NAME , 'MariaDB' as DB , 'NoAliasText' from CUSTOMERS ORDER BY - * CUSTOMERNAME; - */ - doReturn("NUMBER").when(resultSetMetaData).getColumnLabel(1); - doReturn("NAME").when(resultSetMetaData).getColumnLabel(2); - doReturn("LAST_NAME").when(resultSetMetaData).getColumnLabel(3); - doReturn("FIRST_NAME").when(resultSetMetaData).getColumnLabel(4); - doReturn("DB").when(resultSetMetaData).getColumnLabel(5); - doReturn("NoAliasText").when(resultSetMetaData).getColumnLabel(6); - - return resultSetMetaData; - } - - /** - * @return - * @throws Exception - */ - private ResultSetMetaData getResultSetMetaDataException() throws Exception { - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - - doThrow(new SQLException()).when(resultSetMetaData).getColumnLabel(1); - - return resultSetMetaData; - } - - @Test - public void testGetLegacyColumnNameFieldNumber() throws Exception { - assertEquals( - "NUMBER", - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 1)); - } - - @Test - public void testGetLegacyColumnNameFieldName() throws Exception { - assertEquals( - "NAME", - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 2)); - } - - @Test - public void testGetLegacyColumnNameFieldLastName() throws Exception { - assertEquals( - "LAST_NAME", - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 3)); - } - - @Test - public void testGetLegacyColumnNameFieldFirstName() throws Exception { - assertEquals( - "FIRST_NAME", - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 4)); - } - - @Test - public void testGetLegacyColumnNameFieldDB() throws Exception { - assertEquals( - "DB", - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 5)); - } - - @Test - public void testGetLegacyColumnNameNoAliasText() throws Exception { - assertEquals( - "NoAliasText", - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 6)); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameNullDBMetaDataException() throws Exception { - new MariaDBDatabaseMeta().getLegacyColumnName(null, getResultSetMetaData(), 1); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameNullRSMetaDataException() throws Exception { - new MariaDBDatabaseMeta().getLegacyColumnName(mock(DatabaseMetaData.class), null, 1); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameDatabaseException() throws Exception { - new MariaDBDatabaseMeta() - .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaDataException(), 1); - } - - @Test - public void testMysqlOverrides() { - MariaDBDatabaseMeta nativeMeta = new MariaDBDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - - assertEquals(3306, nativeMeta.getDefaultDatabasePort()); - - assertEquals("org.mariadb.jdbc.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:mariadb://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals("jdbc:mariadb://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); - - // The fullExceptionLog method is covered by another test case. - } - - @Test - public void testAddOptionsMariaDB() { - DatabaseMeta databaseMeta = - new DatabaseMeta("", "MariaDB", "JDBC", null, "stub:stub", null, null, null); - Map options = databaseMeta.getExtraOptions(); - if (!options.keySet().contains("MARIADB.defaultFetchSize")) { - fail(); - } - } -} +/* + * 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 org.apache.hop.databases.mariadb; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.BDDMockito.doReturn; +import static org.mockito.BDDMockito.doThrow; +import static org.mockito.BDDMockito.mock; + +import java.sql.DatabaseMetaData; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.Map; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.junit.BeforeClass; +import org.junit.Test; + +public class MariaDBDatabaseMetaTest { + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + } + + /** + * @return + * @throws Exception + */ + private ResultSetMetaData getResultSetMetaData() throws Exception { + ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); + + /** + * Fields setup around the following query: + * + *

select CUSTOMERNUMBER as NUMBER , CUSTOMERNAME as NAME , CONTACTLASTNAME as LAST_NAME , + * CONTACTFIRSTNAME as FIRST_NAME , 'MariaDB' as DB , 'NoAliasText' from CUSTOMERS ORDER BY + * CUSTOMERNAME; + */ + doReturn("NUMBER").when(resultSetMetaData).getColumnLabel(1); + doReturn("NAME").when(resultSetMetaData).getColumnLabel(2); + doReturn("LAST_NAME").when(resultSetMetaData).getColumnLabel(3); + doReturn("FIRST_NAME").when(resultSetMetaData).getColumnLabel(4); + doReturn("DB").when(resultSetMetaData).getColumnLabel(5); + doReturn("NoAliasText").when(resultSetMetaData).getColumnLabel(6); + + return resultSetMetaData; + } + + /** + * @return + * @throws Exception + */ + private ResultSetMetaData getResultSetMetaDataException() throws Exception { + ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); + + doThrow(new SQLException()).when(resultSetMetaData).getColumnLabel(1); + + return resultSetMetaData; + } + + @Test + public void testGetLegacyColumnNameFieldNumber() throws Exception { + assertEquals( + "NUMBER", + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 1)); + } + + @Test + public void testGetLegacyColumnNameFieldName() throws Exception { + assertEquals( + "NAME", + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 2)); + } + + @Test + public void testGetLegacyColumnNameFieldLastName() throws Exception { + assertEquals( + "LAST_NAME", + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 3)); + } + + @Test + public void testGetLegacyColumnNameFieldFirstName() throws Exception { + assertEquals( + "FIRST_NAME", + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 4)); + } + + @Test + public void testGetLegacyColumnNameFieldDB() throws Exception { + assertEquals( + "DB", + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 5)); + } + + @Test + public void testGetLegacyColumnNameNoAliasText() throws Exception { + assertEquals( + "NoAliasText", + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaData(), 6)); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameNullDBMetaDataException() throws Exception { + new MariaDBDatabaseMeta().getLegacyColumnName(null, getResultSetMetaData(), 1); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameNullRSMetaDataException() throws Exception { + new MariaDBDatabaseMeta().getLegacyColumnName(mock(DatabaseMetaData.class), null, 1); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameDatabaseException() throws Exception { + new MariaDBDatabaseMeta() + .getLegacyColumnName(mock(DatabaseMetaData.class), getResultSetMetaDataException(), 1); + } + + @Test + public void testMysqlOverrides() { + MariaDBDatabaseMeta nativeMeta = new MariaDBDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + + assertEquals(3306, nativeMeta.getDefaultDatabasePort()); + + assertEquals("org.mariadb.jdbc.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:mariadb://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals("jdbc:mariadb://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); + + // The fullExceptionLog method is covered by another test case. + } + + @Test + public void testAddOptionsMariaDB() { + DatabaseMeta databaseMeta = + new DatabaseMeta("", "MariaDB", "JDBC", null, "stub:stub", null, null, null); + Map options = databaseMeta.getExtraOptions(); + if (!options.keySet().contains("MARIADB.defaultFetchSize")) { + fail(); + } + } +} diff --git a/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBSequenceAndReleaseSavePointTest.java b/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBSequenceAndReleaseSavePointTest.java index 18f39656108..4a790b91e60 100644 --- a/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/mariadb/src/test/java/org/apache/hop/databases/mariadb/MariaDBSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.mariadb; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class MariaDBSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBDatabaseMetaTest.java b/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBDatabaseMetaTest.java index adefd3888f0..8c5d799f4ad 100644 --- a/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBDatabaseMetaTest.java +++ b/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBDatabaseMetaTest.java @@ -1,291 +1,291 @@ -/* - * 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 org.apache.hop.databases.monetdb; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class MonetDBDatabaseMetaTest { - - private MonetDBDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new MonetDBDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(50000, nativeMeta.getDefaultDatabasePort()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("nl.cwi.monetdb.jdbc.MonetDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:monetdb://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals("jdbc:monetdb://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); - assertFalse(nativeMeta.isFetchSizeSupported()); - assertTrue(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertTrue(nativeMeta.isSupportsBatchUpdates()); - assertTrue(nativeMeta.isSupportsSetMaxRows()); - assertArrayEquals( - new String[] { - "IS", - "ISNULL", - "NOTNULL", - "IN", - "BETWEEN", - "OVERLAPS", - "LIKE", - "ILIKE", - "NOT", - "AND", - "OR", - "CHAR", - "VARCHAR", - "CLOB", - "BLOB", - "DECIMAL", - "DEC", - "NUMERIC", - "TINYINT", - "SMALLINT", - "INT", - "BIGINT", - "REAL", - "DOUBLE", - "BOOLEAN", - "DATE", - "TIME", - "TIMESTAMP", - "INTERVAL", - "YEAR", - "MONTH", - "DAY", - "HOUR", - "MINUTE", - "SECOND", - "TIMEZONE", - "EXTRACT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "LOCALTIME", - "LOCALTIMESTAMP", - "CURRENT_TIME", - "SERIAL", - "START", - "WITH", - "INCREMENT", - "CACHE", - "CYCLE", - "SEQUENCE", - "GETANCHOR", - "GETBASENAME", - "GETCONTENT", - "GETCONTEXT", - "GETDOMAIN", - "GETEXTENSION", - "GETFILE", - "GETHOST", - "GETPORT", - "GETPROTOCOL", - "GETQUERY", - "GETUSER", - "GETROBOTURL", - "ISURL", - "NEWURL", - "BROADCAST", - "MASKLEN", - "SETMASKLEN", - "NETMASK", - "HOSTMASK", - "NETWORK", - "TEXT", - "ABBREV", - "CREATE", - "TYPE", - "NAME", - "DROP", - "USER" - }, - nativeMeta.getReservedWords()); - assertTrue(nativeMeta.isSupportsResultSetMetadataRetrievalOnly()); - assertEquals(Integer.MAX_VALUE, nativeMeta.getMaxVARCHARLength()); - assertTrue(nativeMeta.isSupportsSequences()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals( - "SELECT * FROM FOO;", - nativeMeta.getSqlQueryFields( - "FOO")); // Pretty sure the semicolon shouldn't be there - likely bug. - assertEquals("SELECT name FROM sys.sequences", nativeMeta.getSqlListOfSequences()); - assertEquals( - "SELECT * FROM sys.sequences WHERE name = 'FOO'", nativeMeta.getSqlSequenceExists("FOO")); - assertEquals( - "SELECT get_value_for( 'sys', 'FOO' )", nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals( - "SELECT next_value_for( 'sys', 'FOO' )", nativeMeta.getSqlNextSequenceValue("FOO")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - - // Simple hack to prevent duplication of code. Checking the case of supported boolean type - // both supported and unsupported. Should return BOOLEAN if supported, or CHAR(1) if not. - String[] typeCk = new String[] {"CHAR(1)", "BOOLEAN", "CHAR(1)"}; - int i = (nativeMeta.isSupportsBooleanDataType() ? 1 : 0); - assertEquals( - typeCk[i], - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "SERIAL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", true, false, false)); - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 8, 0), "", "FOO", false, false, false)); - - // integer types ( precision == 0 ) - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 8, 0), "", "", false, false, false)); - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "DECIMAL(19)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 19, 0), "", "", false, false, false)); - assertEquals( - "DOUBLE", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 8, 0), "", "", false, false, false)); - - // Numerics with precisions - assertEquals( - "DECIMAL(19, 5)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 19, 5), "", "", false, false, false)); - - assertEquals( - "DECIMAL(19)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 19, -5), "", "", false, false, false)); - - assertEquals( - "DOUBLE", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 11, 5), "", "", false, false, false)); - - // String Types - assertEquals( - "VARCHAR(10)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 10, 0), "", "", false, false, false)); - - // This next one is a bug: - // getMaxVARCHARLength = Integer.MAX_VALUE, - // if statement for CLOB trips if length > getMaxVARCHARLength() - // length is of type int - so this could never happen - assertEquals( - "VARCHAR()", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() + 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - "VARCHAR()", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -2, 0), - "", - "", - false, - false, - false)); // should end up with (100) if "safeMode = true" - - MonetDBDatabaseMeta.safeModeLocal.set(new Boolean(true)); - assertEquals( - "VARCHAR(100)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -2, 0), - "", - "", - false, - false, - false)); // should end up with (100) if "safeMode = true" - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.monetdb; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class MonetDBDatabaseMetaTest { + + private MonetDBDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new MonetDBDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(50000, nativeMeta.getDefaultDatabasePort()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("nl.cwi.monetdb.jdbc.MonetDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:monetdb://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals("jdbc:monetdb://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); + assertFalse(nativeMeta.isFetchSizeSupported()); + assertTrue(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertTrue(nativeMeta.isSupportsBatchUpdates()); + assertTrue(nativeMeta.isSupportsSetMaxRows()); + assertArrayEquals( + new String[] { + "IS", + "ISNULL", + "NOTNULL", + "IN", + "BETWEEN", + "OVERLAPS", + "LIKE", + "ILIKE", + "NOT", + "AND", + "OR", + "CHAR", + "VARCHAR", + "CLOB", + "BLOB", + "DECIMAL", + "DEC", + "NUMERIC", + "TINYINT", + "SMALLINT", + "INT", + "BIGINT", + "REAL", + "DOUBLE", + "BOOLEAN", + "DATE", + "TIME", + "TIMESTAMP", + "INTERVAL", + "YEAR", + "MONTH", + "DAY", + "HOUR", + "MINUTE", + "SECOND", + "TIMEZONE", + "EXTRACT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "LOCALTIME", + "LOCALTIMESTAMP", + "CURRENT_TIME", + "SERIAL", + "START", + "WITH", + "INCREMENT", + "CACHE", + "CYCLE", + "SEQUENCE", + "GETANCHOR", + "GETBASENAME", + "GETCONTENT", + "GETCONTEXT", + "GETDOMAIN", + "GETEXTENSION", + "GETFILE", + "GETHOST", + "GETPORT", + "GETPROTOCOL", + "GETQUERY", + "GETUSER", + "GETROBOTURL", + "ISURL", + "NEWURL", + "BROADCAST", + "MASKLEN", + "SETMASKLEN", + "NETMASK", + "HOSTMASK", + "NETWORK", + "TEXT", + "ABBREV", + "CREATE", + "TYPE", + "NAME", + "DROP", + "USER" + }, + nativeMeta.getReservedWords()); + assertTrue(nativeMeta.isSupportsResultSetMetadataRetrievalOnly()); + assertEquals(Integer.MAX_VALUE, nativeMeta.getMaxVARCHARLength()); + assertTrue(nativeMeta.isSupportsSequences()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals( + "SELECT * FROM FOO;", + nativeMeta.getSqlQueryFields( + "FOO")); // Pretty sure the semicolon shouldn't be there - likely bug. + assertEquals("SELECT name FROM sys.sequences", nativeMeta.getSqlListOfSequences()); + assertEquals( + "SELECT * FROM sys.sequences WHERE name = 'FOO'", nativeMeta.getSqlSequenceExists("FOO")); + assertEquals( + "SELECT get_value_for( 'sys', 'FOO' )", nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals( + "SELECT next_value_for( 'sys', 'FOO' )", nativeMeta.getSqlNextSequenceValue("FOO")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + + // Simple hack to prevent duplication of code. Checking the case of supported boolean type + // both supported and unsupported. Should return BOOLEAN if supported, or CHAR(1) if not. + String[] typeCk = new String[] {"CHAR(1)", "BOOLEAN", "CHAR(1)"}; + int i = (nativeMeta.isSupportsBooleanDataType() ? 1 : 0); + assertEquals( + typeCk[i], + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "SERIAL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", true, false, false)); + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 8, 0), "", "FOO", false, false, false)); + + // integer types ( precision == 0 ) + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 8, 0), "", "", false, false, false)); + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "DECIMAL(19)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 19, 0), "", "", false, false, false)); + assertEquals( + "DOUBLE", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 8, 0), "", "", false, false, false)); + + // Numerics with precisions + assertEquals( + "DECIMAL(19, 5)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 19, 5), "", "", false, false, false)); + + assertEquals( + "DECIMAL(19)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 19, -5), "", "", false, false, false)); + + assertEquals( + "DOUBLE", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 11, 5), "", "", false, false, false)); + + // String Types + assertEquals( + "VARCHAR(10)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 10, 0), "", "", false, false, false)); + + // This next one is a bug: + // getMaxVARCHARLength = Integer.MAX_VALUE, + // if statement for CLOB trips if length > getMaxVARCHARLength() + // length is of type int - so this could never happen + assertEquals( + "VARCHAR()", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() + 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + "VARCHAR()", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -2, 0), + "", + "", + false, + false, + false)); // should end up with (100) if "safeMode = true" + + MonetDBDatabaseMeta.safeModeLocal.set(new Boolean(true)); + assertEquals( + "VARCHAR(100)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -2, 0), + "", + "", + false, + false, + false)); // should end up with (100) if "safeMode = true" + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBSequenceAndReleaseSavePointTest.java b/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBSequenceAndReleaseSavePointTest.java index 7f79b33c864..3f31bdcdb0a 100644 --- a/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/monetdb/src/test/java/org/apache/hop/databases/monetdb/MonetDBSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.monetdb; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class MonetDBSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/mssql/src/main/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta.java b/plugins/databases/mssql/src/main/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta.java index 4524866740c..d053047dc2a 100644 --- a/plugins/databases/mssql/src/main/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta.java +++ b/plugins/databases/mssql/src/main/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.databases.mssql; +import java.sql.ResultSet; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.Database; @@ -31,12 +32,11 @@ import org.apache.hop.core.util.Utils; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.sql.ResultSet; - -/** - * Contains MS SQL specific information through static final members - */ -@DatabaseMetaPlugin(type = "MSSQL", typeDescription = "MS SQL Server", documentationUrl = "/database/databases/mssql.html") +/** Contains MS SQL specific information through static final members */ +@DatabaseMetaPlugin( + type = "MSSQL", + typeDescription = "MS SQL Server", + documentationUrl = "/database/databases/mssql.html") @GuiPlugin(id = "GUI-MSSQLServerDatabaseMeta") public class MsSqlServerDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @@ -75,7 +75,9 @@ public boolean isUsingDoubleDigit() { return usingDoubleDigit; } - /** @param usingDoubleDigit The usingDoubleDigit to set */ + /** + * @param usingDoubleDigit The usingDoubleDigit to set + */ public void setUsingDoubleDigit(boolean usingDoubleDigit) { this.usingDoubleDigit = usingDoubleDigit; } @@ -143,13 +145,17 @@ public String getSchemaTableCombination(String schemaName, String tablePart) { } } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; @@ -333,7 +339,9 @@ public String getFieldDefinition( return retval; } - /** @return The SQL on this database to get a list of stored procedures. */ + /** + * @return The SQL on this database to get a list of stored procedures. + */ @Override public String getSqlListOfProcedures() { return "select o.name " diff --git a/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMetaTest.java b/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMetaTest.java index b622f6843af..ce011634197 100644 --- a/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMetaTest.java +++ b/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMetaTest.java @@ -1,730 +1,729 @@ -/* - * 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 org.apache.hop.databases.mssql; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; -import org.mockito.Mockito; -import org.mockito.stubbing.Answer; - -import java.sql.ResultSet; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - -public class MsSqlServerDatabaseMetaTest { - MsSqlServerDatabaseMeta nativeMeta; - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - private DatabaseMeta databaseMeta; - private IDatabase iDatabase; - private IVariables variables; - - @BeforeClass - public static void setUpOnce() throws HopPluginException, HopException { - // Register Natives to create a default DatabaseMeta - DatabasePluginType.getInstance().searchPlugins(); - ValueMetaPluginType.getInstance().searchPlugins(); - HopClientEnvironment.init(); - } - - @Before - public void setupOnce() throws Exception { - nativeMeta = new MsSqlServerDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - databaseMeta = new DatabaseMeta(); - iDatabase = mock(IDatabase.class); - databaseMeta.setIDatabase(iDatabase); - variables = spy(new Variables()); - } - - @Test - public void testSettings() throws Exception { - assertFalse(nativeMeta.isSupportsCatalogs()); - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(1433, nativeMeta.getDefaultDatabasePort()); - assertEquals("net.sourceforge.jtds.jdbc.Driver", nativeMeta.getDriverClass()); - - assertEquals("jdbc:jtds:sqlserver://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); - assertEquals( - "jdbc:jtds:sqlserver://FOO:1234/WIBBLE", nativeMeta.getURL("FOO", "1234", "WIBBLE")); - - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - - assertArrayEquals( - new String[] { - /* - * Transact-SQL Reference: Reserved Keywords Includes future keywords: could be reserved in future releases of SQL - * Server as new features are implemented. REMARK: When SET QUOTED_IDENTIFIER is ON (default), identifiers can be - * delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET - * QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers. - */ - "ABSOLUTE", - "ACTION", - "ADD", - "ADMIN", - "AFTER", - "AGGREGATE", - "ALIAS", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASSERTION", - "AT", - "AUTHORIZATION", - "BACKUP", - "BEFORE", - "BEGIN", - "BETWEEN", - "BINARY", - "BIT", - "BLOB", - "BOOLEAN", - "BOTH", - "BREADTH", - "BREAK", - "BROWSE", - "BULK", - "BY", - "CALL", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CHAR", - "CHARACTER", - "CHECK", - "CHECKPOINT", - "CLASS", - "CLOB", - "CLOSE", - "CLUSTERED", - "COALESCE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "COMPLETION", - "COMPUTE", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRUCTOR", - "CONTAINS", - "CONTAINSTABLE", - "CONTINUE", - "CONVERT", - "CORRESPONDING", - "CREATE", - "CROSS", - "CUBE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DATA", - "DATABASE", - "DATE", - "DAY", - "DBCC", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DENY", - "DEPTH", - "DEREF", - "DESC", - "DESCRIBE", - "DESCRIPTOR", - "DESTROY", - "DESTRUCTOR", - "DETERMINISTIC", - "DIAGNOSTICS", - "DICTIONARY", - "DISCONNECT", - "DISK", - "DISTINCT", - "DISTRIBUTED", - "DOMAIN", - "DOUBLE", - "DROP", - "DUMMY", - "DUMP", - "DYNAMIC", - "EACH", - "ELSE", - "END", - "END-EXEC", - "EQUALS", - "ERRLVL", - "ESCAPE", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXTERNAL", - "FALSE", - "FETCH", - "FILE", - "FILLFACTOR", - "FIRST", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE", - "FREETEXT", - "FREETEXTTABLE", - "FROM", - "FULL", - "FUNCTION", - "GENERAL", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "GROUPING", - "HAVING", - "HOLDLOCK", - "HOST", - "HOUR", - "IDENTITY", - "IDENTITY_INSERT", - "IDENTITYCOL", - "IF", - "IGNORE", - "IMMEDIATE", - "IN", - "INDEX", - "INDICATOR", - "INITIALIZE", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOLATION", - "ITERATE", - "JOIN", - "KEY", - "KILL", - "LANGUAGE", - "LARGE", - "LAST", - "LATERAL", - "LEADING", - "LEFT", - "LESS", - "LEVEL", - "LIKE", - "LIMIT", - "LINENO", - "LOAD", - "LOCAL", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATOR", - "MAP", - "MATCH", - "MINUTE", - "MODIFIES", - "MODIFY", - "MODULE", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NCLOB", - "NEW", - "NEXT", - "NO", - "NOCHECK", - "NONCLUSTERED", - "NONE", - "NOT", - "NULL", - "NULLIF", - "NUMERIC", - "OBJECT", - "OF", - "OFF", - "OFFSETS", - "OLD", - "ON", - "ONLY", - "OPEN", - "OPENDATASOURCE", - "OPENQUERY", - "OPENROWSET", - "OPENXML", - "OPERATION", - "OPTION", - "OR", - "ORDER", - "ORDINALITY", - "OUT", - "OUTER", - "OUTPUT", - "OVER", - "PAD", - "PARAMETER", - "PARAMETERS", - "PARTIAL", - "PATH", - "PERCENT", - "PLAN", - "POSTFIX", - "PRECISION", - "PREFIX", - "PREORDER", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRINT", - "PRIOR", - "PRIVILEGES", - "PROC", - "PROCEDURE", - "PUBLIC", - "RAISERROR", - "READ", - "READS", - "READTEXT", - "REAL", - "RECONFIGURE", - "RECURSIVE", - "REF", - "REFERENCES", - "REFERENCING", - "RELATIVE", - "REPLICATION", - "RESTORE", - "RESTRICT", - "RESULT", - "RETURN", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROW", - "ROWCOUNT", - "ROWGUIDCOL", - "ROWS", - "RULE", - "SAVE", - "SAVEPOINT", - "SCHEMA", - "SCOPE", - "SCROLL", - "SEARCH", - "SECOND", - "SECTION", - "SELECT", - "SEQUENCE", - "SESSION", - "SESSION_USER", - "SET", - "SETS", - "SETUSER", - "SHUTDOWN", - "SIZE", - "SMALLINT", - "SOME", - "SPACE", - "SPECIFIC", - "SPECIFICTYPE", - "SQL", - "SQLEXCEPTION", - "SQLSTATE", - "SQLWARNING", - "START", - "STATE", - "STATEMENT", - "STATIC", - "STATISTICS", - "STRUCTURE", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TERMINATE", - "TEXTSIZE", - "THAN", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TOP", - "TRAILING", - "TRAN", - "TRANSACTION", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRUE", - "TRUNCATE", - "TSEQUAL", - "UNDER", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNNEST", - "UPDATE", - "UPDATETEXT", - "USAGE", - "USE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VIEW", - "WAITFOR", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WITH", - "WITHOUT", - "WORK", - "WRITE", - "WRITETEXT", - "YEAR", - "ZONE" - }, - nativeMeta.getReservedWords()); - - assertEquals( - "http://jtds.sourceforge.net/faq.html#urlFormat", nativeMeta.getExtraOptionsHelpText()); - assertTrue(nativeMeta.isSupportsSchemas()); - assertTrue(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); - assertFalse(nativeMeta.isUseSafePoints()); - assertTrue(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); - assertEquals(8000, nativeMeta.getMaxVARCHARLength()); - } - - @Test - public void testSqlStatements() { - assertEquals("SELECT TOP 1 * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); - String lineSep = System.getProperty("line.separator"); - assertEquals( - "SELECT top 0 * FROM FOO WITH (UPDLOCK, HOLDLOCK);" - + lineSep - + "SELECT top 0 * FROM BAR WITH (UPDLOCK, HOLDLOCK);" - + lineSep, - nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - - assertEquals( - "ALTER TABLE FOO ADD BAR DATETIME", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DATETIME", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(100)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR"), "", false, "", true)); - - assertEquals( - "select o.name from sysobjects o, sysusers u where xtype in ( 'FN', 'P' ) and o.uid = u.uid order by o.name", - nativeMeta.getSqlListOfProcedures()); - - assertEquals("select name from sys.schemas", nativeMeta.getSqlListOfSchemas()); - assertEquals( - "insert into FOO(FOOVERSION) values (1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - assertEquals("SELECT NEXT VALUE FOR FOO", nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals( - "SELECT current_value FROM sys.sequences WHERE name = 'FOO'", - nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals( - "SELECT 1 FROM sys.sequences WHERE name = 'FOO'", nativeMeta.getSqlSequenceExists("FOO")); - assertEquals("SELECT name FROM sys.sequences", nativeMeta.getSqlListOfSequences()); - } - - @Test - public void testGetFieldDefinition() throws Exception { - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("BAR"), "", "", false, false, false)); - - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", 10, 0), "", "", false, false, false)); - - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("BAR", 10, 0), "", "", false, false, false)); - - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("BAR", 10, 0), "", "", false, false, false)); - - assertEquals( - "INT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", 0, 0), "", "", false, false, false)); - - assertEquals( - "INT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", 5, 0), "", "", false, false, false)); - - assertEquals( - "DECIMAL(10,3)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", 10, 3), "", "", false, false, false)); - - assertEquals( - "DECIMAL(10,3)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("BAR", 10, 3), "", "", false, false, false)); - - assertEquals( - "DECIMAL(21,4)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("BAR", 21, 4), "", "", false, false, false)); - - assertEquals( - "TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - "", - false, - false, - false)); - - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("BAR", 15, 0), "", "", false, false, false)); - - assertEquals( - "FLOAT(53)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", 10, -7), - "", - "", - false, - false, - false)); // Bug here - invalid SQL - - assertEquals( - "DECIMAL(22,7)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("BAR", 22, 7), "", "", false, false, false)); - assertEquals( - "FLOAT(53)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", -10, 7), "", "", false, false, false)); - assertEquals( - "DECIMAL(5,7)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("BAR", 5, 7), "", "", false, false, false)); - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("BAR"), "", "", false, false, false)); - - assertEquals( - "BIGINT PRIMARY KEY IDENTITY(0,1)", - nativeMeta.getFieldDefinition(new ValueMetaInteger("BAR"), "BAR", "", true, false, false)); - - assertEquals( - "BIGINT PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaNumber("BAR"), "BAR", "", false, false, false)); - - assertEquals( - "BIGINT PRIMARY KEY IDENTITY(0,1)", - nativeMeta.getFieldDefinition(new ValueMetaInteger("BAR"), "", "BAR", true, false, false)); - assertEquals( - "BIGINT PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaNumber("BAR"), "", "BAR", false, false, false)); - assertEquals( - "VARBINARY(MAX)", - nativeMeta.getFieldDefinition(new ValueMetaBinary(), "", "BAR", false, false, false)); - assertEquals( - "VARBINARY(MAX)", - nativeMeta.getFieldDefinition(new ValueMetaBinary("BAR"), "", "BAR", false, false, false)); - } - - private int rowCnt = 0; - private String[] row1 = new String[] {"ROW1COL1", "ROW1COL2"}; - private String[] row2 = new String[] {"ROW2COL1", "ROW2COL2"}; - - @Test - public void testCheckIndexExists() throws Exception { - String expectedSQL = - "select i.name table_name, c.name column_name from sysindexes i, sysindexkeys k, syscolumns c where i.name = 'FOO' AND i.id = k.id AND i.id = c.id AND k.colid = c.colid "; // yes, variables at the end like in the dbmeta - Database db = Mockito.mock(Database.class); - IRowMeta rm = Mockito.mock(IRowMeta.class); - ResultSet rs = Mockito.mock(ResultSet.class); - DatabaseMeta dm = Mockito.mock(DatabaseMeta.class); - Mockito.when(dm.getQuotedSchemaTableCombination(any(IVariables.class), eq(""), eq("FOO"))) - .thenReturn("FOO"); - Mockito.when(rs.next()).thenReturn(rowCnt < 2); - Mockito.when(db.openQuery(expectedSQL)).thenReturn(rs); - Mockito.when(db.getReturnRowMeta()).thenReturn(rm); - Mockito.when(rm.getString(row1, "column_name", "")).thenReturn("ROW1COL2"); - Mockito.when(rm.getString(row2, "column_name", "")).thenReturn("ROW2COL2"); - Mockito.when(db.getRow(rs)) - .thenAnswer( - (Answer) - invocation -> { - rowCnt++; - if (rowCnt == 1) { - return row1; - } else if (rowCnt == 2) { - return row2; - } else { - return null; - } - }); - Mockito.when(db.getDatabaseMeta()).thenReturn(dm); - assertTrue(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW1COL2", "ROW2COL2"})); - assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW2COL2", "NOTTHERE"})); - assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"NOTTHERE", "ROW1COL2"})); - } - - /* @Test - public void databases_WithSameDbConnTypes_AreTheSame() { - IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); - mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); - assertTrue( databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, mssqlServerDatabaseMeta ) ); - }*/ - - /* @Test - public void databases_WithSameDbConnTypes_AreNotSame_IfPluginIdIsNull() { - IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); - mssqlServerDatabaseMeta.setPluginId( null ); - assertFalse( - databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, mssqlServerDatabaseMeta ) ); - }*/ - - /* @Test - public void databases_WithDifferentDbConnTypes_AreDifferent_IfNonOfThemIsSubsetOfAnother() { - IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); - mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); - IDatabase oracleDatabaseMeta = new OracleDatabaseMeta(); - oracleDatabaseMeta.setPluginId( "ORACLE" ); - - assertFalse( databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, oracleDatabaseMeta ) ); - }*/ - - /* @Test - public void databases_WithDifferentDbConnTypes_AreTheSame_IfOneConnTypeIsSubsetOfAnother_3LevelHierarchy() { - class MSSQLServerNativeDatabaseMetaChild extends MSSQLServerDatabaseMeta { - @Override - public String getPluginId() { - return "MSSQLNATIVE_CHILD"; - } - } - - IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); - mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); - IDatabase mssqlServerNativeDatabaseMetaChild = new MSSQLServerNativeDatabaseMetaChild(); - - assertTrue( - databaseMeta - .databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, mssqlServerNativeDatabaseMetaChild ) ); - }*/ - -} +/* + * 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 org.apache.hop.databases.mssql; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.sql.ResultSet; +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.stubbing.Answer; + +public class MsSqlServerDatabaseMetaTest { + MsSqlServerDatabaseMeta nativeMeta; + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + private DatabaseMeta databaseMeta; + private IDatabase iDatabase; + private IVariables variables; + + @BeforeClass + public static void setUpOnce() throws HopPluginException, HopException { + // Register Natives to create a default DatabaseMeta + DatabasePluginType.getInstance().searchPlugins(); + ValueMetaPluginType.getInstance().searchPlugins(); + HopClientEnvironment.init(); + } + + @Before + public void setupOnce() throws Exception { + nativeMeta = new MsSqlServerDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + databaseMeta = new DatabaseMeta(); + iDatabase = mock(IDatabase.class); + databaseMeta.setIDatabase(iDatabase); + variables = spy(new Variables()); + } + + @Test + public void testSettings() throws Exception { + assertFalse(nativeMeta.isSupportsCatalogs()); + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(1433, nativeMeta.getDefaultDatabasePort()); + assertEquals("net.sourceforge.jtds.jdbc.Driver", nativeMeta.getDriverClass()); + + assertEquals("jdbc:jtds:sqlserver://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); + assertEquals( + "jdbc:jtds:sqlserver://FOO:1234/WIBBLE", nativeMeta.getURL("FOO", "1234", "WIBBLE")); + + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + + assertArrayEquals( + new String[] { + /* + * Transact-SQL Reference: Reserved Keywords Includes future keywords: could be reserved in future releases of SQL + * Server as new features are implemented. REMARK: When SET QUOTED_IDENTIFIER is ON (default), identifiers can be + * delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET + * QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers. + */ + "ABSOLUTE", + "ACTION", + "ADD", + "ADMIN", + "AFTER", + "AGGREGATE", + "ALIAS", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "ARRAY", + "AS", + "ASC", + "ASSERTION", + "AT", + "AUTHORIZATION", + "BACKUP", + "BEFORE", + "BEGIN", + "BETWEEN", + "BINARY", + "BIT", + "BLOB", + "BOOLEAN", + "BOTH", + "BREADTH", + "BREAK", + "BROWSE", + "BULK", + "BY", + "CALL", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CHAR", + "CHARACTER", + "CHECK", + "CHECKPOINT", + "CLASS", + "CLOB", + "CLOSE", + "CLUSTERED", + "COALESCE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "COMPLETION", + "COMPUTE", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONSTRUCTOR", + "CONTAINS", + "CONTAINSTABLE", + "CONTINUE", + "CONVERT", + "CORRESPONDING", + "CREATE", + "CROSS", + "CUBE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_PATH", + "CURRENT_ROLE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "CURSOR", + "CYCLE", + "DATA", + "DATABASE", + "DATE", + "DAY", + "DBCC", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DENY", + "DEPTH", + "DEREF", + "DESC", + "DESCRIBE", + "DESCRIPTOR", + "DESTROY", + "DESTRUCTOR", + "DETERMINISTIC", + "DIAGNOSTICS", + "DICTIONARY", + "DISCONNECT", + "DISK", + "DISTINCT", + "DISTRIBUTED", + "DOMAIN", + "DOUBLE", + "DROP", + "DUMMY", + "DUMP", + "DYNAMIC", + "EACH", + "ELSE", + "END", + "END-EXEC", + "EQUALS", + "ERRLVL", + "ESCAPE", + "EVERY", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXTERNAL", + "FALSE", + "FETCH", + "FILE", + "FILLFACTOR", + "FIRST", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE", + "FREETEXT", + "FREETEXTTABLE", + "FROM", + "FULL", + "FUNCTION", + "GENERAL", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "GROUPING", + "HAVING", + "HOLDLOCK", + "HOST", + "HOUR", + "IDENTITY", + "IDENTITY_INSERT", + "IDENTITYCOL", + "IF", + "IGNORE", + "IMMEDIATE", + "IN", + "INDEX", + "INDICATOR", + "INITIALIZE", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOLATION", + "ITERATE", + "JOIN", + "KEY", + "KILL", + "LANGUAGE", + "LARGE", + "LAST", + "LATERAL", + "LEADING", + "LEFT", + "LESS", + "LEVEL", + "LIKE", + "LIMIT", + "LINENO", + "LOAD", + "LOCAL", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATOR", + "MAP", + "MATCH", + "MINUTE", + "MODIFIES", + "MODIFY", + "MODULE", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NCLOB", + "NEW", + "NEXT", + "NO", + "NOCHECK", + "NONCLUSTERED", + "NONE", + "NOT", + "NULL", + "NULLIF", + "NUMERIC", + "OBJECT", + "OF", + "OFF", + "OFFSETS", + "OLD", + "ON", + "ONLY", + "OPEN", + "OPENDATASOURCE", + "OPENQUERY", + "OPENROWSET", + "OPENXML", + "OPERATION", + "OPTION", + "OR", + "ORDER", + "ORDINALITY", + "OUT", + "OUTER", + "OUTPUT", + "OVER", + "PAD", + "PARAMETER", + "PARAMETERS", + "PARTIAL", + "PATH", + "PERCENT", + "PLAN", + "POSTFIX", + "PRECISION", + "PREFIX", + "PREORDER", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRINT", + "PRIOR", + "PRIVILEGES", + "PROC", + "PROCEDURE", + "PUBLIC", + "RAISERROR", + "READ", + "READS", + "READTEXT", + "REAL", + "RECONFIGURE", + "RECURSIVE", + "REF", + "REFERENCES", + "REFERENCING", + "RELATIVE", + "REPLICATION", + "RESTORE", + "RESTRICT", + "RESULT", + "RETURN", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROLLUP", + "ROUTINE", + "ROW", + "ROWCOUNT", + "ROWGUIDCOL", + "ROWS", + "RULE", + "SAVE", + "SAVEPOINT", + "SCHEMA", + "SCOPE", + "SCROLL", + "SEARCH", + "SECOND", + "SECTION", + "SELECT", + "SEQUENCE", + "SESSION", + "SESSION_USER", + "SET", + "SETS", + "SETUSER", + "SHUTDOWN", + "SIZE", + "SMALLINT", + "SOME", + "SPACE", + "SPECIFIC", + "SPECIFICTYPE", + "SQL", + "SQLEXCEPTION", + "SQLSTATE", + "SQLWARNING", + "START", + "STATE", + "STATEMENT", + "STATIC", + "STATISTICS", + "STRUCTURE", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TERMINATE", + "TEXTSIZE", + "THAN", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TOP", + "TRAILING", + "TRAN", + "TRANSACTION", + "TRANSLATION", + "TREAT", + "TRIGGER", + "TRUE", + "TRUNCATE", + "TSEQUAL", + "UNDER", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNNEST", + "UPDATE", + "UPDATETEXT", + "USAGE", + "USE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VIEW", + "WAITFOR", + "WHEN", + "WHENEVER", + "WHERE", + "WHILE", + "WITH", + "WITHOUT", + "WORK", + "WRITE", + "WRITETEXT", + "YEAR", + "ZONE" + }, + nativeMeta.getReservedWords()); + + assertEquals( + "http://jtds.sourceforge.net/faq.html#urlFormat", nativeMeta.getExtraOptionsHelpText()); + assertTrue(nativeMeta.isSupportsSchemas()); + assertTrue(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); + assertFalse(nativeMeta.isUseSafePoints()); + assertTrue(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); + assertEquals(8000, nativeMeta.getMaxVARCHARLength()); + } + + @Test + public void testSqlStatements() { + assertEquals("SELECT TOP 1 * FROM FOO", nativeMeta.getSqlQueryFields("FOO")); + String lineSep = System.getProperty("line.separator"); + assertEquals( + "SELECT top 0 * FROM FOO WITH (UPDLOCK, HOLDLOCK);" + + lineSep + + "SELECT top 0 * FROM BAR WITH (UPDLOCK, HOLDLOCK);" + + lineSep, + nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + + assertEquals( + "ALTER TABLE FOO ADD BAR DATETIME", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DATETIME", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(100)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR"), "", false, "", true)); + + assertEquals( + "select o.name from sysobjects o, sysusers u where xtype in ( 'FN', 'P' ) and o.uid = u.uid order by o.name", + nativeMeta.getSqlListOfProcedures()); + + assertEquals("select name from sys.schemas", nativeMeta.getSqlListOfSchemas()); + assertEquals( + "insert into FOO(FOOVERSION) values (1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + assertEquals("SELECT NEXT VALUE FOR FOO", nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals( + "SELECT current_value FROM sys.sequences WHERE name = 'FOO'", + nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals( + "SELECT 1 FROM sys.sequences WHERE name = 'FOO'", nativeMeta.getSqlSequenceExists("FOO")); + assertEquals("SELECT name FROM sys.sequences", nativeMeta.getSqlListOfSequences()); + } + + @Test + public void testGetFieldDefinition() throws Exception { + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("BAR"), "", "", false, false, false)); + + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", 10, 0), "", "", false, false, false)); + + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("BAR", 10, 0), "", "", false, false, false)); + + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("BAR", 10, 0), "", "", false, false, false)); + + assertEquals( + "INT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", 0, 0), "", "", false, false, false)); + + assertEquals( + "INT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", 5, 0), "", "", false, false, false)); + + assertEquals( + "DECIMAL(10,3)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", 10, 3), "", "", false, false, false)); + + assertEquals( + "DECIMAL(10,3)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("BAR", 10, 3), "", "", false, false, false)); + + assertEquals( + "DECIMAL(21,4)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("BAR", 21, 4), "", "", false, false, false)); + + assertEquals( + "TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + "", + false, + false, + false)); + + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("BAR", 15, 0), "", "", false, false, false)); + + assertEquals( + "FLOAT(53)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", 10, -7), + "", + "", + false, + false, + false)); // Bug here - invalid SQL + + assertEquals( + "DECIMAL(22,7)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("BAR", 22, 7), "", "", false, false, false)); + assertEquals( + "FLOAT(53)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", -10, 7), "", "", false, false, false)); + assertEquals( + "DECIMAL(5,7)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("BAR", 5, 7), "", "", false, false, false)); + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("BAR"), "", "", false, false, false)); + + assertEquals( + "BIGINT PRIMARY KEY IDENTITY(0,1)", + nativeMeta.getFieldDefinition(new ValueMetaInteger("BAR"), "BAR", "", true, false, false)); + + assertEquals( + "BIGINT PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaNumber("BAR"), "BAR", "", false, false, false)); + + assertEquals( + "BIGINT PRIMARY KEY IDENTITY(0,1)", + nativeMeta.getFieldDefinition(new ValueMetaInteger("BAR"), "", "BAR", true, false, false)); + assertEquals( + "BIGINT PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaNumber("BAR"), "", "BAR", false, false, false)); + assertEquals( + "VARBINARY(MAX)", + nativeMeta.getFieldDefinition(new ValueMetaBinary(), "", "BAR", false, false, false)); + assertEquals( + "VARBINARY(MAX)", + nativeMeta.getFieldDefinition(new ValueMetaBinary("BAR"), "", "BAR", false, false, false)); + } + + private int rowCnt = 0; + private String[] row1 = new String[] {"ROW1COL1", "ROW1COL2"}; + private String[] row2 = new String[] {"ROW2COL1", "ROW2COL2"}; + + @Test + public void testCheckIndexExists() throws Exception { + String expectedSQL = + "select i.name table_name, c.name column_name from sysindexes i, sysindexkeys k, syscolumns c where i.name = 'FOO' AND i.id = k.id AND i.id = c.id AND k.colid = c.colid "; // yes, variables at the end like in the dbmeta + Database db = Mockito.mock(Database.class); + IRowMeta rm = Mockito.mock(IRowMeta.class); + ResultSet rs = Mockito.mock(ResultSet.class); + DatabaseMeta dm = Mockito.mock(DatabaseMeta.class); + Mockito.when(dm.getQuotedSchemaTableCombination(any(IVariables.class), eq(""), eq("FOO"))) + .thenReturn("FOO"); + Mockito.when(rs.next()).thenReturn(rowCnt < 2); + Mockito.when(db.openQuery(expectedSQL)).thenReturn(rs); + Mockito.when(db.getReturnRowMeta()).thenReturn(rm); + Mockito.when(rm.getString(row1, "column_name", "")).thenReturn("ROW1COL2"); + Mockito.when(rm.getString(row2, "column_name", "")).thenReturn("ROW2COL2"); + Mockito.when(db.getRow(rs)) + .thenAnswer( + (Answer) + invocation -> { + rowCnt++; + if (rowCnt == 1) { + return row1; + } else if (rowCnt == 2) { + return row2; + } else { + return null; + } + }); + Mockito.when(db.getDatabaseMeta()).thenReturn(dm); + assertTrue(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW1COL2", "ROW2COL2"})); + assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW2COL2", "NOTTHERE"})); + assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"NOTTHERE", "ROW1COL2"})); + } + + /* @Test + public void databases_WithSameDbConnTypes_AreTheSame() { + IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); + mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); + assertTrue( databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, mssqlServerDatabaseMeta ) ); + }*/ + + /* @Test + public void databases_WithSameDbConnTypes_AreNotSame_IfPluginIdIsNull() { + IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); + mssqlServerDatabaseMeta.setPluginId( null ); + assertFalse( + databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, mssqlServerDatabaseMeta ) ); + }*/ + + /* @Test + public void databases_WithDifferentDbConnTypes_AreDifferent_IfNonOfThemIsSubsetOfAnother() { + IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); + mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); + IDatabase oracleDatabaseMeta = new OracleDatabaseMeta(); + oracleDatabaseMeta.setPluginId( "ORACLE" ); + + assertFalse( databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, oracleDatabaseMeta ) ); + }*/ + + /* @Test + public void databases_WithDifferentDbConnTypes_AreTheSame_IfOneConnTypeIsSubsetOfAnother_3LevelHierarchy() { + class MSSQLServerNativeDatabaseMetaChild extends MSSQLServerDatabaseMeta { + @Override + public String getPluginId() { + return "MSSQLNATIVE_CHILD"; + } + } + + IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); + mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); + IDatabase mssqlServerNativeDatabaseMetaChild = new MSSQLServerNativeDatabaseMetaChild(); + + assertTrue( + databaseMeta + .databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, mssqlServerNativeDatabaseMetaChild ) ); + }*/ + +} diff --git a/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta_FieldDefinitionTest.java b/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta_FieldDefinitionTest.java index d9550aee3ca..2bd64488bdb 100644 --- a/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta_FieldDefinitionTest.java +++ b/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerDatabaseMeta_FieldDefinitionTest.java @@ -17,6 +17,9 @@ package org.apache.hop.databases.mssql; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaNone; import org.apache.hop.core.row.value.ValueMetaNumber; @@ -24,9 +27,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class MsSqlServerDatabaseMeta_FieldDefinitionTest { private MsSqlServerDatabaseMeta dbMeta; diff --git a/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerSequenceAndReleaseSavePointTest.java b/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerSequenceAndReleaseSavePointTest.java index f8f8be1f490..b2addbbec98 100644 --- a/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/mssql/src/test/java/org/apache/hop/databases/mssql/MsSqlServerSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.mssql; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class MsSqlServerSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/mssqlnative/src/main/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMeta.java b/plugins/databases/mssqlnative/src/main/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMeta.java index f2261fda4e9..6cc1c58bfde 100644 --- a/plugins/databases/mssqlnative/src/main/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMeta.java +++ b/plugins/databases/mssqlnative/src/main/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.databases.mssqlnative; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.DatabaseMeta; @@ -32,10 +34,10 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Control; -import java.util.ArrayList; -import java.util.List; - -@DatabaseMetaPlugin(type = "MSSQLNATIVE", typeDescription = "MS SQL Server (Native)", documentationUrl = "/database/databases/mssqlnative.html") +@DatabaseMetaPlugin( + type = "MSSQLNATIVE", + typeDescription = "MS SQL Server (Native)", + documentationUrl = "/database/databases/mssqlnative.html") @GuiPlugin(id = "GUI-MSSQLServerNativeDatabaseMeta") public class MsSqlServerNativeDatabaseMeta extends MsSqlServerDatabaseMeta implements IGuiPluginCompositeWidgetsListener { @@ -69,7 +71,7 @@ public void widgetModified( @Override public void persistContents(GuiCompositeWidgets compositeWidgets) { - //not needed + // not needed } private void enableField(GuiCompositeWidgets compositeWidgets) { @@ -105,7 +107,9 @@ public boolean isUsingIntegratedSecurity() { return this.usingIntegratedSecurity; } - /** @param usingIntegratedSecurity The usingIntegratedSecurity to set */ + /** + * @param usingIntegratedSecurity The usingIntegratedSecurity to set + */ public void setUsingIntegratedSecurity(boolean usingIntegratedSecurity) { this.usingIntegratedSecurity = usingIntegratedSecurity; } @@ -174,13 +178,13 @@ public String getSchemaTableCombination(String schemaName, String tablePart) { if (isUsingDoubleDecimalAsSchemaTableSeparator()) { return schemaName + ".." + tablePart; } else { - if(!schemaName.startsWith("[") && !schemaName.endsWith("]")){ + if (!schemaName.startsWith("[") && !schemaName.endsWith("]")) { return '[' + schemaName + ']' + "." + tablePart; } - return schemaName + "." + tablePart; + return schemaName + "." + tablePart; } } - + @Override public boolean isSupportsTimestampDataType() { return true; diff --git a/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMetaTest.java b/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMetaTest.java index 0627b7e4f07..52848bebd40 100644 --- a/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMetaTest.java +++ b/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeDatabaseMetaTest.java @@ -1,94 +1,94 @@ -/* - * 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 org.apache.hop.databases.mssqlnative; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.databases.mssql.MsSqlServerDatabaseMeta; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.ClassRule; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class MsSqlServerNativeDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - @Test - public void testMsSqlOverrides() throws Exception { - MsSqlServerNativeDatabaseMeta localNativeMeta = new MsSqlServerNativeDatabaseMeta(); - localNativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - - assertEquals("com.microsoft.sqlserver.jdbc.SQLServerDriver", localNativeMeta.getDriverClass()); - assertEquals( - "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE", - localNativeMeta.getURL("FOO", "1234", "WIBBLE")); - - localNativeMeta.setUsingIntegratedSecurity(false); - assertEquals( - "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE", - localNativeMeta.getURL("FOO", "1234", "WIBBLE")); - - localNativeMeta.setUsingIntegratedSecurity(true); - assertEquals( - "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE;integratedSecurity=true", - localNativeMeta.getURL("FOO", "1234", "WIBBLE")); - - localNativeMeta.setInstanceName("TEST"); - assertEquals( - "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE;integratedSecurity=true", - localNativeMeta.getURL("FOO", "1234", "WIBBLE")); - - localNativeMeta.setPort(""); - assertEquals( - "jdbc:sqlserver://FOO\\TEST;databaseName=WIBBLE;integratedSecurity=true", - localNativeMeta.getURL("FOO", "", "WIBBLE")); - } - - @Test - public void setSqlServerInstanceTest() { - DatabaseMeta dbmeta = new DatabaseMeta(); - IDatabase mssqlServerDatabaseMeta = new MsSqlServerDatabaseMeta(); - mssqlServerDatabaseMeta.setPluginId("MSSQL"); - IDatabase mssqlServerNativeDatabaseMeta = new MsSqlServerNativeDatabaseMeta(); - mssqlServerNativeDatabaseMeta.setPluginId("MSSQLNATIVE"); - dbmeta.setIDatabase(mssqlServerDatabaseMeta); - dbmeta.setSqlServerInstance(""); - assertEquals(null, dbmeta.getSqlServerInstance()); - dbmeta.setSqlServerInstance("instance1"); - assertEquals("instance1", dbmeta.getSqlServerInstance()); - dbmeta.setIDatabase(mssqlServerNativeDatabaseMeta); - dbmeta.setSqlServerInstance(""); - assertEquals(null, dbmeta.getSqlServerInstance()); - dbmeta.setSqlServerInstance("instance1"); - assertEquals("instance1", dbmeta.getSqlServerInstance()); - } - - /* @Ignore - @Test - public void databases_WithDifferentDbConnTypes_AreTheSame_IfOneConnTypeIsSubsetOfAnother_2LevelHierarchy() { - IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); - mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); - IDatabase mssqlServerNativeDatabaseMeta = new MSSQLServerNativeDatabaseMeta(); - mssqlServerNativeDatabaseMeta.setPluginId( "MSSQLNATIVE" ); - - assertTrue( databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, - mssqlServerNativeDatabaseMeta ) ); - }*/ - -} +/* + * 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 org.apache.hop.databases.mssqlnative; + +import static org.junit.Assert.assertEquals; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.databases.mssql.MsSqlServerDatabaseMeta; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.ClassRule; +import org.junit.Test; + +public class MsSqlServerNativeDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + @Test + public void testMsSqlOverrides() throws Exception { + MsSqlServerNativeDatabaseMeta localNativeMeta = new MsSqlServerNativeDatabaseMeta(); + localNativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + + assertEquals("com.microsoft.sqlserver.jdbc.SQLServerDriver", localNativeMeta.getDriverClass()); + assertEquals( + "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE", + localNativeMeta.getURL("FOO", "1234", "WIBBLE")); + + localNativeMeta.setUsingIntegratedSecurity(false); + assertEquals( + "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE", + localNativeMeta.getURL("FOO", "1234", "WIBBLE")); + + localNativeMeta.setUsingIntegratedSecurity(true); + assertEquals( + "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE;integratedSecurity=true", + localNativeMeta.getURL("FOO", "1234", "WIBBLE")); + + localNativeMeta.setInstanceName("TEST"); + assertEquals( + "jdbc:sqlserver://FOO:1234;databaseName=WIBBLE;integratedSecurity=true", + localNativeMeta.getURL("FOO", "1234", "WIBBLE")); + + localNativeMeta.setPort(""); + assertEquals( + "jdbc:sqlserver://FOO\\TEST;databaseName=WIBBLE;integratedSecurity=true", + localNativeMeta.getURL("FOO", "", "WIBBLE")); + } + + @Test + public void setSqlServerInstanceTest() { + DatabaseMeta dbmeta = new DatabaseMeta(); + IDatabase mssqlServerDatabaseMeta = new MsSqlServerDatabaseMeta(); + mssqlServerDatabaseMeta.setPluginId("MSSQL"); + IDatabase mssqlServerNativeDatabaseMeta = new MsSqlServerNativeDatabaseMeta(); + mssqlServerNativeDatabaseMeta.setPluginId("MSSQLNATIVE"); + dbmeta.setIDatabase(mssqlServerDatabaseMeta); + dbmeta.setSqlServerInstance(""); + assertEquals(null, dbmeta.getSqlServerInstance()); + dbmeta.setSqlServerInstance("instance1"); + assertEquals("instance1", dbmeta.getSqlServerInstance()); + dbmeta.setIDatabase(mssqlServerNativeDatabaseMeta); + dbmeta.setSqlServerInstance(""); + assertEquals(null, dbmeta.getSqlServerInstance()); + dbmeta.setSqlServerInstance("instance1"); + assertEquals("instance1", dbmeta.getSqlServerInstance()); + } + + /* @Ignore + @Test + public void databases_WithDifferentDbConnTypes_AreTheSame_IfOneConnTypeIsSubsetOfAnother_2LevelHierarchy() { + IDatabase mssqlServerDatabaseMeta = new MSSQLServerDatabaseMeta(); + mssqlServerDatabaseMeta.setPluginId( "MSSQL" ); + IDatabase mssqlServerNativeDatabaseMeta = new MSSQLServerNativeDatabaseMeta(); + mssqlServerNativeDatabaseMeta.setPluginId( "MSSQLNATIVE" ); + + assertTrue( databaseMeta.databaseForBothDbInterfacesIsTheSame( mssqlServerDatabaseMeta, + mssqlServerNativeDatabaseMeta ) ); + }*/ + +} diff --git a/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeSequenceAndReleaseSavePointTest.java b/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeSequenceAndReleaseSavePointTest.java index 0064bb3e8c0..603c6224dd2 100644 --- a/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/mssqlnative/src/test/java/org/apache/hop/databases/mssqlnative/MsSqlServerNativeSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.mssqlnative; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class MsSqlServerNativeSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/mysql/src/main/java/org/apache/hop/databases/mysql/MySqlDatabaseMeta.java b/plugins/databases/mysql/src/main/java/org/apache/hop/databases/mysql/MySqlDatabaseMeta.java index b595351ddbe..6a41881d369 100644 --- a/plugins/databases/mysql/src/main/java/org/apache/hop/databases/mysql/MySqlDatabaseMeta.java +++ b/plugins/databases/mysql/src/main/java/org/apache/hop/databases/mysql/MySqlDatabaseMeta.java @@ -18,6 +18,11 @@ package org.apache.hop.databases.mysql; import com.google.common.collect.Sets; +import java.sql.DatabaseMetaData; +import java.sql.ResultSetMetaData; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.DatabaseMeta; @@ -34,12 +39,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadataProvider; -import java.sql.DatabaseMetaData; -import java.sql.ResultSetMetaData; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - /** Contains MySQL specific information through static final members */ @DatabaseMetaPlugin( type = "MYSQL", @@ -56,6 +55,7 @@ public class MySqlDatabaseMeta extends BaseDatabaseMeta implements IDatabase { type = GuiElementType.CHECKBOX, label = "i18n:org.apache.hop.ui.core.database:DatabaseDialog.label.MySQLStreamResults") private boolean resultStreaming; + @GuiWidgetElement( id = "mySqlDriverClass", order = "20", diff --git a/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlDatabaseMetaTest.java b/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlDatabaseMetaTest.java index 66f7a002393..cfaa4b962cb 100644 --- a/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlDatabaseMetaTest.java +++ b/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlDatabaseMetaTest.java @@ -1,760 +1,759 @@ -/* - * 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 org.apache.hop.databases.mysql; - -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILoggingObject; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Map; - -import static org.junit.Assert.assertArrayEquals; -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 static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class MySqlDatabaseMetaTest { - MySqlDatabaseMeta nativeMeta; - - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - } - - @Before - public void setupBefore() { - nativeMeta = new MySqlDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(3306, nativeMeta.getDefaultDatabasePort()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("com.mysql.cj.jdbc.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:mysql://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals("jdbc:mysql://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); - assertEquals("&", nativeMeta.getExtraOptionSeparator()); - assertEquals("?", nativeMeta.getExtraOptionIndicator()); - assertFalse(nativeMeta.isSupportsTransactions()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertTrue(nativeMeta.isSupportsViews()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertArrayEquals( - new String[] { - "ADD", - "ALL", - "ALTER", - "ANALYZE", - "AND", - "AS", - "ASC", - "ASENSITIVE", - "BEFORE", - "BETWEEN", - "BIGINT", - "BINARY", - "BLOB", - "BOTH", - "BY", - "CALL", - "CASCADE", - "CASE", - "CHANGE", - "CHAR", - "CHARACTER", - "CHECK", - "COLLATE", - "COLUMN", - "CONDITION", - "CONNECTION", - "CONSTRAINT", - "CONTINUE", - "CONVERT", - "CREATE", - "CROSS", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "CURSOR", - "DATABASE", - "DATABASES", - "DAY_HOUR", - "DAY_MICROSECOND", - "DAY_MINUTE", - "DAY_SECOND", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DELAYED", - "DELETE", - "DESC", - "DESCRIBE", - "DETERMINISTIC", - "DISTINCT", - "DISTINCTROW", - "DIV", - "DOUBLE", - "DROP", - "DUAL", - "EACH", - "ELSE", - "ELSEIF", - "ENCLOSED", - "ESCAPED", - "EXISTS", - "EXIT", - "EXPLAIN", - "FALSE", - "FETCH", - "FLOAT", - "FOR", - "FORCE", - "FOREIGN", - "FROM", - "FULLTEXT", - "GOTO", - "GRANT", - "GROUP", - "HAVING", - "HIGH_PRIORITY", - "HOUR_MICROSECOND", - "HOUR_MINUTE", - "HOUR_SECOND", - "IF", - "IGNORE", - "IN", - "INDEX", - "INFILE", - "INNER", - "INOUT", - "INSENSITIVE", - "INSERT", - "INT", - "INTEGER", - "INTERVAL", - "INTO", - "IS", - "ITERATE", - "JOIN", - "KEY", - "KEYS", - "KILL", - "LEADING", - "LEAVE", - "LEFT", - "LIKE", - "LIMIT", - "LINES", - "LOAD", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATE", - "LOCK", - "LONG", - "LONGBLOB", - "LONGTEXT", - "LOOP", - "LOW_PRIORITY", - "MATCH", - "MEDIUMBLOB", - "MEDIUMINT", - "MEDIUMTEXT", - "MIDDLEINT", - "MINUTE_MICROSECOND", - "MINUTE_SECOND", - "MOD", - "MODIFIES", - "NATURAL", - "NOT", - "NO_WRITE_TO_BINLOG", - "NULL", - "NUMERIC", - "ON", - "OPTIMIZE", - "OPTION", - "OPTIONALLY", - "OR", - "ORDER", - "OUT", - "OUTER", - "OUTFILE", - "POSITION", - "PRECISION", - "PRIMARY", - "PROCEDURE", - "PURGE", - "READ", - "READS", - "REAL", - "REFERENCES", - "REGEXP", - "RENAME", - "REPEAT", - "REPLACE", - "REQUIRE", - "RESTRICT", - "RETURN", - "REVOKE", - "RIGHT", - "RLIKE", - "SCHEMA", - "SCHEMAS", - "SECOND_MICROSECOND", - "SELECT", - "SENSITIVE", - "SEPARATOR", - "SET", - "SHOW", - "SMALLINT", - "SONAME", - "SPATIAL", - "SPECIFIC", - "SQL", - "SQLEXCEPTION", - "SQLSTATE", - "SQLWARNING", - "SQL_BIG_RESULT", - "SQL_CALC_FOUND_ROWS", - "SQL_SMALL_RESULT", - "SSL", - "STARTING", - "STRAIGHT_JOIN", - "TABLE", - "TERMINATED", - "THEN", - "TINYBLOB", - "TINYINT", - "TINYTEXT", - "TO", - "TRAILING", - "TRIGGER", - "TRUE", - "UNDO", - "UNION", - "UNIQUE", - "UNLOCK", - "UNSIGNED", - "UPDATE", - "USAGE", - "USE", - "USING", - "UTC_DATE", - "UTC_TIME", - "UTC_TIMESTAMP", - "VALUES", - "VARBINARY", - "VARCHAR", - "VARCHARACTER", - "VARYING", - "WHEN", - "WHERE", - "WHILE", - "WITH", - "WRITE", - "XOR", - "YEAR_MONTH", - "ZEROFILL" - }, - nativeMeta.getReservedWords()); - - assertEquals("`", nativeMeta.getStartQuote()); - assertEquals("`", nativeMeta.getEndQuote()); - assertEquals( - "http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html", - nativeMeta.getExtraOptionsHelpText()); - assertTrue(nativeMeta.isSystemTable("sysTest")); - assertTrue(nativeMeta.isSystemTable("dtproperties")); - assertFalse(nativeMeta.isSystemTable("SysTest")); - assertFalse(nativeMeta.isSystemTable("dTproperties")); - assertFalse(nativeMeta.isSystemTable("Testsys")); - assertTrue(nativeMeta.isMySqlVariant()); - assertFalse(nativeMeta.isReleaseSavepoint()); - assertTrue(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); - assertFalse(nativeMeta.isRequiringTransactionsOnQueries()); - } - - @Test - public void testSqlStatements() { - assertEquals(" LIMIT 15", nativeMeta.getLimitClause(15)); - assertEquals("SELECT * FROM FOO LIMIT 0", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT * FROM FOO LIMIT 0", nativeMeta.getSqlTableExists("FOO")); - assertEquals("SELECT FOO FROM BAR LIMIT 0", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - - assertEquals( - "ALTER TABLE FOO ADD BAR DATETIME", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DATETIME", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BOOLEAN", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR INT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR INT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(21, 4)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR MEDIUMTEXT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaNumber("BAR", 10, -7), - "", - false, - "", - false)); // Bug here - invalid SQL - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(22, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR DOUBLE", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR UNKNOWN", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP BAR" + lineSep, - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR TINYTEXT", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR"), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ADD BAR INT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT NOT NULL PRIMARY KEY", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR DECIMAL(22)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR CHAR(1)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 1, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD BAR LONGTEXT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 16777250, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD BAR LONGBLOB", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBinary("BAR", 16777250, 0), "", false, "", false)); - - assertEquals( - "LOCK TABLES FOO WRITE, BAR WRITE;" + lineSep, - nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - - assertEquals("UNLOCK TABLES", nativeMeta.getSqlUnlockTables(new String[] {})); - - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (1, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } - - /** - * @return - * @throws Exception - */ - private ResultSetMetaData getResultSetMetaData() throws Exception { - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - - /** - * Fields setup around the following query: - * - *

select CUSTOMERNUMBER as NUMBER , CUSTOMERNAME as NAME , CONTACTLASTNAME as LAST_NAME , - * CONTACTFIRSTNAME as FIRST_NAME , 'MySQL' as DB , 'NoAliasText' from CUSTOMERS ORDER BY - * CUSTOMERNAME; - */ - doReturn("NUMBER").when(resultSetMetaData).getColumnLabel(1); - doReturn("NAME").when(resultSetMetaData).getColumnLabel(2); - doReturn("LAST_NAME").when(resultSetMetaData).getColumnLabel(3); - doReturn("FIRST_NAME").when(resultSetMetaData).getColumnLabel(4); - doReturn("DB").when(resultSetMetaData).getColumnLabel(5); - doReturn("NoAliasText").when(resultSetMetaData).getColumnLabel(6); - - doReturn("CUSTOMERNUMBER").when(resultSetMetaData).getColumnName(1); - doReturn("CUSTOMERNAME").when(resultSetMetaData).getColumnName(2); - doReturn("CONTACTLASTNAME").when(resultSetMetaData).getColumnName(3); - doReturn("CONTACTFIRSTNAME").when(resultSetMetaData).getColumnName(4); - doReturn("MySQL").when(resultSetMetaData).getColumnName(5); - doReturn("NoAliasText").when(resultSetMetaData).getColumnName(6); - - return resultSetMetaData; - } - - /** - * @return - * @throws Exception - */ - private ResultSetMetaData getResultSetMetaDataException() throws Exception { - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - - doThrow(new SQLException()).when(resultSetMetaData).getColumnLabel(1); - doThrow(new SQLException()).when(resultSetMetaData).getColumnName(1); - - return resultSetMetaData; - } - - @Test - public void testExtraOptions() { - DatabaseMeta nativeMeta = - new DatabaseMeta("", "MYSQL", "JDBC", null, "stub:stub", null, null, null); - Map opts = nativeMeta.getExtraOptions(); - assertNotNull(opts); - assertEquals("500", opts.get("MYSQL.defaultFetchSize")); - } - - @Test - public void testGetLegacyColumnNameDriverGreaterThanThreeFieldNumber() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - assertEquals( - "NUMBER", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 1)); - } - - @Test - public void testGetLegacyColumnNameDriverGreaterThanThreeFieldName() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - assertEquals( - "NAME", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 2)); - } - - @Test - public void testGetLegacyColumnNameDriverGreaterThanThreeFieldLastName() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - assertEquals( - "LAST_NAME", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 3)); - } - - @Test - public void testGetLegacyColumnNameDriverGreaterThanThreeFieldFirstName() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - assertEquals( - "FIRST_NAME", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 4)); - } - - @Test - public void testGetLegacyColumnNameDriverGreaterThanThreeFieldDB() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - assertEquals( - "DB", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 5)); - } - - @Test - public void testGetLegacyColumnNameDriverGreaterThanThreeFieldNoAliasText() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - assertEquals( - "NoAliasText", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 6)); - } - - @Test - public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldCustomerNumber() - throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - assertEquals( - "CUSTOMERNUMBER", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 1)); - } - - @Test - public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldCustomerName() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - assertEquals( - "CUSTOMERNAME", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 2)); - } - - @Test - public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldContactLastName() - throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - assertEquals( - "CONTACTLASTNAME", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 3)); - } - - @Test - public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldContactFirstName() - throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - assertEquals( - "CONTACTFIRSTNAME", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 4)); - } - - @Test - public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldMySql() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - assertEquals( - "MySQL", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 5)); - } - - @Test - public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldNoAliasText() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - assertEquals( - "NoAliasText", - new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 6)); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameNullDBMetaDataException() throws Exception { - new MySqlDatabaseMeta().getLegacyColumnName(null, getResultSetMetaData(), 1); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameNullRSMetaDataException() throws Exception { - new MySqlDatabaseMeta().getLegacyColumnName(mock(DatabaseMetaData.class), null, 1); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameDriverGreaterThanThreeException() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); - - new MySqlDatabaseMeta() - .getLegacyColumnName(databaseMetaData, getResultSetMetaDataException(), 1); - } - - @Test(expected = HopDatabaseException.class) - public void testGetLegacyColumnNameDriverLessOrEqualToThreeException() throws Exception { - DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); - when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); - - new MySqlDatabaseMeta() - .getLegacyColumnName(databaseMetaData, getResultSetMetaDataException(), 1); - } - - @Test - public void testReleaseSavepoint() { - assertFalse(nativeMeta.isReleaseSavepoint()); - } - - @Test - public void testSupportsSequence() { - String dbType = nativeMeta.getClass().getSimpleName(); - assertFalse(dbType, nativeMeta.isSupportsSequences()); - assertTrue(Utils.isEmpty(nativeMeta.getSqlListOfSequences())); - assertEquals("", nativeMeta.getSqlSequenceExists("testSeq")); - assertEquals("", nativeMeta.getSqlNextSequenceValue("testSeq")); - assertEquals("", nativeMeta.getSqlCurrentSequenceValue("testSeq")); - } - - private Connection mockConnection(DatabaseMetaData dbMetaData) throws SQLException { - Connection conn = mock(Connection.class); - when(conn.getMetaData()).thenReturn(dbMetaData); - return conn; - } - - @Test - public void testVarBinaryIsConvertedToStringType() throws Exception { - ILoggingObject log = mock(ILoggingObject.class); - PreparedStatement ps = mock(PreparedStatement.class); - DatabaseMetaData dbMetaData = mock(DatabaseMetaData.class); - IVariables variables = mock(IVariables.class); - ResultSet rs = mock(ResultSet.class); - ResultSetMetaData rsMeta = mock(ResultSetMetaData.class); - - when(rsMeta.getColumnCount()).thenReturn(1); - when(rsMeta.getColumnLabel(1)).thenReturn("column"); - when(rsMeta.getColumnName(1)).thenReturn("column"); - when(rsMeta.getColumnType(1)).thenReturn(java.sql.Types.VARBINARY); - when(rs.getMetaData()).thenReturn(rsMeta); - when(ps.executeQuery()).thenReturn(rs); - - DatabaseMeta meta = new DatabaseMeta(); - meta.setIDatabase(new MySqlDatabaseMeta()); - - Database db = new Database(log, variables, meta); - db.setConnection(mockConnection(dbMetaData)); - db.getLookup(ps, false); - - IRowMeta rowMeta = db.getReturnRowMeta(); - assertEquals(1, db.getReturnRowMeta().size()); - - IValueMeta valueMeta = rowMeta.getValueMeta(0); - assertEquals(IValueMeta.TYPE_BINARY, valueMeta.getType()); - } -} +/* + * 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 org.apache.hop.databases.mysql; + +import static org.junit.Assert.assertArrayEquals; +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 static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.Map; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILoggingObject; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +public class MySqlDatabaseMetaTest { + MySqlDatabaseMeta nativeMeta; + + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + } + + @Before + public void setupBefore() { + nativeMeta = new MySqlDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(3306, nativeMeta.getDefaultDatabasePort()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("com.mysql.cj.jdbc.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:mysql://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals("jdbc:mysql://FOO/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); + assertEquals("&", nativeMeta.getExtraOptionSeparator()); + assertEquals("?", nativeMeta.getExtraOptionIndicator()); + assertFalse(nativeMeta.isSupportsTransactions()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertTrue(nativeMeta.isSupportsViews()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertArrayEquals( + new String[] { + "ADD", + "ALL", + "ALTER", + "ANALYZE", + "AND", + "AS", + "ASC", + "ASENSITIVE", + "BEFORE", + "BETWEEN", + "BIGINT", + "BINARY", + "BLOB", + "BOTH", + "BY", + "CALL", + "CASCADE", + "CASE", + "CHANGE", + "CHAR", + "CHARACTER", + "CHECK", + "COLLATE", + "COLUMN", + "CONDITION", + "CONNECTION", + "CONSTRAINT", + "CONTINUE", + "CONVERT", + "CREATE", + "CROSS", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "CURSOR", + "DATABASE", + "DATABASES", + "DAY_HOUR", + "DAY_MICROSECOND", + "DAY_MINUTE", + "DAY_SECOND", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DELAYED", + "DELETE", + "DESC", + "DESCRIBE", + "DETERMINISTIC", + "DISTINCT", + "DISTINCTROW", + "DIV", + "DOUBLE", + "DROP", + "DUAL", + "EACH", + "ELSE", + "ELSEIF", + "ENCLOSED", + "ESCAPED", + "EXISTS", + "EXIT", + "EXPLAIN", + "FALSE", + "FETCH", + "FLOAT", + "FOR", + "FORCE", + "FOREIGN", + "FROM", + "FULLTEXT", + "GOTO", + "GRANT", + "GROUP", + "HAVING", + "HIGH_PRIORITY", + "HOUR_MICROSECOND", + "HOUR_MINUTE", + "HOUR_SECOND", + "IF", + "IGNORE", + "IN", + "INDEX", + "INFILE", + "INNER", + "INOUT", + "INSENSITIVE", + "INSERT", + "INT", + "INTEGER", + "INTERVAL", + "INTO", + "IS", + "ITERATE", + "JOIN", + "KEY", + "KEYS", + "KILL", + "LEADING", + "LEAVE", + "LEFT", + "LIKE", + "LIMIT", + "LINES", + "LOAD", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATE", + "LOCK", + "LONG", + "LONGBLOB", + "LONGTEXT", + "LOOP", + "LOW_PRIORITY", + "MATCH", + "MEDIUMBLOB", + "MEDIUMINT", + "MEDIUMTEXT", + "MIDDLEINT", + "MINUTE_MICROSECOND", + "MINUTE_SECOND", + "MOD", + "MODIFIES", + "NATURAL", + "NOT", + "NO_WRITE_TO_BINLOG", + "NULL", + "NUMERIC", + "ON", + "OPTIMIZE", + "OPTION", + "OPTIONALLY", + "OR", + "ORDER", + "OUT", + "OUTER", + "OUTFILE", + "POSITION", + "PRECISION", + "PRIMARY", + "PROCEDURE", + "PURGE", + "READ", + "READS", + "REAL", + "REFERENCES", + "REGEXP", + "RENAME", + "REPEAT", + "REPLACE", + "REQUIRE", + "RESTRICT", + "RETURN", + "REVOKE", + "RIGHT", + "RLIKE", + "SCHEMA", + "SCHEMAS", + "SECOND_MICROSECOND", + "SELECT", + "SENSITIVE", + "SEPARATOR", + "SET", + "SHOW", + "SMALLINT", + "SONAME", + "SPATIAL", + "SPECIFIC", + "SQL", + "SQLEXCEPTION", + "SQLSTATE", + "SQLWARNING", + "SQL_BIG_RESULT", + "SQL_CALC_FOUND_ROWS", + "SQL_SMALL_RESULT", + "SSL", + "STARTING", + "STRAIGHT_JOIN", + "TABLE", + "TERMINATED", + "THEN", + "TINYBLOB", + "TINYINT", + "TINYTEXT", + "TO", + "TRAILING", + "TRIGGER", + "TRUE", + "UNDO", + "UNION", + "UNIQUE", + "UNLOCK", + "UNSIGNED", + "UPDATE", + "USAGE", + "USE", + "USING", + "UTC_DATE", + "UTC_TIME", + "UTC_TIMESTAMP", + "VALUES", + "VARBINARY", + "VARCHAR", + "VARCHARACTER", + "VARYING", + "WHEN", + "WHERE", + "WHILE", + "WITH", + "WRITE", + "XOR", + "YEAR_MONTH", + "ZEROFILL" + }, + nativeMeta.getReservedWords()); + + assertEquals("`", nativeMeta.getStartQuote()); + assertEquals("`", nativeMeta.getEndQuote()); + assertEquals( + "http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html", + nativeMeta.getExtraOptionsHelpText()); + assertTrue(nativeMeta.isSystemTable("sysTest")); + assertTrue(nativeMeta.isSystemTable("dtproperties")); + assertFalse(nativeMeta.isSystemTable("SysTest")); + assertFalse(nativeMeta.isSystemTable("dTproperties")); + assertFalse(nativeMeta.isSystemTable("Testsys")); + assertTrue(nativeMeta.isMySqlVariant()); + assertFalse(nativeMeta.isReleaseSavepoint()); + assertTrue(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); + assertFalse(nativeMeta.isRequiringTransactionsOnQueries()); + } + + @Test + public void testSqlStatements() { + assertEquals(" LIMIT 15", nativeMeta.getLimitClause(15)); + assertEquals("SELECT * FROM FOO LIMIT 0", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT * FROM FOO LIMIT 0", nativeMeta.getSqlTableExists("FOO")); + assertEquals("SELECT FOO FROM BAR LIMIT 0", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + + assertEquals( + "ALTER TABLE FOO ADD BAR DATETIME", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DATETIME", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BOOLEAN", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR INT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR INT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(21, 4)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR MEDIUMTEXT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaNumber("BAR", 10, -7), + "", + false, + "", + false)); // Bug here - invalid SQL + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(22, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR DOUBLE", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR UNKNOWN", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP BAR" + lineSep, + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR TINYTEXT", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR"), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ADD BAR INT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT NOT NULL PRIMARY KEY", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR DECIMAL(22)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR CHAR(1)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 1, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD BAR LONGTEXT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 16777250, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD BAR LONGBLOB", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBinary("BAR", 16777250, 0), "", false, "", false)); + + assertEquals( + "LOCK TABLES FOO WRITE, BAR WRITE;" + lineSep, + nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + + assertEquals("UNLOCK TABLES", nativeMeta.getSqlUnlockTables(new String[] {})); + + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (1, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } + + /** + * @return + * @throws Exception + */ + private ResultSetMetaData getResultSetMetaData() throws Exception { + ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); + + /** + * Fields setup around the following query: + * + *

select CUSTOMERNUMBER as NUMBER , CUSTOMERNAME as NAME , CONTACTLASTNAME as LAST_NAME , + * CONTACTFIRSTNAME as FIRST_NAME , 'MySQL' as DB , 'NoAliasText' from CUSTOMERS ORDER BY + * CUSTOMERNAME; + */ + doReturn("NUMBER").when(resultSetMetaData).getColumnLabel(1); + doReturn("NAME").when(resultSetMetaData).getColumnLabel(2); + doReturn("LAST_NAME").when(resultSetMetaData).getColumnLabel(3); + doReturn("FIRST_NAME").when(resultSetMetaData).getColumnLabel(4); + doReturn("DB").when(resultSetMetaData).getColumnLabel(5); + doReturn("NoAliasText").when(resultSetMetaData).getColumnLabel(6); + + doReturn("CUSTOMERNUMBER").when(resultSetMetaData).getColumnName(1); + doReturn("CUSTOMERNAME").when(resultSetMetaData).getColumnName(2); + doReturn("CONTACTLASTNAME").when(resultSetMetaData).getColumnName(3); + doReturn("CONTACTFIRSTNAME").when(resultSetMetaData).getColumnName(4); + doReturn("MySQL").when(resultSetMetaData).getColumnName(5); + doReturn("NoAliasText").when(resultSetMetaData).getColumnName(6); + + return resultSetMetaData; + } + + /** + * @return + * @throws Exception + */ + private ResultSetMetaData getResultSetMetaDataException() throws Exception { + ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); + + doThrow(new SQLException()).when(resultSetMetaData).getColumnLabel(1); + doThrow(new SQLException()).when(resultSetMetaData).getColumnName(1); + + return resultSetMetaData; + } + + @Test + public void testExtraOptions() { + DatabaseMeta nativeMeta = + new DatabaseMeta("", "MYSQL", "JDBC", null, "stub:stub", null, null, null); + Map opts = nativeMeta.getExtraOptions(); + assertNotNull(opts); + assertEquals("500", opts.get("MYSQL.defaultFetchSize")); + } + + @Test + public void testGetLegacyColumnNameDriverGreaterThanThreeFieldNumber() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + assertEquals( + "NUMBER", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 1)); + } + + @Test + public void testGetLegacyColumnNameDriverGreaterThanThreeFieldName() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + assertEquals( + "NAME", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 2)); + } + + @Test + public void testGetLegacyColumnNameDriverGreaterThanThreeFieldLastName() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + assertEquals( + "LAST_NAME", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 3)); + } + + @Test + public void testGetLegacyColumnNameDriverGreaterThanThreeFieldFirstName() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + assertEquals( + "FIRST_NAME", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 4)); + } + + @Test + public void testGetLegacyColumnNameDriverGreaterThanThreeFieldDB() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + assertEquals( + "DB", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 5)); + } + + @Test + public void testGetLegacyColumnNameDriverGreaterThanThreeFieldNoAliasText() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + assertEquals( + "NoAliasText", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 6)); + } + + @Test + public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldCustomerNumber() + throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + assertEquals( + "CUSTOMERNUMBER", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 1)); + } + + @Test + public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldCustomerName() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + assertEquals( + "CUSTOMERNAME", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 2)); + } + + @Test + public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldContactLastName() + throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + assertEquals( + "CONTACTLASTNAME", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 3)); + } + + @Test + public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldContactFirstName() + throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + assertEquals( + "CONTACTFIRSTNAME", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 4)); + } + + @Test + public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldMySql() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + assertEquals( + "MySQL", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 5)); + } + + @Test + public void testGetLegacyColumnNameDriverLessOrEqualToThreeFieldNoAliasText() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + assertEquals( + "NoAliasText", + new MySqlDatabaseMeta().getLegacyColumnName(databaseMetaData, getResultSetMetaData(), 6)); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameNullDBMetaDataException() throws Exception { + new MySqlDatabaseMeta().getLegacyColumnName(null, getResultSetMetaData(), 1); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameNullRSMetaDataException() throws Exception { + new MySqlDatabaseMeta().getLegacyColumnName(mock(DatabaseMetaData.class), null, 1); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameDriverGreaterThanThreeException() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(5); + + new MySqlDatabaseMeta() + .getLegacyColumnName(databaseMetaData, getResultSetMetaDataException(), 1); + } + + @Test(expected = HopDatabaseException.class) + public void testGetLegacyColumnNameDriverLessOrEqualToThreeException() throws Exception { + DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); + when(databaseMetaData.getDriverMajorVersion()).thenReturn(3); + + new MySqlDatabaseMeta() + .getLegacyColumnName(databaseMetaData, getResultSetMetaDataException(), 1); + } + + @Test + public void testReleaseSavepoint() { + assertFalse(nativeMeta.isReleaseSavepoint()); + } + + @Test + public void testSupportsSequence() { + String dbType = nativeMeta.getClass().getSimpleName(); + assertFalse(dbType, nativeMeta.isSupportsSequences()); + assertTrue(Utils.isEmpty(nativeMeta.getSqlListOfSequences())); + assertEquals("", nativeMeta.getSqlSequenceExists("testSeq")); + assertEquals("", nativeMeta.getSqlNextSequenceValue("testSeq")); + assertEquals("", nativeMeta.getSqlCurrentSequenceValue("testSeq")); + } + + private Connection mockConnection(DatabaseMetaData dbMetaData) throws SQLException { + Connection conn = mock(Connection.class); + when(conn.getMetaData()).thenReturn(dbMetaData); + return conn; + } + + @Test + public void testVarBinaryIsConvertedToStringType() throws Exception { + ILoggingObject log = mock(ILoggingObject.class); + PreparedStatement ps = mock(PreparedStatement.class); + DatabaseMetaData dbMetaData = mock(DatabaseMetaData.class); + IVariables variables = mock(IVariables.class); + ResultSet rs = mock(ResultSet.class); + ResultSetMetaData rsMeta = mock(ResultSetMetaData.class); + + when(rsMeta.getColumnCount()).thenReturn(1); + when(rsMeta.getColumnLabel(1)).thenReturn("column"); + when(rsMeta.getColumnName(1)).thenReturn("column"); + when(rsMeta.getColumnType(1)).thenReturn(java.sql.Types.VARBINARY); + when(rs.getMetaData()).thenReturn(rsMeta); + when(ps.executeQuery()).thenReturn(rs); + + DatabaseMeta meta = new DatabaseMeta(); + meta.setIDatabase(new MySqlDatabaseMeta()); + + Database db = new Database(log, variables, meta); + db.setConnection(mockConnection(dbMetaData)); + db.getLookup(ps, false); + + IRowMeta rowMeta = db.getReturnRowMeta(); + assertEquals(1, db.getReturnRowMeta().size()); + + IValueMeta valueMeta = rowMeta.getValueMeta(0); + assertEquals(IValueMeta.TYPE_BINARY, valueMeta.getType()); + } +} diff --git a/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlValueMetaBaseTest.java b/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlValueMetaBaseTest.java index 85931bf6254..91143486088 100644 --- a/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlValueMetaBaseTest.java +++ b/plugins/databases/mysql/src/test/java/org/apache/hop/databases/mysql/MySqlValueMetaBaseTest.java @@ -1,176 +1,175 @@ -/* - * 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 org.apache.hop.databases.mysql; - -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.database.BaseDatabaseMeta; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaBase; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Types; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class MySqlValueMetaBaseTest { - protected static final String TEST_NAME = "TEST_NAME"; - protected static final String LOG_FIELD = "LOG_FIELD"; - - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - ; - private PreparedStatement preparedStatementMock = mock(PreparedStatement.class); - private ResultSet resultSet; - private DatabaseMeta databaseMeta; - private IValueMeta valueMetaBase; - private IVariables variables; - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - // HopLogStore.init(); - } - - @Before - public void setUp() throws HopPluginException { - valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); - databaseMeta = spy(new DatabaseMeta()); - resultSet = mock(ResultSet.class); - variables = spy(new Variables()); - } - - protected void initValueMeta(BaseDatabaseMeta dbMeta, int length, Object data) - throws HopDatabaseException { - IValueMeta valueMetaString = new ValueMetaString(LOG_FIELD, length, 0); - databaseMeta.setIDatabase(dbMeta); - valueMetaString.setPreparedStatementValue(databaseMeta, preparedStatementMock, 0, data); - } - - @Test - public void test_Pdi_17126_mysql() throws Exception { - String data = StringUtils.repeat("*", 10); - initValueMeta(new MySqlDatabaseMeta(), DatabaseMeta.CLOB_LENGTH, data); - - verify(preparedStatementMock, times(1)).setString(0, data); - } - - @Test - public void testGetValueFromSqlTypeBinaryMysql() throws Exception { - - final int binaryColumnIndex = 1; - ValueMetaBase valueMetaBase = new ValueMetaBase(); - DatabaseMeta dbMeta = spy(new DatabaseMeta()); - IDatabase iDatabase = new MySqlDatabaseMeta(); - dbMeta.setIDatabase(iDatabase); - - ResultSetMetaData metaData = mock(ResultSetMetaData.class); - - when(resultSet.getMetaData()).thenReturn(metaData); - when(metaData.getColumnType(binaryColumnIndex)).thenReturn(Types.LONGVARBINARY); - - IValueMeta binaryValueMeta = - valueMetaBase.getValueFromSqlType( - variables, dbMeta, TEST_NAME, metaData, binaryColumnIndex, false, false); - assertEquals(IValueMeta.TYPE_BINARY, binaryValueMeta.getType()); - assertTrue(binaryValueMeta.isBinary()); - } - - @Test - public void testMetdataPreviewSqlDoubleWithPrecisionGreaterThanLengthUsingMySqlVariant() - throws SQLException, HopDatabaseException { - doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE"); - doReturn(4).when(resultSet).getInt("COLUMN_SIZE"); - doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS"); - doReturn(5).when(resultSet).getInt("DECIMAL_DIGITS"); - doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); - doReturn(true).when(databaseMeta).isMySqlVariant(); - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isNumber()); - assertEquals(-1, valueMeta.getPrecision()); - assertEquals(-1, valueMeta.getLength()); - } - - @Test - public void testMetdataPreviewSqlTimeToHopIntegerUsingMySqlVariant() - throws SQLException, HopDatabaseException { - doReturn(Types.TIME).when(resultSet).getInt("DATA_TYPE"); - doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); - doReturn(true).when(databaseMeta).isMySqlVariant(); - doReturn(mock(Properties.class)).when(databaseMeta).getConnectionProperties(variables); - when(databaseMeta.getConnectionProperties(variables).getProperty("yearIsDateType")) - .thenReturn("false"); - doReturn("YEAR").when(resultSet).getString("TYPE_NAME"); - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isInteger()); - assertEquals(0, valueMeta.getPrecision()); - assertEquals(4, valueMeta.getLength()); - } - - @Test - public void testMetdataPreviewSqlVarBinaryToHopBinaryUsingMySqlVariant() - throws SQLException, HopDatabaseException { - doReturn(Types.VARBINARY).when(resultSet).getInt("DATA_TYPE"); - doReturn(16).when(resultSet).getInt("COLUMN_SIZE"); - doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); - doReturn(true).when(databaseMeta).isMySqlVariant(); - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isBinary()); - assertEquals(-1, valueMeta.getLength()); - } - - @Test - public void testMetdataPreviewSqlDoubleToHopNumberUsingMySql() - throws SQLException, HopDatabaseException { - doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE"); - doReturn(22).when(resultSet).getInt("COLUMN_SIZE"); - doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); - doReturn(true).when(databaseMeta).isMySqlVariant(); - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isNumber()); - assertEquals(-1, valueMeta.getLength()); - } -} +/* + * 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 org.apache.hop.databases.mysql; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Properties; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.database.BaseDatabaseMeta; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaBase; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +public class MySqlValueMetaBaseTest { + protected static final String TEST_NAME = "TEST_NAME"; + protected static final String LOG_FIELD = "LOG_FIELD"; + + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + ; + private PreparedStatement preparedStatementMock = mock(PreparedStatement.class); + private ResultSet resultSet; + private DatabaseMeta databaseMeta; + private IValueMeta valueMetaBase; + private IVariables variables; + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + // HopLogStore.init(); + } + + @Before + public void setUp() throws HopPluginException { + valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); + databaseMeta = spy(new DatabaseMeta()); + resultSet = mock(ResultSet.class); + variables = spy(new Variables()); + } + + protected void initValueMeta(BaseDatabaseMeta dbMeta, int length, Object data) + throws HopDatabaseException { + IValueMeta valueMetaString = new ValueMetaString(LOG_FIELD, length, 0); + databaseMeta.setIDatabase(dbMeta); + valueMetaString.setPreparedStatementValue(databaseMeta, preparedStatementMock, 0, data); + } + + @Test + public void test_Pdi_17126_mysql() throws Exception { + String data = StringUtils.repeat("*", 10); + initValueMeta(new MySqlDatabaseMeta(), DatabaseMeta.CLOB_LENGTH, data); + + verify(preparedStatementMock, times(1)).setString(0, data); + } + + @Test + public void testGetValueFromSqlTypeBinaryMysql() throws Exception { + + final int binaryColumnIndex = 1; + ValueMetaBase valueMetaBase = new ValueMetaBase(); + DatabaseMeta dbMeta = spy(new DatabaseMeta()); + IDatabase iDatabase = new MySqlDatabaseMeta(); + dbMeta.setIDatabase(iDatabase); + + ResultSetMetaData metaData = mock(ResultSetMetaData.class); + + when(resultSet.getMetaData()).thenReturn(metaData); + when(metaData.getColumnType(binaryColumnIndex)).thenReturn(Types.LONGVARBINARY); + + IValueMeta binaryValueMeta = + valueMetaBase.getValueFromSqlType( + variables, dbMeta, TEST_NAME, metaData, binaryColumnIndex, false, false); + assertEquals(IValueMeta.TYPE_BINARY, binaryValueMeta.getType()); + assertTrue(binaryValueMeta.isBinary()); + } + + @Test + public void testMetdataPreviewSqlDoubleWithPrecisionGreaterThanLengthUsingMySqlVariant() + throws SQLException, HopDatabaseException { + doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE"); + doReturn(4).when(resultSet).getInt("COLUMN_SIZE"); + doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS"); + doReturn(5).when(resultSet).getInt("DECIMAL_DIGITS"); + doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); + doReturn(true).when(databaseMeta).isMySqlVariant(); + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isNumber()); + assertEquals(-1, valueMeta.getPrecision()); + assertEquals(-1, valueMeta.getLength()); + } + + @Test + public void testMetdataPreviewSqlTimeToHopIntegerUsingMySqlVariant() + throws SQLException, HopDatabaseException { + doReturn(Types.TIME).when(resultSet).getInt("DATA_TYPE"); + doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); + doReturn(true).when(databaseMeta).isMySqlVariant(); + doReturn(mock(Properties.class)).when(databaseMeta).getConnectionProperties(variables); + when(databaseMeta.getConnectionProperties(variables).getProperty("yearIsDateType")) + .thenReturn("false"); + doReturn("YEAR").when(resultSet).getString("TYPE_NAME"); + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isInteger()); + assertEquals(0, valueMeta.getPrecision()); + assertEquals(4, valueMeta.getLength()); + } + + @Test + public void testMetdataPreviewSqlVarBinaryToHopBinaryUsingMySqlVariant() + throws SQLException, HopDatabaseException { + doReturn(Types.VARBINARY).when(resultSet).getInt("DATA_TYPE"); + doReturn(16).when(resultSet).getInt("COLUMN_SIZE"); + doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); + doReturn(true).when(databaseMeta).isMySqlVariant(); + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isBinary()); + assertEquals(-1, valueMeta.getLength()); + } + + @Test + public void testMetdataPreviewSqlDoubleToHopNumberUsingMySql() + throws SQLException, HopDatabaseException { + doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE"); + doReturn(22).when(resultSet).getInt("COLUMN_SIZE"); + doReturn(mock(MySqlDatabaseMeta.class)).when(databaseMeta).getIDatabase(); + doReturn(true).when(databaseMeta).isMySqlVariant(); + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isNumber()); + assertEquals(-1, valueMeta.getLength()); + } +} diff --git a/plugins/databases/netezza/src/main/java/org/apache/hop/databases/netezza/NetezzaDatabaseMeta.java b/plugins/databases/netezza/src/main/java/org/apache/hop/databases/netezza/NetezzaDatabaseMeta.java index 8c7fbb2cb5b..b1d6ad5f5d6 100644 --- a/plugins/databases/netezza/src/main/java/org/apache/hop/databases/netezza/NetezzaDatabaseMeta.java +++ b/plugins/databases/netezza/src/main/java/org/apache/hop/databases/netezza/NetezzaDatabaseMeta.java @@ -25,21 +25,26 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Netezza specific information through static final members - */ -@DatabaseMetaPlugin(type = "NETEZZA", typeDescription = "Netezza", documentationUrl = "/database/databases/netezza.html") +/** Contains Netezza specific information through static final members */ +@DatabaseMetaPlugin( + type = "NETEZZA", + typeDescription = "Netezza", + documentationUrl = "/database/databases/netezza.html") @GuiPlugin(id = "GUI-NetezzaDatabaseMeta") public class NetezzaDatabaseMeta extends BaseDatabaseMeta implements IDatabase { public static final int MAX_CHAR_LEN = 32767; - /** @return The extra option separator in database URL for this platform */ + /** + * @return The extra option separator in database URL for this platform + */ @Override public String getExtraOptionSeparator() { return "&"; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "?"; @@ -78,13 +83,17 @@ public boolean isFetchSizeSupported() { return true; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; @@ -95,7 +104,9 @@ public boolean isSupportsSequences() { return true; } - /** @return true if auto incremment is supported */ + /** + * @return true if auto incremment is supported + */ @Override public boolean isSupportsAutoInc() { return false; diff --git a/plugins/databases/netezza/src/test/java/org/apache/hop/core/row/value/NettezaValueMetaBaseTest.java b/plugins/databases/netezza/src/test/java/org/apache/hop/core/row/value/NettezaValueMetaBaseTest.java index c6f1a7b9672..442f5c74da7 100644 --- a/plugins/databases/netezza/src/test/java/org/apache/hop/core/row/value/NettezaValueMetaBaseTest.java +++ b/plugins/databases/netezza/src/test/java/org/apache/hop/core/row/value/NettezaValueMetaBaseTest.java @@ -17,6 +17,19 @@ package org.apache.hop.core.row.value; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.DatabasePluginType; import org.apache.hop.core.database.IDatabase; @@ -35,20 +48,6 @@ import org.junit.Test; import org.mockito.Spy; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class NettezaValueMetaBaseTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NetezzaDatabaseMetaTest.java b/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NetezzaDatabaseMetaTest.java index d792052bba0..e06c460adcf 100644 --- a/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NetezzaDatabaseMetaTest.java +++ b/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NetezzaDatabaseMetaTest.java @@ -1,688 +1,688 @@ -/* - * 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 org.apache.hop.databases.netezza; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class NetezzaDatabaseMetaTest { - private NetezzaDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new NetezzaDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertEquals("&", nativeMeta.getExtraOptionSeparator()); - assertEquals("?", nativeMeta.getExtraOptionIndicator()); - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(5480, nativeMeta.getDefaultDatabasePort()); - assertEquals("org.netezza.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:netezza://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:netezza://FOO:/WIBBLE", - nativeMeta.getURL("FOO", "", "WIBBLE")); // I think this is a bug... - assertEquals( - "jdbc:netezza://FOO:null/WIBBLE", - nativeMeta.getURL("FOO", null, "WIBBLE")); // I think this is a bug... - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertTrue(nativeMeta.isSupportsSequences()); - assertFalse(nativeMeta.isSupportsAutoInc()); - - assertArrayEquals( - new String[] { - // As per the user manual - "ABORT", - "ADMIN", - "AGGREGATE", - "ALIGN", - "ALL", - "ALLOCATE", - "ANALYSE", - "ANALYZE", - "AND", - "ANY", - "AS", - "ASC", - "BETWEEN", - "BINARY", - "BIT", - "BOTH", - "CASE", - "CAST", - "CHAR", - "CHARACTER", - "CHECK", - "CLUSTER", - "COALESCE", - "COLLATE", - "COLLATION", - "COLUMN", - "CONSTRAINT", - "COPY", - "CROSS", - "CURRENT", - "CURRENT_CATALOG", - "CURRENT_DATE", - "CURRENT_DB", - "CURRENT_SCHEMA", - "CURRENT_SID", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "CURRENT_USERID", - "CURRENT_USEROID", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECODE", - "DEFAULT", - "DEFERRABLE", - "DESC", - "DISTINCT", - "DISTRIBUTE", - "DO", - "ELSE", - "END", - "EXCEPT", - "EXCLUDE", - "EXISTS", - "EXPLAIN", - "EXPRESS", - "EXTEND", - "EXTRACT", - "FALSE", - "FIRST", - "FLOAT", - "FOLLOWING", - "FOR", - "FOREIGN", - "FROM", - "FULL", - "FUNCTION", - "GENSTATS", - "GLOBAL", - "GROUP", - "HAVING", - "ILIKE", - "IN", - "INDEX", - "INITIALLY", - "INNER", - "INOUT", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISNULL", - "JOIN", - "LAST", - "LEADING", - "LEFT", - "LIKE", - "LIMIT", - "LISTEN", - "LOAD", - "LOCAL", - "LOCK", - "MATERIALIZED", - "MINUS", - "MOVE", - "NATURAL", - "NCHAR", - "NEW", - "NOT", - "NOTNULL", - "NULL", - "NULLIF", - "NULLS", - "NUMERIC", - "NVL", - "NVL2", - "OFF", - "OFFSET", - "OLD", - "ON", - "ONLINE", - "ONLY", - "OR", - "ORDER", - "OTHERS", - "OUT", - "OUTER", - "OVER", - "OVERLAPS", - "PARTITION", - "POSITION", - "PRECEDING", - "PRECISION", - "PRESERVE", - "PRIMARY", - "PUBLIC", - "RANGE", - "RECLAIM", - "REFERENCES", - "RESET", - "REUSE", - "RIGHT", - "ROWS", - "ROWSETLIMIT", - "RULE", - "SEARCH", - "SELECT", - "SEQUENCE", - "SESSION_USER", - "SETOF", - "SHOW", - "SOME", - "SUBSTRING", - "SYSTEM", - "TABLE", - "THEN", - "TIES", - "TIME", - "TIMESTAMP", - "TO", - "TRAILING", - "TRANSACTION", - "TRIGGER", - "TRIM", - "TRUE", - "UNBOUNDED", - "UNION", - "UNIQUE", - "USER", - "USING", - "VACUUM", - "VARCHAR", - "VERBOSE", - "VIEW", - "WHEN", - "WHERE", - "WITH", - "WRITE", - "ABSOLUTE", - "ACTION", - "ADD", - "ADMIN", - "AFTER", - "AGGREGATE", - "ALIAS", - "ALL", - "ALLOCATE", - "ALTER", - "AND", - "ANY", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASSERTION", - "AT", - "AUTHORIZATION", - "BEFORE", - "BEGIN", - "BINARY", - "BIT", - "BLOB", - "BOOLEAN", - "BOTH", - "BREADTH", - "BY", - "CALL", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CHAR", - "CHARACTER", - "CHECK", - "CLASS", - "CLOB", - "CLOSE", - "COLLATE", - "COLLATION", - "COLUMN", - "COMMIT", - "COMPLETION", - "CONNECT", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRUCTOR", - "CONTINUE", - "CORRESPONDING", - "CREATE", - "CROSS", - "CUBE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_TIME", - "CURRENT_", - "TIMESTAMP", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DATA", - "DATE", - "DAY", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRABLE", - "DEFERRED", - "DELETE", - "DEPTH", - "DEREF", - "DESC", - "DESCRIBE", - "DESCRIPTOR", - "DESTROY", - "DESTRUCTOR", - "DETERMINISTIC", - "DIAGNOSTICS", - "DICTIONARY", - "DISCONNECT", - "DISTINCT", - "DOMAIN", - "DOUBLE", - "DROP", - "DYNAMIC", - "EACH", - "ELSE", - "END_EXEC", - "END", - "EQUALS", - "ESCAPE", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXEC", - "EXECUTE", - "EXTERNAL", - "FALSE", - "FETCH", - "FIRST", - "FLOAT", - "FOR", - "FOREIGN", - "FOUND", - "FREE", - "FROM", - "FULL", - "FUNCTION", - "GENERAL", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GROUP", - "GROUPING", - "HAVING", - "HOST", - "HOUR", - "IDENTITY", - "IGNORE", - "IMMEDIATE", - "IN", - "INDICATOR", - "INITIALIZE", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSERT", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ISOLATION", - "ITERATE", - "JOIN", - "KEY", - "LANGUAGE", - "LARGE", - "LAST", - "LATERAL", - "LEADING", - "LEFT", - "LESS", - "LEVEL", - "LIKE", - "LIMIT", - "LOCAL", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATOR", - "MAP", - "MATCH", - "MINUTE", - "MODIFIES", - "MODIFY", - "MODULE", - "MONTH", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NCLOB", - "NEW", - "NEXT", - "NO", - "NONE", - "NOT", - "NULL", - "NUMERIC", - "OBJECT", - "OF", - "OFF", - "OLD", - "ON", - "ONLY", - "OPEN", - "OPERATION", - "OPTION", - "OR", - "ORDER", - "ORDINALITY", - "OUT", - "OUTER", - "OUTPUT", - "PAD", - "PARAMETER", - "PARAMETERS", - "PARTIAL", - "PATH", - "POSTFIX", - "PRECISION", - "PREFIX", - "PREORDER", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURE", - "PUBLIC", - "READ", - "READS", - "REAL", - "RECURSIVE", - "REF", - "REFERENCES", - "REFERENCING", - "RELATIVE", - "RESTRICT", - "RESULT", - "RETURN", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROW", - "ROWS", - "SAVEPOINT", - "SCHEMA", - "SCOPE", - "SCROLL", - "SEARCH", - "SECOND", - "SECTION", - "SELECT", - "SEQUENCE", - "SESSION", - "SESSION_USER", - "SET", - "SETS", - "SIZE", - "SMALLINT", - "SOME", - "SPACE", - "SPECIFIC", - "SPECIFICTYPE", - "SQL", - "SQLEXCEPTION", - "SQLSTATE", - "SQLWARNING", - "START", - "STATE", - "STATEMENT", - "STATIC", - "STRUCTURE", - "SYSTEM_USER", - "TABLE", - "TEMPORARY", - "TERMINATE", - "THAN", - "THEN", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TRAILING", - "TRANSACTION", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRUE", - "UNDER", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNNEST", - "UPDATE", - "USAGE", - "USER", - "USING", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VIEW", - "WHEN", - "WHENEVER", - "WHERE", - "WITH", - "WITHOUT", - "WORK", - "WRITE", - "YEAR", - "ZONE" - }, - nativeMeta.getReservedWords()); - - assertFalse(nativeMeta.isDefaultingToUppercase()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - } - - @Test - public void testSqlStatements() { - assertEquals(" limit 15", nativeMeta.getLimitClause(15)); - assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlTableExists("FOO")); - - assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlColumnExists("FOO", "BAR")); - assertEquals("select next value for FOO", nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals("select last_value from FOO", nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals( - "SELECT seqname AS sequence_name from _v_sequence where seqname = 'foo'", - nativeMeta.getSqlSequenceExists("FOO")); - assertEquals( - "SELECT seqname AS sequence_name from _v_sequence", nativeMeta.getSqlListOfSequences()); - assertNull(nativeMeta.getAddColumnStatement("", null, "", false, "", false)); - assertNull(nativeMeta.getDropColumnStatement("", null, "", false, "", false)); - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO MODIFY COLUMN BAR" + lineSep + ";" + lineSep, - nativeMeta.getModifyColumnStatement( - "FOO", - new ValueMetaString("BAR", 15, 0), - null, - false, - null, - false)); // Pretty sure this is a bug ... - assertNull(nativeMeta.getSqlListOfProcedures()); - assertNull(nativeMeta.getSqlLockTables(new String[] {})); - assertNull(nativeMeta.getSqlUnlockTables(new String[] {})); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO date", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), null, null, false, true, false)); - assertEquals( - "boolean", - nativeMeta.getFieldDefinition( - new ValueMetaBoolean("FOO"), null, null, false, false, false)); - - assertEquals( - "", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 0, 0), null, null, false, false, false)); - assertEquals( - "byteint", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 1, 0), null, null, false, false, false)); - assertEquals( - "byteint", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 2, 0), null, null, false, false, false)); - assertEquals( - "smallint", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 3, 0), null, null, false, false, false)); - assertEquals( - "smallint", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 4, 0), null, null, false, false, false)); - for (int i = 5; i < 10; i++) { - assertEquals( - "integer", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", i, 0), null, null, false, false, false)); - } - assertEquals( - "bigint", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), null, null, false, false, false)); - assertEquals( - "", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", -22, 3), null, null, false, false, false)); - assertEquals( - "", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 0, 3), null, null, false, false, false)); - assertEquals( - "real", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 1, 3), - null, - null, - false, - false, - false)); // pretty sure this is a bug ... - assertEquals( - "real", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 2, 3), - null, - null, - false, - false, - false)); // pretty sure this is a bug ... - for (int i = 3; i < 9; i++) { - assertEquals( - "real", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", i, 3), null, null, false, false, false)); - } - for (int i = 10; i < 18; i++) { - assertEquals( - "double", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", i, 3), null, null, false, false, false)); - } - assertEquals( - "numeric(18, 3)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 18, 3), null, null, false, false, false)); - assertEquals( - "numeric(19)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 19, -12), null, null, false, false, false)); - - assertEquals( - "varchar(32767)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", (NetezzaDatabaseMeta.MAX_CHAR_LEN + 2), 0), - null, - null, - false, - false, - false)); - assertEquals( - "varchar(10)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 10, 0), null, null, false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 10, 0), null, null, false, false, false)); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - " UNKNOWN" + lineSep, - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 10, 0), null, null, false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.netezza; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.junit.Before; +import org.junit.Test; + +public class NetezzaDatabaseMetaTest { + private NetezzaDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new NetezzaDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertEquals("&", nativeMeta.getExtraOptionSeparator()); + assertEquals("?", nativeMeta.getExtraOptionIndicator()); + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(5480, nativeMeta.getDefaultDatabasePort()); + assertEquals("org.netezza.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:netezza://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:netezza://FOO:/WIBBLE", + nativeMeta.getURL("FOO", "", "WIBBLE")); // I think this is a bug... + assertEquals( + "jdbc:netezza://FOO:null/WIBBLE", + nativeMeta.getURL("FOO", null, "WIBBLE")); // I think this is a bug... + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertTrue(nativeMeta.isSupportsSequences()); + assertFalse(nativeMeta.isSupportsAutoInc()); + + assertArrayEquals( + new String[] { + // As per the user manual + "ABORT", + "ADMIN", + "AGGREGATE", + "ALIGN", + "ALL", + "ALLOCATE", + "ANALYSE", + "ANALYZE", + "AND", + "ANY", + "AS", + "ASC", + "BETWEEN", + "BINARY", + "BIT", + "BOTH", + "CASE", + "CAST", + "CHAR", + "CHARACTER", + "CHECK", + "CLUSTER", + "COALESCE", + "COLLATE", + "COLLATION", + "COLUMN", + "CONSTRAINT", + "COPY", + "CROSS", + "CURRENT", + "CURRENT_CATALOG", + "CURRENT_DATE", + "CURRENT_DB", + "CURRENT_SCHEMA", + "CURRENT_SID", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "CURRENT_USERID", + "CURRENT_USEROID", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECODE", + "DEFAULT", + "DEFERRABLE", + "DESC", + "DISTINCT", + "DISTRIBUTE", + "DO", + "ELSE", + "END", + "EXCEPT", + "EXCLUDE", + "EXISTS", + "EXPLAIN", + "EXPRESS", + "EXTEND", + "EXTRACT", + "FALSE", + "FIRST", + "FLOAT", + "FOLLOWING", + "FOR", + "FOREIGN", + "FROM", + "FULL", + "FUNCTION", + "GENSTATS", + "GLOBAL", + "GROUP", + "HAVING", + "ILIKE", + "IN", + "INDEX", + "INITIALLY", + "INNER", + "INOUT", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISNULL", + "JOIN", + "LAST", + "LEADING", + "LEFT", + "LIKE", + "LIMIT", + "LISTEN", + "LOAD", + "LOCAL", + "LOCK", + "MATERIALIZED", + "MINUS", + "MOVE", + "NATURAL", + "NCHAR", + "NEW", + "NOT", + "NOTNULL", + "NULL", + "NULLIF", + "NULLS", + "NUMERIC", + "NVL", + "NVL2", + "OFF", + "OFFSET", + "OLD", + "ON", + "ONLINE", + "ONLY", + "OR", + "ORDER", + "OTHERS", + "OUT", + "OUTER", + "OVER", + "OVERLAPS", + "PARTITION", + "POSITION", + "PRECEDING", + "PRECISION", + "PRESERVE", + "PRIMARY", + "PUBLIC", + "RANGE", + "RECLAIM", + "REFERENCES", + "RESET", + "REUSE", + "RIGHT", + "ROWS", + "ROWSETLIMIT", + "RULE", + "SEARCH", + "SELECT", + "SEQUENCE", + "SESSION_USER", + "SETOF", + "SHOW", + "SOME", + "SUBSTRING", + "SYSTEM", + "TABLE", + "THEN", + "TIES", + "TIME", + "TIMESTAMP", + "TO", + "TRAILING", + "TRANSACTION", + "TRIGGER", + "TRIM", + "TRUE", + "UNBOUNDED", + "UNION", + "UNIQUE", + "USER", + "USING", + "VACUUM", + "VARCHAR", + "VERBOSE", + "VIEW", + "WHEN", + "WHERE", + "WITH", + "WRITE", + "ABSOLUTE", + "ACTION", + "ADD", + "ADMIN", + "AFTER", + "AGGREGATE", + "ALIAS", + "ALL", + "ALLOCATE", + "ALTER", + "AND", + "ANY", + "ARE", + "ARRAY", + "AS", + "ASC", + "ASSERTION", + "AT", + "AUTHORIZATION", + "BEFORE", + "BEGIN", + "BINARY", + "BIT", + "BLOB", + "BOOLEAN", + "BOTH", + "BREADTH", + "BY", + "CALL", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CHAR", + "CHARACTER", + "CHECK", + "CLASS", + "CLOB", + "CLOSE", + "COLLATE", + "COLLATION", + "COLUMN", + "COMMIT", + "COMPLETION", + "CONNECT", + "CONNECTION", + "CONSTRAINT", + "CONSTRAINTS", + "CONSTRUCTOR", + "CONTINUE", + "CORRESPONDING", + "CREATE", + "CROSS", + "CUBE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_PATH", + "CURRENT_ROLE", + "CURRENT_TIME", + "CURRENT_", + "TIMESTAMP", + "CURRENT_USER", + "CURSOR", + "CYCLE", + "DATA", + "DATE", + "DAY", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DEPTH", + "DEREF", + "DESC", + "DESCRIBE", + "DESCRIPTOR", + "DESTROY", + "DESTRUCTOR", + "DETERMINISTIC", + "DIAGNOSTICS", + "DICTIONARY", + "DISCONNECT", + "DISTINCT", + "DOMAIN", + "DOUBLE", + "DROP", + "DYNAMIC", + "EACH", + "ELSE", + "END_EXEC", + "END", + "EQUALS", + "ESCAPE", + "EVERY", + "EXCEPT", + "EXCEPTION", + "EXEC", + "EXECUTE", + "EXTERNAL", + "FALSE", + "FETCH", + "FIRST", + "FLOAT", + "FOR", + "FOREIGN", + "FOUND", + "FREE", + "FROM", + "FULL", + "FUNCTION", + "GENERAL", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GROUP", + "GROUPING", + "HAVING", + "HOST", + "HOUR", + "IDENTITY", + "IGNORE", + "IMMEDIATE", + "IN", + "INDICATOR", + "INITIALIZE", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSERT", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ISOLATION", + "ITERATE", + "JOIN", + "KEY", + "LANGUAGE", + "LARGE", + "LAST", + "LATERAL", + "LEADING", + "LEFT", + "LESS", + "LEVEL", + "LIKE", + "LIMIT", + "LOCAL", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATOR", + "MAP", + "MATCH", + "MINUTE", + "MODIFIES", + "MODIFY", + "MODULE", + "MONTH", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NCLOB", + "NEW", + "NEXT", + "NO", + "NONE", + "NOT", + "NULL", + "NUMERIC", + "OBJECT", + "OF", + "OFF", + "OLD", + "ON", + "ONLY", + "OPEN", + "OPERATION", + "OPTION", + "OR", + "ORDER", + "ORDINALITY", + "OUT", + "OUTER", + "OUTPUT", + "PAD", + "PARAMETER", + "PARAMETERS", + "PARTIAL", + "PATH", + "POSTFIX", + "PRECISION", + "PREFIX", + "PREORDER", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURE", + "PUBLIC", + "READ", + "READS", + "REAL", + "RECURSIVE", + "REF", + "REFERENCES", + "REFERENCING", + "RELATIVE", + "RESTRICT", + "RESULT", + "RETURN", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROLLUP", + "ROUTINE", + "ROW", + "ROWS", + "SAVEPOINT", + "SCHEMA", + "SCOPE", + "SCROLL", + "SEARCH", + "SECOND", + "SECTION", + "SELECT", + "SEQUENCE", + "SESSION", + "SESSION_USER", + "SET", + "SETS", + "SIZE", + "SMALLINT", + "SOME", + "SPACE", + "SPECIFIC", + "SPECIFICTYPE", + "SQL", + "SQLEXCEPTION", + "SQLSTATE", + "SQLWARNING", + "START", + "STATE", + "STATEMENT", + "STATIC", + "STRUCTURE", + "SYSTEM_USER", + "TABLE", + "TEMPORARY", + "TERMINATE", + "THAN", + "THEN", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TRAILING", + "TRANSACTION", + "TRANSLATION", + "TREAT", + "TRIGGER", + "TRUE", + "UNDER", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNNEST", + "UPDATE", + "USAGE", + "USER", + "USING", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VIEW", + "WHEN", + "WHENEVER", + "WHERE", + "WITH", + "WITHOUT", + "WORK", + "WRITE", + "YEAR", + "ZONE" + }, + nativeMeta.getReservedWords()); + + assertFalse(nativeMeta.isDefaultingToUppercase()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + } + + @Test + public void testSqlStatements() { + assertEquals(" limit 15", nativeMeta.getLimitClause(15)); + assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlTableExists("FOO")); + + assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlColumnExists("FOO", "BAR")); + assertEquals("select next value for FOO", nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals("select last_value from FOO", nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals( + "SELECT seqname AS sequence_name from _v_sequence where seqname = 'foo'", + nativeMeta.getSqlSequenceExists("FOO")); + assertEquals( + "SELECT seqname AS sequence_name from _v_sequence", nativeMeta.getSqlListOfSequences()); + assertNull(nativeMeta.getAddColumnStatement("", null, "", false, "", false)); + assertNull(nativeMeta.getDropColumnStatement("", null, "", false, "", false)); + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO MODIFY COLUMN BAR" + lineSep + ";" + lineSep, + nativeMeta.getModifyColumnStatement( + "FOO", + new ValueMetaString("BAR", 15, 0), + null, + false, + null, + false)); // Pretty sure this is a bug ... + assertNull(nativeMeta.getSqlListOfProcedures()); + assertNull(nativeMeta.getSqlLockTables(new String[] {})); + assertNull(nativeMeta.getSqlUnlockTables(new String[] {})); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO date", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), null, null, false, true, false)); + assertEquals( + "boolean", + nativeMeta.getFieldDefinition( + new ValueMetaBoolean("FOO"), null, null, false, false, false)); + + assertEquals( + "", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 0, 0), null, null, false, false, false)); + assertEquals( + "byteint", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 1, 0), null, null, false, false, false)); + assertEquals( + "byteint", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 2, 0), null, null, false, false, false)); + assertEquals( + "smallint", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 3, 0), null, null, false, false, false)); + assertEquals( + "smallint", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 4, 0), null, null, false, false, false)); + for (int i = 5; i < 10; i++) { + assertEquals( + "integer", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", i, 0), null, null, false, false, false)); + } + assertEquals( + "bigint", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), null, null, false, false, false)); + assertEquals( + "", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", -22, 3), null, null, false, false, false)); + assertEquals( + "", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 0, 3), null, null, false, false, false)); + assertEquals( + "real", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 1, 3), + null, + null, + false, + false, + false)); // pretty sure this is a bug ... + assertEquals( + "real", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 2, 3), + null, + null, + false, + false, + false)); // pretty sure this is a bug ... + for (int i = 3; i < 9; i++) { + assertEquals( + "real", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", i, 3), null, null, false, false, false)); + } + for (int i = 10; i < 18; i++) { + assertEquals( + "double", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", i, 3), null, null, false, false, false)); + } + assertEquals( + "numeric(18, 3)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 18, 3), null, null, false, false, false)); + assertEquals( + "numeric(19)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 19, -12), null, null, false, false, false)); + + assertEquals( + "varchar(32767)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", (NetezzaDatabaseMeta.MAX_CHAR_LEN + 2), 0), + null, + null, + false, + false, + false)); + assertEquals( + "varchar(10)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 10, 0), null, null, false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 10, 0), null, null, false, false, false)); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + " UNKNOWN" + lineSep, + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 10, 0), null, null, false, false, true)); + } +} diff --git a/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NettezaSequenceAndReleaseSavePointTest.java b/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NettezaSequenceAndReleaseSavePointTest.java index e4a6306d574..adbbfc35361 100644 --- a/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NettezaSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/netezza/src/test/java/org/apache/hop/databases/netezza/NettezaSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.netezza; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class NettezaSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/oracle/src/main/java/org/apache/hop/databases/oracle/OracleDatabaseMeta.java b/plugins/databases/oracle/src/main/java/org/apache/hop/databases/oracle/OracleDatabaseMeta.java index cae0e32e057..d22c8f75c5d 100644 --- a/plugins/databases/oracle/src/main/java/org/apache/hop/databases/oracle/OracleDatabaseMeta.java +++ b/plugins/databases/oracle/src/main/java/org/apache/hop/databases/oracle/OracleDatabaseMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.databases.oracle; +import java.sql.ResultSet; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.Database; @@ -30,12 +31,11 @@ import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; -import java.sql.ResultSet; - -/** - * Contains Oracle specific information through static final members - */ -@DatabaseMetaPlugin(type = "ORACLE", typeDescription = "Oracle", documentationUrl = "/database/databases/oracle.html") +/** Contains Oracle specific information through static final members */ +@DatabaseMetaPlugin( + type = "ORACLE", + typeDescription = "Oracle", + documentationUrl = "/database/databases/oracle.html") @GuiPlugin(id = "GUI-OracleDatabaseMeta") public class OracleDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @@ -54,13 +54,17 @@ public int getDefaultDatabasePort() { return -1; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; } - /** @see IDatabase#getLimitClause(int) */ + /** + * @see IDatabase#getLimitClause(int) + */ @Override public String getLimitClause(int nrRows) { return " WHERE ROWNUM <= " + nrRows; @@ -164,7 +168,9 @@ public boolean isSupportsOptionsInURL() { return false; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return true; @@ -233,7 +239,9 @@ public boolean useSchemaNameForTableList() { return true; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return true; @@ -533,7 +541,9 @@ public String[] getReservedWords() { }; } - /** @return The SQL on this database to get a list of stored procedures. */ + /** + * @return The SQL on this database to get a list of stored procedures. + */ @Override public String getSqlListOfProcedures() { return "SELECT OWNER||'.'||OBJECT_NAME||NVL2(PROCEDURE_NAME,'.'||PROCEDURE_NAME,NULL) FROM ALL_PROCEDURES ORDER BY 1"; @@ -556,7 +566,9 @@ public String getSqlUnlockTables(String[] tableNames) { return null; // commit handles the unlocking! } - /** @return extra help text on the supported options on the selected database platform. */ + /** + * @return extra help text on the supported options on the selected database platform. + */ @Override public String getExtraOptionsHelpText() { return "http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#i1006362"; @@ -646,13 +658,17 @@ public boolean isSupportsPreparedStatementMetadataRetrieval() { return true; } - /** @return The maximum number of columns in a database, <=0 means: no known limit */ + /** + * @return The maximum number of columns in a database, <=0 means: no known limit + */ @Override public int getMaxColumnsInIndex() { return 32; } - /** @return The SQL on this database to get a list of sequences. */ + /** + * @return The SQL on this database to get a list of sequences. + */ @Override public String getSqlListOfSequences() { return "SELECT SEQUENCE_NAME FROM all_sequences"; @@ -728,13 +744,17 @@ public SqlScriptParser createSqlScriptParser() { return new SqlScriptParser(false); } - /** @return true if using strict number(38) interpretation */ + /** + * @return true if using strict number(38) interpretation + */ @Override public boolean isStrictBigNumberInterpretation() { return "Y".equalsIgnoreCase(getAttributeProperty(STRICT_BIGNUMBER_INTERPRETATION, "N")); } - /** @param strictBigNumberInterpretation true if use strict number(38) interpretation */ + /** + * @param strictBigNumberInterpretation true if use strict number(38) interpretation + */ public void setStrictBigNumberInterpretation(boolean strictBigNumberInterpretation) { getAttributes().put(STRICT_BIGNUMBER_INTERPRETATION, strictBigNumberInterpretation ? "Y" : "N"); } diff --git a/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleDatabaseMetaTest.java b/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleDatabaseMetaTest.java index 2708b022074..36c7e18e876 100644 --- a/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleDatabaseMetaTest.java +++ b/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleDatabaseMetaTest.java @@ -1,541 +1,541 @@ -/* - * 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 org.apache.hop.databases.oracle; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.HopLogStore; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; -import org.mockito.Mockito; -import org.mockito.stubbing.Answer; - -import java.sql.ResultSet; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; - -public class OracleDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - private final String sequenceName = "sequence_name"; - - private OracleDatabaseMeta nativeMeta; - private IVariables variables; - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - HopLogStore.init(); - } - - @Before - public void setupOnce() throws Exception { - nativeMeta = new OracleDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - HopClientEnvironment.init(); - variables = Mockito.spy(new Variables()); - } - - @Test - public void testOverriddenSettings() throws Exception { - // Tests the settings of the Oracle Database Meta - // according to the features of the DB as we know them - - assertEquals(1521, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertEquals("oracle.jdbc.driver.OracleDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:oracle:thin:@FOO:1024:BAR", nativeMeta.getURL("FOO", "1024", "BAR")); - assertEquals("jdbc:oracle:thin:@FOO:11:BAR", nativeMeta.getURL("FOO", "11", ":BAR")); - assertEquals("jdbc:oracle:thin:@BAR:65534/FOO", nativeMeta.getURL("BAR", "65534", "/FOO")); - assertEquals("jdbc:oracle:thin:@FOO", nativeMeta.getURL("", "", "FOO")); - assertEquals("jdbc:oracle:thin:@FOO", nativeMeta.getURL(null, "-1", "FOO")); - assertEquals("jdbc:oracle:thin:@FOO", nativeMeta.getURL(null, null, "FOO")); - assertEquals("jdbc:oracle:thin:@FOO:1234:BAR", nativeMeta.getURL("FOO", "1234", "BAR")); - assertEquals( - "jdbc:oracle:thin:@", nativeMeta.getURL("", "", "")); // Pretty sure this is a bug... - assertFalse(nativeMeta.isSupportsOptionsInURL()); - assertTrue(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); - assertTrue(nativeMeta.useSchemaNameForTableList()); - assertTrue(nativeMeta.isSupportsSynonyms()); - String[] reservedWords = - new String[] { - "ACCESS", - "ADD", - "ALL", - "ALTER", - "AND", - "ANY", - "ARRAYLEN", - "AS", - "ASC", - "AUDIT", - "BETWEEN", - "BY", - "CHAR", - "CHECK", - "CLUSTER", - "COLUMN", - "COMMENT", - "COMPRESS", - "CONNECT", - "CREATE", - "CURRENT", - "DATE", - "DECIMAL", - "DEFAULT", - "DELETE", - "DESC", - "DISTINCT", - "DROP", - "ELSE", - "EXCLUSIVE", - "EXISTS", - "FILE", - "FLOAT", - "FOR", - "FROM", - "GRANT", - "GROUP", - "HAVING", - "IDENTIFIED", - "IMMEDIATE", - "IN", - "INCREMENT", - "INDEX", - "INITIAL", - "INSERT", - "INTEGER", - "INTERSECT", - "INTO", - "IS", - "LEVEL", - "LIKE", - "LOCK", - "LONG", - "MAXEXTENTS", - "MINUS", - "MODE", - "MODIFY", - "NOAUDIT", - "NOCOMPRESS", - "NOT", - "NOTFOUND", - "NOWAIT", - "NULL", - "NUMBER", - "OF", - "OFFLINE", - "ON", - "ONLINE", - "OPTION", - "OR", - "ORDER", - "PCTFREE", - "PRIOR", - "PRIVILEGES", - "PUBLIC", - "RAW", - "RENAME", - "RESOURCE", - "REVOKE", - "ROW", - "ROWID", - "ROWLABEL", - "ROWNUM", - "ROWS", - "SELECT", - "SESSION", - "SET", - "SHARE", - "SIZE", - "SMALLINT", - "SQLBUF", - "START", - "SUCCESSFUL", - "SYNONYM", - "SYSDATE", - "TABLE", - "THEN", - "TO", - "TRIGGER", - "UID", - "UNION", - "UNIQUE", - "UPDATE", - "USER", - "VALIDATE", - "VALUES", - "VARCHAR", - "VARCHAR2", - "VIEW", - "WHENEVER", - "WHERE", - "WITH" - }; - assertArrayEquals(reservedWords, nativeMeta.getReservedWords()); - assertEquals( - "http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#i1006362", - nativeMeta.getExtraOptionsHelpText()); - assertTrue(nativeMeta.isRequiresCreateTablePrimaryKeyAppend()); - assertTrue(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); - String quoteTest1 = "FOO 'BAR' \r TEST \n"; - String quoteTest2 = "FOO 'BAR' \\r TEST \\n"; - assertEquals( - "'FOO ''BAR'' '||chr(10)||' TEST '||chr(13)||''", nativeMeta.quoteSqlString(quoteTest1)); - assertEquals("'FOO ''BAR'' \\r TEST \\n'", nativeMeta.quoteSqlString(quoteTest2)); - assertFalse(nativeMeta.isReleaseSavepoint()); - Variables v = new Variables(); - v.setVariable("FOOVARIABLE", "FOOVALUE"); - - DatabaseMeta dm = new DatabaseMeta(); - dm.setIDatabase(nativeMeta); - assertEquals("TABLESPACE FOOVALUE", nativeMeta.getTablespaceDDL(v, dm, "${FOOVARIABLE}")); - assertEquals("", nativeMeta.getTablespaceDDL(v, dm, "")); - assertFalse(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); - assertEquals(2000, nativeMeta.getMaxVARCHARLength()); - assertFalse(nativeMeta.isSupportsTimestampDataType()); - assertEquals(32, nativeMeta.getMaxColumnsInIndex()); - } - - @Test - public void testOverriddenSqlStatements() throws Exception { - assertEquals(" WHERE ROWNUM <= 5", nativeMeta.getLimitClause(5)); - String reusedFieldsQuery = "SELECT * FROM FOO WHERE 1=0"; - assertEquals(reusedFieldsQuery, nativeMeta.getSqlQueryFields("FOO")); - assertEquals(reusedFieldsQuery, nativeMeta.getSqlTableExists("FOO")); - String reusedColumnsQuery = "SELECT FOO FROM BAR WHERE 1=0"; - assertEquals(reusedColumnsQuery, nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - assertEquals(reusedColumnsQuery, nativeMeta.getSqlColumnExists("FOO", "BAR")); - assertEquals( - "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", - nativeMeta.getSqlSequenceExists("FOO")); - assertEquals( - "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", - nativeMeta.getSqlSequenceExists("foo")); - - assertEquals( - "SELECT * FROM ALL_SEQUENCES WHERE SEQUENCE_NAME = 'BAR' AND SEQUENCE_OWNER = 'FOO'", - nativeMeta.getSqlSequenceExists("FOO.BAR")); - assertEquals( - "SELECT * FROM ALL_SEQUENCES WHERE SEQUENCE_NAME = 'BAR' AND SEQUENCE_OWNER = 'FOO'", - nativeMeta.getSqlSequenceExists("foo.bar")); - - assertEquals("SELECT FOO.currval FROM DUAL", nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals("SELECT FOO.nextval FROM DUAL", nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals( - "ALTER TABLE FOO ADD ( FOO DATE ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("FOO"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO DATE ) ", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("FOO"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO VARCHAR2(15) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("FOO", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO INTEGER ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("FOO", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO NUMBER(15, 10) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("FOO", 15, 10), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO NUMBER(15, 10) ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("FOO", 15, 10), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO BLOB ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBinary("FOO", 2048, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO CHAR(1) ) ", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("FOO"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO UNKNOWN ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("FOO"), "", false, "", false)); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP ( BAR ) " + lineSep, - nativeMeta.getDropColumnStatement("FOO", new ValueMetaString("BAR"), "", false, "", false)); - String modColStmtExpected = - "ALTER TABLE FOO ADD ( BAR_KTL VARCHAR2(2000) ) ;" - + lineSep - + "UPDATE FOO SET BAR_KTL=BAR;" - + lineSep - + "ALTER TABLE FOO DROP ( BAR ) " - + lineSep - + ";" - + lineSep - + "ALTER TABLE FOO ADD ( BAR VARCHAR2(2000) ) ;" - + lineSep - + "UPDATE FOO SET BAR=BAR_KTL;" - + lineSep - + "ALTER TABLE FOO DROP ( BAR_KTL ) " - + lineSep; - assertEquals( - modColStmtExpected, - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR"), "", false, "", false)); - modColStmtExpected = - "ALTER TABLE \"FOO\" ADD ( BAR_KTL VARCHAR2(2000) ) ;" - + lineSep - + "UPDATE \"FOO\" SET BAR_KTL=BAR;" - + lineSep - + "ALTER TABLE \"FOO\" DROP ( BAR ) " - + lineSep - + ";" - + lineSep - + "ALTER TABLE \"FOO\" ADD ( BAR VARCHAR2(2000) ) ;" - + lineSep - + "UPDATE \"FOO\" SET BAR=BAR_KTL;" - + lineSep - + "ALTER TABLE \"FOO\" DROP ( BAR_KTL ) " - + lineSep; - assertEquals( - modColStmtExpected, - nativeMeta.getModifyColumnStatement( - "\"FOO\"", new ValueMetaString("BAR"), "", false, "", false)); - - modColStmtExpected = - "ALTER TABLE FOO ADD ( A12345678901234567890123456789_KTL VARCHAR2(2000) ) ;" - + lineSep - + "UPDATE FOO SET A12345678901234567890123456789_KTL=A1234567890123456789012345678901234567890;" - + lineSep - + "ALTER TABLE FOO DROP ( A1234567890123456789012345678901234567890 ) " - + lineSep - + ";" - + lineSep - + "ALTER TABLE FOO ADD ( A1234567890123456789012345678901234567890 VARCHAR2(2000) ) ;" - + lineSep - + "UPDATE FOO SET A1234567890123456789012345678901234567890=A12345678901234567890123456789_KTL;" - + lineSep - + "ALTER TABLE FOO DROP ( A12345678901234567890123456789_KTL ) " - + lineSep; - assertEquals( - modColStmtExpected, - nativeMeta.getModifyColumnStatement( - "FOO", - new ValueMetaString("A1234567890123456789012345678901234567890"), - "", - false, - "", - false)); - - String expectedProcSql = "SELECT OWNER||'.'||OBJECT_NAME||NVL2(PROCEDURE_NAME,'.'||PROCEDURE_NAME,NULL) FROM ALL_PROCEDURES ORDER BY 1"; - - assertEquals(expectedProcSql, nativeMeta.getSqlListOfProcedures()); - - String expectedLockOneItem = "LOCK TABLE FOO IN EXCLUSIVE MODE;" + lineSep; - assertEquals(expectedLockOneItem, nativeMeta.getSqlLockTables(new String[] {"FOO"})); - String expectedLockMultiItem = - "LOCK TABLE FOO IN EXCLUSIVE MODE;" - + lineSep - + "LOCK TABLE BAR IN EXCLUSIVE MODE;" - + lineSep; - assertEquals(expectedLockMultiItem, nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - assertNull(nativeMeta.getSqlUnlockTables(null)); // Commit unlocks tables - assertEquals("SELECT SEQUENCE_NAME FROM all_sequences", nativeMeta.getSqlListOfSequences()); - assertEquals( - "BEGIN EXECUTE IMMEDIATE 'DROP TABLE FOO'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;", - nativeMeta.getDropTableIfExistsStatement("FOO")); - } - - @Test - public void testGetFieldDefinition() throws Exception { - assertEquals( - "FOO DATE", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "DATE", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "NUMBER(5, 3)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 5, 3), "", "", false, false, false)); - assertEquals( - "NUMBER(5)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 17, 0), "", "", false, false, false)); - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH, 0), "", "", false, false, false)); - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 1, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR2(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR2(2000)", - nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", false, false, false)); - assertEquals( - "VARCHAR2(2000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength(), 0), - "", - "", - false, - false, - false)); - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() + 1, 0), - "", - "", - false, - false, - false)); - - assertEquals( - "BLOB", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 45, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } - - private int rowCnt = 0; - private String[] row1 = new String[] {"ROW1COL1", "ROW1COL2"}; - private String[] row2 = new String[] {"ROW2COL1", "ROW2COL2"}; - - @Test - public void testCheckIndexExists() throws Exception { - String expectedSql = "SELECT * FROM USER_IND_COLUMNS WHERE TABLE_NAME = 'FOO'"; - Database db = Mockito.mock(Database.class); - IRowMeta rm = Mockito.mock(IRowMeta.class); - ResultSet rs = Mockito.mock(ResultSet.class); - DatabaseMeta dm = Mockito.mock(DatabaseMeta.class); - Mockito.when(dm.getQuotedSchemaTableCombination(any(IVariables.class), eq(""), eq("FOO"))) - .thenReturn("FOO"); - Mockito.when(rs.next()).thenReturn(rowCnt < 2); - Mockito.when(db.openQuery(expectedSql)).thenReturn(rs); - Mockito.when(db.getReturnRowMeta()).thenReturn(rm); - Mockito.when(rm.getString(row1, "COLUMN_NAME", "")).thenReturn("ROW1COL2"); - Mockito.when(rm.getString(row2, "COLUMN_NAME", "")).thenReturn("ROW2COL2"); - Mockito.when(db.getRow(rs)) - .thenAnswer( - (Answer) - invocation -> { - rowCnt++; - if (rowCnt == 1) { - return row1; - } else if (rowCnt == 2) { - return row2; - } else { - return null; - } - }); - Mockito.when(db.getDatabaseMeta()).thenReturn(dm); - assertTrue(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW1COL2", "ROW2COL2"})); - assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW2COL2", "NOTTHERE"})); - assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"NOTTHERE", "ROW1COL2"})); - } - - @Test - public void testSupportsSavepoint() { - assertFalse(nativeMeta.isReleaseSavepoint()); - } - - @Test - public void testSupportsSequence() { - String dbType = nativeMeta.getClass().getSimpleName(); - assertTrue(dbType, nativeMeta.isSupportsSequences()); - assertFalse(dbType + ": List of Sequences", Utils.isEmpty(nativeMeta.getSqlListOfSequences())); - assertFalse( - dbType + ": Sequence Exists", Utils.isEmpty(nativeMeta.getSqlSequenceExists("testSeq"))); - assertFalse( - dbType + ": Current Value", - Utils.isEmpty(nativeMeta.getSqlCurrentSequenceValue("testSeq"))); - assertFalse( - dbType + ": Next Value", Utils.isEmpty(nativeMeta.getSqlNextSequenceValue("testSeq"))); - - assertEquals( - "SELECT sequence_name.nextval FROM DUAL", nativeMeta.getSqlNextSequenceValue(sequenceName)); - assertEquals( - "SELECT sequence_name.currval FROM DUAL", - nativeMeta.getSqlCurrentSequenceValue(sequenceName)); - } - - @Test - public void testSupportsTimestampDataTypeIsTrue() throws Exception { - nativeMeta.setSupportsTimestampDataType(true); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - assertEquals( - "ALTER TABLE FOO ADD ( FOO TIMESTAMP ) ", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("FOO"), "", false, "", false)); - } -} +/* + * 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 org.apache.hop.databases.oracle; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; + +import java.sql.ResultSet; +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.HopLogStore; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.stubbing.Answer; + +public class OracleDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + private final String sequenceName = "sequence_name"; + + private OracleDatabaseMeta nativeMeta; + private IVariables variables; + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + HopLogStore.init(); + } + + @Before + public void setupOnce() throws Exception { + nativeMeta = new OracleDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + HopClientEnvironment.init(); + variables = Mockito.spy(new Variables()); + } + + @Test + public void testOverriddenSettings() throws Exception { + // Tests the settings of the Oracle Database Meta + // according to the features of the DB as we know them + + assertEquals(1521, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertEquals("oracle.jdbc.driver.OracleDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:oracle:thin:@FOO:1024:BAR", nativeMeta.getURL("FOO", "1024", "BAR")); + assertEquals("jdbc:oracle:thin:@FOO:11:BAR", nativeMeta.getURL("FOO", "11", ":BAR")); + assertEquals("jdbc:oracle:thin:@BAR:65534/FOO", nativeMeta.getURL("BAR", "65534", "/FOO")); + assertEquals("jdbc:oracle:thin:@FOO", nativeMeta.getURL("", "", "FOO")); + assertEquals("jdbc:oracle:thin:@FOO", nativeMeta.getURL(null, "-1", "FOO")); + assertEquals("jdbc:oracle:thin:@FOO", nativeMeta.getURL(null, null, "FOO")); + assertEquals("jdbc:oracle:thin:@FOO:1234:BAR", nativeMeta.getURL("FOO", "1234", "BAR")); + assertEquals( + "jdbc:oracle:thin:@", nativeMeta.getURL("", "", "")); // Pretty sure this is a bug... + assertFalse(nativeMeta.isSupportsOptionsInURL()); + assertTrue(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); + assertTrue(nativeMeta.useSchemaNameForTableList()); + assertTrue(nativeMeta.isSupportsSynonyms()); + String[] reservedWords = + new String[] { + "ACCESS", + "ADD", + "ALL", + "ALTER", + "AND", + "ANY", + "ARRAYLEN", + "AS", + "ASC", + "AUDIT", + "BETWEEN", + "BY", + "CHAR", + "CHECK", + "CLUSTER", + "COLUMN", + "COMMENT", + "COMPRESS", + "CONNECT", + "CREATE", + "CURRENT", + "DATE", + "DECIMAL", + "DEFAULT", + "DELETE", + "DESC", + "DISTINCT", + "DROP", + "ELSE", + "EXCLUSIVE", + "EXISTS", + "FILE", + "FLOAT", + "FOR", + "FROM", + "GRANT", + "GROUP", + "HAVING", + "IDENTIFIED", + "IMMEDIATE", + "IN", + "INCREMENT", + "INDEX", + "INITIAL", + "INSERT", + "INTEGER", + "INTERSECT", + "INTO", + "IS", + "LEVEL", + "LIKE", + "LOCK", + "LONG", + "MAXEXTENTS", + "MINUS", + "MODE", + "MODIFY", + "NOAUDIT", + "NOCOMPRESS", + "NOT", + "NOTFOUND", + "NOWAIT", + "NULL", + "NUMBER", + "OF", + "OFFLINE", + "ON", + "ONLINE", + "OPTION", + "OR", + "ORDER", + "PCTFREE", + "PRIOR", + "PRIVILEGES", + "PUBLIC", + "RAW", + "RENAME", + "RESOURCE", + "REVOKE", + "ROW", + "ROWID", + "ROWLABEL", + "ROWNUM", + "ROWS", + "SELECT", + "SESSION", + "SET", + "SHARE", + "SIZE", + "SMALLINT", + "SQLBUF", + "START", + "SUCCESSFUL", + "SYNONYM", + "SYSDATE", + "TABLE", + "THEN", + "TO", + "TRIGGER", + "UID", + "UNION", + "UNIQUE", + "UPDATE", + "USER", + "VALIDATE", + "VALUES", + "VARCHAR", + "VARCHAR2", + "VIEW", + "WHENEVER", + "WHERE", + "WITH" + }; + assertArrayEquals(reservedWords, nativeMeta.getReservedWords()); + assertEquals( + "http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#i1006362", + nativeMeta.getExtraOptionsHelpText()); + assertTrue(nativeMeta.isRequiresCreateTablePrimaryKeyAppend()); + assertTrue(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); + String quoteTest1 = "FOO 'BAR' \r TEST \n"; + String quoteTest2 = "FOO 'BAR' \\r TEST \\n"; + assertEquals( + "'FOO ''BAR'' '||chr(10)||' TEST '||chr(13)||''", nativeMeta.quoteSqlString(quoteTest1)); + assertEquals("'FOO ''BAR'' \\r TEST \\n'", nativeMeta.quoteSqlString(quoteTest2)); + assertFalse(nativeMeta.isReleaseSavepoint()); + Variables v = new Variables(); + v.setVariable("FOOVARIABLE", "FOOVALUE"); + + DatabaseMeta dm = new DatabaseMeta(); + dm.setIDatabase(nativeMeta); + assertEquals("TABLESPACE FOOVALUE", nativeMeta.getTablespaceDDL(v, dm, "${FOOVARIABLE}")); + assertEquals("", nativeMeta.getTablespaceDDL(v, dm, "")); + assertFalse(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); + assertEquals(2000, nativeMeta.getMaxVARCHARLength()); + assertFalse(nativeMeta.isSupportsTimestampDataType()); + assertEquals(32, nativeMeta.getMaxColumnsInIndex()); + } + + @Test + public void testOverriddenSqlStatements() throws Exception { + assertEquals(" WHERE ROWNUM <= 5", nativeMeta.getLimitClause(5)); + String reusedFieldsQuery = "SELECT * FROM FOO WHERE 1=0"; + assertEquals(reusedFieldsQuery, nativeMeta.getSqlQueryFields("FOO")); + assertEquals(reusedFieldsQuery, nativeMeta.getSqlTableExists("FOO")); + String reusedColumnsQuery = "SELECT FOO FROM BAR WHERE 1=0"; + assertEquals(reusedColumnsQuery, nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + assertEquals(reusedColumnsQuery, nativeMeta.getSqlColumnExists("FOO", "BAR")); + assertEquals( + "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", + nativeMeta.getSqlSequenceExists("FOO")); + assertEquals( + "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", + nativeMeta.getSqlSequenceExists("foo")); + + assertEquals( + "SELECT * FROM ALL_SEQUENCES WHERE SEQUENCE_NAME = 'BAR' AND SEQUENCE_OWNER = 'FOO'", + nativeMeta.getSqlSequenceExists("FOO.BAR")); + assertEquals( + "SELECT * FROM ALL_SEQUENCES WHERE SEQUENCE_NAME = 'BAR' AND SEQUENCE_OWNER = 'FOO'", + nativeMeta.getSqlSequenceExists("foo.bar")); + + assertEquals("SELECT FOO.currval FROM DUAL", nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals("SELECT FOO.nextval FROM DUAL", nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals( + "ALTER TABLE FOO ADD ( FOO DATE ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("FOO"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO DATE ) ", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("FOO"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO VARCHAR2(15) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("FOO", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO INTEGER ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("FOO", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO NUMBER(15, 10) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("FOO", 15, 10), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO NUMBER(15, 10) ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("FOO", 15, 10), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO BLOB ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBinary("FOO", 2048, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO CHAR(1) ) ", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("FOO"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO UNKNOWN ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("FOO"), "", false, "", false)); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP ( BAR ) " + lineSep, + nativeMeta.getDropColumnStatement("FOO", new ValueMetaString("BAR"), "", false, "", false)); + String modColStmtExpected = + "ALTER TABLE FOO ADD ( BAR_KTL VARCHAR2(2000) ) ;" + + lineSep + + "UPDATE FOO SET BAR_KTL=BAR;" + + lineSep + + "ALTER TABLE FOO DROP ( BAR ) " + + lineSep + + ";" + + lineSep + + "ALTER TABLE FOO ADD ( BAR VARCHAR2(2000) ) ;" + + lineSep + + "UPDATE FOO SET BAR=BAR_KTL;" + + lineSep + + "ALTER TABLE FOO DROP ( BAR_KTL ) " + + lineSep; + assertEquals( + modColStmtExpected, + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR"), "", false, "", false)); + modColStmtExpected = + "ALTER TABLE \"FOO\" ADD ( BAR_KTL VARCHAR2(2000) ) ;" + + lineSep + + "UPDATE \"FOO\" SET BAR_KTL=BAR;" + + lineSep + + "ALTER TABLE \"FOO\" DROP ( BAR ) " + + lineSep + + ";" + + lineSep + + "ALTER TABLE \"FOO\" ADD ( BAR VARCHAR2(2000) ) ;" + + lineSep + + "UPDATE \"FOO\" SET BAR=BAR_KTL;" + + lineSep + + "ALTER TABLE \"FOO\" DROP ( BAR_KTL ) " + + lineSep; + assertEquals( + modColStmtExpected, + nativeMeta.getModifyColumnStatement( + "\"FOO\"", new ValueMetaString("BAR"), "", false, "", false)); + + modColStmtExpected = + "ALTER TABLE FOO ADD ( A12345678901234567890123456789_KTL VARCHAR2(2000) ) ;" + + lineSep + + "UPDATE FOO SET A12345678901234567890123456789_KTL=A1234567890123456789012345678901234567890;" + + lineSep + + "ALTER TABLE FOO DROP ( A1234567890123456789012345678901234567890 ) " + + lineSep + + ";" + + lineSep + + "ALTER TABLE FOO ADD ( A1234567890123456789012345678901234567890 VARCHAR2(2000) ) ;" + + lineSep + + "UPDATE FOO SET A1234567890123456789012345678901234567890=A12345678901234567890123456789_KTL;" + + lineSep + + "ALTER TABLE FOO DROP ( A12345678901234567890123456789_KTL ) " + + lineSep; + assertEquals( + modColStmtExpected, + nativeMeta.getModifyColumnStatement( + "FOO", + new ValueMetaString("A1234567890123456789012345678901234567890"), + "", + false, + "", + false)); + + String expectedProcSql = + "SELECT OWNER||'.'||OBJECT_NAME||NVL2(PROCEDURE_NAME,'.'||PROCEDURE_NAME,NULL) FROM ALL_PROCEDURES ORDER BY 1"; + + assertEquals(expectedProcSql, nativeMeta.getSqlListOfProcedures()); + + String expectedLockOneItem = "LOCK TABLE FOO IN EXCLUSIVE MODE;" + lineSep; + assertEquals(expectedLockOneItem, nativeMeta.getSqlLockTables(new String[] {"FOO"})); + String expectedLockMultiItem = + "LOCK TABLE FOO IN EXCLUSIVE MODE;" + + lineSep + + "LOCK TABLE BAR IN EXCLUSIVE MODE;" + + lineSep; + assertEquals(expectedLockMultiItem, nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + assertNull(nativeMeta.getSqlUnlockTables(null)); // Commit unlocks tables + assertEquals("SELECT SEQUENCE_NAME FROM all_sequences", nativeMeta.getSqlListOfSequences()); + assertEquals( + "BEGIN EXECUTE IMMEDIATE 'DROP TABLE FOO'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;", + nativeMeta.getDropTableIfExistsStatement("FOO")); + } + + @Test + public void testGetFieldDefinition() throws Exception { + assertEquals( + "FOO DATE", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "DATE", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "NUMBER(5, 3)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 5, 3), "", "", false, false, false)); + assertEquals( + "NUMBER(5)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 17, 0), "", "", false, false, false)); + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH, 0), "", "", false, false, false)); + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 1, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR2(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR2(2000)", + nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", false, false, false)); + assertEquals( + "VARCHAR2(2000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength(), 0), + "", + "", + false, + false, + false)); + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", nativeMeta.getMaxVARCHARLength() + 1, 0), + "", + "", + false, + false, + false)); + + assertEquals( + "BLOB", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 45, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } + + private int rowCnt = 0; + private String[] row1 = new String[] {"ROW1COL1", "ROW1COL2"}; + private String[] row2 = new String[] {"ROW2COL1", "ROW2COL2"}; + + @Test + public void testCheckIndexExists() throws Exception { + String expectedSql = "SELECT * FROM USER_IND_COLUMNS WHERE TABLE_NAME = 'FOO'"; + Database db = Mockito.mock(Database.class); + IRowMeta rm = Mockito.mock(IRowMeta.class); + ResultSet rs = Mockito.mock(ResultSet.class); + DatabaseMeta dm = Mockito.mock(DatabaseMeta.class); + Mockito.when(dm.getQuotedSchemaTableCombination(any(IVariables.class), eq(""), eq("FOO"))) + .thenReturn("FOO"); + Mockito.when(rs.next()).thenReturn(rowCnt < 2); + Mockito.when(db.openQuery(expectedSql)).thenReturn(rs); + Mockito.when(db.getReturnRowMeta()).thenReturn(rm); + Mockito.when(rm.getString(row1, "COLUMN_NAME", "")).thenReturn("ROW1COL2"); + Mockito.when(rm.getString(row2, "COLUMN_NAME", "")).thenReturn("ROW2COL2"); + Mockito.when(db.getRow(rs)) + .thenAnswer( + (Answer) + invocation -> { + rowCnt++; + if (rowCnt == 1) { + return row1; + } else if (rowCnt == 2) { + return row2; + } else { + return null; + } + }); + Mockito.when(db.getDatabaseMeta()).thenReturn(dm); + assertTrue(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW1COL2", "ROW2COL2"})); + assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"ROW2COL2", "NOTTHERE"})); + assertFalse(nativeMeta.hasIndex(db, "", "FOO", new String[] {"NOTTHERE", "ROW1COL2"})); + } + + @Test + public void testSupportsSavepoint() { + assertFalse(nativeMeta.isReleaseSavepoint()); + } + + @Test + public void testSupportsSequence() { + String dbType = nativeMeta.getClass().getSimpleName(); + assertTrue(dbType, nativeMeta.isSupportsSequences()); + assertFalse(dbType + ": List of Sequences", Utils.isEmpty(nativeMeta.getSqlListOfSequences())); + assertFalse( + dbType + ": Sequence Exists", Utils.isEmpty(nativeMeta.getSqlSequenceExists("testSeq"))); + assertFalse( + dbType + ": Current Value", + Utils.isEmpty(nativeMeta.getSqlCurrentSequenceValue("testSeq"))); + assertFalse( + dbType + ": Next Value", Utils.isEmpty(nativeMeta.getSqlNextSequenceValue("testSeq"))); + + assertEquals( + "SELECT sequence_name.nextval FROM DUAL", nativeMeta.getSqlNextSequenceValue(sequenceName)); + assertEquals( + "SELECT sequence_name.currval FROM DUAL", + nativeMeta.getSqlCurrentSequenceValue(sequenceName)); + } + + @Test + public void testSupportsTimestampDataTypeIsTrue() throws Exception { + nativeMeta.setSupportsTimestampDataType(true); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + assertEquals( + "ALTER TABLE FOO ADD ( FOO TIMESTAMP ) ", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("FOO"), "", false, "", false)); + } +} diff --git a/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleValueMetaBaseTest.java b/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleValueMetaBaseTest.java index d73f506907e..227eb6572b9 100644 --- a/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleValueMetaBaseTest.java +++ b/plugins/databases/oracle/src/test/java/org/apache/hop/databases/oracle/OracleValueMetaBaseTest.java @@ -1,141 +1,140 @@ -/* - * 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 org.apache.hop.databases.oracle; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.exception.HopDatabaseException; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -public class OracleValueMetaBaseTest { - - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - private DatabaseMeta databaseMeta; - private IValueMeta valueMetaBase; - private ResultSet resultSet; - private IVariables variables; - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - } - - @Before - public void setUp() throws HopException { - valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); - databaseMeta = spy(DatabaseMeta.class); - databaseMeta.setIDatabase(spy(OracleDatabaseMeta.class)); - resultSet = mock(ResultSet.class); - variables = spy(new Variables()); - } - - @Test - public void testMetadataPreviewSqlVarBinaryToString() throws SQLException, HopDatabaseException { - when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.VARBINARY); - when(resultSet.getInt("COLUMN_SIZE")).thenReturn(16); - - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isString()); - assertEquals(16, valueMeta.getLength()); - } - - @Test - public void testMetadataPreviewSqlLongVarBinaryToString() - throws SQLException, HopDatabaseException { - when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.LONGVARBINARY); - - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isString()); - } - - @Test - public void testMetadataPreviewSqlNumericWithStrictBigNumberInterpretation() - throws SQLException, HopDatabaseException { - - when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.NUMERIC); - when(resultSet.getInt("COLUMN_SIZE")).thenReturn(38); - when(resultSet.getInt("DECIMAL_DIGITS")).thenReturn(0); - when(databaseMeta.getIDatabase().isStrictBigNumberInterpretation()).thenReturn(true); - - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isBigNumber()); - } - - @Test - public void testMetadataPreviewSqlNumericWithoutStrictBigNumberInterpretation() - throws SQLException, HopDatabaseException { - when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.NUMERIC); - when(resultSet.getInt("COLUMN_SIZE")).thenReturn(38); - when(resultSet.getInt("DECIMAL_DIGITS")).thenReturn(0); - when(databaseMeta.getIDatabase().isStrictBigNumberInterpretation()).thenReturn(false); - - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isInteger()); - } - - @Test - public void testMetadataPreviewSqlTimestampToDate() throws SQLException, HopDatabaseException { - when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.TIMESTAMP); - when(resultSet.getInt("DECIMAL_DIGITS")).thenReturn(19); - when(resultSet.getObject("DECIMAL_DIGITS")).thenReturn(mock(Object.class)); - when(databaseMeta.supportsTimestampDataType()).thenReturn(true); - - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isDate()); - assertEquals(-1, valueMeta.getPrecision()); - assertEquals(19, valueMeta.getLength()); - } - - @Test - public void testMetdataPreviewSqlDoubleWithTooBigLengthAndPrecision() - throws SQLException, HopDatabaseException { - doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE"); - doReturn(128).when(resultSet).getInt("COLUMN_SIZE"); - doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS"); - doReturn(127).when(resultSet).getInt("DECIMAL_DIGITS"); - IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); - assertTrue(valueMeta.isBigNumber()); - assertEquals(-1, valueMeta.getPrecision()); - assertEquals(-1, valueMeta.getLength()); - } -} +/* + * 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 org.apache.hop.databases.oracle; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.exception.HopDatabaseException; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +public class OracleValueMetaBaseTest { + + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + private DatabaseMeta databaseMeta; + private IValueMeta valueMetaBase; + private ResultSet resultSet; + private IVariables variables; + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + } + + @Before + public void setUp() throws HopException { + valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); + databaseMeta = spy(DatabaseMeta.class); + databaseMeta.setIDatabase(spy(OracleDatabaseMeta.class)); + resultSet = mock(ResultSet.class); + variables = spy(new Variables()); + } + + @Test + public void testMetadataPreviewSqlVarBinaryToString() throws SQLException, HopDatabaseException { + when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.VARBINARY); + when(resultSet.getInt("COLUMN_SIZE")).thenReturn(16); + + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isString()); + assertEquals(16, valueMeta.getLength()); + } + + @Test + public void testMetadataPreviewSqlLongVarBinaryToString() + throws SQLException, HopDatabaseException { + when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.LONGVARBINARY); + + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isString()); + } + + @Test + public void testMetadataPreviewSqlNumericWithStrictBigNumberInterpretation() + throws SQLException, HopDatabaseException { + + when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.NUMERIC); + when(resultSet.getInt("COLUMN_SIZE")).thenReturn(38); + when(resultSet.getInt("DECIMAL_DIGITS")).thenReturn(0); + when(databaseMeta.getIDatabase().isStrictBigNumberInterpretation()).thenReturn(true); + + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isBigNumber()); + } + + @Test + public void testMetadataPreviewSqlNumericWithoutStrictBigNumberInterpretation() + throws SQLException, HopDatabaseException { + when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.NUMERIC); + when(resultSet.getInt("COLUMN_SIZE")).thenReturn(38); + when(resultSet.getInt("DECIMAL_DIGITS")).thenReturn(0); + when(databaseMeta.getIDatabase().isStrictBigNumberInterpretation()).thenReturn(false); + + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isInteger()); + } + + @Test + public void testMetadataPreviewSqlTimestampToDate() throws SQLException, HopDatabaseException { + when(resultSet.getInt("DATA_TYPE")).thenReturn(Types.TIMESTAMP); + when(resultSet.getInt("DECIMAL_DIGITS")).thenReturn(19); + when(resultSet.getObject("DECIMAL_DIGITS")).thenReturn(mock(Object.class)); + when(databaseMeta.supportsTimestampDataType()).thenReturn(true); + + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isDate()); + assertEquals(-1, valueMeta.getPrecision()); + assertEquals(19, valueMeta.getLength()); + } + + @Test + public void testMetdataPreviewSqlDoubleWithTooBigLengthAndPrecision() + throws SQLException, HopDatabaseException { + doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE"); + doReturn(128).when(resultSet).getInt("COLUMN_SIZE"); + doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS"); + doReturn(127).when(resultSet).getInt("DECIMAL_DIGITS"); + IValueMeta valueMeta = valueMetaBase.getMetadataPreview(variables, databaseMeta, resultSet); + assertTrue(valueMeta.isBigNumber()); + assertEquals(-1, valueMeta.getPrecision()); + assertEquals(-1, valueMeta.getLength()); + } +} diff --git a/plugins/databases/oraclerdb/src/main/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMeta.java b/plugins/databases/oraclerdb/src/main/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMeta.java index 44dc3a437e9..6fccc8755c1 100644 --- a/plugins/databases/oraclerdb/src/main/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMeta.java +++ b/plugins/databases/oraclerdb/src/main/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMeta.java @@ -26,10 +26,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Oracle RDB specific information through static final members - */ -@DatabaseMetaPlugin(type = "ORACLERDB", typeDescription = "Oracle RDB", documentationUrl = "/database/databases/oraclerdb.html") +/** Contains Oracle RDB specific information through static final members */ +@DatabaseMetaPlugin( + type = "ORACLERDB", + typeDescription = "Oracle RDB", + documentationUrl = "/database/databases/oraclerdb.html") @GuiPlugin(id = "GUI-OracleRDBDatabaseMeta") public class OracleRDBDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -37,13 +38,17 @@ public int[] getAccessTypeList() { return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; } - /** @see IDatabase#getLimitClause(int) */ + /** + * @see IDatabase#getLimitClause(int) + */ @Override public String getLimitClause(int nrRows) { return " WHERE ROWNUM <= " + nrRows; @@ -95,7 +100,9 @@ public boolean isSupportsOptionsInURL() { return false; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return true; @@ -150,7 +157,9 @@ public boolean useSchemaNameForTableList() { return true; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return true; diff --git a/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMetaTest.java b/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMetaTest.java index b82faed6993..5671e66bc07 100644 --- a/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMetaTest.java +++ b/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBDatabaseMetaTest.java @@ -1,202 +1,202 @@ -/* - * 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 org.apache.hop.databases.oraclerdb; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class OracleRDBDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - private OracleRDBDatabaseMeta nativeMeta; - - @Before - public void setupOnce() throws Exception { - nativeMeta = new OracleRDBDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - HopClientEnvironment.init(); - } - - @Test - public void testOverriddenSettings() throws Exception { - // Tests the settings of the Oracle Database Meta - // according to the features of the DB as we know them - - assertEquals(-1, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertEquals("oracle.rdb.jdbc.rdbThin.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:rdbThin://FOO:1024/BAR", nativeMeta.getURL("FOO", "1024", "BAR")); - assertEquals("jdbc:rdbThin://FOO:11/:BAR", nativeMeta.getURL("FOO", "11", ":BAR")); - assertEquals("jdbc:rdbThin://BAR:65534//FOO", nativeMeta.getURL("BAR", "65534", "/FOO")); - assertEquals( - "jdbc:rdbThin://:/FOO", nativeMeta.getURL("", "", "FOO")); // Pretty sure this is a bug... - assertEquals( - "jdbc:rdbThin://null:-1/FOO", - nativeMeta.getURL(null, "-1", "FOO")); // Pretty sure this is a bug... - assertEquals( - "jdbc:rdbThin://null:null/FOO", - nativeMeta.getURL(null, null, "FOO")); // Pretty sure this is a bug... - assertEquals("jdbc:rdbThin://FOO:1234/BAR", nativeMeta.getURL("FOO", "1234", "BAR")); - assertEquals( - "jdbc:rdbThin://:/", nativeMeta.getURL("", "", "")); // Pretty sure this is a bug... - assertFalse(nativeMeta.isSupportsOptionsInURL()); - assertTrue(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.useSchemaNameForTableList()); - assertTrue(nativeMeta.isSupportsSynonyms()); - String[] reservedWords = - new String[] { - "ACCESS", - "ADD", - "ALL", - "ALTER", - "AND", - "ANY", - "ARRAYLEN", - "AS", - "ASC", - "AUDIT", - "BETWEEN", - "BY", - "CHAR", - "CHECK", - "CLUSTER", - "COLUMN", - "COMMENT", - "COMPRESS", - "CONNECT", - "CREATE", - "CURRENT", - "DATE", - "DECIMAL", - "DEFAULT", - "DELETE", - "DESC", - "DISTINCT", - "DROP", - "ELSE", - "EXCLUSIVE", - "EXISTS", - "FILE", - "FLOAT", - "FOR", - "FROM", - "GRANT", - "GROUP", - "HAVING", - "IDENTIFIED", - "IMMEDIATE", - "IN", - "INCREMENT", - "INDEX", - "INITIAL", - "INSERT", - "INTEGER", - "INTERSECT", - "INTO", - "IS", - "LEVEL", - "LIKE", - "LOCK", - "LONG", - "MAXEXTENTS", - "MINUS", - "MODE", - "MODIFY", - "NOAUDIT", - "NOCOMPRESS", - "NOT", - "NOTFOUND", - "NOWAIT", - "NULL", - "NUMBER", - "OF", - "OFFLINE", - "ON", - "ONLINE", - "OPTION", - "OR", - "ORDER", - "PCTFREE", - "PRIOR", - "PRIVILEGES", - "PUBLIC", - "RAW", - "RENAME", - "RESOURCE", - "REVOKE", - "ROW", - "ROWID", - "ROWLABEL", - "ROWNUM", - "ROWS", - "SELECT", - "SESSION", - "SET", - "SHARE", - "SIZE", - "SMALLINT", - "SQLBUF", - "START", - "SUCCESSFUL", - "SYNONYM", - "SYSDATE", - "TABLE", - "THEN", - "TO", - "TRIGGER", - "UID", - "UNION", - "UNIQUE", - "UPDATE", - "USER", - "VALIDATE", - "VALUES", - "VARCHAR", - "VARCHAR2", - "VIEW", - "WHENEVER", - "WHERE", - "WITH" - }; - assertArrayEquals(reservedWords, nativeMeta.getReservedWords()); - assertEquals(9999999, nativeMeta.getMaxVARCHARLength()); - assertEquals("SELECT SEQUENCE_NAME FROM USER_SEQUENCES", nativeMeta.getSqlListOfSequences()); - assertEquals( - "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", - nativeMeta.getSqlSequenceExists("FOO")); - assertEquals( - "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", - nativeMeta.getSqlSequenceExists("foo")); - assertEquals("SELECT FOO.currval FROM DUAL", nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals("SELECT FOO.nextval FROM dual", nativeMeta.getSqlNextSequenceValue("FOO")); - String reusedFieldsQuery = "SELECT * FROM FOO WHERE 1=0"; - ; - assertEquals(reusedFieldsQuery, nativeMeta.getSqlQueryFields("FOO")); - assertEquals(reusedFieldsQuery, nativeMeta.getSqlTableExists("FOO")); - String reusedColumnsQuery = "SELECT FOO FROM BAR WHERE 1=0"; - assertEquals(reusedColumnsQuery, nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - assertEquals(reusedColumnsQuery, nativeMeta.getSqlColumnExists("FOO", "BAR")); - } -} +/* + * 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 org.apache.hop.databases.oraclerdb; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +public class OracleRDBDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + private OracleRDBDatabaseMeta nativeMeta; + + @Before + public void setupOnce() throws Exception { + nativeMeta = new OracleRDBDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + HopClientEnvironment.init(); + } + + @Test + public void testOverriddenSettings() throws Exception { + // Tests the settings of the Oracle Database Meta + // according to the features of the DB as we know them + + assertEquals(-1, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertEquals("oracle.rdb.jdbc.rdbThin.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:rdbThin://FOO:1024/BAR", nativeMeta.getURL("FOO", "1024", "BAR")); + assertEquals("jdbc:rdbThin://FOO:11/:BAR", nativeMeta.getURL("FOO", "11", ":BAR")); + assertEquals("jdbc:rdbThin://BAR:65534//FOO", nativeMeta.getURL("BAR", "65534", "/FOO")); + assertEquals( + "jdbc:rdbThin://:/FOO", nativeMeta.getURL("", "", "FOO")); // Pretty sure this is a bug... + assertEquals( + "jdbc:rdbThin://null:-1/FOO", + nativeMeta.getURL(null, "-1", "FOO")); // Pretty sure this is a bug... + assertEquals( + "jdbc:rdbThin://null:null/FOO", + nativeMeta.getURL(null, null, "FOO")); // Pretty sure this is a bug... + assertEquals("jdbc:rdbThin://FOO:1234/BAR", nativeMeta.getURL("FOO", "1234", "BAR")); + assertEquals( + "jdbc:rdbThin://:/", nativeMeta.getURL("", "", "")); // Pretty sure this is a bug... + assertFalse(nativeMeta.isSupportsOptionsInURL()); + assertTrue(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.useSchemaNameForTableList()); + assertTrue(nativeMeta.isSupportsSynonyms()); + String[] reservedWords = + new String[] { + "ACCESS", + "ADD", + "ALL", + "ALTER", + "AND", + "ANY", + "ARRAYLEN", + "AS", + "ASC", + "AUDIT", + "BETWEEN", + "BY", + "CHAR", + "CHECK", + "CLUSTER", + "COLUMN", + "COMMENT", + "COMPRESS", + "CONNECT", + "CREATE", + "CURRENT", + "DATE", + "DECIMAL", + "DEFAULT", + "DELETE", + "DESC", + "DISTINCT", + "DROP", + "ELSE", + "EXCLUSIVE", + "EXISTS", + "FILE", + "FLOAT", + "FOR", + "FROM", + "GRANT", + "GROUP", + "HAVING", + "IDENTIFIED", + "IMMEDIATE", + "IN", + "INCREMENT", + "INDEX", + "INITIAL", + "INSERT", + "INTEGER", + "INTERSECT", + "INTO", + "IS", + "LEVEL", + "LIKE", + "LOCK", + "LONG", + "MAXEXTENTS", + "MINUS", + "MODE", + "MODIFY", + "NOAUDIT", + "NOCOMPRESS", + "NOT", + "NOTFOUND", + "NOWAIT", + "NULL", + "NUMBER", + "OF", + "OFFLINE", + "ON", + "ONLINE", + "OPTION", + "OR", + "ORDER", + "PCTFREE", + "PRIOR", + "PRIVILEGES", + "PUBLIC", + "RAW", + "RENAME", + "RESOURCE", + "REVOKE", + "ROW", + "ROWID", + "ROWLABEL", + "ROWNUM", + "ROWS", + "SELECT", + "SESSION", + "SET", + "SHARE", + "SIZE", + "SMALLINT", + "SQLBUF", + "START", + "SUCCESSFUL", + "SYNONYM", + "SYSDATE", + "TABLE", + "THEN", + "TO", + "TRIGGER", + "UID", + "UNION", + "UNIQUE", + "UPDATE", + "USER", + "VALIDATE", + "VALUES", + "VARCHAR", + "VARCHAR2", + "VIEW", + "WHENEVER", + "WHERE", + "WITH" + }; + assertArrayEquals(reservedWords, nativeMeta.getReservedWords()); + assertEquals(9999999, nativeMeta.getMaxVARCHARLength()); + assertEquals("SELECT SEQUENCE_NAME FROM USER_SEQUENCES", nativeMeta.getSqlListOfSequences()); + assertEquals( + "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", + nativeMeta.getSqlSequenceExists("FOO")); + assertEquals( + "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'FOO'", + nativeMeta.getSqlSequenceExists("foo")); + assertEquals("SELECT FOO.currval FROM DUAL", nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals("SELECT FOO.nextval FROM dual", nativeMeta.getSqlNextSequenceValue("FOO")); + String reusedFieldsQuery = "SELECT * FROM FOO WHERE 1=0"; + ; + assertEquals(reusedFieldsQuery, nativeMeta.getSqlQueryFields("FOO")); + assertEquals(reusedFieldsQuery, nativeMeta.getSqlTableExists("FOO")); + String reusedColumnsQuery = "SELECT FOO FROM BAR WHERE 1=0"; + assertEquals(reusedColumnsQuery, nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + assertEquals(reusedColumnsQuery, nativeMeta.getSqlColumnExists("FOO", "BAR")); + } +} diff --git a/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBSequenceAndReleaseSavePointTest.java b/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBSequenceAndReleaseSavePointTest.java index a836d7bc477..9b8a3f75d1a 100644 --- a/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/oraclerdb/src/test/java/org/apache/hop/databases/oraclerdb/OracleRDBSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.oraclerdb; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class OracleRDBSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/postgresql/src/main/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMeta.java b/plugins/databases/postgresql/src/main/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMeta.java index 4d940275914..32baabe9a76 100644 --- a/plugins/databases/postgresql/src/main/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMeta.java +++ b/plugins/databases/postgresql/src/main/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMeta.java @@ -25,10 +25,12 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains PostgreSQL specific information through static final members - */ -@DatabaseMetaPlugin(type = "POSTGRESQL", typeDescription = "PostgreSQL", documentationUrl = "/database/databases/postgresql.html", classLoaderGroup = "postgres-db") +/** Contains PostgreSQL specific information through static final members */ +@DatabaseMetaPlugin( + type = "POSTGRESQL", + typeDescription = "PostgreSQL", + documentationUrl = "/database/databases/postgresql.html", + classLoaderGroup = "postgres-db") @GuiPlugin(id = "GUI-PostgreSQLDatabaseMeta") public class PostgreSqlDatabaseMeta extends BaseDatabaseMeta implements IDatabase { private static final int GB_LIMIT = 1_073_741_824; @@ -38,13 +40,17 @@ public boolean isPostgresVariant() { return true; } - /** @return The extra option separator in database URL for this platform */ + /** + * @return The extra option separator in database URL for this platform + */ @Override public String getExtraOptionSeparator() { return "&"; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "?"; @@ -83,13 +89,17 @@ public boolean isFetchSizeSupported() { return true; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; @@ -1078,14 +1088,14 @@ public boolean isRequiresCastToVariousForIsNull() { } @Override - public boolean isSupportsBooleanDataType() { + public boolean isSupportsBooleanDataType() { return true; } - + @Override public boolean isSupportsTimestampDataType() { return true; - } + } @Override public boolean isSupportsGetBlob() { diff --git a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMetaTest.java b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMetaTest.java index 5f79cdd2bb5..4a9fdca096b 100644 --- a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMetaTest.java +++ b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlDatabaseMetaTest.java @@ -1,871 +1,871 @@ -/* - * 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 org.apache.hop.databases.postgresql; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class PostgreSqlDatabaseMetaTest { - PostgreSqlDatabaseMeta nativeMeta; - - @Before - public void setupBefore() throws Exception { - - nativeMeta = new PostgreSqlDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertEquals("&", nativeMeta.getExtraOptionSeparator()); - assertEquals("?", nativeMeta.getExtraOptionIndicator()); - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(5432, nativeMeta.getDefaultDatabasePort()); - assertEquals("org.postgresql.Driver", nativeMeta.getDriverClass()); - - assertEquals("jdbc:postgresql://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertTrue(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(" limit 5", nativeMeta.getLimitClause(5)); - assertArrayEquals( - new String[] { - // http://www.postgresql.org/docs/8.1/static/sql-keywords-appendix.html - // added also non-reserved key words because there is progress from the Postgre developers - // to add them - "A", - "ABORT", - "ABS", - "ABSOLUTE", - "ACCESS", - "ACTION", - "ADA", - "ADD", - "ADMIN", - "AFTER", - "AGGREGATE", - "ALIAS", - "ALL", - "ALLOCATE", - "ALSO", - "ALTER", - "ALWAYS", - "ANALYSE", - "ANALYZE", - "AND", - "ANY", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASENSITIVE", - "ASSERTION", - "ASSIGNMENT", - "ASYMMETRIC", - "AT", - "ATOMIC", - "ATTRIBUTE", - "ATTRIBUTES", - "AUTHORIZATION", - "AVG", - "BACKWARD", - "BEFORE", - "BEGIN", - "BERNOULLI", - "BETWEEN", - "BIGINT", - "BINARY", - "BIT", - "BITVAR", - "BIT_LENGTH", - "BLOB", - "BOOLEAN", - "BOTH", - "BREADTH", - "BY", - "C", - "CACHE", - "CALL", - "CALLED", - "CARDINALITY", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CATALOG_NAME", - "CEIL", - "CEILING", - "CHAIN", - "CHAR", - "CHARACTER", - "CHARACTERISTICS", - "CHARACTERS", - "CHARACTER_LENGTH", - "CHARACTER_SET_CATALOG", - "CHARACTER_SET_NAME", - "CHARACTER_SET_SCHEMA", - "CHAR_LENGTH", - "CHECK", - "CHECKED", - "CHECKPOINT", - "CLASS", - "CLASS_ORIGIN", - "CLOB", - "CLOSE", - "CLUSTER", - "COALESCE", - "COBOL", - "COLLATE", - "COLLATION", - "COLLATION_CATALOG", - "COLLATION_NAME", - "COLLATION_SCHEMA", - "COLLECT", - "COLUMN", - "COLUMN_NAME", - "COMMAND_FUNCTION", - "COMMAND_FUNCTION_CODE", - "COMMENT", - "COMMIT", - "COMMITTED", - "COMPLETION", - "CONDITION", - "CONDITION_NUMBER", - "CONNECT", - "CONNECTION", - "CONNECTION_NAME", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRAINT_CATALOG", - "CONSTRAINT_NAME", - "CONSTRAINT_SCHEMA", - "CONSTRUCTOR", - "CONTAINS", - "CONTINUE", - "CONVERSION", - "CONVERT", - "COPY", - "CORR", - "CORRESPONDING", - "COUNT", - "COVAR_POP", - "COVAR_SAMP", - "CREATE", - "CREATEDB", - "CREATEROLE", - "CREATEUSER", - "CROSS", - "CSV", - "CUBE", - "CUME_DIST", - "CURRENT", - "CURRENT_DATE", - "CURRENT_DEFAULT_TRANSFORM_GROUP", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_TRANSFORM_GROUP_FOR_TYPE", - "CURRENT_USER", - "CURSOR", - "CURSOR_NAME", - "CYCLE", - "DATA", - "DATABASE", - "DATE", - "DATETIME_INTERVAL_CODE", - "DATETIME_INTERVAL_PRECISION", - "DAY", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFAULTS", - "DEFERRABLE", - "DEFERRED", - "DEFINED", - "DEFINER", - "DEGREE", - "DELETE", - "DELIMITER", - "DELIMITERS", - "DENSE_RANK", - "DEPTH", - "DEREF", - "DERIVED", - "DESC", - "DESCRIBE", - "DESCRIPTOR", - "DESTROY", - "DESTRUCTOR", - "DETERMINISTIC", - "DIAGNOSTICS", - "DICTIONARY", - "DISABLE", - "DISCONNECT", - "DISPATCH", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "DYNAMIC", - "DYNAMIC_FUNCTION", - "DYNAMIC_FUNCTION_CODE", - "EACH", - "ELEMENT", - "ELSE", - "ENABLE", - "ENCODING", - "ENCRYPTED", - "END", - "END-EXEC", - "EQUALS", - "ESCAPE", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXCLUDE", - "EXCLUDING", - "EXCLUSIVE", - "EXEC", - "EXECUTE", - "EXISTING", - "EXISTS", - "EXP", - "EXPLAIN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FILTER", - "FINAL", - "FIRST", - "FLOAT", - "FLOOR", - "FOLLOWING", - "FOR", - "FORCE", - "FOREIGN", - "FORTRAN", - "FORWARD", - "FOUND", - "FREE", - "FREEZE", - "FROM", - "FULL", - "FUNCTION", - "FUSION", - "G", - "GENERAL", - "GENERATED", - "GET", - "GLOBAL", - "GO", - "GOTO", - "GRANT", - "GRANTED", - "GREATEST", - "GROUP", - "GROUPING", - "HANDLER", - "HAVING", - "HEADER", - "HIERARCHY", - "HOLD", - "HOST", - "HOUR", - "IDENTITY", - "IGNORE", - "ILIKE", - "IMMEDIATE", - "IMMUTABLE", - "IMPLEMENTATION", - "IMPLICIT", - "IN", - "INCLUDING", - "INCREMENT", - "INDEX", - "INDICATOR", - "INFIX", - "INHERIT", - "INHERITS", - "INITIALIZE", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSENSITIVE", - "INSERT", - "INSTANCE", - "INSTANTIABLE", - "INSTEAD", - "INT", - "INTEGER", - "INTERSECT", - "INTERSECTION", - "INTERVAL", - "INTO", - "INVOKER", - "IS", - "ISNULL", - "ISOLATION", - "ITERATE", - "JOIN", - "K", - "KEY", - "KEY_MEMBER", - "KEY_TYPE", - "LANCOMPILER", - "LANGUAGE", - "LARGE", - "LAST", - "LATERAL", - "LEADING", - "LEAST", - "LEFT", - "LENGTH", - "LESS", - "LEVEL", - "LIKE", - "LIMIT", - "LISTEN", - "LN", - "LOAD", - "LOCAL", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATION", - "LOCATOR", - "LOCK", - "LOGIN", - "LOWER", - "M", - "MAP", - "MATCH", - "MATCHED", - "MAX", - "MAXVALUE", - "MEMBER", - "MERGE", - "MESSAGE_LENGTH", - "MESSAGE_OCTET_LENGTH", - "MESSAGE_TEXT", - "METHOD", - "MIN", - "MINUTE", - "MINVALUE", - "MOD", - "MODE", - "MODIFIES", - "MODIFY", - "MODULE", - "MONTH", - "MORE", - "MOVE", - "MULTISET", - "MUMPS", - "NAME", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NCLOB", - "NESTING", - "NEW", - "NEXT", - "NO", - "NOCREATEDB", - "NOCREATEROLE", - "NOCREATEUSER", - "NOINHERIT", - "NOLOGIN", - "NONE", - "NORMALIZE", - "NORMALIZED", - "NOSUPERUSER", - "NOT", - "NOTHING", - "NOTIFY", - "NOTNULL", - "NOWAIT", - "NULL", - "NULLABLE", - "NULLIF", - "NULLS", - "NUMBER", - "NUMERIC", - "OBJECT", - "OCTETS", - "OCTET_LENGTH", - "OF", - "OFF", - "OFFSET", - "OIDS", - "OLD", - "ON", - "ONLY", - "OPEN", - "OPERATION", - "OPERATOR", - "OPTION", - "OPTIONS", - "OR", - "ORDER", - "ORDERING", - "ORDINALITY", - "OTHERS", - "OUT", - "OUTER", - "OUTPUT", - "OVER", - "OVERLAPS", - "OVERLAY", - "OVERRIDING", - "OWNER", - "PAD", - "PARAMETER", - "PARAMETERS", - "PARAMETER_MODE", - "PARAMETER_NAME", - "PARAMETER_ORDINAL_POSITION", - "PARAMETER_SPECIFIC_CATALOG", - "PARAMETER_SPECIFIC_NAME", - "PARAMETER_SPECIFIC_SCHEMA", - "PARTIAL", - "PARTITION", - "PASCAL", - "PASSWORD", - "PATH", - "PERCENTILE_CONT", - "PERCENTILE_DISC", - "PERCENT_RANK", - "PLACING", - "PLI", - "POSITION", - "POSTFIX", - "POWER", - "PRECEDING", - "PRECISION", - "PREFIX", - "PREORDER", - "PREPARE", - "PREPARED", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURAL", - "PROCEDURE", - "PUBLIC", - "QUOTE", - "RANGE", - "RANK", - "READ", - "READS", - "REAL", - "RECHECK", - "RECURSIVE", - "REF", - "REFERENCES", - "REFERENCING", - "REGR_AVGX", - "REGR_AVGY", - "REGR_COUNT", - "REGR_INTERCEPT", - "REGR_R2", - "REGR_SLOPE", - "REGR_SXX", - "REGR_SXY", - "REGR_SYY", - "REINDEX", - "RELATIVE", - "RELEASE", - "RENAME", - "REPEATABLE", - "REPLACE", - "RESET", - "RESTART", - "RESTRICT", - "RESULT", - "RETURN", - "RETURNED_CARDINALITY", - "RETURNED_LENGTH", - "RETURNED_OCTET_LENGTH", - "RETURNED_SQLSTATE", - "RETURNS", - "REVOKE", - "RIGHT", - "ROLE", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROUTINE_CATALOG", - "ROUTINE_NAME", - "ROUTINE_SCHEMA", - "ROW", - "ROWS", - "ROW_COUNT", - "ROW_NUMBER", - "RULE", - "SAVEPOINT", - "SCALE", - "SCHEMA", - "SCHEMA_NAME", - "SCOPE", - "SCOPE_CATALOG", - "SCOPE_NAME", - "SCOPE_SCHEMA", - "SCROLL", - "SEARCH", - "SECOND", - "SECTION", - "SECURITY", - "SELECT", - "SELF", - "SENSITIVE", - "SEQUENCE", - "SERIALIZABLE", - "SERVER_NAME", - "SESSION", - "SESSION_USER", - "SET", - "SETOF", - "SETS", - "SHARE", - "SHOW", - "SIMILAR", - "SIMPLE", - "SIZE", - "SMALLINT", - "SOME", - "SOURCE", - "SPACE", - "SPECIFIC", - "SPECIFICTYPE", - "SPECIFIC_NAME", - "SQL", - "SQLCODE", - "SQLERROR", - "SQLEXCEPTION", - "SQLSTATE", - "SQLWARNING", - "SQRT", - "STABLE", - "START", - "STATE", - "STATEMENT", - "STATIC", - "STATISTICS", - "STDDEV_POP", - "STDDEV_SAMP", - "STDIN", - "STDOUT", - "STORAGE", - "STRICT", - "STRUCTURE", - "STYLE", - "SUBCLASS_ORIGIN", - "SUBLIST", - "SUBMULTISET", - "SUBSTRING", - "SUM", - "SUPERUSER", - "SYMMETRIC", - "SYSID", - "SYSTEM", - "SYSTEM_USER", - "TABLE", - "TABLESAMPLE", - "TABLESPACE", - "TABLE_NAME", - "TEMP", - "TEMPLATE", - "TEMPORARY", - "TERMINATE", - "THAN", - "THEN", - "TIES", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TO", - "TOAST", - "TOP_LEVEL_COUNT", - "TRAILING", - "TRANSACTION", - "TRANSACTIONS_COMMITTED", - "TRANSACTIONS_ROLLED_BACK", - "TRANSACTION_ACTIVE", - "TRANSFORM", - "TRANSFORMS", - "TRANSLATE", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRIGGER_CATALOG", - "TRIGGER_NAME", - "TRIGGER_SCHEMA", - "TRIM", - "TRUE", - "TRUNCATE", - "TRUSTED", - "TYPE", - "UESCAPE", - "UNBOUNDED", - "UNCOMMITTED", - "UNDER", - "UNENCRYPTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNLISTEN", - "UNNAMED", - "UNNEST", - "UNTIL", - "UPDATE", - "UPPER", - "USAGE", - "USER", - "USER_DEFINED_TYPE_CATALOG", - "USER_DEFINED_TYPE_CODE", - "USER_DEFINED_TYPE_NAME", - "USER_DEFINED_TYPE_SCHEMA", - "USING", - "VACUUM", - "VALID", - "VALIDATOR", - "VALUE", - "VALUES", - "VARCHAR", - "VARIABLE", - "VARYING", - "VAR_POP", - "VAR_SAMP", - "VERBOSE", - "VIEW", - "VOLATILE", - "WHEN", - "WHENEVER", - "WHERE", - "WIDTH_BUCKET", - "WINDOW", - "WITH", - "WITHIN", - "WITHOUT", - "WORK", - "WRITE", - "YEAR", - "ZONE" - }, - nativeMeta.getReservedWords()); - - assertFalse(nativeMeta.isDefaultingToUppercase()); - assertEquals( - "http://jdbc.postgresql.org/documentation/83/connect.html#connection-parameters", - nativeMeta.getExtraOptionsHelpText()); - assertFalse(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); - assertTrue(nativeMeta.isRequiresCastToVariousForIsNull()); - assertFalse(nativeMeta.isSupportsGetBlob()); - assertTrue(nativeMeta.isUseSafePoints()); - assertTrue(nativeMeta.isSupportsBooleanDataType()); - assertTrue(nativeMeta.isSupportsTimestampDataType()); - } - - @Test - public void testSqlStatements() { - assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlTableExists("FOO")); - assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlColumnExists("FOO", "BAR")); - assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); - assertEquals( - "SELECT relname AS sequence_name FROM pg_catalog.pg_statio_all_sequences", - nativeMeta.getSqlListOfSequences()); - assertEquals("SELECT nextval('FOO')", nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals("SELECT currval('FOO')", nativeMeta.getSqlCurrentSequenceValue("FOO")); - assertEquals( - "SELECT relname AS sequence_name FROM pg_catalog.pg_statio_all_sequences WHERE relname = 'foo'", - nativeMeta.getSqlSequenceExists("FOO")); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR TIMESTAMP", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR TIMESTAMP", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BOOLEAN", - nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR DOUBLE PRECISION", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR INTEGER", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(13, 3)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(13, 3)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(25, 4)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR TEXT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), - "", - false, - "", - false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BIGINT", - nativeMeta.getAddColumnStatement( - "FOO", - new ValueMetaNumber("BAR", 10, -7), - "", - false, - "", - false)); // Bug here - invalid SQL - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(29, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR DOUBLE PRECISION", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(12, 7)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR UNKNOWN", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BIGSERIAL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR BIGSERIAL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); - - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR", - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR_KTL VARCHAR(15);" - + lineSep - + "UPDATE FOO SET BAR_KTL=BAR;" - + lineSep - + "ALTER TABLE FOO DROP COLUMN BAR;" - + lineSep - + "ALTER TABLE FOO RENAME BAR_KTL TO BAR;" - + lineSep, - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR_KTL TEXT;" - + lineSep - + "UPDATE FOO SET BAR_KTL=BAR;" - + lineSep - + "ALTER TABLE FOO DROP COLUMN BAR;" - + lineSep - + "ALTER TABLE FOO RENAME BAR_KTL TO BAR;" - + lineSep, - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR"), "", false, "", true)); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR SMALLINT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); - - assertEquals( - "LOCK TABLE FOO , BAR IN ACCESS EXCLUSIVE MODE;" + lineSep, - nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); - - assertNull(nativeMeta.getSqlUnlockTables(new String[] {"FOO"})); - } -} +/* + * 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 org.apache.hop.databases.postgresql; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class PostgreSqlDatabaseMetaTest { + PostgreSqlDatabaseMeta nativeMeta; + + @Before + public void setupBefore() throws Exception { + + nativeMeta = new PostgreSqlDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertEquals("&", nativeMeta.getExtraOptionSeparator()); + assertEquals("?", nativeMeta.getExtraOptionIndicator()); + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(5432, nativeMeta.getDefaultDatabasePort()); + assertEquals("org.postgresql.Driver", nativeMeta.getDriverClass()); + + assertEquals("jdbc:postgresql://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertTrue(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.isSupportsSequenceNoMaxValueOption()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(" limit 5", nativeMeta.getLimitClause(5)); + assertArrayEquals( + new String[] { + // http://www.postgresql.org/docs/8.1/static/sql-keywords-appendix.html + // added also non-reserved key words because there is progress from the Postgre developers + // to add them + "A", + "ABORT", + "ABS", + "ABSOLUTE", + "ACCESS", + "ACTION", + "ADA", + "ADD", + "ADMIN", + "AFTER", + "AGGREGATE", + "ALIAS", + "ALL", + "ALLOCATE", + "ALSO", + "ALTER", + "ALWAYS", + "ANALYSE", + "ANALYZE", + "AND", + "ANY", + "ARE", + "ARRAY", + "AS", + "ASC", + "ASENSITIVE", + "ASSERTION", + "ASSIGNMENT", + "ASYMMETRIC", + "AT", + "ATOMIC", + "ATTRIBUTE", + "ATTRIBUTES", + "AUTHORIZATION", + "AVG", + "BACKWARD", + "BEFORE", + "BEGIN", + "BERNOULLI", + "BETWEEN", + "BIGINT", + "BINARY", + "BIT", + "BITVAR", + "BIT_LENGTH", + "BLOB", + "BOOLEAN", + "BOTH", + "BREADTH", + "BY", + "C", + "CACHE", + "CALL", + "CALLED", + "CARDINALITY", + "CASCADE", + "CASCADED", + "CASE", + "CAST", + "CATALOG", + "CATALOG_NAME", + "CEIL", + "CEILING", + "CHAIN", + "CHAR", + "CHARACTER", + "CHARACTERISTICS", + "CHARACTERS", + "CHARACTER_LENGTH", + "CHARACTER_SET_CATALOG", + "CHARACTER_SET_NAME", + "CHARACTER_SET_SCHEMA", + "CHAR_LENGTH", + "CHECK", + "CHECKED", + "CHECKPOINT", + "CLASS", + "CLASS_ORIGIN", + "CLOB", + "CLOSE", + "CLUSTER", + "COALESCE", + "COBOL", + "COLLATE", + "COLLATION", + "COLLATION_CATALOG", + "COLLATION_NAME", + "COLLATION_SCHEMA", + "COLLECT", + "COLUMN", + "COLUMN_NAME", + "COMMAND_FUNCTION", + "COMMAND_FUNCTION_CODE", + "COMMENT", + "COMMIT", + "COMMITTED", + "COMPLETION", + "CONDITION", + "CONDITION_NUMBER", + "CONNECT", + "CONNECTION", + "CONNECTION_NAME", + "CONSTRAINT", + "CONSTRAINTS", + "CONSTRAINT_CATALOG", + "CONSTRAINT_NAME", + "CONSTRAINT_SCHEMA", + "CONSTRUCTOR", + "CONTAINS", + "CONTINUE", + "CONVERSION", + "CONVERT", + "COPY", + "CORR", + "CORRESPONDING", + "COUNT", + "COVAR_POP", + "COVAR_SAMP", + "CREATE", + "CREATEDB", + "CREATEROLE", + "CREATEUSER", + "CROSS", + "CSV", + "CUBE", + "CUME_DIST", + "CURRENT", + "CURRENT_DATE", + "CURRENT_DEFAULT_TRANSFORM_GROUP", + "CURRENT_PATH", + "CURRENT_ROLE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_TRANSFORM_GROUP_FOR_TYPE", + "CURRENT_USER", + "CURSOR", + "CURSOR_NAME", + "CYCLE", + "DATA", + "DATABASE", + "DATE", + "DATETIME_INTERVAL_CODE", + "DATETIME_INTERVAL_PRECISION", + "DAY", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFAULTS", + "DEFERRABLE", + "DEFERRED", + "DEFINED", + "DEFINER", + "DEGREE", + "DELETE", + "DELIMITER", + "DELIMITERS", + "DENSE_RANK", + "DEPTH", + "DEREF", + "DERIVED", + "DESC", + "DESCRIBE", + "DESCRIPTOR", + "DESTROY", + "DESTRUCTOR", + "DETERMINISTIC", + "DIAGNOSTICS", + "DICTIONARY", + "DISABLE", + "DISCONNECT", + "DISPATCH", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "DYNAMIC", + "DYNAMIC_FUNCTION", + "DYNAMIC_FUNCTION_CODE", + "EACH", + "ELEMENT", + "ELSE", + "ENABLE", + "ENCODING", + "ENCRYPTED", + "END", + "END-EXEC", + "EQUALS", + "ESCAPE", + "EVERY", + "EXCEPT", + "EXCEPTION", + "EXCLUDE", + "EXCLUDING", + "EXCLUSIVE", + "EXEC", + "EXECUTE", + "EXISTING", + "EXISTS", + "EXP", + "EXPLAIN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FILTER", + "FINAL", + "FIRST", + "FLOAT", + "FLOOR", + "FOLLOWING", + "FOR", + "FORCE", + "FOREIGN", + "FORTRAN", + "FORWARD", + "FOUND", + "FREE", + "FREEZE", + "FROM", + "FULL", + "FUNCTION", + "FUSION", + "G", + "GENERAL", + "GENERATED", + "GET", + "GLOBAL", + "GO", + "GOTO", + "GRANT", + "GRANTED", + "GREATEST", + "GROUP", + "GROUPING", + "HANDLER", + "HAVING", + "HEADER", + "HIERARCHY", + "HOLD", + "HOST", + "HOUR", + "IDENTITY", + "IGNORE", + "ILIKE", + "IMMEDIATE", + "IMMUTABLE", + "IMPLEMENTATION", + "IMPLICIT", + "IN", + "INCLUDING", + "INCREMENT", + "INDEX", + "INDICATOR", + "INFIX", + "INHERIT", + "INHERITS", + "INITIALIZE", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSENSITIVE", + "INSERT", + "INSTANCE", + "INSTANTIABLE", + "INSTEAD", + "INT", + "INTEGER", + "INTERSECT", + "INTERSECTION", + "INTERVAL", + "INTO", + "INVOKER", + "IS", + "ISNULL", + "ISOLATION", + "ITERATE", + "JOIN", + "K", + "KEY", + "KEY_MEMBER", + "KEY_TYPE", + "LANCOMPILER", + "LANGUAGE", + "LARGE", + "LAST", + "LATERAL", + "LEADING", + "LEAST", + "LEFT", + "LENGTH", + "LESS", + "LEVEL", + "LIKE", + "LIMIT", + "LISTEN", + "LN", + "LOAD", + "LOCAL", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATION", + "LOCATOR", + "LOCK", + "LOGIN", + "LOWER", + "M", + "MAP", + "MATCH", + "MATCHED", + "MAX", + "MAXVALUE", + "MEMBER", + "MERGE", + "MESSAGE_LENGTH", + "MESSAGE_OCTET_LENGTH", + "MESSAGE_TEXT", + "METHOD", + "MIN", + "MINUTE", + "MINVALUE", + "MOD", + "MODE", + "MODIFIES", + "MODIFY", + "MODULE", + "MONTH", + "MORE", + "MOVE", + "MULTISET", + "MUMPS", + "NAME", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NCLOB", + "NESTING", + "NEW", + "NEXT", + "NO", + "NOCREATEDB", + "NOCREATEROLE", + "NOCREATEUSER", + "NOINHERIT", + "NOLOGIN", + "NONE", + "NORMALIZE", + "NORMALIZED", + "NOSUPERUSER", + "NOT", + "NOTHING", + "NOTIFY", + "NOTNULL", + "NOWAIT", + "NULL", + "NULLABLE", + "NULLIF", + "NULLS", + "NUMBER", + "NUMERIC", + "OBJECT", + "OCTETS", + "OCTET_LENGTH", + "OF", + "OFF", + "OFFSET", + "OIDS", + "OLD", + "ON", + "ONLY", + "OPEN", + "OPERATION", + "OPERATOR", + "OPTION", + "OPTIONS", + "OR", + "ORDER", + "ORDERING", + "ORDINALITY", + "OTHERS", + "OUT", + "OUTER", + "OUTPUT", + "OVER", + "OVERLAPS", + "OVERLAY", + "OVERRIDING", + "OWNER", + "PAD", + "PARAMETER", + "PARAMETERS", + "PARAMETER_MODE", + "PARAMETER_NAME", + "PARAMETER_ORDINAL_POSITION", + "PARAMETER_SPECIFIC_CATALOG", + "PARAMETER_SPECIFIC_NAME", + "PARAMETER_SPECIFIC_SCHEMA", + "PARTIAL", + "PARTITION", + "PASCAL", + "PASSWORD", + "PATH", + "PERCENTILE_CONT", + "PERCENTILE_DISC", + "PERCENT_RANK", + "PLACING", + "PLI", + "POSITION", + "POSTFIX", + "POWER", + "PRECEDING", + "PRECISION", + "PREFIX", + "PREORDER", + "PREPARE", + "PREPARED", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURAL", + "PROCEDURE", + "PUBLIC", + "QUOTE", + "RANGE", + "RANK", + "READ", + "READS", + "REAL", + "RECHECK", + "RECURSIVE", + "REF", + "REFERENCES", + "REFERENCING", + "REGR_AVGX", + "REGR_AVGY", + "REGR_COUNT", + "REGR_INTERCEPT", + "REGR_R2", + "REGR_SLOPE", + "REGR_SXX", + "REGR_SXY", + "REGR_SYY", + "REINDEX", + "RELATIVE", + "RELEASE", + "RENAME", + "REPEATABLE", + "REPLACE", + "RESET", + "RESTART", + "RESTRICT", + "RESULT", + "RETURN", + "RETURNED_CARDINALITY", + "RETURNED_LENGTH", + "RETURNED_OCTET_LENGTH", + "RETURNED_SQLSTATE", + "RETURNS", + "REVOKE", + "RIGHT", + "ROLE", + "ROLLBACK", + "ROLLUP", + "ROUTINE", + "ROUTINE_CATALOG", + "ROUTINE_NAME", + "ROUTINE_SCHEMA", + "ROW", + "ROWS", + "ROW_COUNT", + "ROW_NUMBER", + "RULE", + "SAVEPOINT", + "SCALE", + "SCHEMA", + "SCHEMA_NAME", + "SCOPE", + "SCOPE_CATALOG", + "SCOPE_NAME", + "SCOPE_SCHEMA", + "SCROLL", + "SEARCH", + "SECOND", + "SECTION", + "SECURITY", + "SELECT", + "SELF", + "SENSITIVE", + "SEQUENCE", + "SERIALIZABLE", + "SERVER_NAME", + "SESSION", + "SESSION_USER", + "SET", + "SETOF", + "SETS", + "SHARE", + "SHOW", + "SIMILAR", + "SIMPLE", + "SIZE", + "SMALLINT", + "SOME", + "SOURCE", + "SPACE", + "SPECIFIC", + "SPECIFICTYPE", + "SPECIFIC_NAME", + "SQL", + "SQLCODE", + "SQLERROR", + "SQLEXCEPTION", + "SQLSTATE", + "SQLWARNING", + "SQRT", + "STABLE", + "START", + "STATE", + "STATEMENT", + "STATIC", + "STATISTICS", + "STDDEV_POP", + "STDDEV_SAMP", + "STDIN", + "STDOUT", + "STORAGE", + "STRICT", + "STRUCTURE", + "STYLE", + "SUBCLASS_ORIGIN", + "SUBLIST", + "SUBMULTISET", + "SUBSTRING", + "SUM", + "SUPERUSER", + "SYMMETRIC", + "SYSID", + "SYSTEM", + "SYSTEM_USER", + "TABLE", + "TABLESAMPLE", + "TABLESPACE", + "TABLE_NAME", + "TEMP", + "TEMPLATE", + "TEMPORARY", + "TERMINATE", + "THAN", + "THEN", + "TIES", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TO", + "TOAST", + "TOP_LEVEL_COUNT", + "TRAILING", + "TRANSACTION", + "TRANSACTIONS_COMMITTED", + "TRANSACTIONS_ROLLED_BACK", + "TRANSACTION_ACTIVE", + "TRANSFORM", + "TRANSFORMS", + "TRANSLATE", + "TRANSLATION", + "TREAT", + "TRIGGER", + "TRIGGER_CATALOG", + "TRIGGER_NAME", + "TRIGGER_SCHEMA", + "TRIM", + "TRUE", + "TRUNCATE", + "TRUSTED", + "TYPE", + "UESCAPE", + "UNBOUNDED", + "UNCOMMITTED", + "UNDER", + "UNENCRYPTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNLISTEN", + "UNNAMED", + "UNNEST", + "UNTIL", + "UPDATE", + "UPPER", + "USAGE", + "USER", + "USER_DEFINED_TYPE_CATALOG", + "USER_DEFINED_TYPE_CODE", + "USER_DEFINED_TYPE_NAME", + "USER_DEFINED_TYPE_SCHEMA", + "USING", + "VACUUM", + "VALID", + "VALIDATOR", + "VALUE", + "VALUES", + "VARCHAR", + "VARIABLE", + "VARYING", + "VAR_POP", + "VAR_SAMP", + "VERBOSE", + "VIEW", + "VOLATILE", + "WHEN", + "WHENEVER", + "WHERE", + "WIDTH_BUCKET", + "WINDOW", + "WITH", + "WITHIN", + "WITHOUT", + "WORK", + "WRITE", + "YEAR", + "ZONE" + }, + nativeMeta.getReservedWords()); + + assertFalse(nativeMeta.isDefaultingToUppercase()); + assertEquals( + "http://jdbc.postgresql.org/documentation/83/connect.html#connection-parameters", + nativeMeta.getExtraOptionsHelpText()); + assertFalse(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); + assertTrue(nativeMeta.isRequiresCastToVariousForIsNull()); + assertFalse(nativeMeta.isSupportsGetBlob()); + assertTrue(nativeMeta.isUseSafePoints()); + assertTrue(nativeMeta.isSupportsBooleanDataType()); + assertTrue(nativeMeta.isSupportsTimestampDataType()); + } + + @Test + public void testSqlStatements() { + assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT * FROM FOO limit 1", nativeMeta.getSqlTableExists("FOO")); + assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlColumnExists("FOO", "BAR")); + assertEquals("SELECT FOO FROM BAR limit 1", nativeMeta.getSqlQueryColumnFields("FOO", "BAR")); + assertEquals( + "SELECT relname AS sequence_name FROM pg_catalog.pg_statio_all_sequences", + nativeMeta.getSqlListOfSequences()); + assertEquals("SELECT nextval('FOO')", nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals("SELECT currval('FOO')", nativeMeta.getSqlCurrentSequenceValue("FOO")); + assertEquals( + "SELECT relname AS sequence_name FROM pg_catalog.pg_statio_all_sequences WHERE relname = 'foo'", + nativeMeta.getSqlSequenceExists("FOO")); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR TIMESTAMP", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaDate("BAR"), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR TIMESTAMP", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaTimestamp("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BOOLEAN", + nativeMeta.getAddColumnStatement("FOO", new ValueMetaBoolean("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 10, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR DOUBLE PRECISION", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 0, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR INTEGER", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(13, 3)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(13, 3)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 10, 3), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(25, 4)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 21, 4), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR TEXT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaString("BAR", nativeMeta.getMaxVARCHARLength() + 2, 0), + "", + false, + "", + false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BIGINT", + nativeMeta.getAddColumnStatement( + "FOO", + new ValueMetaNumber("BAR", 10, -7), + "", + false, + "", + false)); // Bug here - invalid SQL + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(29, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaBigNumber("BAR", 22, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR DOUBLE PRECISION", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", -10, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR NUMERIC(12, 7)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 5, 7), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR UNKNOWN", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInternetAddress("BAR"), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BIGSERIAL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR"), "BAR", true, "", false)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR BIGSERIAL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaNumber("BAR", 26, 8), "BAR", true, "", false)); + + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR", + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR_KTL VARCHAR(15);" + + lineSep + + "UPDATE FOO SET BAR_KTL=BAR;" + + lineSep + + "ALTER TABLE FOO DROP COLUMN BAR;" + + lineSep + + "ALTER TABLE FOO RENAME BAR_KTL TO BAR;" + + lineSep, + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR_KTL TEXT;" + + lineSep + + "UPDATE FOO SET BAR_KTL=BAR;" + + lineSep + + "ALTER TABLE FOO DROP COLUMN BAR;" + + lineSep + + "ALTER TABLE FOO RENAME BAR_KTL TO BAR;" + + lineSep, + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR"), "", false, "", true)); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR SMALLINT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaInteger("BAR", 4, 0), "", true, "", false)); + + assertEquals( + "LOCK TABLE FOO , BAR IN ACCESS EXCLUSIVE MODE;" + lineSep, + nativeMeta.getSqlLockTables(new String[] {"FOO", "BAR"})); + + assertNull(nativeMeta.getSqlUnlockTables(new String[] {"FOO"})); + } +} diff --git a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlValueMetaBaseTest.java b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlValueMetaBaseTest.java index d201bd5bcd2..932fb078133 100644 --- a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlValueMetaBaseTest.java +++ b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/PostgreSqlValueMetaBaseTest.java @@ -17,6 +17,24 @@ package org.apache.hop.databases.postgresql; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.DatabaseMeta; @@ -42,25 +60,6 @@ import org.junit.Test; import org.mockito.Spy; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - public class PostgreSqlValueMetaBaseTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/ReleaseSavePointTest.java b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/ReleaseSavePointTest.java index 94642c72135..faa6fa038f5 100644 --- a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/ReleaseSavePointTest.java +++ b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/ReleaseSavePointTest.java @@ -17,11 +17,11 @@ package org.apache.hop.databases.postgresql; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.junit.Test; -import static org.junit.Assert.assertTrue; - public class ReleaseSavePointTest { IDatabase[] support = diff --git a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/SequenceMetaTest.java b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/SequenceMetaTest.java index 79d1226f317..1b653b6d30c 100644 --- a/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/SequenceMetaTest.java +++ b/plugins/databases/postgresql/src/test/java/org/apache/hop/databases/postgresql/SequenceMetaTest.java @@ -17,14 +17,14 @@ package org.apache.hop.databases.postgresql; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.util.Utils; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.util.Utils; +import org.junit.Test; + public class SequenceMetaTest { @Test diff --git a/plugins/databases/redshift/src/main/java/org/apache/hop/databases/redshift/RedshiftDatabaseMeta.java b/plugins/databases/redshift/src/main/java/org/apache/hop/databases/redshift/RedshiftDatabaseMeta.java index 1d89b43e250..36161ab8c1d 100644 --- a/plugins/databases/redshift/src/main/java/org/apache/hop/databases/redshift/RedshiftDatabaseMeta.java +++ b/plugins/databases/redshift/src/main/java/org/apache/hop/databases/redshift/RedshiftDatabaseMeta.java @@ -1,79 +1,82 @@ -/* - * 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 org.apache.hop.databases.redshift; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabaseMetaPlugin; -import org.apache.hop.core.gui.plugin.GuiPlugin; -import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; - -@DatabaseMetaPlugin(type = "REDSHIFT", typeDescription = "Redshift", documentationUrl = "/database/databases/redshift.html") -@GuiPlugin(id = "GUI-RedshiftDatabaseMeta") -public class RedshiftDatabaseMeta extends PostgreSqlDatabaseMeta { - - public RedshiftDatabaseMeta() { - addExtraOption("REDSHIFT", "tcpKeepAlive", "true"); - } - - @Override - public int getDefaultDatabasePort() { - if (getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE) { - return 5439; - } - return -1; - } - - @Override - public String getDriverClass() { - return "com.amazon.redshift.jdbc42.Driver"; - } - - @Override - public String getURL(String hostname, String port, String databaseName) { - return "jdbc:redshift://" + hostname + ":" + port + "/" + databaseName; - } - - @Override - public String getExtraOptionsHelpText() { - return "http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html"; - } - - /** - * The superclass method checks whether or not the command setFetchSize() is supported by the - * driver. In the case of Redshift, setFetchSize() is supported, but in the case of LIMIT, the - * Redshift driver will enforce that the value for fetch size is less than or equal to the value - * specified in the LIMIT clause. - * - *

To avoid these problems, this method (and supportsSetMaxRows()) returns false - * - * @return false - */ - @Override - public boolean isFetchSizeSupported() { - return false; - } - - /** - * Redshift does not recognize the JDBC "setMaxRows" parameter - * - * @return false - */ - @Override - public boolean isSupportsSetMaxRows() { - return false; - } -} +/* + * 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 org.apache.hop.databases.redshift; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabaseMetaPlugin; +import org.apache.hop.core.gui.plugin.GuiPlugin; +import org.apache.hop.databases.postgresql.PostgreSqlDatabaseMeta; + +@DatabaseMetaPlugin( + type = "REDSHIFT", + typeDescription = "Redshift", + documentationUrl = "/database/databases/redshift.html") +@GuiPlugin(id = "GUI-RedshiftDatabaseMeta") +public class RedshiftDatabaseMeta extends PostgreSqlDatabaseMeta { + + public RedshiftDatabaseMeta() { + addExtraOption("REDSHIFT", "tcpKeepAlive", "true"); + } + + @Override + public int getDefaultDatabasePort() { + if (getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE) { + return 5439; + } + return -1; + } + + @Override + public String getDriverClass() { + return "com.amazon.redshift.jdbc42.Driver"; + } + + @Override + public String getURL(String hostname, String port, String databaseName) { + return "jdbc:redshift://" + hostname + ":" + port + "/" + databaseName; + } + + @Override + public String getExtraOptionsHelpText() { + return "http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html"; + } + + /** + * The superclass method checks whether or not the command setFetchSize() is supported by the + * driver. In the case of Redshift, setFetchSize() is supported, but in the case of LIMIT, the + * Redshift driver will enforce that the value for fetch size is less than or equal to the value + * specified in the LIMIT clause. + * + *

To avoid these problems, this method (and supportsSetMaxRows()) returns false + * + * @return false + */ + @Override + public boolean isFetchSizeSupported() { + return false; + } + + /** + * Redshift does not recognize the JDBC "setMaxRows" parameter + * + * @return false + */ + @Override + public boolean isSupportsSetMaxRows() { + return false; + } +} diff --git a/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/RedshiftDatabaseMetaTest.java b/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/RedshiftDatabaseMetaTest.java index 7951fc37a39..1a66081b0bf 100644 --- a/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/RedshiftDatabaseMetaTest.java +++ b/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/RedshiftDatabaseMetaTest.java @@ -17,16 +17,15 @@ package org.apache.hop.databases.redshift; -import org.apache.hop.core.database.DatabaseMeta; -import org.junit.Before; -import org.junit.Test; - -import java.util.Map; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import java.util.Map; +import org.apache.hop.core.database.DatabaseMeta; +import org.junit.Before; +import org.junit.Test; + /** Unit tests for RedshiftDatabaseMeta */ public class RedshiftDatabaseMetaTest { diff --git a/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/ReleaseSavePointTest.java b/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/ReleaseSavePointTest.java index 715706d2dc2..5a6552d1d18 100644 --- a/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/ReleaseSavePointTest.java +++ b/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/ReleaseSavePointTest.java @@ -17,11 +17,11 @@ package org.apache.hop.databases.redshift; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.junit.Test; -import static org.junit.Assert.assertTrue; - public class ReleaseSavePointTest { IDatabase[] support = diff --git a/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/SequenceMetaTest.java b/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/SequenceMetaTest.java index da1c8fb0901..51b397e513c 100644 --- a/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/SequenceMetaTest.java +++ b/plugins/databases/redshift/src/test/java/org/apache/hop/databases/redshift/SequenceMetaTest.java @@ -17,14 +17,14 @@ package org.apache.hop.databases.redshift; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.util.Utils; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.util.Utils; +import org.junit.Test; + public class SequenceMetaTest { @Test diff --git a/plugins/databases/sapdb/src/main/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMeta.java b/plugins/databases/sapdb/src/main/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMeta.java index 17eb9d87970..442e15164e1 100644 --- a/plugins/databases/sapdb/src/main/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMeta.java +++ b/plugins/databases/sapdb/src/main/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains SAP DB specific information through static final members - */ -@DatabaseMetaPlugin(type = "SAPDB", typeDescription = "MaxDB (SAP DB)", documentationUrl = "/database/databases/sapdb.html") +/** Contains SAP DB specific information through static final members */ +@DatabaseMetaPlugin( + type = "SAPDB", + typeDescription = "MaxDB (SAP DB)", + documentationUrl = "/database/databases/sapdb.html") @GuiPlugin(id = "GUI-SAPDBDatabaseMeta") public class SAPDBDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -41,7 +42,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; @@ -57,13 +60,17 @@ public String getURL(String hostname, String port, String databaseName) { return "jdbc:sapdb://" + hostname + "/" + databaseName; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports synonyms */ + /** + * @return true if the database supports synonyms + */ @Override public boolean isSupportsSynonyms() { return false; diff --git a/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMetaTest.java b/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMetaTest.java index 49e46b5b8d5..88fa5f0ea18 100644 --- a/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMetaTest.java +++ b/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBDatabaseMetaTest.java @@ -1,356 +1,356 @@ -/* - * 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 org.apache.hop.databases.sapdb; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class SAPDBDatabaseMetaTest { - - private SAPDBDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new SAPDBDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(-1, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("com.sap.dbtech.jdbc.DriverSapDB", nativeMeta.getDriverClass()); - assertEquals("jdbc:sapdb://FOO/WIBBLE", nativeMeta.getURL("FOO", "IGNORED", "WIBBLE")); - assertTrue(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertEquals( - new String[] { - "ABS", - "ABSOLUTE", - "ACOS", - "ADDDATE", - "ADDTIME", - "ALL", - "ALPHA", - "ALTER", - "ANY", - "ASCII", - "ASIN", - "ATAN", - "ATAN2", - "AVG", - "BINARY", - "BIT", - "BOOLEAN", - "BYTE", - "CASE", - "CEIL", - "CEILING", - "CHAR", - "CHARACTER", - "CHECK", - "CHR", - "COLUMN", - "CONCAT", - "CONSTRAINT", - "COS", - "COSH", - "COT", - "COUNT", - "CROSS", - "CURDATE", - "CURRENT", - "CURTIME", - "DATABASE", - "DATE", - "DATEDIFF", - "DAY", - "DAYNAME", - "DAYOFMONTH", - "DAYOFWEEK", - "DAYOFYEAR", - "DEC", - "DECIMAL", - "DECODE", - "DEFAULT", - "DEGREES", - "DELETE", - "DIGITS", - "DISTINCT", - "DOUBLE", - "EXCEPT", - "EXISTS", - "EXP", - "EXPAND", - "FIRST", - "FIXED", - "FLOAT", - "FLOOR", - "FOR", - "FROM", - "FULL", - "GET_OBJECTNAME", - "GET_SCHEMA", - "GRAPHIC", - "GREATEST", - "GROUP", - "HAVING", - "HEX", - "HEXTORAW", - "HOUR", - "IFNULL", - "IGNORE", - "INDEX", - "INITCAP", - "INNER", - "INSERT", - "INT", - "INTEGER", - "INTERNAL", - "INTERSECT", - "INTO", - "JOIN", - "KEY", - "LAST", - "LCASE", - "LEAST", - "LEFT", - "LENGTH", - "LFILL", - "LIST", - "LN", - "LOCATE", - "LOG", - "LOG10", - "LONG", - "LONGFILE", - "LOWER", - "LPAD", - "LTRIM", - "MAKEDATE", - "MAKETIME", - "MAPCHAR", - "MAX", - "MBCS", - "MICROSECOND", - "MIN", - "MINUTE", - "MOD", - "MONTH", - "MONTHNAME", - "NATURAL", - "NCHAR", - "NEXT", - "NO", - "NOROUND", - "NOT", - "NOW", - "NULL", - "NUM", - "NUMERIC", - "OBJECT", - "OF", - "ON", - "ORDER", - "PACKED", - "PI", - "POWER", - "PREV", - "PRIMARY", - "RADIANS", - "REAL", - "REJECT", - "RELATIVE", - "REPLACE", - "RFILL", - "RIGHT", - "ROUND", - "ROWID", - "ROWNO", - "RPAD", - "RTRIM", - "SECOND", - "SELECT", - "SELUPD", - "SERIAL", - "SET", - "SHOW", - "SIGN", - "SIN", - "SINH", - "SMALLINT", - "SOME", - "SOUNDEX", - "SPACE", - "SQRT", - "STAMP", - "STATISTICS", - "STDDEV", - "SUBDATE", - "SUBSTR", - "SUBSTRING", - "SUBTIME", - "SUM", - "SYSDBA", - "TABLE", - "TAN", - "TANH", - "TIME", - "TIMEDIFF", - "TIMESTAMP", - "TIMEZONE", - "TO", - "TOIDENTIFIER", - "TRANSACTION", - "TRANSLATE", - "TRIM", - "TRUNC", - "TRUNCATE", - "UCASE", - "UID", - "UNICODE", - "UNION", - "UPDATE", - "UPPER", - "USER", - "USERGROUP", - "USING", - "UTCDATE", - "UTCDIFF", - "VALUE", - "VALUES", - "VARCHAR", - "VARGRAPHIC", - "VARIANCE", - "WEEK", - "WEEKOFYEAR", - "WHEN", - "WHERE", - "WITH", - "YEAR", - "ZONED" - }, - nativeMeta.getReservedWords()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR TYPE VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "BIGINT NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "BIGINT NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 10, 0), "", "FOO", false, false, false)); - - // Decimal Types - assertEquals( - "DECIMAL(10, 3)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 3), "", "", false, false, false)); - assertEquals( - "DECIMAL(19)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 19, 0), "", "", false, false, false)); - - // Integers - assertEquals( - "INT64", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 4, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); - - assertEquals( - "DOUBLE", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", -7, -3), "", "", false, false, false)); - - // Strings - assertEquals( - "VARCHAR(32719)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32719, 0), "", "", false, false, false)); - - assertEquals( - "BLOB SUB_TYPE TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32720, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(8000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -122, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.sapdb; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class SAPDBDatabaseMetaTest { + + private SAPDBDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new SAPDBDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(-1, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("com.sap.dbtech.jdbc.DriverSapDB", nativeMeta.getDriverClass()); + assertEquals("jdbc:sapdb://FOO/WIBBLE", nativeMeta.getURL("FOO", "IGNORED", "WIBBLE")); + assertTrue(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertEquals( + new String[] { + "ABS", + "ABSOLUTE", + "ACOS", + "ADDDATE", + "ADDTIME", + "ALL", + "ALPHA", + "ALTER", + "ANY", + "ASCII", + "ASIN", + "ATAN", + "ATAN2", + "AVG", + "BINARY", + "BIT", + "BOOLEAN", + "BYTE", + "CASE", + "CEIL", + "CEILING", + "CHAR", + "CHARACTER", + "CHECK", + "CHR", + "COLUMN", + "CONCAT", + "CONSTRAINT", + "COS", + "COSH", + "COT", + "COUNT", + "CROSS", + "CURDATE", + "CURRENT", + "CURTIME", + "DATABASE", + "DATE", + "DATEDIFF", + "DAY", + "DAYNAME", + "DAYOFMONTH", + "DAYOFWEEK", + "DAYOFYEAR", + "DEC", + "DECIMAL", + "DECODE", + "DEFAULT", + "DEGREES", + "DELETE", + "DIGITS", + "DISTINCT", + "DOUBLE", + "EXCEPT", + "EXISTS", + "EXP", + "EXPAND", + "FIRST", + "FIXED", + "FLOAT", + "FLOOR", + "FOR", + "FROM", + "FULL", + "GET_OBJECTNAME", + "GET_SCHEMA", + "GRAPHIC", + "GREATEST", + "GROUP", + "HAVING", + "HEX", + "HEXTORAW", + "HOUR", + "IFNULL", + "IGNORE", + "INDEX", + "INITCAP", + "INNER", + "INSERT", + "INT", + "INTEGER", + "INTERNAL", + "INTERSECT", + "INTO", + "JOIN", + "KEY", + "LAST", + "LCASE", + "LEAST", + "LEFT", + "LENGTH", + "LFILL", + "LIST", + "LN", + "LOCATE", + "LOG", + "LOG10", + "LONG", + "LONGFILE", + "LOWER", + "LPAD", + "LTRIM", + "MAKEDATE", + "MAKETIME", + "MAPCHAR", + "MAX", + "MBCS", + "MICROSECOND", + "MIN", + "MINUTE", + "MOD", + "MONTH", + "MONTHNAME", + "NATURAL", + "NCHAR", + "NEXT", + "NO", + "NOROUND", + "NOT", + "NOW", + "NULL", + "NUM", + "NUMERIC", + "OBJECT", + "OF", + "ON", + "ORDER", + "PACKED", + "PI", + "POWER", + "PREV", + "PRIMARY", + "RADIANS", + "REAL", + "REJECT", + "RELATIVE", + "REPLACE", + "RFILL", + "RIGHT", + "ROUND", + "ROWID", + "ROWNO", + "RPAD", + "RTRIM", + "SECOND", + "SELECT", + "SELUPD", + "SERIAL", + "SET", + "SHOW", + "SIGN", + "SIN", + "SINH", + "SMALLINT", + "SOME", + "SOUNDEX", + "SPACE", + "SQRT", + "STAMP", + "STATISTICS", + "STDDEV", + "SUBDATE", + "SUBSTR", + "SUBSTRING", + "SUBTIME", + "SUM", + "SYSDBA", + "TABLE", + "TAN", + "TANH", + "TIME", + "TIMEDIFF", + "TIMESTAMP", + "TIMEZONE", + "TO", + "TOIDENTIFIER", + "TRANSACTION", + "TRANSLATE", + "TRIM", + "TRUNC", + "TRUNCATE", + "UCASE", + "UID", + "UNICODE", + "UNION", + "UPDATE", + "UPPER", + "USER", + "USERGROUP", + "USING", + "UTCDATE", + "UTCDIFF", + "VALUE", + "VALUES", + "VARCHAR", + "VARGRAPHIC", + "VARIANCE", + "WEEK", + "WEEKOFYEAR", + "WHEN", + "WHERE", + "WITH", + "YEAR", + "ZONED" + }, + nativeMeta.getReservedWords()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR TYPE VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "BIGINT NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "BIGINT NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 10, 0), "", "FOO", false, false, false)); + + // Decimal Types + assertEquals( + "DECIMAL(10, 3)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 3), "", "", false, false, false)); + assertEquals( + "DECIMAL(19)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 19, 0), "", "", false, false, false)); + + // Integers + assertEquals( + "INT64", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 4, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 5, 0), "", "", false, false, false)); + + assertEquals( + "DOUBLE", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", -7, -3), "", "", false, false, false)); + + // Strings + assertEquals( + "VARCHAR(32719)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32719, 0), "", "", false, false, false)); + + assertEquals( + "BLOB SUB_TYPE TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32720, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(8000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -122, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBSequenceAndReleaseSavePointTest.java b/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBSequenceAndReleaseSavePointTest.java index 24ec33e0fe2..8261aaf9775 100644 --- a/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/sapdb/src/test/java/org/apache/hop/databases/sapdb/SAPDBSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.sapdb; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SAPDBSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/snowflake/src/main/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMeta.java b/plugins/databases/snowflake/src/main/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMeta.java index a66b01b6414..be4289dc2f5 100644 --- a/plugins/databases/snowflake/src/main/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMeta.java +++ b/plugins/databases/snowflake/src/main/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMeta.java @@ -18,6 +18,8 @@ package org.apache.hop.databases.snowflake; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.lang.Validate; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; @@ -31,9 +33,6 @@ import org.apache.hop.core.util.Utils; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.HashMap; -import java.util.Map; - /** * Contains Snowflake specific information through static final members * @@ -326,13 +325,17 @@ public String getExtraOptionSeparator() { return "&"; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "&"; } - /** @return true if the database supports transactions. */ + /** + * @return true if the database supports transactions. + */ @Override public boolean isSupportsTransactions() { return false; @@ -343,13 +346,17 @@ public boolean isSupportsTimeStampToDateConversion() { return false; // The 3.6.9 driver _does_ support conversion, but errors when value is null. } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports views */ + /** + * @return true if the database supports views + */ @Override public boolean isSupportsViews() { return true; diff --git a/plugins/databases/snowflake/src/test/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMetaTest.java b/plugins/databases/snowflake/src/test/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMetaTest.java index 733b50c8124..409e4ca676b 100644 --- a/plugins/databases/snowflake/src/test/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMetaTest.java +++ b/plugins/databases/snowflake/src/test/java/org/apache/hop/databases/snowflake/SnowflakeDatabaseMetaTest.java @@ -1,105 +1,105 @@ -/* - * 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 org.apache.hop.databases.snowflake; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class SnowflakeDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - SnowflakeDatabaseMeta nativeMeta; - - @Before - public void setupOnce() throws Exception { - nativeMeta = new SnowflakeDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - - HopClientEnvironment.init(); - } - - @Test - public void testAccessType() throws Exception { - int[] aTypes = new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; - assertArrayEquals(aTypes, nativeMeta.getAccessTypeList()); - } - - @Test - public void testUrl() throws Exception { - assertEquals("net.snowflake.client.jdbc.SnowflakeDriver", nativeMeta.getDriverClass()); - - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com:1500/?db=bar", - nativeMeta.getURL("account.snowflakecomputing.com", "1500", "bar")); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com:1500/?db=bar", - nativeMeta.getURL("account", "1500", "bar")); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com/?db=bar", - nativeMeta.getURL("account", "", "bar")); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com", nativeMeta.getURL("account", "", "")); - - nativeMeta.setWarehouse("wh"); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com:1500/?warehouse=wh&db=bar", - nativeMeta.getURL("account.snowflakecomputing.com", "1500", "bar")); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com:1500/?warehouse=wh&db=bar", - nativeMeta.getURL("account", "1500", "bar")); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com:1500/?warehouse=wh", - nativeMeta.getURL("account", "1500", "")); - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com/?warehouse=wh&db=bar", - nativeMeta.getURL("account", "", "bar")); - - try { - assertEquals( - "jdbc:snowflake://account.snowflakecomputing.com:1500/?db=bar", - nativeMeta.getURL("", "1500", "bar")); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException dummy) { - // expected if host is null or empty - } - } - - @Test - public void testSupport() throws Exception { - assertTrue(nativeMeta.isSupportsSchemas()); - assertTrue(nativeMeta.isSupportsViews()); - assertTrue(nativeMeta.isSupportsSequences()); - assertTrue(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); - assertTrue(nativeMeta.isSupportsBooleanDataType()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsTransactions()); - assertFalse(nativeMeta.isSupportsSynonyms()); - } -} +/* + * 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 org.apache.hop.databases.snowflake; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +public class SnowflakeDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + SnowflakeDatabaseMeta nativeMeta; + + @Before + public void setupOnce() throws Exception { + nativeMeta = new SnowflakeDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + + HopClientEnvironment.init(); + } + + @Test + public void testAccessType() throws Exception { + int[] aTypes = new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; + assertArrayEquals(aTypes, nativeMeta.getAccessTypeList()); + } + + @Test + public void testUrl() throws Exception { + assertEquals("net.snowflake.client.jdbc.SnowflakeDriver", nativeMeta.getDriverClass()); + + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com:1500/?db=bar", + nativeMeta.getURL("account.snowflakecomputing.com", "1500", "bar")); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com:1500/?db=bar", + nativeMeta.getURL("account", "1500", "bar")); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com/?db=bar", + nativeMeta.getURL("account", "", "bar")); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com", nativeMeta.getURL("account", "", "")); + + nativeMeta.setWarehouse("wh"); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com:1500/?warehouse=wh&db=bar", + nativeMeta.getURL("account.snowflakecomputing.com", "1500", "bar")); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com:1500/?warehouse=wh&db=bar", + nativeMeta.getURL("account", "1500", "bar")); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com:1500/?warehouse=wh", + nativeMeta.getURL("account", "1500", "")); + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com/?warehouse=wh&db=bar", + nativeMeta.getURL("account", "", "bar")); + + try { + assertEquals( + "jdbc:snowflake://account.snowflakecomputing.com:1500/?db=bar", + nativeMeta.getURL("", "1500", "bar")); + fail("Should have thrown IllegalArgumentException"); + } catch (IllegalArgumentException dummy) { + // expected if host is null or empty + } + } + + @Test + public void testSupport() throws Exception { + assertTrue(nativeMeta.isSupportsSchemas()); + assertTrue(nativeMeta.isSupportsViews()); + assertTrue(nativeMeta.isSupportsSequences()); + assertTrue(nativeMeta.IsSupportsErrorHandlingOnBatchUpdates()); + assertTrue(nativeMeta.isSupportsBooleanDataType()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsTransactions()); + assertFalse(nativeMeta.isSupportsSynonyms()); + } +} diff --git a/plugins/databases/sqlbase/src/main/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMeta.java b/plugins/databases/sqlbase/src/main/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMeta.java index b937569d8f0..3a713050399 100644 --- a/plugins/databases/sqlbase/src/main/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMeta.java +++ b/plugins/databases/sqlbase/src/main/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Gupta SQLBase specific information through static final members - */ -@DatabaseMetaPlugin(type = "SQLBASE", typeDescription = "Gupta SQL Base", documentationUrl = "/database/databases/sqlbase.html") +/** Contains Gupta SQLBase specific information through static final members */ +@DatabaseMetaPlugin( + type = "SQLBASE", + typeDescription = "Gupta SQL Base", + documentationUrl = "/database/databases/sqlbase.html") @GuiPlugin(id = "GUI-SQLBaseDatabaseMeta") public class GuptaDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -44,7 +45,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @return Whether or not the database can use auto increment type of fields (pk) */ + /** + * @return Whether or not the database can use auto increment type of fields (pk) + */ @Override public boolean isSupportsAutoInc() { return false; @@ -70,13 +73,17 @@ public boolean isFetchSizeSupported() { return false; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; } - /** @return true if the database supports catalogs */ + /** + * @return true if the database supports catalogs + */ @Override public boolean isSupportsCatalogs() { return false; diff --git a/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMetaTest.java b/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMetaTest.java index c08e4be43d1..15a7b3832c6 100644 --- a/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMetaTest.java +++ b/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaDatabaseMetaTest.java @@ -1,169 +1,169 @@ -/* - * 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 org.apache.hop.databases.sqlbase; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class GuptaDatabaseMetaTest { - - private GuptaDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new GuptaDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(2155, nativeMeta.getDefaultDatabasePort()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertEquals("jdbc.gupta.sqlbase.SqlbaseDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:sqlbase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:sqlbase://FOO:/WIBBLE", - nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) - assertFalse(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertFalse(nativeMeta.isSupportsCatalogs()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - - assertEquals(0, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - - assertTrue(nativeMeta.isSystemTable("SYSFOO")); - assertFalse(nativeMeta.isSystemTable("SySBAR")); - assertFalse(nativeMeta.isSystemTable("BARSYS")); - assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - String lineSep = System.getProperty("line.separator"); - assertEquals( - "ALTER TABLE FOO DROP BAR" - + lineSep - + ";" - + lineSep - + "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATETIME NULL", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "DATETIME NULL", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - - assertEquals( - "INTEGER NOT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "INTEGER NOT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 8, 0), "", "FOO", false, false, false)); - - // Note - ValueMetaInteger returns zero always from the precision - so this avoids the weirdness - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", -8, -3), - "", - "", - false, - false, - false)); // Weird if statement - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", -8, -3), - "", - "", - false, - false, - false)); // Weird if statement ( length and precision less than zero) - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 3), "", "", false, false, false)); // Weird if statement - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); // Weird if statement - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 9, 0), "", "", false, false, false)); // Weird if statement - - assertEquals( - "LONG VARCHAR", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 255, 0), "", "", false, false, false)); - - assertEquals( - "LONG VARCHAR", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -33, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(0)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.sqlbase; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class GuptaDatabaseMetaTest { + + private GuptaDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new GuptaDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(2155, nativeMeta.getDefaultDatabasePort()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertEquals("jdbc.gupta.sqlbase.SqlbaseDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:sqlbase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:sqlbase://FOO:/WIBBLE", + nativeMeta.getURL("FOO", "", "WIBBLE")); // Pretty sure this is a bug (colon after foo) + assertFalse(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertFalse(nativeMeta.isSupportsCatalogs()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + + assertEquals(0, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + + assertTrue(nativeMeta.isSystemTable("SYSFOO")); + assertFalse(nativeMeta.isSystemTable("SySBAR")); + assertFalse(nativeMeta.isSystemTable("BARSYS")); + assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + String lineSep = System.getProperty("line.separator"); + assertEquals( + "ALTER TABLE FOO DROP BAR" + + lineSep + + ";" + + lineSep + + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATETIME NULL", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "DATETIME NULL", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + + assertEquals( + "INTEGER NOT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "INTEGER NOT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 8, 0), "", "FOO", false, false, false)); + + // Note - ValueMetaInteger returns zero always from the precision - so this avoids the weirdness + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", -8, -3), + "", + "", + false, + false, + false)); // Weird if statement + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", -8, -3), + "", + "", + false, + false, + false)); // Weird if statement ( length and precision less than zero) + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 3), "", "", false, false, false)); // Weird if statement + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); // Weird if statement + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 9, 0), "", "", false, false, false)); // Weird if statement + + assertEquals( + "LONG VARCHAR", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 255, 0), "", "", false, false, false)); + + assertEquals( + "LONG VARCHAR", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -33, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(0)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaSequenceAndReleaseSavePointTest.java b/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaSequenceAndReleaseSavePointTest.java index 78ed6006dcc..0f8ac67d420 100644 --- a/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/sqlbase/src/test/java/org/apache/hop/databases/sqlbase/GuptaSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.sqlbase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class GuptaSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/sqlite/src/main/java/org/apache/hop/databases/sqlite/SqliteDatabaseMeta.java b/plugins/databases/sqlite/src/main/java/org/apache/hop/databases/sqlite/SqliteDatabaseMeta.java index 58ede8608b4..2f32d90f712 100644 --- a/plugins/databases/sqlite/src/main/java/org/apache/hop/databases/sqlite/SqliteDatabaseMeta.java +++ b/plugins/databases/sqlite/src/main/java/org/apache/hop/databases/sqlite/SqliteDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains SQLite specific information through static final members - */ -@DatabaseMetaPlugin(type = "SQLITE", typeDescription = "SQLite", documentationUrl = "/database/databases/sqlite.html") +/** Contains SQLite specific information through static final members */ +@DatabaseMetaPlugin( + type = "SQLITE", + typeDescription = "SQLite", + documentationUrl = "/database/databases/sqlite.html") @GuiPlugin(id = "GUI-SQLiteDatabaseMeta") public class SqliteDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -36,7 +37,9 @@ public int[] getAccessTypeList() { return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { @@ -65,7 +68,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; diff --git a/plugins/databases/sqlite/src/test/java/org/apache/hop/core/row/value/SQLiteValueMetaBaseTest.java b/plugins/databases/sqlite/src/test/java/org/apache/hop/core/row/value/SQLiteValueMetaBaseTest.java index 01333bb516b..80f96899d31 100644 --- a/plugins/databases/sqlite/src/test/java/org/apache/hop/core/row/value/SQLiteValueMetaBaseTest.java +++ b/plugins/databases/sqlite/src/test/java/org/apache/hop/core/row/value/SQLiteValueMetaBaseTest.java @@ -17,6 +17,17 @@ package org.apache.hop.core.row.value; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.DatabasePluginType; import org.apache.hop.core.exception.HopDatabaseException; @@ -37,18 +48,6 @@ import org.junit.Test; import org.mockito.Spy; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - public class SQLiteValueMetaBaseTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteDatabaseMetaTest.java b/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteDatabaseMetaTest.java index d9efaf8a40b..577ce00e705 100644 --- a/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteDatabaseMetaTest.java +++ b/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteDatabaseMetaTest.java @@ -1,149 +1,149 @@ -/* - * 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 org.apache.hop.databases.sqlite; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class SqliteDatabaseMetaTest { - - private SqliteDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new SqliteDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(-1, nativeMeta.getDefaultDatabasePort()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("org.sqlite.JDBC", nativeMeta.getDriverClass()); - assertEquals("jdbc:sqlite:WIBBLE", nativeMeta.getURL("IGNORED", "IGNORED", "WIBBLE")); - assertFalse(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertFalse(nativeMeta.isSupportsErrorHandling()); - - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - } - - @Test - public void testSqlStatements() { - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals( - "ALTER TABLE FOO ADD BAR TEXT", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO MODIFY BAR TEXT", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATETIME", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "DATETIME", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - // PK/TK - assertEquals( - "INTEGER PRIMARY KEY AUTOINCREMENT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "INTEGER PRIMARY KEY AUTOINCREMENT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); - - // Numeric Types - assertEquals( - "NUMERIC", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, -6), "", "", false, false, false)); - assertEquals( - "NUMERIC", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", -13, 0), "", "", false, false, false)); - assertEquals( - "NUMERIC", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 19, 0), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 11, 0), "", "", false, false, false)); - - // Strings - assertEquals( - "TEXT", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 50, 0), "", "", false, false, false)); - - assertEquals( - "BLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), - "", - "", - false, - false, - false)); - - // Others - assertEquals( - "BLOB", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 15, 0), "", "", false, false, false)); - - assertEquals( - "UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - "UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.sqlite; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class SqliteDatabaseMetaTest { + + private SqliteDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new SqliteDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(-1, nativeMeta.getDefaultDatabasePort()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("org.sqlite.JDBC", nativeMeta.getDriverClass()); + assertEquals("jdbc:sqlite:WIBBLE", nativeMeta.getURL("IGNORED", "IGNORED", "WIBBLE")); + assertFalse(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertFalse(nativeMeta.isSupportsErrorHandling()); + + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + } + + @Test + public void testSqlStatements() { + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals( + "ALTER TABLE FOO ADD BAR TEXT", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO MODIFY BAR TEXT", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATETIME", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "DATETIME", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + // PK/TK + assertEquals( + "INTEGER PRIMARY KEY AUTOINCREMENT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "INTEGER PRIMARY KEY AUTOINCREMENT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); + + // Numeric Types + assertEquals( + "NUMERIC", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, -6), "", "", false, false, false)); + assertEquals( + "NUMERIC", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", -13, 0), "", "", false, false, false)); + assertEquals( + "NUMERIC", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 19, 0), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 11, 0), "", "", false, false, false)); + + // Strings + assertEquals( + "TEXT", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 50, 0), "", "", false, false, false)); + + assertEquals( + "BLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", DatabaseMeta.CLOB_LENGTH + 1, 0), + "", + "", + false, + false, + false)); + + // Others + assertEquals( + "BLOB", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 15, 0), "", "", false, false, false)); + + assertEquals( + "UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + "UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteSequenceAndReleaseSavePointTest.java b/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteSequenceAndReleaseSavePointTest.java index e9aec49106a..40cb05662a4 100644 --- a/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/sqlite/src/test/java/org/apache/hop/databases/sqlite/SqliteSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.sqlite; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SqliteSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/sybase/src/main/java/org/apache/hop/databases/sybase/SybaseDatabaseMeta.java b/plugins/databases/sybase/src/main/java/org/apache/hop/databases/sybase/SybaseDatabaseMeta.java index 60e95faf7ef..d432338819c 100644 --- a/plugins/databases/sybase/src/main/java/org/apache/hop/databases/sybase/SybaseDatabaseMeta.java +++ b/plugins/databases/sybase/src/main/java/org/apache/hop/databases/sybase/SybaseDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Sybase specific information through static final members - */ -@DatabaseMetaPlugin(type = "SYBASE", typeDescription = "Sybase", documentationUrl = "/database/databases/sybase.html") +/** Contains Sybase specific information through static final members */ +@DatabaseMetaPlugin( + type = "SYBASE", + typeDescription = "Sybase", + documentationUrl = "/database/databases/sybase.html") @GuiPlugin(id = "GUI-SybaseDatabaseMeta") public class SybaseDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -44,7 +45,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { @@ -64,7 +67,9 @@ public String getURL(String hostname, String port, String databaseName) { return "jdbc:jtds:sybase://" + hostname + ":" + port + "/" + databaseName; } - /** @see IDatabase#getSchemaTableCombination(String, String) */ + /** + * @see IDatabase#getSchemaTableCombination(String, String) + */ @Override public String getSchemaTableCombination(String schemaName, String tablePart) { return tablePart; diff --git a/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseDatabaseMetaTest.java b/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseDatabaseMetaTest.java index 193913bc2c7..7701ca3ba1b 100644 --- a/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseDatabaseMetaTest.java +++ b/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseDatabaseMetaTest.java @@ -1,148 +1,148 @@ -/* - * 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 org.apache.hop.databases.sybase; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -public class SybaseDatabaseMetaTest { - private SybaseDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new SybaseDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(5001, nativeMeta.getDefaultDatabasePort()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("net.sourceforge.jtds.jdbc.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:jtds:sybase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:jtds:sybase://FOO:/WIBBLE", - nativeMeta.getURL( - "FOO", "", "WIBBLE")); // Pretty sure this is a bug - uses port empty or not - assertEquals("BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - assertFalse(nativeMeta.isRequiringTransactionsOnQueries()); - assertEquals( - "http://jtds.sourceforge.net/faq.html#urlFormat", nativeMeta.getExtraOptionsHelpText()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15) NULL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15) NULL", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "insert into FOO(FOOVERSION) values (1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATETIME NULL", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, true, false)); - assertEquals( - "DATETIME NULL", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "INTEGER NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); - assertEquals( - "INTEGER NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); - - assertEquals( - "DOUBLE PRECISION NULL", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); - - assertEquals( - "DECIMAL(11, 3) NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 11, 3), "", "", false, false, false)); - - assertEquals( - "TINYINT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 2, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 3, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 4, 0), "", "", false, false, false)); - assertEquals( - "INTEGER NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(15) NULL", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - - assertEquals( - "TEXT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 2050, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition(new ValueMetaBinary("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.sybase; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class SybaseDatabaseMetaTest { + private SybaseDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new SybaseDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(5001, nativeMeta.getDefaultDatabasePort()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("net.sourceforge.jtds.jdbc.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:jtds:sybase://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:jtds:sybase://FOO:/WIBBLE", + nativeMeta.getURL( + "FOO", "", "WIBBLE")); // Pretty sure this is a bug - uses port empty or not + assertEquals("BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + assertFalse(nativeMeta.isRequiringTransactionsOnQueries()); + assertEquals( + "http://jtds.sourceforge.net/faq.html#urlFormat", nativeMeta.getExtraOptionsHelpText()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15) NULL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15) NULL", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "insert into FOO(FOOVERSION) values (1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATETIME NULL", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, true, false)); + assertEquals( + "DATETIME NULL", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "INTEGER NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); + assertEquals( + "INTEGER NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); + + assertEquals( + "DOUBLE PRECISION NULL", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); + + assertEquals( + "DECIMAL(11, 3) NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 11, 3), "", "", false, false, false)); + + assertEquals( + "TINYINT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 2, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 3, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 4, 0), "", "", false, false, false)); + assertEquals( + "INTEGER NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(15) NULL", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + + assertEquals( + "TEXT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 2050, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition(new ValueMetaBinary("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseSequenceAndReleaseSavePointTest.java b/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseSequenceAndReleaseSavePointTest.java index 1a9b479e7dd..c494e930e33 100644 --- a/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/sybase/src/test/java/org/apache/hop/databases/sybase/SybaseSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.sybase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SybaseSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/sybaseiq/src/main/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMeta.java b/plugins/databases/sybaseiq/src/main/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMeta.java index bcd7bc9fba6..473045eb57a 100644 --- a/plugins/databases/sybaseiq/src/main/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMeta.java +++ b/plugins/databases/sybaseiq/src/main/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Sybase IQ specific information through static final members - */ -@DatabaseMetaPlugin(type = "SYBASEIQ", typeDescription = "Sybase IQ", documentationUrl = "/database/databases/sybaseiq.html") +/** Contains Sybase IQ specific information through static final members */ +@DatabaseMetaPlugin( + type = "SYBASEIQ", + typeDescription = "Sybase IQ", + documentationUrl = "/database/databases/sybaseiq.html") @GuiPlugin(id = "GUI-SybaseIQDatabaseMeta") public class SybaseIQDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -44,7 +45,9 @@ public int getDefaultDatabasePort() { return -1; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { @@ -63,7 +66,9 @@ public String getURL(String hostname, String port, String databaseName) { return "jdbc:sybase:Tds:" + hostname + ":" + port + "/" + databaseName; } - /** @see IDatabase#getSchemaTableCombination(String, String) */ + /** + * @see IDatabase#getSchemaTableCombination(String, String) + */ @Override public String getSchemaTableCombination(String schemaName, String tablePart) { return schemaName + "." + tablePart; diff --git a/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMetaTest.java b/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMetaTest.java index c9380a71b6b..f38668f2670 100644 --- a/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMetaTest.java +++ b/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQDatabaseMetaTest.java @@ -1,155 +1,155 @@ -/* - * 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 org.apache.hop.databases.sybaseiq; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class SybaseIQDatabaseMetaTest { - private SybaseIQDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new SybaseIQDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(2638, nativeMeta.getDefaultDatabasePort()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("com.sybase.jdbc3.jdbc.SybDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:sybase:Tds:FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:sybase:Tds:FOO:/WIBBLE", - nativeMeta.getURL( - "FOO", "", "WIBBLE")); // Pretty sure this is a bug - uses port empty or not - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - - assertEquals( - "http://jtds.sourceforge.net/faq.html#urlFormat", nativeMeta.getExtraOptionsHelpText()); - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - assertTrue(nativeMeta.useSchemaNameForTableList()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15) NULL", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15) NULL", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - assertEquals("SELECT * FROM FOO WHERE 1=2", nativeMeta.getSqlQueryFields("FOO")); - assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATETIME NULL", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, true, false)); - - assertEquals( - "DATETIME NULL", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "INTEGER NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); - - assertEquals( - "INTEGER NOT NULL PRIMARY KEY", - nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); - - assertEquals( - "DOUBLE PRECISION NULL", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); - - assertEquals( - "DECIMAL(11, 3) NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 11, 3), "", "", false, false, false)); - - assertEquals( - "TINYINT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 2, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 3, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 4, 0), "", "", false, false, false)); - assertEquals( - "INTEGER NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(15) NULL", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - - assertEquals( - "TEXT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 2050, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition(new ValueMetaBinary("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.sybaseiq; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Before; +import org.junit.Test; + +public class SybaseIQDatabaseMetaTest { + private SybaseIQDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new SybaseIQDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(2638, nativeMeta.getDefaultDatabasePort()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("com.sybase.jdbc3.jdbc.SybDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:sybase:Tds:FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:sybase:Tds:FOO:/WIBBLE", + nativeMeta.getURL( + "FOO", "", "WIBBLE")); // Pretty sure this is a bug - uses port empty or not + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + + assertEquals( + "http://jtds.sourceforge.net/faq.html#urlFormat", nativeMeta.getExtraOptionsHelpText()); + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + assertTrue(nativeMeta.useSchemaNameForTableList()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15) NULL", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15) NULL", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + assertEquals("SELECT * FROM FOO WHERE 1=2", nativeMeta.getSqlQueryFields("FOO")); + assertFalse(nativeMeta.isSupportsPreparedStatementMetadataRetrieval()); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATETIME NULL", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, true, false)); + + assertEquals( + "DATETIME NULL", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "INTEGER NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); + + assertEquals( + "INTEGER NOT NULL PRIMARY KEY", + nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); + + assertEquals( + "DOUBLE PRECISION NULL", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); + + assertEquals( + "DECIMAL(11, 3) NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 11, 3), "", "", false, false, false)); + + assertEquals( + "TINYINT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 2, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 3, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 4, 0), "", "", false, false, false)); + assertEquals( + "INTEGER NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(15) NULL", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + + assertEquals( + "TEXT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 2050, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition(new ValueMetaBinary("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQSequenceAndReleaseSavePointTest.java b/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQSequenceAndReleaseSavePointTest.java index 8c42831649e..0bde92f2f60 100644 --- a/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/sybaseiq/src/test/java/org/apache/hop/databases/sybaseiq/SybaseIQSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.sybaseiq; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SybaseIQSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/teradata/src/main/java/org/apache/hop/databases/teradata/TeradataDatabaseMeta.java b/plugins/databases/teradata/src/main/java/org/apache/hop/databases/teradata/TeradataDatabaseMeta.java index 982ff3b29a1..32fb84e68fc 100644 --- a/plugins/databases/teradata/src/main/java/org/apache/hop/databases/teradata/TeradataDatabaseMeta.java +++ b/plugins/databases/teradata/src/main/java/org/apache/hop/databases/teradata/TeradataDatabaseMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.databases.teradata; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.BaseDatabaseMeta; @@ -27,12 +28,11 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; -import java.util.Map; - -/** - * Contains NCR Teradata specific information through static final members - */ -@DatabaseMetaPlugin(type = "TERADATA", typeDescription = "Teradata", documentationUrl = "/database/databases/teradata.html") +/** Contains NCR Teradata specific information through static final members */ +@DatabaseMetaPlugin( + type = "TERADATA", + typeDescription = "Teradata", + documentationUrl = "/database/databases/teradata.html") @GuiPlugin(id = "GUI-TeradataDatabaseMeta") public class TeradataDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override @@ -45,7 +45,9 @@ public boolean isTeradataVariant() { return true; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { @@ -81,7 +83,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; @@ -246,7 +250,9 @@ public int getDefaultDatabasePort() { return 1025; } - /** @return an array of reserved words for the database type... */ + /** + * @return an array of reserved words for the database type... + */ @Override public String[] getReservedWords() { return new String[] { diff --git a/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataDatabaseMetaTest.java b/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataDatabaseMetaTest.java index bf5b1fcf3ea..611ff74f3d3 100644 --- a/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataDatabaseMetaTest.java +++ b/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataDatabaseMetaTest.java @@ -1,633 +1,632 @@ -/* - * 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 org.apache.hop.databases.teradata; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Map; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class TeradataDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - private TeradataDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new TeradataDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(1025, nativeMeta.getDefaultDatabasePort()); - assertEquals("com.teradata.jdbc.TeraDriver", nativeMeta.getDriverClass()); - assertEquals( - "jdbc:teradata://FOO/DATABASE=WIBBLE", nativeMeta.getURL("FOO", "IGNOREDHERE", "WIBBLE")); - assertFalse(nativeMeta.isFetchSizeSupported()); - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertEquals(",", nativeMeta.getExtraOptionSeparator()); - assertEquals("/", nativeMeta.getExtraOptionIndicator()); - assertEquals( - "http://www.info.ncr.com/eTeradata-BrowseBy-Results.cfm?pl=&PID=&title=%25&release=" - + "&kword=CJDBC&sbrn=7&nm=Teradata+Tools+and+Utilities+-+Java+Database+Connectivity+(JDBC)", - nativeMeta.getExtraOptionsHelpText()); - assertArrayEquals( - new String[] { - "ABORT", - "ABORTSESSION", - "ABS", - "ACCESS_LOCK", - "ACCOUNT", - "ACOS", - "ACOSH", - "ADD", - "ADD_MONTHS", - "ADMIN", - "AFTER", - "AGGREGATE", - "ALL", - "ALTER", - "AMP", - "AND", - "ANSIDATE", - "ANY", - "ARGLPAREN", - "AS", - "ASC", - "ASIN", - "ASINH", - "AT", - "ATAN", - "ATAN2", - "ATANH", - "ATOMIC", - "AUTHORIZATION", - "AVE", - "AVERAGE", - "AVG", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIGINT", - "BINARY", - "BLOB", - "BOTH", - "BT", - "BUT", - "BY", - "BYTE", - "BYTEINT", - "BYTES", - "CALL", - "CASE", - "CASE_N", - "CASESPECIFIC", - "CAST", - "CD", - "CHAR", - "CHAR_LENGTH", - "CHAR2HEXINT", - "CHARACTER", - "CHARACTER_LENGTH", - "CHARACTERS", - "CHARS", - "CHECK", - "CHECKPOINT", - "CLASS", - "CLOB", - "CLOSE", - "CLUSTER", - "CM", - "COALESCE", - "COLLATION", - "COLLECT", - "COLUMN", - "COMMENT", - "COMMIT", - "COMPRESS", - "CONSTRAINT", - "CONSTRUCTOR", - "CONSUME", - "CONTAINS", - "CONTINUE", - "CONVERT_TABLE_HEADER", - "CORR", - "COS", - "COSH", - "COUNT", - "COVAR_POP", - "COVAR_SAMP", - "CREATE", - "CROSS", - "CS", - "CSUM", - "CT", - "CUBE", - "CURRENT", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURSOR", - "CV", - "CYCLE", - "DATABASE", - "DATABLOCKSIZE", - "DATE", - "DATEFORM", - "DAY", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFERRED", - "DEGREES", - "DEL", - "DELETE", - "DESC", - "DETERMINISTIC", - "DIAGNOSTIC", - "DISABLED", - "DISTINCT", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "DUAL", - "DUMP", - "DYNAMIC", - "EACH", - "ECHO", - "ELSE", - "ELSEIF", - "ENABLED", - "END", - "EQ", - "EQUALS", - "ERROR", - "ERRORFILES", - "ERRORTABLES", - "ESCAPE", - "ET", - "EXCEPT", - "EXEC", - "EXECUTE", - "EXISTS", - "EXIT", - "EXP", - "EXPLAIN", - "EXTERNAL", - "EXTRACT", - "FALLBACK", - "FASTEXPORT", - "FETCH", - "FIRST", - "FLOAT", - "FOR", - "FOREIGN", - "FORMAT", - "FOUND", - "FREESPACE", - "FROM", - "FULL", - "FUNCTION", - "GE", - "GENERATED", - "GIVE", - "GRANT", - "GRAPHIC", - "GROUP", - "GROUPING", - "GT", - "HANDLER", - "HASH", - "HASHAMP", - "HASHBAKAMP", - "HASHBUCKET", - "HASHROW", - "HAVING", - "HELP", - "HOUR", - "IDENTITY", - "IF", - "IMMEDIATE", - "IN", - "INCONSISTENT", - "INDEX", - "INITIATE", - "INNER", - "INOUT", - "INPUT", - "INS", - "INSERT", - "INSTANCE", - "INSTEAD", - "INT", - "INTEGER", - "INTEGERDATE", - "INTERSECT", - "INTERVAL", - "INTO", - "IS", - "ITERATE", - "JAR", - "JOIN", - "JOURNAL", - "KEY", - "KURTOSIS", - "LANGUAGE", - "LARGE", - "LE", - "LEADING", - "LEAVE", - "LEFT", - "LIKE", - "LIMIT", - "LN", - "LOADING", - "LOCAL", - "LOCATOR", - "LOCK", - "LOCKING", - "LOG", - "LOGGING", - "LOGON", - "LONG", - "LOOP", - "LOWER", - "LT", - "MACRO", - "MAP", - "MAVG", - "MAX", - "MAXIMUM", - "MCHARACTERS", - "MDIFF", - "MERGE", - "METHOD", - "MIN", - "MINDEX", - "MINIMUM", - "MINUS", - "MINUTE", - "MLINREG", - "MLOAD", - "MOD", - "MODE", - "MODIFIES", - "MODIFY", - "MONITOR", - "MONRESOURCE", - "MONSESSION", - "MONTH", - "MSUBSTR", - "MSUM", - "MULTISET", - "NAMED", - "NATURAL", - "NE", - "NEW", - "NEW_TABLE", - "NEXT", - "NO", - "NONE", - "NOT", - "NOWAIT", - "NULL", - "NULLIF", - "NULLIFZERO", - "NUMERIC", - "OBJECT", - "OBJECTS", - "OCTET_LENGTH", - "OF", - "OFF", - "OLD", - "OLD_TABLE", - "ON", - "ONLY", - "OPEN", - "OPTION", - "OR", - "ORDER", - "ORDERING", - "OUT", - "OUTER", - "OUTPUT", - "OVER", - "OVERLAPS", - "OVERRIDE", - "PARAMETER", - "PASSWORD", - "PERCENT", - "PERCENT_RANK", - "PERM", - "PERMANENT", - "POSITION", - "PRECISION", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIVILEGES", - "PROCEDURE", - "PROFILE", - "PROTECTION", - "PUBLIC", - "QUALIFIED", - "QUALIFY", - "QUANTILE", - "QUEUE", - "RADIANS", - "RANDOM", - "RANGE_N", - "RANK", - "READS", - "REAL", - "RECURSIVE", - "REFERENCES", - "REFERENCING", - "REGR_AVGX", - "REGR_AVGY", - "REGR_COUNT", - "REGR_INTERCEPT", - "REGR_R2", - "REGR_SLOPE", - "REGR_SXX", - "REGR_SXY", - "REGR_SYY", - "RELATIVE", - "RELEASE", - "RENAME", - "REPEAT", - "REPLACE", - "REPLCONTROL", - "REPLICATION", - "REQUEST", - "RESTART", - "RESTORE", - "RESULT", - "RESUME", - "RET", - "RETRIEVE", - "RETURN", - "RETURNS", - "REVALIDATE", - "REVOKE", - "RIGHT", - "RIGHTS", - "ROLE", - "ROLLBACK", - "ROLLFORWARD", - "ROLLUP", - "ROW", - "ROW_NUMBER", - "ROWID", - "ROWS", - "SAMPLE", - "SAMPLEID", - "SCROLL", - "SECOND", - "SEL", - "SELECT", - "SESSION", - "SET", - "SETRESRATE", - "SETS", - "SETSESSRATE", - "SHOW", - "SIN", - "SINH", - "SKEW", - "SMALLINT", - "SOME", - "SOUNDEX", - "SPECIFIC", - "SPOOL", - "SQL", - "SQLEXCEPTION", - "SQLTEXT", - "SQLWARNING", - "SQRT", - "SS", - "START", - "STARTUP", - "STATEMENT", - "STATISTICS", - "STDDEV_POP", - "STDDEV_SAMP", - "STEPINFO", - "STRING_CS", - "SUBSCRIBER", - "SUBSTR", - "SUBSTRING", - "SUM", - "SUMMARY", - "SUSPEND", - "TABLE", - "TAN", - "TANH", - "TBL_CS", - "TEMPORARY", - "TERMINATE", - "THEN", - "THRESHOLD", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TITLE", - "TO", - "TOP", - "TRACE", - "TRAILING", - "TRANSACTION", - "TRANSFORM", - "TRANSLATE", - "TRANSLATE_CHK", - "TRIGGER", - "TRIM", - "TRUE", - "TYPE", - "UC", - "UDTCASTAS", - "UDTCASTLPAREN", - "UDTMETHOD", - "UDTTYPE", - "UDTUSAGE", - "UESCAPE", - "UNDEFINED", - "UNDO", - "UNION", - "UNIQUE", - "UNTIL", - "UPD", - "UPDATE", - "UPPER", - "UPPERCASE", - "USER", - "USING", - "VALUE", - "VALUES", - "VAR_POP", - "VAR_SAMP", - "VARBYTE", - "VARCHAR", - "VARGRAPHIC", - "VARYING", - "VIEW", - "VOLATILE", - "WHEN", - "WHERE", - "WHILE", - "WIDTH_BUCKET", - "WITH", - "WITHOUT", - "WORK", - "YEAR", - "ZEROIFNULL", - "ZONE" - }, - nativeMeta.getReservedWords()); - - nativeMeta.setPort("1025"); - nativeMeta.setPluginId("FOOPLUGIN"); - Map xtraOptions = nativeMeta.getExtraOptions(); - assertTrue(xtraOptions.containsKey("FOOPLUGIN.DBS_PORT")); - assertEquals("1025", xtraOptions.get("FOOPLUGIN.DBS_PORT")); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - } - - @Test - public void testSqlStatements() { - assertEquals("show table FOO", nativeMeta.getSqlTableExists("FOO")); - assertEquals( - "SELECT * FROM DBC.columns WHERE tablename =BAR AND columnname =FOO", - nativeMeta.getSqlColumnExists("FOO", "BAR")); // Likely a bug - table/column not quoted. - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, true, false)); - - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); - - assertEquals( - "DECIMAL(10, 0)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 10, 0), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 6, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 9, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 3, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 4, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); - assertEquals( - "BYTEINT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 2, 0), "", "", false, false, false)); - assertEquals( - "BYTEINT", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 1, 0), "", "", false, false, false)); - - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", -23, 0), "", "", false, false, false)); - - assertEquals( - "CLOB", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 64001, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(64000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 64000, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(1)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 1, 0), "", "", false, false, false)); - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.teradata; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Map; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +public class TeradataDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + private TeradataDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new TeradataDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(1025, nativeMeta.getDefaultDatabasePort()); + assertEquals("com.teradata.jdbc.TeraDriver", nativeMeta.getDriverClass()); + assertEquals( + "jdbc:teradata://FOO/DATABASE=WIBBLE", nativeMeta.getURL("FOO", "IGNOREDHERE", "WIBBLE")); + assertFalse(nativeMeta.isFetchSizeSupported()); + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertEquals(",", nativeMeta.getExtraOptionSeparator()); + assertEquals("/", nativeMeta.getExtraOptionIndicator()); + assertEquals( + "http://www.info.ncr.com/eTeradata-BrowseBy-Results.cfm?pl=&PID=&title=%25&release=" + + "&kword=CJDBC&sbrn=7&nm=Teradata+Tools+and+Utilities+-+Java+Database+Connectivity+(JDBC)", + nativeMeta.getExtraOptionsHelpText()); + assertArrayEquals( + new String[] { + "ABORT", + "ABORTSESSION", + "ABS", + "ACCESS_LOCK", + "ACCOUNT", + "ACOS", + "ACOSH", + "ADD", + "ADD_MONTHS", + "ADMIN", + "AFTER", + "AGGREGATE", + "ALL", + "ALTER", + "AMP", + "AND", + "ANSIDATE", + "ANY", + "ARGLPAREN", + "AS", + "ASC", + "ASIN", + "ASINH", + "AT", + "ATAN", + "ATAN2", + "ATANH", + "ATOMIC", + "AUTHORIZATION", + "AVE", + "AVERAGE", + "AVG", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIGINT", + "BINARY", + "BLOB", + "BOTH", + "BT", + "BUT", + "BY", + "BYTE", + "BYTEINT", + "BYTES", + "CALL", + "CASE", + "CASE_N", + "CASESPECIFIC", + "CAST", + "CD", + "CHAR", + "CHAR_LENGTH", + "CHAR2HEXINT", + "CHARACTER", + "CHARACTER_LENGTH", + "CHARACTERS", + "CHARS", + "CHECK", + "CHECKPOINT", + "CLASS", + "CLOB", + "CLOSE", + "CLUSTER", + "CM", + "COALESCE", + "COLLATION", + "COLLECT", + "COLUMN", + "COMMENT", + "COMMIT", + "COMPRESS", + "CONSTRAINT", + "CONSTRUCTOR", + "CONSUME", + "CONTAINS", + "CONTINUE", + "CONVERT_TABLE_HEADER", + "CORR", + "COS", + "COSH", + "COUNT", + "COVAR_POP", + "COVAR_SAMP", + "CREATE", + "CROSS", + "CS", + "CSUM", + "CT", + "CUBE", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURSOR", + "CV", + "CYCLE", + "DATABASE", + "DATABLOCKSIZE", + "DATE", + "DATEFORM", + "DAY", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFERRED", + "DEGREES", + "DEL", + "DELETE", + "DESC", + "DETERMINISTIC", + "DIAGNOSTIC", + "DISABLED", + "DISTINCT", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "DUAL", + "DUMP", + "DYNAMIC", + "EACH", + "ECHO", + "ELSE", + "ELSEIF", + "ENABLED", + "END", + "EQ", + "EQUALS", + "ERROR", + "ERRORFILES", + "ERRORTABLES", + "ESCAPE", + "ET", + "EXCEPT", + "EXEC", + "EXECUTE", + "EXISTS", + "EXIT", + "EXP", + "EXPLAIN", + "EXTERNAL", + "EXTRACT", + "FALLBACK", + "FASTEXPORT", + "FETCH", + "FIRST", + "FLOAT", + "FOR", + "FOREIGN", + "FORMAT", + "FOUND", + "FREESPACE", + "FROM", + "FULL", + "FUNCTION", + "GE", + "GENERATED", + "GIVE", + "GRANT", + "GRAPHIC", + "GROUP", + "GROUPING", + "GT", + "HANDLER", + "HASH", + "HASHAMP", + "HASHBAKAMP", + "HASHBUCKET", + "HASHROW", + "HAVING", + "HELP", + "HOUR", + "IDENTITY", + "IF", + "IMMEDIATE", + "IN", + "INCONSISTENT", + "INDEX", + "INITIATE", + "INNER", + "INOUT", + "INPUT", + "INS", + "INSERT", + "INSTANCE", + "INSTEAD", + "INT", + "INTEGER", + "INTEGERDATE", + "INTERSECT", + "INTERVAL", + "INTO", + "IS", + "ITERATE", + "JAR", + "JOIN", + "JOURNAL", + "KEY", + "KURTOSIS", + "LANGUAGE", + "LARGE", + "LE", + "LEADING", + "LEAVE", + "LEFT", + "LIKE", + "LIMIT", + "LN", + "LOADING", + "LOCAL", + "LOCATOR", + "LOCK", + "LOCKING", + "LOG", + "LOGGING", + "LOGON", + "LONG", + "LOOP", + "LOWER", + "LT", + "MACRO", + "MAP", + "MAVG", + "MAX", + "MAXIMUM", + "MCHARACTERS", + "MDIFF", + "MERGE", + "METHOD", + "MIN", + "MINDEX", + "MINIMUM", + "MINUS", + "MINUTE", + "MLINREG", + "MLOAD", + "MOD", + "MODE", + "MODIFIES", + "MODIFY", + "MONITOR", + "MONRESOURCE", + "MONSESSION", + "MONTH", + "MSUBSTR", + "MSUM", + "MULTISET", + "NAMED", + "NATURAL", + "NE", + "NEW", + "NEW_TABLE", + "NEXT", + "NO", + "NONE", + "NOT", + "NOWAIT", + "NULL", + "NULLIF", + "NULLIFZERO", + "NUMERIC", + "OBJECT", + "OBJECTS", + "OCTET_LENGTH", + "OF", + "OFF", + "OLD", + "OLD_TABLE", + "ON", + "ONLY", + "OPEN", + "OPTION", + "OR", + "ORDER", + "ORDERING", + "OUT", + "OUTER", + "OUTPUT", + "OVER", + "OVERLAPS", + "OVERRIDE", + "PARAMETER", + "PASSWORD", + "PERCENT", + "PERCENT_RANK", + "PERM", + "PERMANENT", + "POSITION", + "PRECISION", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIVILEGES", + "PROCEDURE", + "PROFILE", + "PROTECTION", + "PUBLIC", + "QUALIFIED", + "QUALIFY", + "QUANTILE", + "QUEUE", + "RADIANS", + "RANDOM", + "RANGE_N", + "RANK", + "READS", + "REAL", + "RECURSIVE", + "REFERENCES", + "REFERENCING", + "REGR_AVGX", + "REGR_AVGY", + "REGR_COUNT", + "REGR_INTERCEPT", + "REGR_R2", + "REGR_SLOPE", + "REGR_SXX", + "REGR_SXY", + "REGR_SYY", + "RELATIVE", + "RELEASE", + "RENAME", + "REPEAT", + "REPLACE", + "REPLCONTROL", + "REPLICATION", + "REQUEST", + "RESTART", + "RESTORE", + "RESULT", + "RESUME", + "RET", + "RETRIEVE", + "RETURN", + "RETURNS", + "REVALIDATE", + "REVOKE", + "RIGHT", + "RIGHTS", + "ROLE", + "ROLLBACK", + "ROLLFORWARD", + "ROLLUP", + "ROW", + "ROW_NUMBER", + "ROWID", + "ROWS", + "SAMPLE", + "SAMPLEID", + "SCROLL", + "SECOND", + "SEL", + "SELECT", + "SESSION", + "SET", + "SETRESRATE", + "SETS", + "SETSESSRATE", + "SHOW", + "SIN", + "SINH", + "SKEW", + "SMALLINT", + "SOME", + "SOUNDEX", + "SPECIFIC", + "SPOOL", + "SQL", + "SQLEXCEPTION", + "SQLTEXT", + "SQLWARNING", + "SQRT", + "SS", + "START", + "STARTUP", + "STATEMENT", + "STATISTICS", + "STDDEV_POP", + "STDDEV_SAMP", + "STEPINFO", + "STRING_CS", + "SUBSCRIBER", + "SUBSTR", + "SUBSTRING", + "SUM", + "SUMMARY", + "SUSPEND", + "TABLE", + "TAN", + "TANH", + "TBL_CS", + "TEMPORARY", + "TERMINATE", + "THEN", + "THRESHOLD", + "TIME", + "TIMESTAMP", + "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", + "TITLE", + "TO", + "TOP", + "TRACE", + "TRAILING", + "TRANSACTION", + "TRANSFORM", + "TRANSLATE", + "TRANSLATE_CHK", + "TRIGGER", + "TRIM", + "TRUE", + "TYPE", + "UC", + "UDTCASTAS", + "UDTCASTLPAREN", + "UDTMETHOD", + "UDTTYPE", + "UDTUSAGE", + "UESCAPE", + "UNDEFINED", + "UNDO", + "UNION", + "UNIQUE", + "UNTIL", + "UPD", + "UPDATE", + "UPPER", + "UPPERCASE", + "USER", + "USING", + "VALUE", + "VALUES", + "VAR_POP", + "VAR_SAMP", + "VARBYTE", + "VARCHAR", + "VARGRAPHIC", + "VARYING", + "VIEW", + "VOLATILE", + "WHEN", + "WHERE", + "WHILE", + "WIDTH_BUCKET", + "WITH", + "WITHOUT", + "WORK", + "YEAR", + "ZEROIFNULL", + "ZONE" + }, + nativeMeta.getReservedWords()); + + nativeMeta.setPort("1025"); + nativeMeta.setPluginId("FOOPLUGIN"); + Map xtraOptions = nativeMeta.getExtraOptions(); + assertTrue(xtraOptions.containsKey("FOOPLUGIN.DBS_PORT")); + assertEquals("1025", xtraOptions.get("FOOPLUGIN.DBS_PORT")); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + } + + @Test + public void testSqlStatements() { + assertEquals("show table FOO", nativeMeta.getSqlTableExists("FOO")); + assertEquals( + "SELECT * FROM DBC.columns WHERE tablename =BAR AND columnname =FOO", + nativeMeta.getSqlColumnExists("FOO", "BAR")); // Likely a bug - table/column not quoted. + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, true, false)); + + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, false, false)); + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "FOO", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "FOO", false, false, false)); + + assertEquals( + "DECIMAL(10, 0)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 10, 0), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 6, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 9, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 3, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 4, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 5, 0), "", "", false, false, false)); + assertEquals( + "BYTEINT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 2, 0), "", "", false, false, false)); + assertEquals( + "BYTEINT", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 1, 0), "", "", false, false, false)); + + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", -23, 0), "", "", false, false, false)); + + assertEquals( + "CLOB", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 64001, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(64000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 64000, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(1)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 1, 0), "", "", false, false, false)); + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataSequenceAndReleaseSavePointTest.java b/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataSequenceAndReleaseSavePointTest.java index 6e645b14866..c70a254221a 100644 --- a/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.teradata; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class TeradataSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataValueMetaBaseTest.java b/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataValueMetaBaseTest.java index 0c321d309d0..1b79d8ea526 100644 --- a/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataValueMetaBaseTest.java +++ b/plugins/databases/teradata/src/test/java/org/apache/hop/databases/teradata/TeradataValueMetaBaseTest.java @@ -17,6 +17,18 @@ package org.apache.hop.databases.teradata; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.DatabasePluginType; import org.apache.hop.core.exception.HopDatabaseException; @@ -38,19 +50,6 @@ import org.junit.Test; import org.mockito.Spy; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - public class TeradataValueMetaBaseTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/universe/src/main/java/org/apache/hop/databases/universe/UniVerseDatabaseMeta.java b/plugins/databases/universe/src/main/java/org/apache/hop/databases/universe/UniVerseDatabaseMeta.java index 3a0882c6e39..c1ddf96e3aa 100644 --- a/plugins/databases/universe/src/main/java/org/apache/hop/databases/universe/UniVerseDatabaseMeta.java +++ b/plugins/databases/universe/src/main/java/org/apache/hop/databases/universe/UniVerseDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains IBM UniVerse database specific information through static final members - */ -@DatabaseMetaPlugin(type = "UNIVERSE", typeDescription = "IBM UniVerse database", documentationUrl = "/database/databases/universe.html") +/** Contains IBM UniVerse database specific information through static final members */ +@DatabaseMetaPlugin( + type = "UNIVERSE", + typeDescription = "IBM UniVerse database", + documentationUrl = "/database/databases/universe.html") @GuiPlugin(id = "GUI-UniVerseDatabaseMeta") public class UniVerseDatabaseMeta extends BaseDatabaseMeta implements IDatabase { private static final int MAX_VARCHAR_LENGTH = 65535; @@ -38,7 +39,9 @@ public int[] getAccessTypeList() { return new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}; } - /** @see IDatabase#getNotFoundTK(boolean) */ + /** + * @see IDatabase#getNotFoundTK(boolean) + */ @Override public int getNotFoundTK(boolean useAutoinc) { if (isSupportsAutoInc() && useAutoinc) { @@ -67,7 +70,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; @@ -410,7 +415,9 @@ public String[] getReservedWords() { }; } - /** @return true if the database supports newlines in a SQL statements. */ + /** + * @return true if the database supports newlines in a SQL statements. + */ @Override public boolean isSupportsNewLinesInSql() { return true; diff --git a/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseDatabaseMetaTest.java b/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseDatabaseMetaTest.java index c9d5ad076a0..7278819c65a 100644 --- a/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseDatabaseMetaTest.java +++ b/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseDatabaseMetaTest.java @@ -1,364 +1,364 @@ -/* - * 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 org.apache.hop.databases.universe; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class UniVerseDatabaseMetaTest { - - private UniVerseDatabaseMeta nativeMeta; - - @Before - public void setupBefore() { - nativeMeta = new UniVerseDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(65535, nativeMeta.getMaxVARCHARLength()); - assertEquals(-1, nativeMeta.getDefaultDatabasePort()); - assertTrue(nativeMeta.isSupportsAutoInc()); - assertEquals(1, nativeMeta.getNotFoundTK(true)); - assertEquals(0, nativeMeta.getNotFoundTK(false)); - assertEquals("com.ibm.u2.jdbc.UniJDBCDriver", nativeMeta.getDriverClass()); - assertEquals("jdbc:ibm-u2://FOO/WIBBLE", nativeMeta.getURL("FOO", "IGNORED", "WIBBLE")); - assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); - assertFalse(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertFalse(nativeMeta.isSupportsSynonyms()); - assertTrue(nativeMeta.isSupportsNewLinesInSql()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - assertArrayEquals( - new String[] { - "@NEW", - "@OLD", - "ACTION", - "ADD", - "AL", - "ALL", - "ALTER", - "AND", - "AR", - "AS", - "ASC", - "ASSOC", - "ASSOCIATED", - "ASSOCIATION", - "AUTHORIZATION", - "AVERAGE", - "AVG", - "BEFORE", - "BETWEEN", - "BIT", - "BOTH", - "BY", - "CALC", - "CASCADE", - "CASCADED", - "CAST", - "CHAR", - "CHAR_LENGTH", - "CHARACTER", - "CHARACTER_LENGTH", - "CHECK", - "COL.HDG", - "COL.SPACES", - "COL.SPCS", - "COL.SUP", - "COLUMN", - "COMPILED", - "CONNECT", - "CONSTRAINT", - "CONV", - "CONVERSION", - "COUNT", - "COUNT.SUP", - "CREATE", - "CROSS", - "CURRENT_DATE", - "CURRENT_TIME", - "DATA", - "DATE", - "DBA", - "DBL.SPC", - "DEC", - "DECIMAL", - "DEFAULT", - "DELETE", - "DESC", - "DET.SUP", - "DICT", - "DISPLAY.NAME", - "DISPLAYLIKE", - "DISPLAYNAME", - "DISTINCT", - "DL", - "DOUBLE", - "DR", - "DROP", - "DYNAMIC", - "E.EXIST", - "EMPTY", - "EQ", - "EQUAL", - "ESCAPE", - "EVAL", - "EVERY", - "EXISTING", - "EXISTS", - "EXPLAIN", - "EXPLICIT", - "FAILURE", - "FIRST", - "FLOAT", - "FMT", - "FOOTER", - "FOOTING", - "FOR", - "FOREIGN", - "FORMAT", - "FROM", - "FULL", - "GE", - "GENERAL", - "GRAND", - "GRAND.TOTAL", - "GRANT", - "GREATER", - "GROUP", - "GROUP.SIZE", - "GT", - "HAVING", - "HEADER", - "HEADING", - "HOME", - "IMPLICIT", - "IN", - "INDEX", - "INNER", - "INQUIRING", - "INSERT", - "INT", - "INTEGER", - "INTO", - "IS", - "JOIN", - "KEY", - "LARGE.RECORD", - "LAST", - "LE", - "LEADING", - "LEFT", - "LESS", - "LIKE", - "LOCAL", - "LOWER", - "LPTR", - "MARGIN", - "MATCHES", - "MATCHING", - "MAX", - "MERGE.LOAD", - "MIN", - "MINIMIZE.SPACE", - "MINIMUM.MODULUS", - "MODULO", - "MULTI.VALUE", - "MULTIVALUED", - "NATIONAL", - "NCHAR", - "NE", - "NO", - "NO.INDEX", - "NO.OPTIMIZE", - "NO.PAGE", - "NOPAGE", - "NOT", - "NRKEY", - "NULL", - "NUMERIC", - "NVARCHAR", - "ON", - "OPTION", - "OR", - "ORDER", - "OUTER", - "PCT", - "PRECISION", - "PRESERVING", - "PRIMARY", - "PRIVILEGES", - "PUBLIC", - "REAL", - "RECORD.SIZE", - "REFERENCES", - "REPORTING", - "RESOURCE", - "RESTORE", - "RESTRICT", - "REVOKE", - "RIGHT", - "ROWUNIQUE", - "SAID", - "SAMPLE", - "SAMPLED", - "SCHEMA", - "SELECT", - "SEPARATION", - "SEQ.NUM", - "SET", - "SINGLE.VALUE", - "SINGLEVALUED", - "SLIST", - "SMALLINT", - "SOME", - "SPLIT.LOAD", - "SPOKEN", - "SUBSTRING", - "SUCCESS", - "SUM", - "SUPPRESS", - "SYNONYM", - "TABLE", - "TIME", - "TO", - "TOTAL", - "TRAILING", - "TRIM", - "TYPE", - "UNION", - "UNIQUE", - "UNNEST", - "UNORDERED", - "UPDATE", - "UPPER", - "USER", - "USING", - "VALUES", - "VARBIT", - "VARCHAR", - "VARYING", - "VERT", - "VERTICALLY", - "VIEW", - "WHEN", - "WHERE", - "WITH", - }, - nativeMeta.getReservedWords()); - } - - @Test - public void testSqlStatements() { - assertEquals( - "ALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); - } - - @Test - public void testGetFieldDefinition() { - assertEquals( - "FOO DATE", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "DATE", - nativeMeta.getFieldDefinition( - new ValueMetaDate("FOO"), - "", - "", - false, - false, - false)); // Note - Rocket U2 does *not* support timestamps ... - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "", "FOO", false, false, false)); - - // Numeric Types - assertEquals( - "DECIMAL(5, 5)", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 5, 5), "", "", false, false, false)); - assertEquals( - "DECIMAL(19, 0)", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 19, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 18, 0), "", "", false, false, false)); - assertEquals( - "DOUBLE PRECISION", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", -7, -3), "", "", false, false, false)); - - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - - assertEquals( - "VARCHAR(65535)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 65537, 0), "", "", false, false, false)); - - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.universe; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.junit.Before; +import org.junit.Test; + +public class UniVerseDatabaseMetaTest { + + private UniVerseDatabaseMeta nativeMeta; + + @Before + public void setupBefore() { + nativeMeta = new UniVerseDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(65535, nativeMeta.getMaxVARCHARLength()); + assertEquals(-1, nativeMeta.getDefaultDatabasePort()); + assertTrue(nativeMeta.isSupportsAutoInc()); + assertEquals(1, nativeMeta.getNotFoundTK(true)); + assertEquals(0, nativeMeta.getNotFoundTK(false)); + assertEquals("com.ibm.u2.jdbc.UniJDBCDriver", nativeMeta.getDriverClass()); + assertEquals("jdbc:ibm-u2://FOO/WIBBLE", nativeMeta.getURL("FOO", "IGNORED", "WIBBLE")); + assertEquals("FOO.BAR", nativeMeta.getSchemaTableCombination("FOO", "BAR")); + assertFalse(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertFalse(nativeMeta.isSupportsSynonyms()); + assertTrue(nativeMeta.isSupportsNewLinesInSql()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + assertArrayEquals( + new String[] { + "@NEW", + "@OLD", + "ACTION", + "ADD", + "AL", + "ALL", + "ALTER", + "AND", + "AR", + "AS", + "ASC", + "ASSOC", + "ASSOCIATED", + "ASSOCIATION", + "AUTHORIZATION", + "AVERAGE", + "AVG", + "BEFORE", + "BETWEEN", + "BIT", + "BOTH", + "BY", + "CALC", + "CASCADE", + "CASCADED", + "CAST", + "CHAR", + "CHAR_LENGTH", + "CHARACTER", + "CHARACTER_LENGTH", + "CHECK", + "COL.HDG", + "COL.SPACES", + "COL.SPCS", + "COL.SUP", + "COLUMN", + "COMPILED", + "CONNECT", + "CONSTRAINT", + "CONV", + "CONVERSION", + "COUNT", + "COUNT.SUP", + "CREATE", + "CROSS", + "CURRENT_DATE", + "CURRENT_TIME", + "DATA", + "DATE", + "DBA", + "DBL.SPC", + "DEC", + "DECIMAL", + "DEFAULT", + "DELETE", + "DESC", + "DET.SUP", + "DICT", + "DISPLAY.NAME", + "DISPLAYLIKE", + "DISPLAYNAME", + "DISTINCT", + "DL", + "DOUBLE", + "DR", + "DROP", + "DYNAMIC", + "E.EXIST", + "EMPTY", + "EQ", + "EQUAL", + "ESCAPE", + "EVAL", + "EVERY", + "EXISTING", + "EXISTS", + "EXPLAIN", + "EXPLICIT", + "FAILURE", + "FIRST", + "FLOAT", + "FMT", + "FOOTER", + "FOOTING", + "FOR", + "FOREIGN", + "FORMAT", + "FROM", + "FULL", + "GE", + "GENERAL", + "GRAND", + "GRAND.TOTAL", + "GRANT", + "GREATER", + "GROUP", + "GROUP.SIZE", + "GT", + "HAVING", + "HEADER", + "HEADING", + "HOME", + "IMPLICIT", + "IN", + "INDEX", + "INNER", + "INQUIRING", + "INSERT", + "INT", + "INTEGER", + "INTO", + "IS", + "JOIN", + "KEY", + "LARGE.RECORD", + "LAST", + "LE", + "LEADING", + "LEFT", + "LESS", + "LIKE", + "LOCAL", + "LOWER", + "LPTR", + "MARGIN", + "MATCHES", + "MATCHING", + "MAX", + "MERGE.LOAD", + "MIN", + "MINIMIZE.SPACE", + "MINIMUM.MODULUS", + "MODULO", + "MULTI.VALUE", + "MULTIVALUED", + "NATIONAL", + "NCHAR", + "NE", + "NO", + "NO.INDEX", + "NO.OPTIMIZE", + "NO.PAGE", + "NOPAGE", + "NOT", + "NRKEY", + "NULL", + "NUMERIC", + "NVARCHAR", + "ON", + "OPTION", + "OR", + "ORDER", + "OUTER", + "PCT", + "PRECISION", + "PRESERVING", + "PRIMARY", + "PRIVILEGES", + "PUBLIC", + "REAL", + "RECORD.SIZE", + "REFERENCES", + "REPORTING", + "RESOURCE", + "RESTORE", + "RESTRICT", + "REVOKE", + "RIGHT", + "ROWUNIQUE", + "SAID", + "SAMPLE", + "SAMPLED", + "SCHEMA", + "SELECT", + "SEPARATION", + "SEQ.NUM", + "SET", + "SINGLE.VALUE", + "SINGLEVALUED", + "SLIST", + "SMALLINT", + "SOME", + "SPLIT.LOAD", + "SPOKEN", + "SUBSTRING", + "SUCCESS", + "SUM", + "SUPPRESS", + "SYNONYM", + "TABLE", + "TIME", + "TO", + "TOTAL", + "TRAILING", + "TRIM", + "TYPE", + "UNION", + "UNIQUE", + "UNNEST", + "UNORDERED", + "UPDATE", + "UPPER", + "USER", + "USING", + "VALUES", + "VARBIT", + "VARCHAR", + "VARYING", + "VERT", + "VERTICALLY", + "VIEW", + "WHEN", + "WHERE", + "WITH", + }, + nativeMeta.getReservedWords()); + } + + @Test + public void testSqlStatements() { + assertEquals( + "ALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO MODIFY BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + assertEquals("DELETE FROM FOO", nativeMeta.getTruncateTableStatement("FOO")); + } + + @Test + public void testGetFieldDefinition() { + assertEquals( + "FOO DATE", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "DATE", + nativeMeta.getFieldDefinition( + new ValueMetaDate("FOO"), + "", + "", + false, + false, + false)); // Note - Rocket U2 does *not* support timestamps ... + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "", "FOO", false, false, false)); + + // Numeric Types + assertEquals( + "DECIMAL(5, 5)", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 5, 5), "", "", false, false, false)); + assertEquals( + "DECIMAL(19, 0)", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 19, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 18, 0), "", "", false, false, false)); + assertEquals( + "DOUBLE PRECISION", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", -7, -3), "", "", false, false, false)); + + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + + assertEquals( + "VARCHAR(65535)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 65537, 0), "", "", false, false, false)); + + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseSequenceAndReleaseSavePointTest.java b/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseSequenceAndReleaseSavePointTest.java index 1783878162f..914a0b40f87 100644 --- a/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/universe/src/test/java/org/apache/hop/databases/universe/UniVerseSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.universe; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class UniVerseSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/vectorwise/src/main/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMeta.java b/plugins/databases/vectorwise/src/main/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMeta.java index 89f0a13bfb2..0a34062d07b 100644 --- a/plugins/databases/vectorwise/src/main/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMeta.java +++ b/plugins/databases/vectorwise/src/main/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.util.Utils; import org.apache.hop.databases.ingres.IngresDatabaseMeta; -/** - * Contains Computer Associates Ingres specific information through static final members - */ -@DatabaseMetaPlugin(type = "VECTORWISE", typeDescription = "Ingres VectorWise", documentationUrl = "/database/databases/vectorwise.html") +/** Contains Computer Associates Ingres specific information through static final members */ +@DatabaseMetaPlugin( + type = "VECTORWISE", + typeDescription = "Ingres VectorWise", + documentationUrl = "/database/databases/vectorwise.html") @GuiPlugin(id = "GUI-VectorWiseDatabaseMeta") public class VectorWiseDatabaseMeta extends IngresDatabaseMeta implements IDatabase { diff --git a/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMetaTest.java b/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMetaTest.java index 8b2cea870b1..fba6851bd6d 100644 --- a/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMetaTest.java +++ b/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorWiseDatabaseMetaTest.java @@ -1,164 +1,164 @@ -/* - * 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 org.apache.hop.databases.vectorwise; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -public class VectorWiseDatabaseMetaTest { - - @Test - public void testIngresOverrides() throws Exception { - VectorWiseDatabaseMeta nativeMeta; - nativeMeta = new VectorWiseDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - assertEquals("jdbc:ingres://FOO:VW7/WIBBLE", nativeMeta.getURL("FOO", "VW7", "WIBBLE")); - assertEquals( - "jdbc:ingres://FOO:VW7/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); // Empty bit - assertEquals( - "jdbc:ingres://FOO:VW7/WIBBLE", nativeMeta.getURL("FOO", "-1", "WIBBLE")); // Empty bit - assertEquals("jdbc:ingres://FOO:2345/WIBBLE", nativeMeta.getURL("FOO", "2345", "WIBBLE")); - - assertEquals( - "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", - nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); - - assertEquals( - "ALTER TABLE FOO DROP COLUMN BAR" + System.getProperty("line.separator"), - nativeMeta.getDropColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "CALL VECTORWISE( COMBINE 'FOO - FOO' )", nativeMeta.getTruncateTableStatement("FOO")); - - assertFalse(nativeMeta.isSupportsGetBlob()); - } - - @Test - public void testGetFieldDefinition() { - VectorWiseDatabaseMeta nativeMeta; - nativeMeta = new VectorWiseDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - - assertEquals( - "CHAR(1)", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - - assertEquals( - "GENERATED ALWAYS AS IDENTITY START WITH 1 INCREMENT BY 1", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 10, 0), "FOO", "", true, false, false)); - assertEquals( - "GENERATED ALWAYS AS IDENTITY START WITH 1 INCREMENT BY 1", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "FOO", true, false, false)); - assertEquals( - "BIGINT PRIMARY KEY NOT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "FOO", "", false, false, false)); - assertEquals( - "BIGINT PRIMARY KEY NOT NULL", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); - - // Integer tests - assertEquals( - "BIGINT", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 6, 0), "", "", false, false, false)); - assertEquals( - "SMALLINT", - nativeMeta.getFieldDefinition( - new ValueMetaNumber("FOO", 3, 0), "", "", false, false, false)); - assertEquals( - "INTEGER1", - nativeMeta.getFieldDefinition( - new ValueMetaInteger("FOO", 2, 0), "", "", false, false, false)); - - assertEquals( - "FLOAT8", - nativeMeta.getFieldDefinition( - new ValueMetaBigNumber("FOO", 6, 3), "", "", false, false, false)); - - // String Types - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(32000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32000, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(32000)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 32050, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(9999)", - nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", true, false, false)); - assertEquals( - "VARCHAR(9999)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(9999)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", -34, 0), "", "", false, false, false)); - - // Unknown - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } -} +/* + * 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 org.apache.hop.databases.vectorwise; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.junit.Test; + +public class VectorWiseDatabaseMetaTest { + + @Test + public void testIngresOverrides() throws Exception { + VectorWiseDatabaseMeta nativeMeta; + nativeMeta = new VectorWiseDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + assertEquals("jdbc:ingres://FOO:VW7/WIBBLE", nativeMeta.getURL("FOO", "VW7", "WIBBLE")); + assertEquals( + "jdbc:ingres://FOO:VW7/WIBBLE", nativeMeta.getURL("FOO", "", "WIBBLE")); // Empty bit + assertEquals( + "jdbc:ingres://FOO:VW7/WIBBLE", nativeMeta.getURL("FOO", "-1", "WIBBLE")); // Empty bit + assertEquals("jdbc:ingres://FOO:2345/WIBBLE", nativeMeta.getURL("FOO", "2345", "WIBBLE")); + + assertEquals( + "ALTER TABLE FOO ADD COLUMN BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "ALTER TABLE FOO ALTER COLUMN BAR VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "insert into FOO(FOOKEY, FOOVERSION) values (0, 1)", + nativeMeta.getSqlInsertAutoIncUnknownDimensionRow("FOO", "FOOKEY", "FOOVERSION")); + + assertEquals( + "ALTER TABLE FOO DROP COLUMN BAR" + System.getProperty("line.separator"), + nativeMeta.getDropColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "CALL VECTORWISE( COMBINE 'FOO - FOO' )", nativeMeta.getTruncateTableStatement("FOO")); + + assertFalse(nativeMeta.isSupportsGetBlob()); + } + + @Test + public void testGetFieldDefinition() { + VectorWiseDatabaseMeta nativeMeta; + nativeMeta = new VectorWiseDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + + assertEquals( + "CHAR(1)", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + + assertEquals( + "GENERATED ALWAYS AS IDENTITY START WITH 1 INCREMENT BY 1", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 10, 0), "FOO", "", true, false, false)); + assertEquals( + "GENERATED ALWAYS AS IDENTITY START WITH 1 INCREMENT BY 1", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "FOO", true, false, false)); + assertEquals( + "BIGINT PRIMARY KEY NOT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "FOO", "", false, false, false)); + assertEquals( + "BIGINT PRIMARY KEY NOT NULL", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 8, 0), "", "FOO", false, false, false)); + + // Integer tests + assertEquals( + "BIGINT", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 10, 0), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 6, 0), "", "", false, false, false)); + assertEquals( + "SMALLINT", + nativeMeta.getFieldDefinition( + new ValueMetaNumber("FOO", 3, 0), "", "", false, false, false)); + assertEquals( + "INTEGER1", + nativeMeta.getFieldDefinition( + new ValueMetaInteger("FOO", 2, 0), "", "", false, false, false)); + + assertEquals( + "FLOAT8", + nativeMeta.getFieldDefinition( + new ValueMetaBigNumber("FOO", 6, 3), "", "", false, false, false)); + + // String Types + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(32000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32000, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(32000)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 32050, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(9999)", + nativeMeta.getFieldDefinition(new ValueMetaString("FOO"), "", "", true, false, false)); + assertEquals( + "VARCHAR(9999)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(9999)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", -34, 0), "", "", false, false, false)); + + // Unknown + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } +} diff --git a/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorwiseSequenceAndReleaseSavePointTest.java b/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorwiseSequenceAndReleaseSavePointTest.java index 0014c3c4bcb..97b2832d907 100644 --- a/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorwiseSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/vectorwise/src/test/java/org/apache/hop/databases/vectorwise/VectorwiseSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.vectorwise; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class VectorwiseSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/vertica/src/main/java/org/apache/hop/databases/vertica/VerticaDatabaseMeta.java b/plugins/databases/vertica/src/main/java/org/apache/hop/databases/vertica/VerticaDatabaseMeta.java index 7da76d46187..9cc323c5120 100644 --- a/plugins/databases/vertica/src/main/java/org/apache/hop/databases/vertica/VerticaDatabaseMeta.java +++ b/plugins/databases/vertica/src/main/java/org/apache/hop/databases/vertica/VerticaDatabaseMeta.java @@ -25,10 +25,11 @@ import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.row.IValueMeta; -/** - * Contains Vertica Analytic Database information through static final members - */ -@DatabaseMetaPlugin(type = "VERTICA", typeDescription = "Vertica", documentationUrl = "/database/databases/vertica.html") +/** Contains Vertica Analytic Database information through static final members */ +@DatabaseMetaPlugin( + type = "VERTICA", + typeDescription = "Vertica", + documentationUrl = "/database/databases/vertica.html") @GuiPlugin(id = "GUI-VerticaDatabaseMeta") public class VerticaDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @@ -64,7 +65,9 @@ public boolean isFetchSizeSupported() { return false; } - /** @return true if the database supports bitmap indexes */ + /** + * @return true if the database supports bitmap indexes + */ @Override public boolean isSupportsBitmapIndex() { return false; @@ -588,7 +591,9 @@ public boolean isRequiresCastToVariousForIsNull() { return true; } - /** @return This indicator separates the normal URL from the options */ + /** + * @return This indicator separates the normal URL from the options + */ @Override public String getExtraOptionIndicator() { return "?"; @@ -599,7 +604,9 @@ public String getExtraOptionSeparator() { return "&"; } - /** @return true if the database supports sequences */ + /** + * @return true if the database supports sequences + */ @Override public boolean isSupportsSequences() { return true; @@ -637,7 +644,9 @@ public String getSqlNextSequenceValue(String sequenceName) { return "SELECT nextval('" + sequenceName + "')"; } - /** @return false as the database does not support timestamp to date conversion. */ + /** + * @return false as the database does not support timestamp to date conversion. + */ @Override public boolean isSupportsTimeStampToDateConversion() { return false; diff --git a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5DatabaseMetaTest.java b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5DatabaseMetaTest.java index 34f6d902d1b..e8948ee6d1c 100644 --- a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5DatabaseMetaTest.java +++ b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5DatabaseMetaTest.java @@ -1,224 +1,223 @@ -/* - * 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 org.apache.hop.databases.vertica; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.logging.HopLogStore; -import org.apache.hop.core.logging.HopLoggingEvent; -import org.apache.hop.core.logging.IHopLoggingEventListener; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaBase; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; -import org.mockito.Mockito; -import org.mockito.Spy; - -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -public class Vertica5DatabaseMetaTest extends VerticaDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - private static final String TEST_NAME = "TEST_NAME"; - private static final String LOG_FIELD = "LOG_FIELD"; - public static final int MAX_TEXT_FIELD_LEN = 5; - - // Get PKG from class under test - private Class PKG = ValueMetaBase.PKG; - private StoreLoggingEventListener listener; - - @Spy private DatabaseMeta databaseMetaSpy = spy(new DatabaseMeta()); - private PreparedStatement preparedStatementMock = mock(PreparedStatement.class); - private ResultSet resultSet; - private DatabaseMeta dbMeta; - private IValueMeta valueMetaBase; - private IVariables variables; - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - HopLogStore.init(); - } - - @Override - @Before - public void setUp() throws HopPluginException { - listener = new StoreLoggingEventListener(); - HopLogStore.getAppender().addLoggingEventListener(listener); - variables = spy(new Variables()); - - valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); - - dbMeta = spy(new DatabaseMeta()); - resultSet = mock(ResultSet.class); - } - - @Test - public void testOverridesToVerticaDatabaseMeta() throws Exception { - Vertica5DatabaseMeta nativeMeta = new Vertica5DatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - - assertEquals("com.vertica.jdbc.Driver", nativeMeta.getDriverClass()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - - ResultSet resultSet = mock(ResultSet.class); - ResultSetMetaData metaData = mock(ResultSetMetaData.class); - when(resultSet.getMetaData()).thenReturn(metaData); - - when(resultSet.getTimestamp(1)).thenReturn(new Timestamp(65535)); - when(resultSet.getTime(2)).thenReturn(new Time(1000)); - when(resultSet.getDate(3)).thenReturn(new Date((65535 * 2))); - ValueMetaTimestamp ts = new ValueMetaTimestamp("FOO"); - ts.setOriginalColumnType(Types.TIMESTAMP); - ValueMetaDate tm = new ValueMetaDate("BAR"); - tm.setOriginalColumnType(Types.TIME); - ValueMetaDate dt = new ValueMetaDate("WIBBLE"); - dt.setOriginalColumnType(Types.DATE); - - Object rtn = null; - rtn = nativeMeta.getValueFromResultSet(resultSet, ts, 0); - assertNotNull(rtn); - assertEquals("java.sql.Timestamp", rtn.getClass().getName()); - - rtn = nativeMeta.getValueFromResultSet(resultSet, tm, 1); - assertNotNull(rtn); - assertEquals("java.sql.Time", rtn.getClass().getName()); - - rtn = nativeMeta.getValueFromResultSet(resultSet, dt, 2); - assertNotNull(rtn); - assertEquals("java.sql.Date", rtn.getClass().getName()); - - when(resultSet.wasNull()).thenReturn(true); - rtn = nativeMeta.getValueFromResultSet(resultSet, new ValueMetaString("WOBBLE"), 3); - assertNull(rtn); - - // Verify that getDate, getTime, and getTimestamp were respectively called once - Mockito.verify(resultSet, Mockito.times(1)).getDate(Mockito.anyInt()); - Mockito.verify(resultSet, Mockito.times(1)).getTime(Mockito.anyInt()); - Mockito.verify(resultSet, Mockito.times(1)).getTimestamp(Mockito.anyInt()); - } - - @Test - public void testGetBinaryWithLength_WhenBinarySqlTypesOfVertica() throws Exception { - final int binaryColumnIndex = 1; - final int varbinaryColumnIndex = 2; - final int expectedBinarylength = 1; - final int expectedVarBinarylength = 80; - - ValueMetaBase obj = new ValueMetaBase(); - DatabaseMeta dbMeta = spy(new DatabaseMeta()); - IDatabase iDatabase = new Vertica5DatabaseMeta(); - dbMeta.setIDatabase(iDatabase); - - ResultSetMetaData metaData = mock(ResultSetMetaData.class); - - when(resultSet.getMetaData()).thenReturn(metaData); - when(metaData.getColumnType(binaryColumnIndex)).thenReturn(Types.BINARY); - when(metaData.getPrecision(binaryColumnIndex)).thenReturn(expectedBinarylength); - when(metaData.getColumnDisplaySize(binaryColumnIndex)).thenReturn(expectedBinarylength * 2); - - when(metaData.getColumnType(varbinaryColumnIndex)).thenReturn(Types.BINARY); - when(metaData.getPrecision(varbinaryColumnIndex)).thenReturn(expectedVarBinarylength); - when(metaData.getColumnDisplaySize(varbinaryColumnIndex)) - .thenReturn(expectedVarBinarylength * 2); - - // get value meta for binary type - IValueMeta binaryValueMeta = - obj.getValueFromSqlType( - variables, dbMeta, TEST_NAME, metaData, binaryColumnIndex, false, false); - assertNotNull(binaryValueMeta); - assertTrue(TEST_NAME.equals(binaryValueMeta.getName())); - assertTrue(IValueMeta.TYPE_BINARY == binaryValueMeta.getType()); - assertTrue(expectedBinarylength == binaryValueMeta.getLength()); - assertFalse(binaryValueMeta.isLargeTextField()); - - // get value meta for varbinary type - IValueMeta varbinaryValueMeta = - obj.getValueFromSqlType( - variables, dbMeta, TEST_NAME, metaData, varbinaryColumnIndex, false, false); - assertNotNull(varbinaryValueMeta); - assertTrue(TEST_NAME.equals(varbinaryValueMeta.getName())); - assertTrue(IValueMeta.TYPE_BINARY == varbinaryValueMeta.getType()); - assertTrue(expectedVarBinarylength == varbinaryValueMeta.getLength()); - assertFalse(varbinaryValueMeta.isLargeTextField()); - } - - @Test - public void testVerticaTimeType() throws Exception { - ResultSetMetaData metaData = mock(ResultSetMetaData.class); - IValueMeta iValueMeta = mock(ValueMetaInternetAddress.class); - - when(resultSet.getMetaData()).thenReturn(metaData); - when(metaData.getColumnType(1)).thenReturn(Types.TIME); - when(resultSet.getTime(1)).thenReturn(new Time(0)); - when(iValueMeta.getOriginalColumnType()).thenReturn(Types.TIME); - when(iValueMeta.getType()).thenReturn(IValueMeta.TYPE_DATE); - - IDatabase iDatabase = new Vertica5DatabaseMeta(); - Object ret = iDatabase.getValueFromResultSet(resultSet, iValueMeta, 0); - assertEquals(new Time(0), ret); - } - - private class StoreLoggingEventListener implements IHopLoggingEventListener { - - private List events = new ArrayList<>(); - - @Override - public void eventAdded(HopLoggingEvent event) { - events.add(event); - } - - public List getEvents() { - return events; - } - } -} +/* + * 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 org.apache.hop.databases.vertica; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.logging.HopLogStore; +import org.apache.hop.core.logging.HopLoggingEvent; +import org.apache.hop.core.logging.IHopLoggingEventListener; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaBase; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.Spy; + +public class Vertica5DatabaseMetaTest extends VerticaDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + private static final String TEST_NAME = "TEST_NAME"; + private static final String LOG_FIELD = "LOG_FIELD"; + public static final int MAX_TEXT_FIELD_LEN = 5; + + // Get PKG from class under test + private Class PKG = ValueMetaBase.PKG; + private StoreLoggingEventListener listener; + + @Spy private DatabaseMeta databaseMetaSpy = spy(new DatabaseMeta()); + private PreparedStatement preparedStatementMock = mock(PreparedStatement.class); + private ResultSet resultSet; + private DatabaseMeta dbMeta; + private IValueMeta valueMetaBase; + private IVariables variables; + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + HopLogStore.init(); + } + + @Override + @Before + public void setUp() throws HopPluginException { + listener = new StoreLoggingEventListener(); + HopLogStore.getAppender().addLoggingEventListener(listener); + variables = spy(new Variables()); + + valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); + + dbMeta = spy(new DatabaseMeta()); + resultSet = mock(ResultSet.class); + } + + @Test + public void testOverridesToVerticaDatabaseMeta() throws Exception { + Vertica5DatabaseMeta nativeMeta = new Vertica5DatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + + assertEquals("com.vertica.jdbc.Driver", nativeMeta.getDriverClass()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + + ResultSet resultSet = mock(ResultSet.class); + ResultSetMetaData metaData = mock(ResultSetMetaData.class); + when(resultSet.getMetaData()).thenReturn(metaData); + + when(resultSet.getTimestamp(1)).thenReturn(new Timestamp(65535)); + when(resultSet.getTime(2)).thenReturn(new Time(1000)); + when(resultSet.getDate(3)).thenReturn(new Date((65535 * 2))); + ValueMetaTimestamp ts = new ValueMetaTimestamp("FOO"); + ts.setOriginalColumnType(Types.TIMESTAMP); + ValueMetaDate tm = new ValueMetaDate("BAR"); + tm.setOriginalColumnType(Types.TIME); + ValueMetaDate dt = new ValueMetaDate("WIBBLE"); + dt.setOriginalColumnType(Types.DATE); + + Object rtn = null; + rtn = nativeMeta.getValueFromResultSet(resultSet, ts, 0); + assertNotNull(rtn); + assertEquals("java.sql.Timestamp", rtn.getClass().getName()); + + rtn = nativeMeta.getValueFromResultSet(resultSet, tm, 1); + assertNotNull(rtn); + assertEquals("java.sql.Time", rtn.getClass().getName()); + + rtn = nativeMeta.getValueFromResultSet(resultSet, dt, 2); + assertNotNull(rtn); + assertEquals("java.sql.Date", rtn.getClass().getName()); + + when(resultSet.wasNull()).thenReturn(true); + rtn = nativeMeta.getValueFromResultSet(resultSet, new ValueMetaString("WOBBLE"), 3); + assertNull(rtn); + + // Verify that getDate, getTime, and getTimestamp were respectively called once + Mockito.verify(resultSet, Mockito.times(1)).getDate(Mockito.anyInt()); + Mockito.verify(resultSet, Mockito.times(1)).getTime(Mockito.anyInt()); + Mockito.verify(resultSet, Mockito.times(1)).getTimestamp(Mockito.anyInt()); + } + + @Test + public void testGetBinaryWithLength_WhenBinarySqlTypesOfVertica() throws Exception { + final int binaryColumnIndex = 1; + final int varbinaryColumnIndex = 2; + final int expectedBinarylength = 1; + final int expectedVarBinarylength = 80; + + ValueMetaBase obj = new ValueMetaBase(); + DatabaseMeta dbMeta = spy(new DatabaseMeta()); + IDatabase iDatabase = new Vertica5DatabaseMeta(); + dbMeta.setIDatabase(iDatabase); + + ResultSetMetaData metaData = mock(ResultSetMetaData.class); + + when(resultSet.getMetaData()).thenReturn(metaData); + when(metaData.getColumnType(binaryColumnIndex)).thenReturn(Types.BINARY); + when(metaData.getPrecision(binaryColumnIndex)).thenReturn(expectedBinarylength); + when(metaData.getColumnDisplaySize(binaryColumnIndex)).thenReturn(expectedBinarylength * 2); + + when(metaData.getColumnType(varbinaryColumnIndex)).thenReturn(Types.BINARY); + when(metaData.getPrecision(varbinaryColumnIndex)).thenReturn(expectedVarBinarylength); + when(metaData.getColumnDisplaySize(varbinaryColumnIndex)) + .thenReturn(expectedVarBinarylength * 2); + + // get value meta for binary type + IValueMeta binaryValueMeta = + obj.getValueFromSqlType( + variables, dbMeta, TEST_NAME, metaData, binaryColumnIndex, false, false); + assertNotNull(binaryValueMeta); + assertTrue(TEST_NAME.equals(binaryValueMeta.getName())); + assertTrue(IValueMeta.TYPE_BINARY == binaryValueMeta.getType()); + assertTrue(expectedBinarylength == binaryValueMeta.getLength()); + assertFalse(binaryValueMeta.isLargeTextField()); + + // get value meta for varbinary type + IValueMeta varbinaryValueMeta = + obj.getValueFromSqlType( + variables, dbMeta, TEST_NAME, metaData, varbinaryColumnIndex, false, false); + assertNotNull(varbinaryValueMeta); + assertTrue(TEST_NAME.equals(varbinaryValueMeta.getName())); + assertTrue(IValueMeta.TYPE_BINARY == varbinaryValueMeta.getType()); + assertTrue(expectedVarBinarylength == varbinaryValueMeta.getLength()); + assertFalse(varbinaryValueMeta.isLargeTextField()); + } + + @Test + public void testVerticaTimeType() throws Exception { + ResultSetMetaData metaData = mock(ResultSetMetaData.class); + IValueMeta iValueMeta = mock(ValueMetaInternetAddress.class); + + when(resultSet.getMetaData()).thenReturn(metaData); + when(metaData.getColumnType(1)).thenReturn(Types.TIME); + when(resultSet.getTime(1)).thenReturn(new Time(0)); + when(iValueMeta.getOriginalColumnType()).thenReturn(Types.TIME); + when(iValueMeta.getType()).thenReturn(IValueMeta.TYPE_DATE); + + IDatabase iDatabase = new Vertica5DatabaseMeta(); + Object ret = iDatabase.getValueFromResultSet(resultSet, iValueMeta, 0); + assertEquals(new Time(0), ret); + } + + private class StoreLoggingEventListener implements IHopLoggingEventListener { + + private List events = new ArrayList<>(); + + @Override + public void eventAdded(HopLoggingEvent event) { + events.add(event); + } + + public List getEvents() { + return events; + } + } +} diff --git a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5SequenceAndReleaseSavePointTest.java b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5SequenceAndReleaseSavePointTest.java index 9a75e0881da..7cfc4e2f416 100644 --- a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5SequenceAndReleaseSavePointTest.java +++ b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/Vertica5SequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.vertica; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class Vertica5SequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaDatabaseMetaTest.java b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaDatabaseMetaTest.java index 57246209206..14e9bb07afe 100644 --- a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaDatabaseMetaTest.java +++ b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaDatabaseMetaTest.java @@ -1,572 +1,571 @@ -/* - * 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 org.apache.hop.databases.vertica; - -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.DatabasePluginType; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.logging.HopLogStore; -import org.apache.hop.core.logging.HopLoggingEvent; -import org.apache.hop.core.logging.IHopLoggingEventListener; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaBase; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaPluginType; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.junit.rules.RestoreHopEnvironment; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; -import org.mockito.Spy; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - -public class VerticaDatabaseMetaTest { - @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); - - private VerticaDatabaseMeta nativeMeta; - - // Get PKG from class under test - private Class PKG = ValueMetaBase.PKG; - private StoreLoggingEventListener listener; - - @Spy private DatabaseMeta databaseMetaSpy = spy(new DatabaseMeta()); - private PreparedStatement preparedStatementMock = mock(PreparedStatement.class); - private ResultSet resultSet; - private DatabaseMeta dbMeta; - private IValueMeta valueMetaBase; - - @BeforeClass - public static void setUpBeforeClass() throws HopException { - PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); - PluginRegistry.addPluginType(DatabasePluginType.getInstance()); - PluginRegistry.init(); - HopLogStore.init(); - } - - @Before - public void setUp() throws HopPluginException { - listener = new VerticaDatabaseMetaTest.StoreLoggingEventListener(); - HopLogStore.getAppender().addLoggingEventListener(listener); - - valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); - - dbMeta = spy(new DatabaseMeta()); - resultSet = mock(ResultSet.class); - } - - @Before - public void setupBefore() { - nativeMeta = new VerticaDatabaseMeta(); - nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); - } - - @Test - public void testSettings() throws Exception { - assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); - assertEquals(5433, nativeMeta.getDefaultDatabasePort()); - assertEquals("com.vertica.Driver", nativeMeta.getDriverClass()); - assertEquals("jdbc:vertica://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); - assertEquals( - "jdbc:vertica://FOO:/WIBBLE", - nativeMeta.getURL( - "FOO", "", - "WIBBLE")); // Believe this is a bug - must have the port. Inconsistent with others - assertFalse(nativeMeta.isFetchSizeSupported()); - assertFalse(nativeMeta.isSupportsBitmapIndex()); - assertEquals(4000, nativeMeta.getMaxVARCHARLength()); - assertArrayEquals( - new String[] { - // From "SQL Reference Manual.pdf" found on support.vertica.com - "ABORT", - "ABSOLUTE", - "ACCESS", - "ACTION", - "ADD", - "AFTER", - "AGGREGATE", - "ALL", - "ALSO", - "ALTER", - "ANALYSE", - "ANALYZE", - "AND", - "ANY", - "ARRAY", - "AS", - "ASC", - "ASSERTION", - "ASSIGNMENT", - "AT", - "AUTHORIZATION", - "BACKWARD", - "BEFORE", - "BEGIN", - "BETWEEN", - "BIGINT", - "BINARY", - "BIT", - "BLOCK_DICT", - "BLOCKDICT_COMP", - "BOOLEAN", - "BOTH", - "BY", - "CACHE", - "CALLED", - "CASCADE", - "CASE", - "CAST", - "CATALOG_PATH", - "CHAIN", - "CHAR", - "CHARACTER", - "CHARACTERISTICS", - "CHECK", - "CHECKPOINT", - "CLASS", - "CLOSE", - "CLUSTER", - "COALESCE", - "COLLATE", - "COLUMN", - "COMMENT", - "COMMIT", - "COMMITTED", - "COMMONDELTA_COMP", - "CONSTRAINT", - "CONSTRAINTS", - "CONVERSION", - "CONVERT", - "COPY", - "CORRELATION", - "CREATE", - "CREATEDB", - "CREATEUSER", - "CROSS", - "CSV", - "CURRENT_DATABASE", - "CURRENT_DATE", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DATA", - "DATABASE", - "DATAPATH", - "DAY", - "DEALLOCATE", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFAULTS", - "DEFERRABLE", - "DEFERRED", - "DEFINER", - "DELETE", - "DELIMITER", - "DELIMITERS", - "DELTARANGE_COMP", - "DELTARANGE_COMP_SP", - "DELTAVAL", - "DESC", - "DETERMINES", - "DIRECT", - "DISTINCT", - "DISTVALINDEX", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "EACH", - "ELSE", - "ENCODING", - "ENCRYPTED", - "END", - "EPOCH", - "ERROR", - "ESCAPE", - "EXCEPT", - "EXCEPTIONS", - "EXCLUDING", - "EXCLUSIVE", - "EXECUTE", - "EXISTS", - "EXPLAIN", - "EXTERNAL", - "EXTRACT", - "FALSE", - "FETCH", - "FIRST", - "FLOAT", - "FOR", - "FORCE", - "FOREIGN", - "FORWARD", - "FREEZE", - "FROM", - "FULL", - "FUNCTION", - "GLOBAL", - "GRANT", - "GROUP", - "HANDLER", - "HAVING", - "HOLD", - "HOUR", - "ILIKE", - "IMMEDIATE", - "IMMUTABLE", - "IMPLICIT", - "IN", - "IN_P", - "INCLUDING", - "INCREMENT", - "INDEX", - "INHERITS", - "INITIALLY", - "INNER", - "INOUT", - "INPUT", - "INSENSITIVE", - "INSERT", - "INSTEAD", - "INT", - "INTEGER", - "INTERSECT", - "INTERVAL", - "INTO", - "INVOKER", - "IS", - "ISNULL", - "ISOLATION", - "JOIN", - "KEY", - "LANCOMPILER", - "LANGUAGE", - "LARGE", - "LAST", - "LATEST", - "LEADING", - "LEFT", - "LESS", - "LEVEL", - "LIKE", - "LIMIT", - "LISTEN", - "LOAD", - "LOCAL", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATION", - "LOCK", - "MATCH", - "MAXVALUE", - "MERGEOUT", - "MINUTE", - "MINVALUE", - "MOBUF", - "MODE", - "MONTH", - "MOVE", - "MOVEOUT", - "MULTIALGORITHM_COMP", - "MULTIALGORITHM_COMP_SP", - "NAMES", - "NATIONAL", - "NATURAL", - "NCHAR", - "NEW", - "NEXT", - "NO", - "NOCREATEDB", - "NOCREATEUSER", - "NODE", - "NODES", - "NONE", - "NOT", - "NOTHING", - "NOTIFY", - "NOTNULL", - "NOWAIT", - "NULL", - "NULLIF", - "NUMERIC", - "OBJECT", - "OF", - "OFF", - "OFFSET", - "OIDS", - "OLD", - "ON", - "ONLY", - "OPERATOR", - "OPTION", - "OR", - "ORDER", - "OUT", - "OUTER", - "OVERLAPS", - "OVERLAY", - "OWNER", - "PARTIAL", - "PARTITION", - "PASSWORD", - "PLACING", - "POSITION", - "PRECISION", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRIOR", - "PRIVILEGES", - "PROCEDURAL", - "PROCEDURE", - "PROJECTION", - "QUOTE", - "READ", - "REAL", - "RECHECK", - "RECORD", - "RECOVER", - "REFERENCES", - "REFRESH", - "REINDEX", - "REJECTED", - "RELATIVE", - "RELEASE", - "RENAME", - "REPEATABLE", - "REPLACE", - "RESET", - "RESTART", - "RESTRICT", - "RETURNS", - "REVOKE", - "RIGHT", - "RLE", - "ROLLBACK", - "ROW", - "ROWS", - "RULE", - "SAVEPOINT", - "SCHEMA", - "SCROLL", - "SECOND", - "SECURITY", - "SEGMENTED", - "SELECT", - "SEQUENCE", - "SERIALIZABLE", - "SESSION", - "SESSION_USER", - "SET", - "SETOF", - "SHARE", - "SHOW", - "SIMILAR", - "SIMPLE", - "SMALLINT", - "SOME", - "SPLIT", - "STABLE", - "START", - "STATEMENT", - "STATISTICS", - "STDIN", - "STDOUT", - "STORAGE", - "STRICT", - "SUBSTRING", - "SYSID", - "TABLE", - "TABLESPACE", - "TEMP", - "TEMPLATE", - "TEMPORARY", - "TERMINATOR", - "THAN", - "THEN", - "TIME", - "TIMESTAMP", - "TIMESTAMPTZ", - "TIMETZ", - "TO", - "TOAST", - "TRAILING", - "TRANSACTION", - "TREAT", - "TRIGGER", - "TRIM", - "TRUE", - "TRUE_P", - "TRUNCATE", - "TRUSTED", - "TYPE", - "UNCOMMITTED", - "UNENCRYPTED", - "UNION", - "UNIQUE", - "UNKNOWN", - "UNLISTEN", - "UNSEGMENTED", - "UNTIL", - "UPDATE", - "USAGE", - "USER", - "USING", - "VACUUM", - "VALID", - "VALIDATOR", - "VALINDEX", - "VALUES", - "VARCHAR", - "VARYING", - "VERBOSE", - "VIEW", - "VOLATILE", - "WHEN", - "WHERE", - "WITH", - "WITHOUT", - "WORK", - "WRITE", - "YEAR", - "ZONE" - }, - nativeMeta.getReservedWords()); - - assertArrayEquals(new String[] {}, nativeMeta.getViewTypes()); - assertFalse(nativeMeta.isSupportsAutoInc()); - assertTrue(nativeMeta.isSupportsBooleanDataType()); - assertTrue(nativeMeta.isRequiresCastToVariousForIsNull()); - assertEquals("?", nativeMeta.getExtraOptionIndicator()); - assertEquals("&", nativeMeta.getExtraOptionSeparator()); - assertTrue(nativeMeta.isSupportsSequences()); - assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); - assertFalse(nativeMeta.isSupportsGetBlob()); - assertTrue(nativeMeta.isDisplaySizeTwiceThePrecision()); - } - - @Test - public void testSqlStatements() { - assertEquals(" LIMIT 5", nativeMeta.getLimitClause(5)); - assertEquals( - "--NOTE: Table cannot be altered unless all projections are dropped.\nALTER TABLE FOO ADD BAR VARCHAR(15)", - nativeMeta.getAddColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals( - "--NOTE: Table cannot be altered unless all projections are dropped.\nALTER TABLE FOO ALTER COLUMN BAR SET DATA TYPE VARCHAR(15)", - nativeMeta.getModifyColumnStatement( - "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); - - assertEquals("SELECT FOO FROM BAR LIMIT 1", nativeMeta.getSqlColumnExists("FOO", "BAR")); - assertEquals("SELECT * FROM FOO LIMIT 1", nativeMeta.getSqlQueryFields("FOO")); - assertEquals("SELECT 1 FROM FOO LIMIT 1", nativeMeta.getSqlTableExists("FOO")); - assertEquals( - "SELECT sequence_name FROM sequences WHERE sequence_name = 'FOO'", - nativeMeta.getSqlSequenceExists("FOO")); - assertEquals("SELECT sequence_name FROM sequences", nativeMeta.getSqlListOfSequences()); - assertEquals("SELECT nextval('FOO')", nativeMeta.getSqlNextSequenceValue("FOO")); - assertEquals("SELECT currval('FOO')", nativeMeta.getSqlCurrentSequenceValue("FOO")); - } - - @Test - public void testGetFieldDefinition() throws Exception { - assertEquals( - "FOO TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); - assertEquals( - "TIMESTAMP", - nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); - assertEquals( - "BOOLEAN", - nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); - assertEquals( - "FLOAT", - nativeMeta.getFieldDefinition(new ValueMetaBigNumber("FOO"), "", "", false, false, false)); - assertEquals( - "INTEGER", - nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "", false, false, false)); - assertEquals( - "VARCHAR", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "VARCHAR(15)", - nativeMeta.getFieldDefinition( - new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); - assertEquals( - "VARBINARY", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 0, 0), "", "", false, false, false)); - assertEquals( - "VARBINARY(50)", - nativeMeta.getFieldDefinition( - new ValueMetaBinary("FOO", 50, 0), "", "", false, false, false)); - assertEquals( - " UNKNOWN", - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); - - assertEquals( - " UNKNOWN" + System.getProperty("line.separator"), - nativeMeta.getFieldDefinition( - new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); - } - - private class StoreLoggingEventListener implements IHopLoggingEventListener { - - private List events = new ArrayList<>(); - - @Override - public void eventAdded(HopLoggingEvent event) { - events.add(event); - } - - public List getEvents() { - return events; - } - } -} +/* + * 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 org.apache.hop.databases.vertica; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.DatabasePluginType; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopPluginException; +import org.apache.hop.core.logging.HopLogStore; +import org.apache.hop.core.logging.HopLoggingEvent; +import org.apache.hop.core.logging.IHopLoggingEventListener; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaBase; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaPluginType; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.junit.rules.RestoreHopEnvironment; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.mockito.Spy; + +public class VerticaDatabaseMetaTest { + @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); + + private VerticaDatabaseMeta nativeMeta; + + // Get PKG from class under test + private Class PKG = ValueMetaBase.PKG; + private StoreLoggingEventListener listener; + + @Spy private DatabaseMeta databaseMetaSpy = spy(new DatabaseMeta()); + private PreparedStatement preparedStatementMock = mock(PreparedStatement.class); + private ResultSet resultSet; + private DatabaseMeta dbMeta; + private IValueMeta valueMetaBase; + + @BeforeClass + public static void setUpBeforeClass() throws HopException { + PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); + PluginRegistry.addPluginType(DatabasePluginType.getInstance()); + PluginRegistry.init(); + HopLogStore.init(); + } + + @Before + public void setUp() throws HopPluginException { + listener = new VerticaDatabaseMetaTest.StoreLoggingEventListener(); + HopLogStore.getAppender().addLoggingEventListener(listener); + + valueMetaBase = ValueMetaFactory.createValueMeta(IValueMeta.TYPE_NONE); + + dbMeta = spy(new DatabaseMeta()); + resultSet = mock(ResultSet.class); + } + + @Before + public void setupBefore() { + nativeMeta = new VerticaDatabaseMeta(); + nativeMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE); + } + + @Test + public void testSettings() throws Exception { + assertArrayEquals(new int[] {DatabaseMeta.TYPE_ACCESS_NATIVE}, nativeMeta.getAccessTypeList()); + assertEquals(5433, nativeMeta.getDefaultDatabasePort()); + assertEquals("com.vertica.Driver", nativeMeta.getDriverClass()); + assertEquals("jdbc:vertica://FOO:BAR/WIBBLE", nativeMeta.getURL("FOO", "BAR", "WIBBLE")); + assertEquals( + "jdbc:vertica://FOO:/WIBBLE", + nativeMeta.getURL( + "FOO", "", + "WIBBLE")); // Believe this is a bug - must have the port. Inconsistent with others + assertFalse(nativeMeta.isFetchSizeSupported()); + assertFalse(nativeMeta.isSupportsBitmapIndex()); + assertEquals(4000, nativeMeta.getMaxVARCHARLength()); + assertArrayEquals( + new String[] { + // From "SQL Reference Manual.pdf" found on support.vertica.com + "ABORT", + "ABSOLUTE", + "ACCESS", + "ACTION", + "ADD", + "AFTER", + "AGGREGATE", + "ALL", + "ALSO", + "ALTER", + "ANALYSE", + "ANALYZE", + "AND", + "ANY", + "ARRAY", + "AS", + "ASC", + "ASSERTION", + "ASSIGNMENT", + "AT", + "AUTHORIZATION", + "BACKWARD", + "BEFORE", + "BEGIN", + "BETWEEN", + "BIGINT", + "BINARY", + "BIT", + "BLOCK_DICT", + "BLOCKDICT_COMP", + "BOOLEAN", + "BOTH", + "BY", + "CACHE", + "CALLED", + "CASCADE", + "CASE", + "CAST", + "CATALOG_PATH", + "CHAIN", + "CHAR", + "CHARACTER", + "CHARACTERISTICS", + "CHECK", + "CHECKPOINT", + "CLASS", + "CLOSE", + "CLUSTER", + "COALESCE", + "COLLATE", + "COLUMN", + "COMMENT", + "COMMIT", + "COMMITTED", + "COMMONDELTA_COMP", + "CONSTRAINT", + "CONSTRAINTS", + "CONVERSION", + "CONVERT", + "COPY", + "CORRELATION", + "CREATE", + "CREATEDB", + "CREATEUSER", + "CROSS", + "CSV", + "CURRENT_DATABASE", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "CURRENT_USER", + "CURSOR", + "CYCLE", + "DATA", + "DATABASE", + "DATAPATH", + "DAY", + "DEALLOCATE", + "DEC", + "DECIMAL", + "DECLARE", + "DEFAULT", + "DEFAULTS", + "DEFERRABLE", + "DEFERRED", + "DEFINER", + "DELETE", + "DELIMITER", + "DELIMITERS", + "DELTARANGE_COMP", + "DELTARANGE_COMP_SP", + "DELTAVAL", + "DESC", + "DETERMINES", + "DIRECT", + "DISTINCT", + "DISTVALINDEX", + "DO", + "DOMAIN", + "DOUBLE", + "DROP", + "EACH", + "ELSE", + "ENCODING", + "ENCRYPTED", + "END", + "EPOCH", + "ERROR", + "ESCAPE", + "EXCEPT", + "EXCEPTIONS", + "EXCLUDING", + "EXCLUSIVE", + "EXECUTE", + "EXISTS", + "EXPLAIN", + "EXTERNAL", + "EXTRACT", + "FALSE", + "FETCH", + "FIRST", + "FLOAT", + "FOR", + "FORCE", + "FOREIGN", + "FORWARD", + "FREEZE", + "FROM", + "FULL", + "FUNCTION", + "GLOBAL", + "GRANT", + "GROUP", + "HANDLER", + "HAVING", + "HOLD", + "HOUR", + "ILIKE", + "IMMEDIATE", + "IMMUTABLE", + "IMPLICIT", + "IN", + "IN_P", + "INCLUDING", + "INCREMENT", + "INDEX", + "INHERITS", + "INITIALLY", + "INNER", + "INOUT", + "INPUT", + "INSENSITIVE", + "INSERT", + "INSTEAD", + "INT", + "INTEGER", + "INTERSECT", + "INTERVAL", + "INTO", + "INVOKER", + "IS", + "ISNULL", + "ISOLATION", + "JOIN", + "KEY", + "LANCOMPILER", + "LANGUAGE", + "LARGE", + "LAST", + "LATEST", + "LEADING", + "LEFT", + "LESS", + "LEVEL", + "LIKE", + "LIMIT", + "LISTEN", + "LOAD", + "LOCAL", + "LOCALTIME", + "LOCALTIMESTAMP", + "LOCATION", + "LOCK", + "MATCH", + "MAXVALUE", + "MERGEOUT", + "MINUTE", + "MINVALUE", + "MOBUF", + "MODE", + "MONTH", + "MOVE", + "MOVEOUT", + "MULTIALGORITHM_COMP", + "MULTIALGORITHM_COMP_SP", + "NAMES", + "NATIONAL", + "NATURAL", + "NCHAR", + "NEW", + "NEXT", + "NO", + "NOCREATEDB", + "NOCREATEUSER", + "NODE", + "NODES", + "NONE", + "NOT", + "NOTHING", + "NOTIFY", + "NOTNULL", + "NOWAIT", + "NULL", + "NULLIF", + "NUMERIC", + "OBJECT", + "OF", + "OFF", + "OFFSET", + "OIDS", + "OLD", + "ON", + "ONLY", + "OPERATOR", + "OPTION", + "OR", + "ORDER", + "OUT", + "OUTER", + "OVERLAPS", + "OVERLAY", + "OWNER", + "PARTIAL", + "PARTITION", + "PASSWORD", + "PLACING", + "POSITION", + "PRECISION", + "PREPARE", + "PRESERVE", + "PRIMARY", + "PRIOR", + "PRIVILEGES", + "PROCEDURAL", + "PROCEDURE", + "PROJECTION", + "QUOTE", + "READ", + "REAL", + "RECHECK", + "RECORD", + "RECOVER", + "REFERENCES", + "REFRESH", + "REINDEX", + "REJECTED", + "RELATIVE", + "RELEASE", + "RENAME", + "REPEATABLE", + "REPLACE", + "RESET", + "RESTART", + "RESTRICT", + "RETURNS", + "REVOKE", + "RIGHT", + "RLE", + "ROLLBACK", + "ROW", + "ROWS", + "RULE", + "SAVEPOINT", + "SCHEMA", + "SCROLL", + "SECOND", + "SECURITY", + "SEGMENTED", + "SELECT", + "SEQUENCE", + "SERIALIZABLE", + "SESSION", + "SESSION_USER", + "SET", + "SETOF", + "SHARE", + "SHOW", + "SIMILAR", + "SIMPLE", + "SMALLINT", + "SOME", + "SPLIT", + "STABLE", + "START", + "STATEMENT", + "STATISTICS", + "STDIN", + "STDOUT", + "STORAGE", + "STRICT", + "SUBSTRING", + "SYSID", + "TABLE", + "TABLESPACE", + "TEMP", + "TEMPLATE", + "TEMPORARY", + "TERMINATOR", + "THAN", + "THEN", + "TIME", + "TIMESTAMP", + "TIMESTAMPTZ", + "TIMETZ", + "TO", + "TOAST", + "TRAILING", + "TRANSACTION", + "TREAT", + "TRIGGER", + "TRIM", + "TRUE", + "TRUE_P", + "TRUNCATE", + "TRUSTED", + "TYPE", + "UNCOMMITTED", + "UNENCRYPTED", + "UNION", + "UNIQUE", + "UNKNOWN", + "UNLISTEN", + "UNSEGMENTED", + "UNTIL", + "UPDATE", + "USAGE", + "USER", + "USING", + "VACUUM", + "VALID", + "VALIDATOR", + "VALINDEX", + "VALUES", + "VARCHAR", + "VARYING", + "VERBOSE", + "VIEW", + "VOLATILE", + "WHEN", + "WHERE", + "WITH", + "WITHOUT", + "WORK", + "WRITE", + "YEAR", + "ZONE" + }, + nativeMeta.getReservedWords()); + + assertArrayEquals(new String[] {}, nativeMeta.getViewTypes()); + assertFalse(nativeMeta.isSupportsAutoInc()); + assertTrue(nativeMeta.isSupportsBooleanDataType()); + assertTrue(nativeMeta.isRequiresCastToVariousForIsNull()); + assertEquals("?", nativeMeta.getExtraOptionIndicator()); + assertEquals("&", nativeMeta.getExtraOptionSeparator()); + assertTrue(nativeMeta.isSupportsSequences()); + assertFalse(nativeMeta.isSupportsTimeStampToDateConversion()); + assertFalse(nativeMeta.isSupportsGetBlob()); + assertTrue(nativeMeta.isDisplaySizeTwiceThePrecision()); + } + + @Test + public void testSqlStatements() { + assertEquals(" LIMIT 5", nativeMeta.getLimitClause(5)); + assertEquals( + "--NOTE: Table cannot be altered unless all projections are dropped.\nALTER TABLE FOO ADD BAR VARCHAR(15)", + nativeMeta.getAddColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals( + "--NOTE: Table cannot be altered unless all projections are dropped.\nALTER TABLE FOO ALTER COLUMN BAR SET DATA TYPE VARCHAR(15)", + nativeMeta.getModifyColumnStatement( + "FOO", new ValueMetaString("BAR", 15, 0), "", false, "", false)); + + assertEquals("SELECT FOO FROM BAR LIMIT 1", nativeMeta.getSqlColumnExists("FOO", "BAR")); + assertEquals("SELECT * FROM FOO LIMIT 1", nativeMeta.getSqlQueryFields("FOO")); + assertEquals("SELECT 1 FROM FOO LIMIT 1", nativeMeta.getSqlTableExists("FOO")); + assertEquals( + "SELECT sequence_name FROM sequences WHERE sequence_name = 'FOO'", + nativeMeta.getSqlSequenceExists("FOO")); + assertEquals("SELECT sequence_name FROM sequences", nativeMeta.getSqlListOfSequences()); + assertEquals("SELECT nextval('FOO')", nativeMeta.getSqlNextSequenceValue("FOO")); + assertEquals("SELECT currval('FOO')", nativeMeta.getSqlCurrentSequenceValue("FOO")); + } + + @Test + public void testGetFieldDefinition() throws Exception { + assertEquals( + "FOO TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaDate("FOO"), "", "", false, true, false)); + assertEquals( + "TIMESTAMP", + nativeMeta.getFieldDefinition(new ValueMetaTimestamp("FOO"), "", "", false, false, false)); + assertEquals( + "BOOLEAN", + nativeMeta.getFieldDefinition(new ValueMetaBoolean("FOO"), "", "", false, false, false)); + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition(new ValueMetaNumber("FOO"), "", "", false, false, false)); + assertEquals( + "FLOAT", + nativeMeta.getFieldDefinition(new ValueMetaBigNumber("FOO"), "", "", false, false, false)); + assertEquals( + "INTEGER", + nativeMeta.getFieldDefinition(new ValueMetaInteger("FOO"), "", "", false, false, false)); + assertEquals( + "VARCHAR", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "VARCHAR(15)", + nativeMeta.getFieldDefinition( + new ValueMetaString("FOO", 15, 0), "", "", false, false, false)); + assertEquals( + "VARBINARY", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 0, 0), "", "", false, false, false)); + assertEquals( + "VARBINARY(50)", + nativeMeta.getFieldDefinition( + new ValueMetaBinary("FOO", 50, 0), "", "", false, false, false)); + assertEquals( + " UNKNOWN", + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, false)); + + assertEquals( + " UNKNOWN" + System.getProperty("line.separator"), + nativeMeta.getFieldDefinition( + new ValueMetaInternetAddress("FOO"), "", "", false, false, true)); + } + + private class StoreLoggingEventListener implements IHopLoggingEventListener { + + private List events = new ArrayList<>(); + + @Override + public void eventAdded(HopLoggingEvent event) { + events.add(event); + } + + public List getEvents() { + return events; + } + } +} diff --git a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaSequenceAndReleaseSavePointTest.java b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaSequenceAndReleaseSavePointTest.java index f843235b1ed..9a0a2e1ad7e 100644 --- a/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaSequenceAndReleaseSavePointTest.java +++ b/plugins/databases/vertica/src/test/java/org/apache/hop/databases/vertica/VerticaSequenceAndReleaseSavePointTest.java @@ -17,16 +17,16 @@ package org.apache.hop.databases.vertica; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.util.Utils; import org.apache.hop.junit.rules.RestoreHopEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class VerticaSequenceAndReleaseSavePointTest { @ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment(); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/config/GenerateFatJarConfigPlugin.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/config/GenerateFatJarConfigPlugin.java index 3986239eaeb..ea9599779eb 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/config/GenerateFatJarConfigPlugin.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/config/GenerateFatJarConfigPlugin.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.config; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.beam.gui.HopBeamGuiPlugin; import org.apache.hop.beam.pipeline.fatjar.FatJarBuilder; @@ -28,8 +29,6 @@ import org.apache.hop.metadata.api.IHasHopMetadataProvider; import picocli.CommandLine; -import java.util.List; - @ConfigPlugin( id = "GenerateFatJarConfigPlugin", description = "Allows you to create a fat jar using the current Hop software installation") @@ -83,7 +82,9 @@ public String getFatJarFilename() { return fatJarFilename; } - /** @param fatJarFilename The fatJarFilename to set */ + /** + * @param fatJarFilename The fatJarFilename to set + */ public void setFatJarFilename(String fatJarFilename) { this.fatJarFilename = fatJarFilename; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/coder/HopRowCoder.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/coder/HopRowCoder.java index 5aabc185e18..25e4ad62638 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/coder/HopRowCoder.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/coder/HopRowCoder.java @@ -17,14 +17,6 @@ package org.apache.hop.beam.core.coder; -import org.apache.avro.Schema; -import org.apache.avro.generic.GenericRecord; -import org.apache.beam.sdk.coders.AtomicCoder; -import org.apache.beam.sdk.coders.CoderException; -import org.apache.hop.beam.core.HopRow; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaAvroRecord; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -37,6 +29,13 @@ import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.util.Date; +import org.apache.avro.Schema; +import org.apache.avro.generic.GenericRecord; +import org.apache.beam.sdk.coders.AtomicCoder; +import org.apache.beam.sdk.coders.CoderException; +import org.apache.hop.beam.core.HopRow; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaAvroRecord; public class HopRowCoder extends AtomicCoder { @@ -181,7 +180,8 @@ private void write(ObjectOutputStream out, int objectType, Object object) throws // Now we perform the binary serialization of the data // - ValueMetaAvroRecord valueMeta = new ValueMetaAvroRecord("write", genericRecord.getSchema()); + ValueMetaAvroRecord valueMeta = + new ValueMetaAvroRecord("write", genericRecord.getSchema()); DataOutputStream dataOutputStream = new DataOutputStream(out); valueMeta.writeData(dataOutputStream, genericRecord); dataOutputStream.flush(); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java index 9d7042977a8..86a380f29e0 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java @@ -19,6 +19,9 @@ import com.google.api.services.bigquery.model.TableFieldSchema; import com.google.api.services.bigquery.model.TableSchema; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.List; import org.apache.avro.generic.GenericRecord; import org.apache.avro.util.Utf8; import org.apache.beam.sdk.io.gcp.bigquery.SchemaAndRecord; @@ -34,10 +37,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.List; - /** BigQuery Avro SchemaRecord to HopRow */ public class BQSchemaAndRecordToHopFn implements SerializableFunction { @@ -56,9 +55,7 @@ public class BQSchemaAndRecordToHopFn implements SerializableFunction>, HopRow> { private String counterName; @@ -282,7 +280,9 @@ public String[] getAggregations() { return aggregations; } - /** @param aggregations The aggregations to set */ + /** + * @param aggregations The aggregations to set + */ public void setAggregations(String[] aggregations) { this.aggregations = aggregations; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopRowToKVStringStringFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopRowToKVStringStringFn.java index 3281f1bc3f1..aab362d0d8f 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopRowToKVStringStringFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopRowToKVStringStringFn.java @@ -29,8 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class HopRowToKVStringStringFn extends DoFn> { private String rowMetaJson; @@ -47,10 +45,7 @@ public class HopRowToKVStringStringFn extends DoFn> { private transient Counter writtenCounter; public HopRowToKVStringStringFn( - String transformName, - int keyIndex, - int valueIndex, - String rowMetaJson) { + String transformName, int keyIndex, int valueIndex, String rowMetaJson) { this.transformName = transformName; this.keyIndex = keyIndex; this.valueIndex = valueIndex; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopToBQTableRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopToBQTableRowFn.java index 652d30d283b..6b2c6ffbe7f 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopToBQTableRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/HopToBQTableRowFn.java @@ -18,6 +18,8 @@ package org.apache.hop.beam.core.fn; import com.google.api.services.bigquery.model.TableRow; +import java.text.SimpleDateFormat; +import java.util.Date; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.SerializableFunction; @@ -30,10 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - public class HopToBQTableRowFn implements SerializableFunction { private String counterName; @@ -50,9 +48,7 @@ public class HopToBQTableRowFn implements SerializableFunction // Log and count parse errors. private static final Logger LOG = LoggerFactory.getLogger(HopToBQTableRowFn.class); - public HopToBQTableRowFn( - String counterName, - String rowMetaJson) { + public HopToBQTableRowFn(String counterName, String rowMetaJson) { this.counterName = counterName; this.rowMetaJson = rowMetaJson; } @@ -103,7 +99,8 @@ public TableRow apply(HopRow inputRow) { case IValueMeta.TYPE_TIMESTAMP: if (valueMeta.getNumber(valueData) != null) { // we have a nanoseconds value and BigQuery expects microseconds, so divide by 1000 - tableRow.put(valueMeta.getName(), Math.round(valueMeta.getNumber(valueData) / 1000)); + tableRow.put( + valueMeta.getName(), Math.round(valueMeta.getNumber(valueData) / 1000)); } else { tableRow.put(valueMeta.getName(), valueMeta.getNumber(valueData)); } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/KVLongStringToHopRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/KVLongStringToHopRowFn.java index 2ba4295e76b..18149df5513 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/KVLongStringToHopRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/KVLongStringToHopRowFn.java @@ -29,8 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class KVLongStringToHopRowFn extends DoFn, HopRow> { private String rowMetaJson; @@ -44,9 +42,7 @@ public class KVLongStringToHopRowFn extends DoFn, HopRow> { private transient Counter inputCounter; private transient Counter writtenCounter; - public KVLongStringToHopRowFn( - String transformName, - String rowMetaJson) { + public KVLongStringToHopRowFn(String transformName, String rowMetaJson) { this.transformName = transformName; this.rowMetaJson = rowMetaJson; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/MergeJoinAssemblerFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/MergeJoinAssemblerFn.java index 90979e6c166..3edc19606c2 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/MergeJoinAssemblerFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/MergeJoinAssemblerFn.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.core.fn; +import java.util.HashMap; +import java.util.Map; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -30,10 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MergeJoinAssemblerFn extends DoFn>, HopRow> { public static int JOIN_TYPE_INNER = 0; @@ -177,11 +175,11 @@ public void processElement(ProcessContext processContext) { if (rightValue.isNotEmpty()) { Integer keyIndex = rightKeyIndexes.get(i); if (keyIndex != null) { - outputRow[leftRowMeta.size()+i] = rightValue.getRow()[keyIndex]; + outputRow[leftRowMeta.size() + i] = rightValue.getRow()[keyIndex]; } Integer valueIndex = rightValueIndexes.get(i); if (valueIndex != null) { - outputRow[leftRowMeta.size()+i] = rightValue.getRow()[valueIndex]; + outputRow[leftRowMeta.size() + i] = rightValue.getRow()[valueIndex]; } } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishMessagesFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishMessagesFn.java index 310d1686326..f80407bce53 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishMessagesFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishMessagesFn.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.core.fn; +import java.util.HashMap; import org.apache.beam.sdk.io.gcp.pubsub.PubsubMessage; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -29,9 +30,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.List; - public class PublishMessagesFn extends DoFn { private String rowMetaJson; @@ -46,10 +44,7 @@ public class PublishMessagesFn extends DoFn { private transient Counter readCounter; private transient Counter outputCounter; - public PublishMessagesFn( - String transformName, - int fieldIndex, - String rowMetaJson) { + public PublishMessagesFn(String transformName, int fieldIndex, String rowMetaJson) { this.transformName = transformName; this.fieldIndex = fieldIndex; this.rowMetaJson = rowMetaJson; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishStringsFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishStringsFn.java index 7d491ff44ee..0ed2e0e56c4 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishStringsFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PublishStringsFn.java @@ -28,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class PublishStringsFn extends DoFn { private String rowMetaJson; @@ -44,10 +42,7 @@ public class PublishStringsFn extends DoFn { private transient Counter readCounter; private transient Counter outputCounter; - public PublishStringsFn( - String transformName, - int fieldIndex, - String rowMetaJson) { + public PublishStringsFn(String transformName, int fieldIndex, String rowMetaJson) { this.transformName = transformName; this.fieldIndex = fieldIndex; this.rowMetaJson = rowMetaJson; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PubsubMessageToHopRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PubsubMessageToHopRowFn.java index 4f1dbcb780f..46bee47c4b1 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PubsubMessageToHopRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/PubsubMessageToHopRowFn.java @@ -29,8 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class PubsubMessageToHopRowFn extends DoFn { private final String rowMetaJson; @@ -43,9 +41,7 @@ public class PubsubMessageToHopRowFn extends DoFn { private transient Counter inputCounter; private transient Counter writtenCounter; - public PubsubMessageToHopRowFn( - String transformName, - String rowMetaJson) { + public PubsubMessageToHopRowFn(String transformName, String rowMetaJson) { this.transformName = transformName; this.rowMetaJson = rowMetaJson; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StaticHopRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StaticHopRowFn.java index f25427aac9c..6734c6a0c1c 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StaticHopRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StaticHopRowFn.java @@ -16,6 +16,7 @@ */ package org.apache.hop.beam.core.fn; +import java.util.Date; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -32,9 +33,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.util.Date; -import java.util.List; - public class StaticHopRowFn extends DoFn, HopRow> { private final String transformName; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopFn.java index 9bc9a7d48fe..d13d821d9fd 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopFn.java @@ -32,8 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class StringToHopFn extends DoFn { private final String transformName; @@ -48,10 +46,7 @@ public class StringToHopFn extends DoFn { private transient IRowMeta rowMeta; - public StringToHopFn( - String transformName, - String rowMetaJson, - String separator) { + public StringToHopFn(String transformName, String rowMetaJson, String separator) { this.transformName = transformName; this.rowMetaJson = rowMetaJson; this.separator = separator; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopRowFn.java index a70ad37b15a..98c66467642 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/StringToHopRowFn.java @@ -28,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class StringToHopRowFn extends DoFn { private final String rowMetaJson; @@ -42,9 +40,7 @@ public class StringToHopRowFn extends DoFn { private transient Counter inputCounter; private transient Counter writtenCounter; - public StringToHopRowFn( - String transformName, - String rowMetaJson) { + public StringToHopRowFn(String transformName, String rowMetaJson) { this.transformName = transformName; this.rowMetaJson = rowMetaJson; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/TimestampFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/TimestampFn.java index 8a1bd8cf399..ed5391b0c7a 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/TimestampFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/TimestampFn.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.core.fn; +import java.util.Date; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -35,9 +36,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Date; -import java.util.List; - public class TimestampFn extends DoFn { private String transformName; @@ -58,10 +56,7 @@ public class TimestampFn extends DoFn { private transient IValueMeta fieldValueMeta; public TimestampFn( - String transformName, - String rowMetaJson, - String fieldName, - boolean getTimestamp) { + String transformName, String rowMetaJson, String fieldName, boolean getTimestamp) { this.transformName = transformName; this.rowMetaJson = rowMetaJson; this.fieldName = fieldName; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/WindowInfoFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/WindowInfoFn.java index 31a8aded30e..1393b99841a 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/WindowInfoFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/WindowInfoFn.java @@ -34,8 +34,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class WindowInfoFn extends DoFn { private final String transformName; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/SimpleVariableSpace.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/SimpleVariableSpace.java index 78c0d963e9b..727137f0558 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/SimpleVariableSpace.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/SimpleVariableSpace.java @@ -39,7 +39,9 @@ public List getVariables() { return variables; } - /** @param variables The variables to set */ + /** + * @param variables The variables to set + */ public void setVariables(List variables) { this.variables = variables; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/VariableValue.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/VariableValue.java index 76996259eb8..288d7c8eebf 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/VariableValue.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/shared/VariableValue.java @@ -40,7 +40,9 @@ public String getVariable() { return variable; } - /** @param variable The variable to set */ + /** + * @param variable The variable to set + */ public void setVariable(String variable) { this.variable = variable; } @@ -54,7 +56,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQInputTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQInputTransform.java index b343a1b851b..961fee29914 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQInputTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQInputTransform.java @@ -18,6 +18,7 @@ package org.apache.hop.beam.core.transform; import com.google.api.services.bigquery.model.TableReference; +import javax.annotation.Nullable; import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -32,9 +33,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import java.util.List; - public class BeamBQInputTransform extends PTransform> { // These non-transient privates get serialized to spread across nodes @@ -80,9 +78,7 @@ public PCollection expand(PBegin input) { // Function to convert from Avro to Hop rows // - BQSchemaAndRecordToHopFn toHopFn = - new BQSchemaAndRecordToHopFn( - transformName, rowMetaJson); + BQSchemaAndRecordToHopFn toHopFn = new BQSchemaAndRecordToHopFn(transformName, rowMetaJson); TableReference tableReference = new TableReference(); if (StringUtils.isNotEmpty(projectId)) { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQOutputTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQOutputTransform.java index bdab82f06ac..3c507998b02 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQOutputTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamBQOutputTransform.java @@ -21,6 +21,8 @@ import com.google.api.services.bigquery.model.TableReference; import com.google.api.services.bigquery.model.TableRow; import com.google.api.services.bigquery.model.TableSchema; +import java.util.ArrayList; +import java.util.List; import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -39,9 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; - public class BeamBQOutputTransform extends PTransform, PDone> { // These non-transient privates get serialized to spread across nodes @@ -137,8 +136,7 @@ public PDone expand(PCollection input) { tableSchema.setFields(schemaFields); SerializableFunction formatFunction = - new HopToBQTableRowFn( - transformName, rowMetaJson); + new HopToBQTableRowFn(transformName, rowMetaJson); BigQueryIO.Write.CreateDisposition createDisposition; if (createIfNeeded) { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamHiveMetastoreInputTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamHiveMetastoreInputTransform.java index 03a61ca3dbc..4a24023b194 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamHiveMetastoreInputTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamHiveMetastoreInputTransform.java @@ -21,7 +21,6 @@ import java.util.Map; import java.util.Objects; import javax.annotation.Nullable; - import org.apache.beam.sdk.io.hcatalog.HCatalogIO; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -34,7 +33,6 @@ import org.apache.hop.beam.core.BeamHop; import org.apache.hop.beam.core.HopRow; import org.apache.hop.beam.core.fn.StringToHopFn; -import org.apache.hop.core.Const; import org.apache.hop.core.row.IRowMeta; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,38 +81,38 @@ public PCollection expand(PBegin input) { PCollection output; PCollection tempOutput = - input.apply( - HCatalogIO.read() - .withConfigProperties(configProperties) - .withDatabase(hiveMetastoreDatabase) - .withTable(hiveMetastoreTable)).apply(ParDo.of( - new DoFn() { - @ProcessElement - public void processElement(ProcessContext c) { - String outputStr = ""; - for(int i=0; i < c.element().size(); i++){ - if(i < c.element().size()-1) { - var element = Objects.requireNonNull(c.element()).get(i); - if(element != null){ - outputStr += element.toString() + ";"; - }else{ - outputStr += ";"; - } - }else{ - var element = Objects.requireNonNull(c.element()).get(i); - if(element != null){ - outputStr += element.toString(); + input + .apply( + HCatalogIO.read() + .withConfigProperties(configProperties) + .withDatabase(hiveMetastoreDatabase) + .withTable(hiveMetastoreTable)) + .apply( + ParDo.of( + new DoFn() { + @ProcessElement + public void processElement(ProcessContext c) { + String outputStr = ""; + for (int i = 0; i < c.element().size(); i++) { + if (i < c.element().size() - 1) { + var element = Objects.requireNonNull(c.element()).get(i); + if (element != null) { + outputStr += element.toString() + ";"; + } else { + outputStr += ";"; + } + } else { + var element = Objects.requireNonNull(c.element()).get(i); + if (element != null) { + outputStr += element.toString(); + } + } } + c.output(outputStr); } - } - c.output(outputStr); - } - }) - ); + })); - output = tempOutput.apply( - ParDo.of(new StringToHopFn(transformName, rowMetaJson, ",")) - ); + output = tempOutput.apply(ParDo.of(new StringToHopFn(transformName, rowMetaJson, ","))); return output; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamInputTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamInputTransform.java index ebfab4a98f5..e8df555c9f3 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamInputTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamInputTransform.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.core.transform; +import javax.annotation.Nullable; import org.apache.beam.sdk.io.Compression; import org.apache.beam.sdk.io.TextIO; import org.apache.beam.sdk.metrics.Counter; @@ -31,9 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import java.util.List; - public class BeamInputTransform extends PTransform> { // These non-transient privates get serialized to spread across nodes @@ -73,20 +71,17 @@ public PCollection expand(PBegin input) { TextIO.Read ioRead = TextIO.read().from(inputLocation).withCompression(Compression.UNCOMPRESSED); - StringToHopFn stringToHopFn = - new StringToHopFn( - transformName, rowMetaJson, separator); + StringToHopFn stringToHopFn = new StringToHopFn(transformName, rowMetaJson, separator); - return - input + return input - // We read a bunch of Strings, one per line basically - // - .apply(transformName + " READ FILE", ioRead) + // We read a bunch of Strings, one per line basically + // + .apply(transformName + " READ FILE", ioRead) - // We need to transform these lines into Hop fields - // - .apply(transformName, ParDo.of(stringToHopFn)); + // We need to transform these lines into Hop fields + // + .apply(transformName, ParDo.of(stringToHopFn)); } catch (Exception e) { numErrors.inc(); LOG.error("Error in beam input transform", e); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamKafkaInputTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamKafkaInputTransform.java index 837eb700d16..d1b2790b456 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamKafkaInputTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamKafkaInputTransform.java @@ -17,6 +17,11 @@ package org.apache.hop.beam.core.transform; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; import org.apache.avro.generic.GenericRecord; import org.apache.beam.sdk.io.kafka.ConfluentSchemaRegistryDeserializerProvider; import org.apache.beam.sdk.io.kafka.KafkaIO; @@ -41,12 +46,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class BeamKafkaInputTransform extends PTransform> { // These non-transient privates get serialized to spread across nodes @@ -210,9 +209,7 @@ public PCollection expand(PBegin input) { output = kafkaConsumerOutput.apply( - ParDo.of( - new KVStringGenericRecordToHopRowFn( - transformName, rowMetaJson))); + ParDo.of(new KVStringGenericRecordToHopRowFn(transformName, rowMetaJson))); return output; } else if ("String".equalsIgnoreCase(messageType)) { @@ -248,9 +245,7 @@ public PCollection expand(PBegin input) { output = kafkaConsumerOutput.apply( - ParDo.of( - new KVStringStringToHopRowFn( - transformName, rowMetaJson))); + ParDo.of(new KVStringStringToHopRowFn(transformName, rowMetaJson))); } else { throw new HopException( @@ -278,9 +273,7 @@ public static final class KVStringStringToHopRowFn extends DoFn, PDone> { // These non-transient privates get serialized to spread across nodes @@ -161,51 +160,45 @@ public PDone expand(PCollection input) { // Write to Kafka topic with or // IValueMeta messageValueMeta = rowMeta.getValueMeta(messageIndex); - if (messageValueMeta.getType()==IValueMeta.TYPE_STRING) { + if (messageValueMeta.getType() == IValueMeta.TYPE_STRING) { // Convert the input stream of HopRows to KV for the keys and messages // HopRowToKVStringStringFn hopRowToKVStringStringFn = - new HopRowToKVStringStringFn( - transformName, - keyIndex, - messageIndex, - rowMetaJson); + new HopRowToKVStringStringFn(transformName, keyIndex, messageIndex, rowMetaJson); // Then write to Kafka topic // KafkaIO.Write stringsToKafka = - KafkaIO.write() - .withBootstrapServers(bootstrapServers) - .withTopic(topic) - .withKeySerializer(StringSerializer.class) - .withValueSerializer(StringSerializer.class) - .withProducerConfigUpdates(producerConfigUpdates); + KafkaIO.write() + .withBootstrapServers(bootstrapServers) + .withTopic(topic) + .withKeySerializer(StringSerializer.class) + .withValueSerializer(StringSerializer.class) + .withProducerConfigUpdates(producerConfigUpdates); PCollection> kvpCollection = - input.apply(ParDo.of(hopRowToKVStringStringFn)); + input.apply(ParDo.of(hopRowToKVStringStringFn)); return kvpCollection.apply(stringsToKafka); - } else if (messageValueMeta.getType()==IValueMeta.TYPE_AVRO) { - // Convert the input stream of HopRows to KV for the keys and messages. + } else if (messageValueMeta.getType() == IValueMeta.TYPE_AVRO) { + // Convert the input stream of HopRows to KV for the keys and + // messages. // HopRowToKVStringGenericRecordFn hopRowToKVStringGenericRecordFn = - new HopRowToKVStringGenericRecordFn( - transformName, - keyIndex, - messageIndex, - rowMetaJson); + new HopRowToKVStringGenericRecordFn(transformName, keyIndex, messageIndex, rowMetaJson); KafkaIO.Write stringsToKafka = - KafkaIO.write() - .withBootstrapServers(bootstrapServers) - .withTopic(topic) - .withKeySerializer(StringSerializer.class) - .withValueSerializer((Class)KafkaAvroSerializer.class) - .withProducerConfigUpdates(producerConfigUpdates); + KafkaIO.write() + .withBootstrapServers(bootstrapServers) + .withTopic(topic) + .withKeySerializer(StringSerializer.class) + .withValueSerializer((Class) KafkaAvroSerializer.class) + .withProducerConfigUpdates(producerConfigUpdates); PCollection> kvpCollection = - input.apply(ParDo.of(hopRowToKVStringGenericRecordFn)); + input.apply(ParDo.of(hopRowToKVStringGenericRecordFn)); return kvpCollection.apply(stringsToKafka); } else { - throw new HopException("Hop only supports sending String or Avro Record values as Kafka messages"); + throw new HopException( + "Hop only supports sending String or Avro Record values as Kafka messages"); } } catch (Exception e) { numErrors.inc(); @@ -214,7 +207,6 @@ public PDone expand(PCollection input) { } } - private static final class GenericRecordCoder extends AtomicCoder { public static GenericRecordCoder of() { return new GenericRecordCoder(); @@ -236,14 +228,16 @@ public GenericRecord decode(InputStream inStream) throws IOException { } } - private static final class HopRowToKVStringGenericRecordFn extends DoFn> { + private static final class HopRowToKVStringGenericRecordFn + extends DoFn> { private String rowMetaJson; private String transformName; private int keyIndex; private int valueIndex; - private static final Logger LOG = LoggerFactory.getLogger(HopRowToKVStringGenericRecordFn.class); + private static final Logger LOG = + LoggerFactory.getLogger(HopRowToKVStringGenericRecordFn.class); private final Counter numErrors = Metrics.counter("main", "BeamKafkaProducerTransformErrors"); private IRowMeta rowMeta; @@ -251,10 +245,7 @@ private static final class HopRowToKVStringGenericRecordFn extends DoFn function", e); - throw new RuntimeException("Error in setup of HopRow to KV function", e); + throw new RuntimeException( + "Error in setup of HopRow to KV function", e); } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamOutputTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamOutputTransform.java index 0f71f3956f8..335321c2b39 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamOutputTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamOutputTransform.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.core.transform; +import java.io.File; import org.apache.beam.sdk.io.TextIO; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -33,9 +34,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.util.List; - public class BeamOutputTransform extends PTransform, PDone> { // These non-transient privates get serialized to spread across nodes @@ -94,11 +92,7 @@ public PDone expand(PCollection input) { transformName, ParDo.of( new HopToStringFn( - transformName, - outputLocation, - separator, - enclosure, - rowMetaJson))); + transformName, outputLocation, separator, enclosure, rowMetaJson))); // We need to transform these lines into a file and then we're PDone // @@ -145,7 +139,9 @@ public String getTransformName() { return transformName; } - /** @param transformName The transformName to set */ + /** + * @param transformName The transformName to set + */ public void setTransformName(String transformName) { this.transformName = transformName; } @@ -159,7 +155,9 @@ public String getOutputLocation() { return outputLocation; } - /** @param outputLocation The outputLocation to set */ + /** + * @param outputLocation The outputLocation to set + */ public void setOutputLocation(String outputLocation) { this.outputLocation = outputLocation; } @@ -173,7 +171,9 @@ public String getFilePrefix() { return filePrefix; } - /** @param filePrefix The filePrefix to set */ + /** + * @param filePrefix The filePrefix to set + */ public void setFilePrefix(String filePrefix) { this.filePrefix = filePrefix; } @@ -187,7 +187,9 @@ public String getFileSuffix() { return fileSuffix; } - /** @param fileSuffix The fileSuffix to set */ + /** + * @param fileSuffix The fileSuffix to set + */ public void setFileSuffix(String fileSuffix) { this.fileSuffix = fileSuffix; } @@ -201,7 +203,9 @@ public String getSeparator() { return separator; } - /** @param separator The separator to set */ + /** + * @param separator The separator to set + */ public void setSeparator(String separator) { this.separator = separator; } @@ -215,7 +219,9 @@ public String getEnclosure() { return enclosure; } - /** @param enclosure The enclosure to set */ + /** + * @param enclosure The enclosure to set + */ public void setEnclosure(String enclosure) { this.enclosure = enclosure; } @@ -229,7 +235,9 @@ public String getRowMetaJson() { return rowMetaJson; } - /** @param rowMetaJson The inputRowMetaJson to set */ + /** + * @param rowMetaJson The inputRowMetaJson to set + */ public void setRowMetaJson(String rowMetaJson) { this.rowMetaJson = rowMetaJson; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamPublishTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamPublishTransform.java index 3ef8afd662f..0fb9bb61d3d 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamPublishTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamPublishTransform.java @@ -36,8 +36,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class BeamPublishTransform extends PTransform, PDone> { // These non-transient privates get serialized to spread across nodes @@ -107,9 +105,7 @@ public PDone expand(PCollection input) { // if (BeamDefaults.PUBSUB_MESSAGE_TYPE_STRING.equalsIgnoreCase(messageType)) { - PublishStringsFn stringsFn = - new PublishStringsFn( - transformName, fieldIndex, rowMetaJson); + PublishStringsFn stringsFn = new PublishStringsFn(transformName, fieldIndex, rowMetaJson); PCollection stringPCollection = input.apply(transformName, ParDo.of(stringsFn)); PDone done = PubsubIO.writeStrings().to(topic).expand(stringPCollection); return done; @@ -119,8 +115,7 @@ public PDone expand(PCollection input) { // if (BeamDefaults.PUBSUB_MESSAGE_TYPE_MESSAGE.equalsIgnoreCase(messageType)) { PublishMessagesFn messagesFn = - new PublishMessagesFn( - transformName, fieldIndex, rowMetaJson); + new PublishMessagesFn(transformName, fieldIndex, rowMetaJson); PCollection messagesPCollection = input.apply(ParDo.of(messagesFn)); PDone done = PubsubIO.writeMessages().to(topic).expand(messagesPCollection); return done; @@ -144,7 +139,9 @@ public String getTransformName() { return transformName; } - /** @param transformName The transformName to set */ + /** + * @param transformName The transformName to set + */ public void setTransformName(String transformName) { this.transformName = transformName; } @@ -158,7 +155,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -172,7 +171,9 @@ public String getMessageType() { return messageType; } - /** @param messageType The messageType to set */ + /** + * @param messageType The messageType to set + */ public void setMessageType(String messageType) { this.messageType = messageType; } @@ -186,7 +187,9 @@ public String getMessageField() { return messageField; } - /** @param messageField The messageField to set */ + /** + * @param messageField The messageField to set + */ public void setMessageField(String messageField) { this.messageField = messageField; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamRowHandler.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamRowHandler.java index c65beda2ba5..87dac2a9ec8 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamRowHandler.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamRowHandler.java @@ -18,6 +18,7 @@ package org.apache.hop.beam.core.transform; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -26,8 +27,6 @@ import org.apache.hop.pipeline.transform.IRowHandler; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.List; - /** * Reading and writing rows from/to row sets is simpler in a Beam context since we're using a single * thread. No locking is required and so on. diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamSubscribeTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamSubscribeTransform.java index 26f51554b80..01ec2e43805 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamSubscribeTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/BeamSubscribeTransform.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.core.transform; +import javax.annotation.Nullable; import org.apache.beam.sdk.io.gcp.pubsub.PubsubIO; import org.apache.beam.sdk.io.gcp.pubsub.PubsubMessage; import org.apache.beam.sdk.metrics.Counter; @@ -37,9 +38,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import java.util.List; - /** A transform to read data from a Google Cloud Platform PubSub topic */ public class BeamSubscribeTransform extends PTransform> { @@ -110,10 +108,7 @@ public PCollection expand(PBegin input) { PCollection stringPCollection = stringRead.expand(input); output = stringPCollection.apply( - transformName, - ParDo.of( - new StringToHopRowFn( - transformName, rowMetaJson))); + transformName, ParDo.of(new StringToHopRowFn(transformName, rowMetaJson))); } else if (BeamDefaults.PUBSUB_MESSAGE_TYPE_MESSAGE.equalsIgnoreCase(messageType)) { @@ -126,10 +121,7 @@ public PCollection expand(PBegin input) { PCollection messagesPCollection = messageRead.expand(input); output = messagesPCollection.apply( - transformName, - ParDo.of( - new PubsubMessageToHopRowFn( - transformName, rowMetaJson))); + transformName, ParDo.of(new PubsubMessageToHopRowFn(transformName, rowMetaJson))); } else { throw new RuntimeException("Unsupported message type: " + messageType); @@ -152,7 +144,9 @@ public String getTransformName() { return transformName; } - /** @param transformName The transformName to set */ + /** + * @param transformName The transformName to set + */ public void setTransformName(String transformName) { this.transformName = transformName; } @@ -166,7 +160,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -180,7 +176,9 @@ public String getMessageType() { return messageType; } - /** @param messageType The messageType to set */ + /** + * @param messageType The messageType to set + */ public void setMessageType(String messageType) { this.messageType = messageType; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/GroupByTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/GroupByTransform.java index 1d74b6ac268..5b0f163629a 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/GroupByTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/GroupByTransform.java @@ -34,8 +34,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class GroupByTransform extends PTransform, PCollection> { // The non-transient methods are serializing @@ -94,12 +92,7 @@ public PCollection expand(PCollection input) { // PCollection> groupSubjects = input.apply( - ParDo.of( - new HopKeyValueFn( - rowMetaJson, - groupFields, - subjects, - transformName))); + ParDo.of(new HopKeyValueFn(rowMetaJson, groupFields, subjects, transformName))); // Now we need to aggregate the groups with a Combine GroupByKey byKey = GroupByKey.create(); @@ -139,7 +132,9 @@ public String getRowMetaJson() { return rowMetaJson; } - /** @param rowMetaJson The inputRowMetaJson to set */ + /** + * @param rowMetaJson The inputRowMetaJson to set + */ public void setRowMetaJson(String rowMetaJson) { this.rowMetaJson = rowMetaJson; } @@ -153,7 +148,9 @@ public String[] getGroupFields() { return groupFields; } - /** @param groupFields The groupFields to set */ + /** + * @param groupFields The groupFields to set + */ public void setGroupFields(String[] groupFields) { this.groupFields = groupFields; } @@ -167,7 +164,9 @@ public String[] getSubjects() { return subjects; } - /** @param subjects The subjects to set */ + /** + * @param subjects The subjects to set + */ public void setSubjects(String[] subjects) { this.subjects = subjects; } @@ -181,7 +180,9 @@ public String[] getAggregations() { return aggregations; } - /** @param aggregations The aggregations to set */ + /** + * @param aggregations The aggregations to set + */ public void setAggregations(String[] aggregations) { this.aggregations = aggregations; } @@ -195,7 +196,9 @@ public String[] getResultFields() { return resultFields; } - /** @param resultFields The resultFields to set */ + /** + * @param resultFields The resultFields to set + */ public void setResultFields(String[] resultFields) { this.resultFields = resultFields; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/SerializerType.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/SerializerType.java index 84c26b22903..097c0e85fb9 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/SerializerType.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/SerializerType.java @@ -29,80 +29,83 @@ import org.apache.kafka.common.serialization.StringSerializer; public enum SerializerType { - String( - "String", - IValueMeta.TYPE_STRING, - StringSerializer.class.getName(), - StringDeserializer.class.getName()), - Integer( - "Integer", - IValueMeta.TYPE_INTEGER, - LongSerializer.class.getName(), - LongDeserializer.class.getName()), - Binary( - "Binary", - IValueMeta.TYPE_BINARY, - ByteArraySerializer.class.getName(), - ByteArrayDeserializer.class.getName()), - Number( - "Number", - IValueMeta.TYPE_NUMBER, - DoubleSerializer.class.getName(), - DoubleDeserializer.class.getName()), - Avro( - "Avro", - IValueMeta.TYPE_AVRO, - "io.confluent.kafka.serializers.KafkaAvroSerializer", - "io.confluent.kafka.serializers.KafkaAvroDeserializer"); + String( + "String", + IValueMeta.TYPE_STRING, + StringSerializer.class.getName(), + StringDeserializer.class.getName()), + Integer( + "Integer", + IValueMeta.TYPE_INTEGER, + LongSerializer.class.getName(), + LongDeserializer.class.getName()), + Binary( + "Binary", + IValueMeta.TYPE_BINARY, + ByteArraySerializer.class.getName(), + ByteArrayDeserializer.class.getName()), + Number( + "Number", + IValueMeta.TYPE_NUMBER, + DoubleSerializer.class.getName(), + DoubleDeserializer.class.getName()), + Avro( + "Avro", + IValueMeta.TYPE_AVRO, + "io.confluent.kafka.serializers.KafkaAvroSerializer", + "io.confluent.kafka.serializers.KafkaAvroDeserializer"); - private final String value; - private final int valueMetaInterfaceType; - private String kafkaSerializerClass; - private String kafkaDeserializerClass; + private final String value; + private final int valueMetaInterfaceType; + private String kafkaSerializerClass; + private String kafkaDeserializerClass; - SerializerType( - String value, - int valueMetaInterfaceType, - String kafkaSerializerClass, - String kafkaDeserializerClass) { - this.value = value; - this.valueMetaInterfaceType = valueMetaInterfaceType; - this.kafkaSerializerClass = kafkaSerializerClass; - this.kafkaDeserializerClass = kafkaDeserializerClass; - } + SerializerType( + String value, + int valueMetaInterfaceType, + String kafkaSerializerClass, + String kafkaDeserializerClass) { + this.value = value; + this.valueMetaInterfaceType = valueMetaInterfaceType; + this.kafkaSerializerClass = kafkaSerializerClass; + this.kafkaDeserializerClass = kafkaDeserializerClass; + } - @Override - public String toString() { - return value; - } + @Override + public String toString() { + return value; + } - boolean isEqual(String value) { - return this.value.equals(value); - } + boolean isEqual(String value) { + return this.value.equals(value); + } - public int getIValueMetaType() { - return valueMetaInterfaceType; - } + public int getIValueMetaType() { + return valueMetaInterfaceType; + } - public String getKafkaSerializerClass() { - return kafkaSerializerClass; - } + public String getKafkaSerializerClass() { + return kafkaSerializerClass; + } - public String getKafkaDeserializerClass() { - return kafkaDeserializerClass; - } + public String getKafkaDeserializerClass() { + return kafkaDeserializerClass; + } - public static SerializerType fromValueMeta(IValueMeta vmi) { - if (vmi != null) { - for (SerializerType t : SerializerType.values()) { - if (vmi.getType() == t.getIValueMetaType()) { - return t; - } + public static SerializerType fromValueMeta(IValueMeta vmi) { + if (vmi != null) { + for (SerializerType t : SerializerType.values()) { + if (vmi.getType() == t.getIValueMetaType()) { + return t; } - throw new IllegalArgumentException( - "There is no known serializer type for value "+vmi.getName()+" and type "+vmi.getType()); } - // if it's null, just default to string - return String; + throw new IllegalArgumentException( + "There is no known serializer type for value " + + vmi.getName() + + " and type " + + vmi.getType()); } - } \ No newline at end of file + // if it's null, just default to string + return String; + } +} diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBaseFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBaseFn.java index f47fe1d26d5..04fac07ee25 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBaseFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBaseFn.java @@ -19,6 +19,12 @@ package org.apache.hop.beam.core.transform; import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.transforms.windowing.BoundedWindow; import org.apache.beam.sdk.values.TupleTag; @@ -57,13 +63,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; - public abstract class TransformBaseFn extends DoFn { protected static final Logger LOG = LoggerFactory.getLogger(TransformBaseFn.class); @@ -264,7 +263,7 @@ public void run() { } protected void registerExecutingTransform(Pipeline pipeline) { - if (executionInfoLocation==null) { + if (executionInfoLocation == null) { return; } @@ -277,7 +276,7 @@ protected void registerExecutingTransform(Pipeline pipeline) { execution.setParentId(parentLogChannelId); executionInfoLocation.getExecutionInfoLocation().registerExecution(execution); ExecutionState transformState = - ExecutionStateBuilder.fromTransform(pipeline, transformComponent).build(); + ExecutionStateBuilder.fromTransform(pipeline, transformComponent).build(); transformState.setParentId(parentLogChannelId); executionInfoLocation.getExecutionInfoLocation().updateExecutionState(transformState); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBatchTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBatchTransform.java index b6ac1134d99..4f0df61a02e 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBatchTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformBatchTransform.java @@ -17,6 +17,14 @@ package org.apache.hop.beam.core.transform; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Queue; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicLong; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.ParDo; @@ -65,15 +73,6 @@ import org.apache.hop.pipeline.transforms.injector.InjectorField; import org.apache.hop.pipeline.transforms.injector.InjectorMeta; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Queue; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.atomic.AtomicLong; - public class TransformBatchTransform extends TransformTransform { public TransformBatchTransform() { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformFn.java index b7d6dcf9690..290fdf36676 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformFn.java @@ -19,6 +19,8 @@ package org.apache.hop.beam.core.transform; import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.ArrayList; +import java.util.List; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -62,9 +64,6 @@ import org.joda.time.Instant; import org.json.simple.parser.ParseException; -import java.util.ArrayList; -import java.util.List; - public class TransformFn extends TransformBaseFn { private static final long serialVersionUID = 95700000000000001L; @@ -434,7 +433,7 @@ public void rowReadEvent(IRowMeta rowMeta, Object[] row) throws HopTransformExce // Change the row handler // for (TransformMetaDataCombi c : pipeline.getTransforms()) { - ((BaseTransform)c.transform).setRowHandler(new BeamRowHandler((BaseTransform) c.transform)); + ((BaseTransform) c.transform).setRowHandler(new BeamRowHandler((BaseTransform) c.transform)); } executor = new SingleThreadedPipelineExecutor(pipeline); @@ -646,7 +645,10 @@ public void tearDown() { } } catch (Exception e) { LOG.error( - "Error sending row samples to execution info location for transform " + transformName+" (non-fatal)", e); + "Error sending row samples to execution info location for transform " + + transformName + + " (non-fatal)", + e); } } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformTransform.java index ba69eb03b6a..5f0cad31e40 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/transform/TransformTransform.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.core.transform; +import java.util.ArrayList; +import java.util.List; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.PTransform; @@ -33,9 +35,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; - public class TransformTransform extends PTransform, PCollectionTuple> { protected List variableValues; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/util/HopBeamUtil.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/util/HopBeamUtil.java index bdc8a5960c8..597e2f5efe1 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/util/HopBeamUtil.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/util/HopBeamUtil.java @@ -48,6 +48,7 @@ public static final String createMainInputTupleId(String transformName) { /** * Create a copy but don't over allocate objects in the target row. + * * @param hopRow * @param rowMeta * @return diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineEngine.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineEngine.java index 04960219d90..7798f7f71e4 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineEngine.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineEngine.java @@ -17,6 +17,19 @@ package org.apache.hop.beam.engines; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.beam.runners.core.metrics.DefaultMetricResults; import org.apache.beam.runners.dataflow.DataflowRunner; import org.apache.beam.runners.direct.DirectRunner; @@ -79,26 +92,13 @@ import org.apache.hop.workflow.engine.IWorkflowEngine; import org.joda.time.Duration; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.atomic.AtomicBoolean; - public abstract class BeamPipelineEngine extends Variables implements IPipelineEngine { static MetricResults EMPTY_METRIC_RESULTS = new DefaultMetricResults( Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); + /** * Constant specifying a filename containing XML to inject into a ZIP file created during resource * export. diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineRunConfiguration.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineRunConfiguration.java index 99bac5f7118..d0f1b20cc26 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineRunConfiguration.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/BeamPipelineRunConfiguration.java @@ -42,7 +42,6 @@ public abstract class BeamPipelineRunConfiguration extends EmptyPipelineRunConfi @HopMetadataProperty protected String tempLocation; - @GuiWidgetElement( order = "90050-general-options", parentId = PipelineRunConfiguration.GUI_PLUGIN_ELEMENT_PARENT_ID, @@ -97,7 +96,9 @@ public String getUserAgent() { return userAgent; } - /** @param userAgent The userAgent to set */ + /** + * @param userAgent The userAgent to set + */ public void setUserAgent(String userAgent) { this.userAgent = userAgent; } @@ -112,7 +113,9 @@ public String getTempLocation() { return tempLocation; } - /** @param tempLocation The tempLocation to set */ + /** + * @param tempLocation The tempLocation to set + */ public void setTempLocation(String tempLocation) { this.tempLocation = tempLocation; } @@ -127,7 +130,9 @@ public String getStreamingHopTransformsFlushInterval() { return streamingHopTransformsFlushInterval; } - /** @param streamingHopTransformsFlushInterval The streamingHopTransformsFlushInterval to set */ + /** + * @param streamingHopTransformsFlushInterval The streamingHopTransformsFlushInterval to set + */ public void setStreamingHopTransformsFlushInterval(String streamingHopTransformsFlushInterval) { this.streamingHopTransformsFlushInterval = streamingHopTransformsFlushInterval; } @@ -142,7 +147,9 @@ public String getStreamingHopTransformsBufferSize() { return streamingHopTransformsBufferSize; } - /** @param streamingHopTransformsBufferSize The streamingHopTransformsBufferSize to set */ + /** + * @param streamingHopTransformsBufferSize The streamingHopTransformsBufferSize to set + */ public void setStreamingHopTransformsBufferSize(String streamingHopTransformsBufferSize) { this.streamingHopTransformsBufferSize = streamingHopTransformsBufferSize; } @@ -157,7 +164,9 @@ public String getFatJar() { return fatJar; } - /** @param fatJar The fatJar to set */ + /** + * @param fatJar The fatJar to set + */ public void setFatJar(String fatJar) { this.fatJar = fatJar; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineEngine.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineEngine.java index a43d5633f0a..25bfa38966a 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineEngine.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineEngine.java @@ -64,15 +64,17 @@ public void validatePipelineRunConfigurationClass( @Override protected void updatePipelineState(IExecutionInfoLocation iLocation) throws HopException { ExecutionState executionState = - ExecutionStateBuilder.fromExecutor(BeamDataFlowPipelineEngine.this, -1).build(); + ExecutionStateBuilder.fromExecutor(BeamDataFlowPipelineEngine.this, -1).build(); // Add Dataflow specific information to the execution state. // This can then be picked up // - if (beamPipelineResults!=null) { + if (beamPipelineResults != null) { DataflowPipelineJob dataflowPipelineJob = (DataflowPipelineJob) beamPipelineResults; executionState.getDetails().put(DETAIL_DATAFLOW_JOB_ID, dataflowPipelineJob.getJobId()); - executionState.getDetails().put(DETAIL_DATAFLOW_PROJECT_ID, dataflowPipelineJob.getProjectId()); + executionState + .getDetails() + .put(DETAIL_DATAFLOW_PROJECT_ID, dataflowPipelineJob.getProjectId()); executionState.getDetails().put(DETAIL_DATAFLOW_REGION, dataflowPipelineJob.getRegion()); } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineRunConfiguration.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineRunConfiguration.java index bf5537d4254..fda9d8a04e5 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineRunConfiguration.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/BeamDataFlowPipelineRunConfiguration.java @@ -17,6 +17,10 @@ package org.apache.hop.beam.engines.dataflow; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.apache.beam.runners.dataflow.options.DataflowPipelineOptions; import org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions; import org.apache.beam.sdk.options.PipelineOptions; @@ -34,11 +38,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.pipeline.config.PipelineRunConfiguration; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - @GuiPlugin public class BeamDataFlowPipelineRunConfiguration extends BeamPipelineRunConfiguration implements IBeamPipelineEngineRunConfiguration, IVariables, Cloneable { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/DataFlowJvmStart.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/DataFlowJvmStart.java index 647d750f18e..10dc2ac9d02 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/DataFlowJvmStart.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/dataflow/DataFlowJvmStart.java @@ -18,11 +18,10 @@ package org.apache.hop.beam.engines.dataflow; import com.google.auto.service.AutoService; +import java.security.Security; import org.apache.beam.sdk.harness.JvmInitializer; import org.apache.beam.sdk.options.PipelineOptions; -import java.security.Security; - /** * This class will be picked up and used at the very start of a DataFlow JVM. As such it allows us * to disable certain security algorithms so that secure connections automatically pick up the right diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineRunConfiguration.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineRunConfiguration.java index 9d883aacc8c..8c5d0add93f 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineRunConfiguration.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineRunConfiguration.java @@ -117,7 +117,9 @@ public String getNumberOfWorkers() { return numberOfWorkers; } - /** @param numberOfWorkers The numberOfWorkers to set */ + /** + * @param numberOfWorkers The numberOfWorkers to set + */ public void setNumberOfWorkers(String numberOfWorkers) { this.numberOfWorkers = numberOfWorkers; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineRunConfiguration.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineRunConfiguration.java index b637ed72341..3b3b537a458 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineRunConfiguration.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineRunConfiguration.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.engines.flink; +import java.util.Arrays; import org.apache.beam.runners.flink.FlinkPipelineOptions; import org.apache.beam.sdk.options.PipelineOptions; import org.apache.beam.sdk.options.PipelineOptionsFactory; @@ -35,8 +36,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.pipeline.config.PipelineRunConfiguration; -import java.util.Arrays; - @GuiPlugin public class BeamFlinkPipelineRunConfiguration extends BeamPipelineRunConfiguration implements IBeamPipelineEngineRunConfiguration, IVariables, Cloneable { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java index 786860652c2..2b4d5e9d8b8 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java @@ -17,6 +17,14 @@ package org.apache.hop.beam.gui; +import java.io.File; +import java.io.OutputStream; +import java.lang.reflect.InvocationTargetException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.beam.runners.dataflow.DataflowPipelineJob; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -46,15 +54,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; -import java.io.File; -import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - @GuiPlugin public class HopBeamGuiPlugin { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/WelcomeBeam.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/WelcomeBeam.java index 01b36a2311b..04e60e55c74 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/WelcomeBeam.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/WelcomeBeam.java @@ -18,6 +18,7 @@ package org.apache.hop.beam.gui; +import java.lang.reflect.Method; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.plugin.GuiElementType; import org.apache.hop.core.gui.plugin.GuiPlugin; @@ -40,8 +41,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; -import java.lang.reflect.Method; - @GuiPlugin public class WelcomeBeam { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FieldDefinition.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FieldDefinition.java index db445c1126d..f876bd7a188 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FieldDefinition.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FieldDefinition.java @@ -17,13 +17,12 @@ package org.apache.hop.beam.metadata; +import java.io.Serializable; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.io.Serializable; - public class FieldDefinition implements Serializable { @HopMetadataProperty private String name; @@ -70,7 +69,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -84,7 +85,9 @@ public String getHopType() { return hopType; } - /** @param hopType The hopType to set */ + /** + * @param hopType The hopType to set + */ public void setHopType(String hopType) { this.hopType = hopType; } @@ -98,7 +101,9 @@ public int getLength() { return length; } - /** @param length The length to set */ + /** + * @param length The length to set + */ public void setLength(int length) { this.length = length; } @@ -112,7 +117,9 @@ public int getPrecision() { return precision; } - /** @param precision The precision to set */ + /** + * @param precision The precision to set + */ public void setPrecision(int precision) { this.precision = precision; } @@ -126,7 +133,9 @@ public String getFormatMask() { return formatMask; } - /** @param formatMask The formatMask to set */ + /** + * @param formatMask The formatMask to set + */ public void setFormatMask(String formatMask) { this.formatMask = formatMask; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinition.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinition.java index 70009bff602..5d36a60294c 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinition.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinition.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.metadata; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopPluginException; @@ -28,10 +31,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "file-definition", name = "Beam File Definition", @@ -73,17 +72,18 @@ public IRowMeta getRowMeta() throws HopPluginException { return rowMeta; } - - public void validate() throws HopException { + public void validate() throws HopException { if (StringUtils.isEmpty(separator)) { - throw new HopException("Please specify a separator in file definition "+name); + throw new HopException("Please specify a separator in file definition " + name); } for (IValueMeta valueMeta : getRowMeta().getValueMetaList()) { if (StringUtils.isEmpty(valueMeta.getName())) { - throw new HopException("File definition "+name+" should not contain fields without a name"); + throw new HopException( + "File definition " + name + " should not contain fields without a name"); } - if (valueMeta.getType()==IValueMeta.TYPE_NONE) { - throw new HopException("File definition "+name+" should not contain fields without a type"); + if (valueMeta.getType() == IValueMeta.TYPE_NONE) { + throw new HopException( + "File definition " + name + " should not contain fields without a type"); } } } @@ -97,7 +97,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -111,7 +113,9 @@ public List getFieldDefinitions() { return fieldDefinitions; } - /** @param fieldDefinitions The fieldDefinitions to set */ + /** + * @param fieldDefinitions The fieldDefinitions to set + */ public void setFieldDefinitions(List fieldDefinitions) { this.fieldDefinitions = fieldDefinitions; } @@ -125,7 +129,9 @@ public String getSeparator() { return separator; } - /** @param separator The separator to set */ + /** + * @param separator The separator to set + */ public void setSeparator(String separator) { this.separator = separator; } @@ -139,9 +145,10 @@ public String getEnclosure() { return enclosure; } - /** @param enclosure The enclosure to set */ + /** + * @param enclosure The enclosure to set + */ public void setEnclosure(String enclosure) { this.enclosure = enclosure; } - } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinitionEditor.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinitionEditor.java index e7af4f86e62..4dae7e75d94 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinitionEditor.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/FileDefinitionEditor.java @@ -16,6 +16,7 @@ */ package org.apache.hop.beam.metadata; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.core.variables.Variables; @@ -35,8 +36,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class FileDefinitionEditor extends MetadataEditor { private static final Class PKG = FileDefinitionEditor.class; // For Translator diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/JobParameter.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/JobParameter.java index 5b3588eddf0..059a14b5583 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/JobParameter.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/metadata/JobParameter.java @@ -41,7 +41,9 @@ public String getVariable() { return variable; } - /** @param variable The variable to set */ + /** + * @param variable The variable to set + */ public void setVariable(String variable) { this.variable = variable; } @@ -55,7 +57,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/HopPipelineMetaToBeamPipelineConverter.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/HopPipelineMetaToBeamPipelineConverter.java index 858d2ba3e9a..5a435029153 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/HopPipelineMetaToBeamPipelineConverter.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/HopPipelineMetaToBeamPipelineConverter.java @@ -17,6 +17,13 @@ package org.apache.hop.beam.pipeline; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.beam.runners.dataflow.DataflowRunner; import org.apache.beam.runners.direct.DirectRunner; import org.apache.beam.runners.flink.FlinkRunner; @@ -63,14 +70,6 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.IndexView; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class HopPipelineMetaToBeamPipelineConverter { protected final String runConfigName; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/fatjar/FatJarBuilder.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/fatjar/FatJarBuilder.java index 0200dd7f5c5..b4d23c9d64b 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/fatjar/FatJarBuilder.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/fatjar/FatJarBuilder.java @@ -17,15 +17,6 @@ package org.apache.hop.beam.pipeline.fatjar; -import org.apache.commons.io.IOUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.plugins.JarCache; -import org.apache.hop.core.variables.IVariables; -import org.jboss.jandex.IndexWriter; -import org.jboss.jandex.Indexer; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -41,6 +32,14 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipInputStream; +import org.apache.commons.io.IOUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.plugins.JarCache; +import org.apache.hop.core.variables.IVariables; +import org.jboss.jandex.IndexWriter; +import org.jboss.jandex.Indexer; public class FatJarBuilder { @@ -274,7 +273,9 @@ public String getTargetJarFile() { return targetJarFile; } - /** @param targetJarFile The targetJarFile to set */ + /** + * @param targetJarFile The targetJarFile to set + */ public void setTargetJarFile(String targetJarFile) { this.targetJarFile = targetJarFile; } @@ -288,7 +289,9 @@ public List getJarFiles() { return jarFiles; } - /** @param jarFiles The jarFiles to set */ + /** + * @param jarFiles The jarFiles to set + */ public void setJarFiles(List jarFiles) { this.jarFiles = jarFiles; } @@ -302,7 +305,9 @@ public String getExtraTransformPluginClasses() { return extraTransformPluginClasses; } - /** @param extraTransformPluginClasses The extraTransformPluginClasses to set */ + /** + * @param extraTransformPluginClasses The extraTransformPluginClasses to set + */ public void setExtraTransformPluginClasses(String extraTransformPluginClasses) { this.extraTransformPluginClasses = extraTransformPluginClasses; } @@ -316,7 +321,9 @@ public String getExtraXpPluginClasses() { return extraXpPluginClasses; } - /** @param extraXpPluginClasses The extraXpPluginClasses to set */ + /** + * @param extraXpPluginClasses The extraXpPluginClasses to set + */ public void setExtraXpPluginClasses(String extraXpPluginClasses) { this.extraXpPluginClasses = extraXpPluginClasses; } @@ -330,7 +337,9 @@ public Map getFileContentMap() { return fileContentMap; } - /** @param fileContentMap The fileContentMap to set */ + /** + * @param fileContentMap The fileContentMap to set + */ public void setFileContentMap(Map fileContentMap) { this.fileContentMap = fileContentMap; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamGenericTransformHandler.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamGenericTransformHandler.java index 3c3896e7342..ad3e86bf696 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamGenericTransformHandler.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamGenericTransformHandler.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.pipeline.handler; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.coders.KvCoder; import org.apache.beam.sdk.coders.StringUtf8Coder; @@ -56,10 +59,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - public class BeamGenericTransformHandler extends BeamBaseTransformHandler implements IBeamPipelineTransformHandler { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamMergeJoinTransformHandler.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamMergeJoinTransformHandler.java index e132d80bbbb..72f322facfc 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamMergeJoinTransformHandler.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamMergeJoinTransformHandler.java @@ -17,6 +17,10 @@ package org.apache.hop.beam.pipeline.handler; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.extensions.joinlibrary.Join; import org.apache.beam.sdk.transforms.DoFn; @@ -28,7 +32,6 @@ import org.apache.hop.beam.core.fn.MergeJoinAssemblerFn; import org.apache.hop.beam.engines.IBeamPipelineEngineRunConfiguration; import org.apache.hop.beam.pipeline.IBeamPipelineTransformHandler; -import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.row.IRowMeta; @@ -41,11 +44,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.mergejoin.MergeJoinMeta; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - public class BeamMergeJoinTransformHandler extends BeamBaseTransformHandler implements IBeamPipelineTransformHandler { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamRowGeneratorTransformHandler.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamRowGeneratorTransformHandler.java index fd402064662..8e0e2528cdc 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamRowGeneratorTransformHandler.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/pipeline/handler/BeamRowGeneratorTransformHandler.java @@ -17,6 +17,10 @@ package org.apache.hop.beam.pipeline.handler; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.io.Read; import org.apache.beam.sdk.io.synthetic.SyntheticBoundedSource; @@ -43,11 +47,6 @@ import org.apache.hop.pipeline.transforms.rowgenerator.RowGenerator; import org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - public class BeamRowGeneratorTransformHandler extends BeamBaseTransformHandler implements IBeamPipelineTransformHandler { @@ -189,12 +188,7 @@ public void handleTransform( sourceInput.apply( ParDo.of( new StaticHopRowFn( - transformMeta.getName(), - rowMetaJson, - rowDataXml, - false, - -1, - -1))); + transformMeta.getName(), rowMetaJson, rowDataXml, false, -1, -1))); } transformCollectionMap.put(transformMeta.getName(), afterInput); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/run/MainDataflowTemplate.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/run/MainDataflowTemplate.java index 800d9dcaa39..a5f4ed9eb73 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/run/MainDataflowTemplate.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/run/MainDataflowTemplate.java @@ -18,6 +18,8 @@ package org.apache.hop.beam.run; +import java.io.IOException; +import java.io.InputStream; import org.apache.beam.sdk.options.Description; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.options.StreamingOptions; @@ -32,9 +34,6 @@ import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.pipeline.PipelineMeta; -import java.io.IOException; -import java.io.InputStream; - public class MainDataflowTemplate { public static final String EXPERIMENT_APACHE_HOP_PIPELINE = "apache_hop_pipeline"; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableInputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableInputMeta.java index e0c6fd2cd2e..2cfc5ae53df 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableInputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableInputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.transforms.bigtable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.io.gcp.bigtable.BigtableIO; import org.apache.beam.sdk.transforms.ParDo; @@ -43,10 +46,6 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamBigtableInput", name = "i18n::BeamBigtableInput.Name", @@ -178,7 +177,9 @@ public String getProjectId() { return projectId; } - /** @param projectId The projectId to set */ + /** + * @param projectId The projectId to set + */ public void setProjectId(String projectId) { this.projectId = projectId; } @@ -192,7 +193,9 @@ public String getInstanceId() { return instanceId; } - /** @param instanceId The datasetId to set */ + /** + * @param instanceId The datasetId to set + */ public void setInstanceId(String instanceId) { this.instanceId = instanceId; } @@ -206,7 +209,9 @@ public String getTableId() { return tableId; } - /** @param tableId The tableId to set */ + /** + * @param tableId The tableId to set + */ public void setTableId(String tableId) { this.tableId = tableId; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableOutputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableOutputMeta.java index 7902a4c7e13..0a9ab074929 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableOutputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BeamBigtableOutputMeta.java @@ -19,6 +19,9 @@ import com.google.bigtable.v2.Mutation; import com.google.protobuf.ByteString; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.io.gcp.bigtable.BigtableIO; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.values.KV; @@ -43,10 +46,6 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamBigtableOutput", name = "i18n::BeamBigtableOutput.Name", @@ -132,14 +131,14 @@ public void handleTransform( // Verify that each column has qualifier, a family value and a source: // for (BigtableColumn column : columns) { - if ( StringUtils.isEmpty(column.getName())) { + if (StringUtils.isEmpty(column.getName())) { throw new HopException("Every column needs to have a name"); } - if ( StringUtils.isEmpty(column.getFamily())) { - throw new HopException("Every column needs to have a family value: "+column.getName()); + if (StringUtils.isEmpty(column.getFamily())) { + throw new HopException("Every column needs to have a family value: " + column.getName()); } - if ( StringUtils.isEmpty(column.getSourceField())) { - throw new HopException("Every column needs to have a source field: "+column.getName()); + if (StringUtils.isEmpty(column.getSourceField())) { + throw new HopException("Every column needs to have a source field: " + column.getName()); } } @@ -168,10 +167,7 @@ public void handleTransform( HopToBigtableFn function = new HopToBigtableFn( - keyIndex, - j.toJSONString(), - transformMeta.getName(), - JsonRowMeta.toJson(rowMeta)); + keyIndex, j.toJSONString(), transformMeta.getName(), JsonRowMeta.toJson(rowMeta)); PCollection>> bigtableInput = input.apply(transformMeta.getName(), ParDo.of(function)); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableColumn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableColumn.java index a2f49efc27e..e25b53ac65d 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableColumn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableColumn.java @@ -17,9 +17,8 @@ package org.apache.hop.beam.transforms.bigtable; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class BigtableColumn { @@ -72,7 +71,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -86,7 +87,9 @@ public String getFamily() { return family; } - /** @param family The family to set */ + /** + * @param family The family to set + */ public void setFamily(String family) { this.family = family; } @@ -100,7 +103,9 @@ public String getSourceField() { return sourceField; } - /** @param sourceField The sourceField to set */ + /** + * @param sourceField The sourceField to set + */ public void setSourceField(String sourceField) { this.sourceField = sourceField; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableRowToHopRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableRowToHopRowFn.java index be6f29d1cac..c3590366b5d 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableRowToHopRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableRowToHopRowFn.java @@ -22,6 +22,10 @@ import com.google.bigtable.v2.Family; import com.google.bigtable.v2.Row; import com.google.protobuf.Descriptors; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -39,11 +43,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class BigtableRowToHopRowFn extends DoFn { private final String counterName; private final String rowMetaJson; @@ -62,10 +61,7 @@ public class BigtableRowToHopRowFn extends DoFn { private static final Logger LOG = LoggerFactory.getLogger(HopToBigtableFn.class); public BigtableRowToHopRowFn( - String counterName, - String rowMetaJson, - String keyField, - String columnsJson) { + String counterName, String rowMetaJson, String keyField, String columnsJson) { this.counterName = counterName; this.rowMetaJson = rowMetaJson; this.keyField = keyField; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableSourceColumn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableSourceColumn.java index b60bea02104..1c3bd323423 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableSourceColumn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/BigtableSourceColumn.java @@ -17,73 +17,71 @@ package org.apache.hop.beam.transforms.bigtable; +import java.util.Objects; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class BigtableSourceColumn { - @HopMetadataProperty(key = "qualifier") - private String qualifier; - - @HopMetadataProperty(key = "target_type") - private String targetType; - - @HopMetadataProperty(key = "target_field_name") - private String targetFieldName; - - public BigtableSourceColumn() { - } - - public BigtableSourceColumn(String qualifier, String targetType, String targetFieldName) { - this.qualifier = qualifier; - this.targetType = targetType; - this.targetFieldName = targetFieldName; - } - - public IValueMeta getValueMeta() throws HopPluginException { - int type = ValueMetaFactory.getIdForValueMeta(targetType); - String name = Const.NVL(targetFieldName, qualifier); - return ValueMetaFactory.createValueMeta(name, type); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BigtableSourceColumn that = (BigtableSourceColumn) o; - return qualifier.equals(that.qualifier); - } - - @Override - public int hashCode() { - return Objects.hash(qualifier); - } - - public String getQualifier() { - return qualifier; - } - - public void setQualifier(String qualifier) { - this.qualifier = qualifier; - } - - public String getTargetType() { - return targetType; - } - - public void setTargetType(String targetType) { - this.targetType = targetType; - } - - public String getTargetFieldName() { - return targetFieldName; - } - - public void setTargetFieldName(String targetFieldName) { - this.targetFieldName = targetFieldName; - } + @HopMetadataProperty(key = "qualifier") + private String qualifier; + + @HopMetadataProperty(key = "target_type") + private String targetType; + + @HopMetadataProperty(key = "target_field_name") + private String targetFieldName; + + public BigtableSourceColumn() {} + + public BigtableSourceColumn(String qualifier, String targetType, String targetFieldName) { + this.qualifier = qualifier; + this.targetType = targetType; + this.targetFieldName = targetFieldName; + } + + public IValueMeta getValueMeta() throws HopPluginException { + int type = ValueMetaFactory.getIdForValueMeta(targetType); + String name = Const.NVL(targetFieldName, qualifier); + return ValueMetaFactory.createValueMeta(name, type); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + BigtableSourceColumn that = (BigtableSourceColumn) o; + return qualifier.equals(that.qualifier); + } + + @Override + public int hashCode() { + return Objects.hash(qualifier); + } + + public String getQualifier() { + return qualifier; + } + + public void setQualifier(String qualifier) { + this.qualifier = qualifier; + } + + public String getTargetType() { + return targetType; + } + + public void setTargetType(String targetType) { + this.targetType = targetType; + } + + public String getTargetFieldName() { + return targetFieldName; + } + + public void setTargetFieldName(String targetFieldName) { + this.targetFieldName = targetFieldName; + } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/HopToBigtableFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/HopToBigtableFn.java index b5d2f2bf1fa..93c0a8793dd 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/HopToBigtableFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bigtable/HopToBigtableFn.java @@ -19,6 +19,12 @@ import com.google.bigtable.v2.Mutation; import com.google.protobuf.ByteString; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -35,13 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - public class HopToBigtableFn extends DoFn>> { private final int keyIndex; @@ -60,11 +59,7 @@ public class HopToBigtableFn extends DoFn { /** diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputMeta.java index fbb608ae8d1..e197ae1723c 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.transforms.bq; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.hop.beam.core.HopRow; import org.apache.hop.beam.core.transform.BeamBQInputTransform; @@ -38,10 +41,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamBQInput", name = "Beam BigQuery Input", @@ -50,7 +49,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamBQInputDialog.keyword", documentationUrl = "/pipeline/transforms/beambigqueryinput.html") -public class BeamBQInputMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamBQInputMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty(key = "project_id") private String projectId; @@ -156,7 +156,9 @@ public String getProjectId() { return projectId; } - /** @param projectId The projectId to set */ + /** + * @param projectId The projectId to set + */ public void setProjectId(String projectId) { this.projectId = projectId; } @@ -170,7 +172,9 @@ public String getDatasetId() { return datasetId; } - /** @param datasetId The datasetId to set */ + /** + * @param datasetId The datasetId to set + */ public void setDatasetId(String datasetId) { this.datasetId = datasetId; } @@ -184,7 +188,9 @@ public String getTableId() { return tableId; } - /** @param tableId The tableId to set */ + /** + * @param tableId The tableId to set + */ public void setTableId(String tableId) { this.tableId = tableId; } @@ -198,7 +204,9 @@ public String getQuery() { return query; } - /** @param query The query to set */ + /** + * @param query The query to set + */ public void setQuery(String query) { this.query = query; } @@ -212,7 +220,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQOutputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQOutputMeta.java index b24f62214f3..aa3db90ebc3 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQOutputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQOutputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.bq; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.hop.beam.core.HopRow; import org.apache.hop.beam.core.transform.BeamBQOutputTransform; @@ -37,9 +39,6 @@ import org.apache.hop.pipeline.transforms.dummy.Dummy; import org.apache.hop.pipeline.transforms.dummy.DummyData; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamBQOutput", image = "beam-bq-output.svg", @@ -48,7 +47,8 @@ categoryDescription = "i18n:org.apache.hop.workflow:ActionCategory.Category.BigData", documentationUrl = "/pipeline/transforms/beambigqueryoutput.html", keywords = "i18n::BeamBQOutputDialog.keyword") -public class BeamBQOutputMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamBQOutputMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty(key = "project_id") private String projectId; @@ -154,7 +154,9 @@ public String getProjectId() { return projectId; } - /** @param projectId The projectId to set */ + /** + * @param projectId The projectId to set + */ public void setProjectId(String projectId) { this.projectId = projectId; } @@ -168,7 +170,9 @@ public String getDatasetId() { return datasetId; } - /** @param datasetId The datasetId to set */ + /** + * @param datasetId The datasetId to set + */ public void setDatasetId(String datasetId) { this.datasetId = datasetId; } @@ -182,7 +186,9 @@ public String getTableId() { return tableId; } - /** @param tableId The tableId to set */ + /** + * @param tableId The tableId to set + */ public void setTableId(String tableId) { this.tableId = tableId; } @@ -196,7 +202,9 @@ public boolean isCreatingIfNeeded() { return creatingIfNeeded; } - /** @param creatingIfNeeded The creatingIfNeeded to set */ + /** + * @param creatingIfNeeded The creatingIfNeeded to set + */ public void setCreatingIfNeeded(boolean creatingIfNeeded) { this.creatingIfNeeded = creatingIfNeeded; } @@ -210,7 +218,9 @@ public boolean isTruncatingTable() { return truncatingTable; } - /** @param truncatingTable The truncatingTable to set */ + /** + * @param truncatingTable The truncatingTable to set + */ public void setTruncatingTable(boolean truncatingTable) { this.truncatingTable = truncatingTable; } @@ -224,7 +234,9 @@ public boolean isFailingIfNotEmpty() { return failingIfNotEmpty; } - /** @param failingIfNotEmpty The failingIfNotEmpty to set */ + /** + * @param failingIfNotEmpty The failingIfNotEmpty to set + */ public void setFailingIfNotEmpty(boolean failingIfNotEmpty) { this.failingIfNotEmpty = failingIfNotEmpty; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInput.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInput.java index 6afc790a6ae..be520eb3e6b 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInput.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInput.java @@ -23,36 +23,37 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -public class BeamHiveCatalogInput extends BaseTransform { +public class BeamHiveCatalogInput + extends BaseTransform { - /** - * This is the base transform that forms that basis for all transforms. You can derive from this - * class to implement your own transforms. - * - * @param transformMeta The TransformMeta object to run. - * @param meta the meta object containing all metadata - * @param data the data object to store temporary data, database connections, caches, result sets, - * hashtables etc. - * @param copyNr The copynumber for this transform. - * @param pipelineMeta The TransInfo of which the transform transformMeta is part of. - * @param pipeline The (running) transformation to obtain information shared among the transforms. - */ - public BeamHiveCatalogInput( - TransformMeta transformMeta, - BeamHiveCatalogInputMeta meta, - BeamHiveCatalogInputData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline) { - super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); - } + /** + * This is the base transform that forms that basis for all transforms. You can derive from this + * class to implement your own transforms. + * + * @param transformMeta The TransformMeta object to run. + * @param meta the meta object containing all metadata + * @param data the data object to store temporary data, database connections, caches, result sets, + * hashtables etc. + * @param copyNr The copynumber for this transform. + * @param pipelineMeta The TransInfo of which the transform transformMeta is part of. + * @param pipeline The (running) transformation to obtain information shared among the transforms. + */ + public BeamHiveCatalogInput( + TransformMeta transformMeta, + BeamHiveCatalogInputMeta meta, + BeamHiveCatalogInputData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { + super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); + } - @Override - public boolean processRow() throws HopException { + @Override + public boolean processRow() throws HopException { - // Outside of Beam this transform doesn't actually do anything, it's just metadata - // This transform gets converted into Beam API calls in a pipeline - // - return false; - } + // Outside of Beam this transform doesn't actually do anything, it's just metadata + // This transform gets converted into Beam API calls in a pipeline + // + return false; + } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputDialog.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputDialog.java index 21e267c878f..4b763be95fe 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputDialog.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputDialog.java @@ -94,7 +94,7 @@ public String open() { wTransformName.setLayoutData(fdTransformName); Control lastControl = wTransformName; - //metatore uri + // metatore uri Label wlMetastoreUri = new Label(shell, SWT.RIGHT); wlMetastoreUri.setText(BaseMessages.getString(PKG, "BeamHiveCatalogInputDialog.MetaStoreUri")); PropsUi.setLook(wlMetastoreUri); @@ -112,9 +112,10 @@ public String open() { wMetastoreUri.setLayoutData(fdMetastoreUri); lastControl = wMetastoreUri; - //Database + // Database Label wlMetastoreDatabase = new Label(shell, SWT.RIGHT); - wlMetastoreDatabase.setText(BaseMessages.getString(PKG, "BeamHiveCatalogInputDialog.MetaStoreDatabase")); + wlMetastoreDatabase.setText( + BaseMessages.getString(PKG, "BeamHiveCatalogInputDialog.MetaStoreDatabase")); PropsUi.setLook(wlMetastoreDatabase); FormData fdlmetastoredatabase = new FormData(); fdlmetastoredatabase.left = new FormAttachment(0, 0); @@ -130,10 +131,10 @@ public String open() { wMetastoreDatabase.setLayoutData(fdMetastoreDatabase); lastControl = wMetastoreDatabase; - - //Table + // Table Label wlMetastoreTable = new Label(shell, SWT.RIGHT); - wlMetastoreTable.setText(BaseMessages.getString(PKG, "BeamHiveCatalogInputDialog.MetaStoreTable")); + wlMetastoreTable.setText( + BaseMessages.getString(PKG, "BeamHiveCatalogInputDialog.MetaStoreTable")); PropsUi.setLook(wlMetastoreTable); FormData fdlmetastoreTable = new FormData(); fdlmetastoreTable.left = new FormAttachment(0, 0); @@ -165,9 +166,9 @@ public String open() { public void getData() { wTransformName.setText(transformName); - wMetastoreUri.setText(Const.NVL(input.getHiveMetastoreUris(),"")); - wMetastoreDatabase.setText(Const.NVL(input.getHiveMetastoreDatabase(),"")); - wMetastoreTable.setText(Const.NVL(input.getHiveMetastoreTable(),"")); + wMetastoreUri.setText(Const.NVL(input.getHiveMetastoreUris(), "")); + wMetastoreDatabase.setText(Const.NVL(input.getHiveMetastoreDatabase(), "")); + wMetastoreTable.setText(Const.NVL(input.getHiveMetastoreTable(), "")); } private void ok() { diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputMeta.java index e52b620f922..965a76e9671 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/hivecatalog/BeamHiveCatalogInputMeta.java @@ -40,60 +40,65 @@ import org.apache.hop.pipeline.transform.TransformMeta; @Transform( - id = "BeamHiveCatalogInput", - image = "beam-input.svg", - name = "i18n::BeamHiveCatalogInputDialog.DialogTitle", - description = "i18n::BeamHiveCatalogInputDialog.Description", - categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Experimental", - keywords = "i18n::BeamHiveCatalogInputDialog.keyword", - documentationUrl = "/pipeline/transforms/beamhivecataloginput.html") -public class BeamHiveCatalogInputMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { - @HopMetadataProperty(key = "hive_metastore_uris") - private String hiveMetastoreUris; - @HopMetadataProperty(key = "hive_metastore_databese") - private String hiveMetastoreDatabase; - @HopMetadataProperty(key = "hive_metastore_table") - private String hiveMetastoreTable; - - public BeamHiveCatalogInputMeta() {} - - @Override - public String getDialogClassName() { - return BeamHiveCatalogInputDialog.class.getName(); - } - - @Override - public boolean isInput() { - return true; - } - - @Override - public boolean isOutput() { - return false; - } - - @Override - public void handleTransform( - ILogChannel log, - IVariables variables, - String runConfigurationName, - IBeamPipelineEngineRunConfiguration runConfiguration, - String dataSamplersJson, - IHopMetadataProvider metadataProvider, - PipelineMeta pipelineMeta, - TransformMeta transformMeta, - Map> transformCollectionMap, - org.apache.beam.sdk.Pipeline pipeline, - IRowMeta rowMeta, - List previousTransforms, - PCollection input, - String parentLogChannelId) - throws HopException { - - // Output rows (fields selection) - // - IRowMeta outputRowMeta = new RowMeta(); - getFields(outputRowMeta, transformMeta.getName(), null, null, variables, null); + id = "BeamHiveCatalogInput", + image = "beam-input.svg", + name = "i18n::BeamHiveCatalogInputDialog.DialogTitle", + description = "i18n::BeamHiveCatalogInputDialog.Description", + categoryDescription = + "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Experimental", + keywords = "i18n::BeamHiveCatalogInputDialog.keyword", + documentationUrl = "/pipeline/transforms/beamhivecataloginput.html") +public class BeamHiveCatalogInputMeta + extends BaseTransformMeta + implements IBeamPipelineTransformHandler { + @HopMetadataProperty(key = "hive_metastore_uris") + private String hiveMetastoreUris; + + @HopMetadataProperty(key = "hive_metastore_databese") + private String hiveMetastoreDatabase; + + @HopMetadataProperty(key = "hive_metastore_table") + private String hiveMetastoreTable; + + public BeamHiveCatalogInputMeta() {} + + @Override + public String getDialogClassName() { + return BeamHiveCatalogInputDialog.class.getName(); + } + + @Override + public boolean isInput() { + return true; + } + + @Override + public boolean isOutput() { + return false; + } + + @Override + public void handleTransform( + ILogChannel log, + IVariables variables, + String runConfigurationName, + IBeamPipelineEngineRunConfiguration runConfiguration, + String dataSamplersJson, + IHopMetadataProvider metadataProvider, + PipelineMeta pipelineMeta, + TransformMeta transformMeta, + Map> transformCollectionMap, + org.apache.beam.sdk.Pipeline pipeline, + IRowMeta rowMeta, + List previousTransforms, + PCollection input, + String parentLogChannelId) + throws HopException { + + // Output rows (fields selection) + // + IRowMeta outputRowMeta = new RowMeta(); + getFields(outputRowMeta, transformMeta.getName(), null, null, variables, null); BeamHiveMetastoreInputTransform beamInputTransform = new BeamHiveMetastoreInputTransform( @@ -103,48 +108,46 @@ public void handleTransform( variables.resolve(hiveMetastoreDatabase), variables.resolve(hiveMetastoreTable), JsonRowMeta.toJson(outputRowMeta)); - PCollection afterInput = pipeline.apply(beamInputTransform); - transformCollectionMap.put(transformMeta.getName(), afterInput); - log.logBasic("Handled transform (Hive Catalog INPUT) : " + transformMeta.getName()); - } - - public String getHiveMetastoreUris() { - return hiveMetastoreUris; - } - - public void setHiveMetastoreUris(String hiveMetastoreUris) { - this.hiveMetastoreUris = hiveMetastoreUris; - } - - public String getHiveMetastoreDatabase() { - return hiveMetastoreDatabase; - } - - public void setHiveMetastoreDatabase(String hiveMetastoreDatabase) { - this.hiveMetastoreDatabase = hiveMetastoreDatabase; - } - - public String getHiveMetastoreTable() { - return hiveMetastoreTable; - } - - public void setHiveMetastoreTable(String hiveMetastoreTable) { - this.hiveMetastoreTable = hiveMetastoreTable; - } - - @Override - public void getFields( - IRowMeta inputRowMeta, - String name, - IRowMeta[] info, - TransformMeta nextTransform, - IVariables variables, - IHopMetadataProvider metadataProvider - ){ - IValueMeta rowNb = new ValueMetaString(); - rowNb.setOrigin(name); - rowNb.setName("hcatalog_output"); - inputRowMeta.addValueMeta(rowNb); - - } + PCollection afterInput = pipeline.apply(beamInputTransform); + transformCollectionMap.put(transformMeta.getName(), afterInput); + log.logBasic("Handled transform (Hive Catalog INPUT) : " + transformMeta.getName()); + } + + public String getHiveMetastoreUris() { + return hiveMetastoreUris; + } + + public void setHiveMetastoreUris(String hiveMetastoreUris) { + this.hiveMetastoreUris = hiveMetastoreUris; + } + + public String getHiveMetastoreDatabase() { + return hiveMetastoreDatabase; + } + + public void setHiveMetastoreDatabase(String hiveMetastoreDatabase) { + this.hiveMetastoreDatabase = hiveMetastoreDatabase; + } + + public String getHiveMetastoreTable() { + return hiveMetastoreTable; + } + + public void setHiveMetastoreTable(String hiveMetastoreTable) { + this.hiveMetastoreTable = hiveMetastoreTable; + } + + @Override + public void getFields( + IRowMeta inputRowMeta, + String name, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables variables, + IHopMetadataProvider metadataProvider) { + IValueMeta rowNb = new ValueMetaString(); + rowNb.setOrigin(name); + rowNb.setName("hcatalog_output"); + inputRowMeta.addValueMeta(rowNb); + } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamInputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamInputMeta.java index 8972e0ada3f..3a8902a4f80 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamInputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamInputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.io; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.lang.StringUtils; import org.apache.hop.beam.core.HopRow; @@ -39,9 +41,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamInput", name = "i18n::BeamInputDialog.DialogTitle", diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamOutputMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamOutputMeta.java index 73e93dadb92..31700de98fd 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamOutputMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/io/BeamOutputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.io; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.lang.StringUtils; import org.apache.hop.beam.core.HopRow; @@ -40,9 +42,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamOutput", image = "beam-output.svg", @@ -51,7 +50,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamOutputMeta.keyword", documentationUrl = "/pipeline/transforms/beamoutput.html") -public class BeamOutputMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamOutputMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty(key = "output_location") private String outputLocation; @@ -202,7 +202,9 @@ public String getOutputLocation() { return outputLocation; } - /** @param outputLocation The outputLocation to set */ + /** + * @param outputLocation The outputLocation to set + */ public void setOutputLocation(String outputLocation) { this.outputLocation = outputLocation; } @@ -216,7 +218,9 @@ public String getFileDefinitionName() { return fileDefinitionName; } - /** @param fileDefinitionName The fileDescriptionName to set */ + /** + * @param fileDefinitionName The fileDescriptionName to set + */ public void setFileDefinitionName(String fileDefinitionName) { this.fileDefinitionName = fileDefinitionName; } @@ -230,7 +234,9 @@ public String getFilePrefix() { return filePrefix; } - /** @param filePrefix The filePrefix to set */ + /** + * @param filePrefix The filePrefix to set + */ public void setFilePrefix(String filePrefix) { this.filePrefix = filePrefix; } @@ -244,7 +250,9 @@ public String getFileSuffix() { return fileSuffix; } - /** @param fileSuffix The fileSuffix to set */ + /** + * @param fileSuffix The fileSuffix to set + */ public void setFileSuffix(String fileSuffix) { this.fileSuffix = fileSuffix; } @@ -258,7 +266,9 @@ public boolean isWindowed() { return windowed; } - /** @param windowed The windowed to set */ + /** + * @param windowed The windowed to set + */ public void setWindowed(boolean windowed) { this.windowed = windowed; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeDialog.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeDialog.java index 972b9be175e..fa04b6e3991 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeDialog.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.transforms.kafka; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -42,8 +43,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class BeamConsumeDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = BeamConsume.class; // For Translator private final BeamConsumeMeta input; @@ -215,7 +214,7 @@ public String open() { fdlMessageType.right = new FormAttachment(middle, -margin); wlMessageType.setLayoutData(fdlMessageType); wMessageType = new ComboVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wMessageType.setItems(new String[] { "String", "Avro Record" }); + wMessageType.setItems(new String[] {"String", "Avro Record"}); PropsUi.setLook(wMessageType); FormData fdMessageType = new FormData(); fdMessageType.left = new FormAttachment(middle, 0); @@ -242,7 +241,8 @@ public String open() { lastControl = wSchemaRegistryUrl; Label wlSchemaRegistrySubject = new Label(shell, SWT.RIGHT); - wlSchemaRegistrySubject.setText(BaseMessages.getString(PKG, "BeamConsumeDialog.SchemaRegistrySubject")); + wlSchemaRegistrySubject.setText( + BaseMessages.getString(PKG, "BeamConsumeDialog.SchemaRegistrySubject")); PropsUi.setLook(wlSchemaRegistrySubject); FormData fdlSchemaRegistrySubject = new FormData(); fdlSchemaRegistrySubject.left = new FormAttachment(0, 0); @@ -257,7 +257,7 @@ public String open() { fdSchemaRegistrySubject.right = new FormAttachment(100, 0); wSchemaRegistrySubject.setLayoutData(fdSchemaRegistrySubject); lastControl = wSchemaRegistrySubject; - + Label wlUseProcessingTime = new Label(shell, SWT.RIGHT); wlUseProcessingTime.setText(BaseMessages.getString(PKG, "BeamProduceDialog.UseProcessingTime")); PropsUi.setLook(wlUseProcessingTime); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeMeta.java index b5e4ba6f7fa..f8ff154c1c4 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamConsumeMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.transforms.kafka; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.hop.beam.core.HopRow; import org.apache.hop.beam.core.transform.BeamKafkaInputTransform; @@ -41,10 +44,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.dummy.DummyData; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamKafkaConsume", name = "Beam Kafka Consume", @@ -53,7 +52,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamConsumeMeta.keyword", documentationUrl = "/pipeline/transforms/beamkafkaconsume.html") -public class BeamConsumeMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamConsumeMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty private String topics; @@ -220,7 +220,9 @@ public String getBootstrapServers() { return bootstrapServers; } - /** @param bootstrapServers The bootstrapServers to set */ + /** + * @param bootstrapServers The bootstrapServers to set + */ public void setBootstrapServers(String bootstrapServers) { this.bootstrapServers = bootstrapServers; } @@ -234,7 +236,9 @@ public String getTopics() { return topics; } - /** @param topics The topics to set */ + /** + * @param topics The topics to set + */ public void setTopics(String topics) { this.topics = topics; } @@ -248,7 +252,9 @@ public String getKeyField() { return keyField; } - /** @param keyField The keyField to set */ + /** + * @param keyField The keyField to set + */ public void setKeyField(String keyField) { this.keyField = keyField; } @@ -262,7 +268,9 @@ public String getMessageField() { return messageField; } - /** @param messageField The messageField to set */ + /** + * @param messageField The messageField to set + */ public void setMessageField(String messageField) { this.messageField = messageField; } @@ -300,7 +308,9 @@ public String getGroupId() { return groupId; } - /** @param groupId The groupId to set */ + /** + * @param groupId The groupId to set + */ public void setGroupId(String groupId) { this.groupId = groupId; } @@ -314,7 +324,9 @@ public boolean isUsingProcessingTime() { return usingProcessingTime; } - /** @param usingProcessingTime The usingProcessingTime to set */ + /** + * @param usingProcessingTime The usingProcessingTime to set + */ public void setUsingProcessingTime(boolean usingProcessingTime) { this.usingProcessingTime = usingProcessingTime; } @@ -328,7 +340,9 @@ public boolean isUsingLogAppendTime() { return usingLogAppendTime; } - /** @param usingLogAppendTime The usingLogAppendTime to set */ + /** + * @param usingLogAppendTime The usingLogAppendTime to set + */ public void setUsingLogAppendTime(boolean usingLogAppendTime) { this.usingLogAppendTime = usingLogAppendTime; } @@ -342,7 +356,9 @@ public boolean isUsingCreateTime() { return usingCreateTime; } - /** @param usingCreateTime The usingCreateTime to set */ + /** + * @param usingCreateTime The usingCreateTime to set + */ public void setUsingCreateTime(boolean usingCreateTime) { this.usingCreateTime = usingCreateTime; } @@ -356,7 +372,9 @@ public boolean isRestrictedToCommitted() { return restrictedToCommitted; } - /** @param restrictedToCommitted The restrictedToCommitted to set */ + /** + * @param restrictedToCommitted The restrictedToCommitted to set + */ public void setRestrictedToCommitted(boolean restrictedToCommitted) { this.restrictedToCommitted = restrictedToCommitted; } @@ -370,7 +388,9 @@ public boolean isAllowingCommitOnConsumedOffset() { return allowingCommitOnConsumedOffset; } - /** @param allowingCommitOnConsumedOffset The allowingCommitOnConsumedOffset to set */ + /** + * @param allowingCommitOnConsumedOffset The allowingCommitOnConsumedOffset to set + */ public void setAllowingCommitOnConsumedOffset(boolean allowingCommitOnConsumedOffset) { this.allowingCommitOnConsumedOffset = allowingCommitOnConsumedOffset; } @@ -384,7 +404,9 @@ public List getConfigOptions() { return configOptions; } - /** @param configOptions The configOptions to set */ + /** + * @param configOptions The configOptions to set + */ public void setConfigOptions(List configOptions) { this.configOptions = configOptions; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceDialog.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceDialog.java index 8fb97d9f362..279bf6a0902 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceDialog.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.transforms.kafka; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -41,8 +42,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class BeamProduceDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = BeamProduce.class; // For Translator private final BeamProduceMeta input; @@ -90,8 +89,7 @@ public String open() { wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wCancel}, margin, null); + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); // TransformName line wlTransformName = new Label(shell, SWT.RIGHT); @@ -181,27 +179,27 @@ public String open() { lastControl = wMessageField; ColumnInfo[] columns = - new ColumnInfo[] { - new ColumnInfo( - BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Parameter"), - ColumnInfo.COLUMN_TYPE_TEXT, - false), - new ColumnInfo( - BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Value"), - ColumnInfo.COLUMN_TYPE_TEXT, - false), - new ColumnInfo( - BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Type"), - ColumnInfo.COLUMN_TYPE_CCOMBO, - ConfigOption.Type.getTypeNames(), - false), - }; + new ColumnInfo[] { + new ColumnInfo( + BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Parameter"), + ColumnInfo.COLUMN_TYPE_TEXT, + false), + new ColumnInfo( + BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Value"), + ColumnInfo.COLUMN_TYPE_TEXT, + false), + new ColumnInfo( + BaseMessages.getString(PKG, "BeamProduceDialog.ConfigOptions.Column.Type"), + ColumnInfo.COLUMN_TYPE_CCOMBO, + ConfigOption.Type.getTypeNames(), + false), + }; columns[0].setUsingVariables(true); columns[1].setUsingVariables(true); wConfigOptions = - new TableView( - variables, shell, SWT.NONE, columns, input.getConfigOptions().size(), null, props); + new TableView( + variables, shell, SWT.NONE, columns, input.getConfigOptions().size(), null, props); PropsUi.setLook(wConfigOptions); FormData fdConfigOptions = new FormData(); fdConfigOptions.left = new FormAttachment(0, 0); @@ -210,7 +208,6 @@ public String open() { fdConfigOptions.bottom = new FormAttachment(wOk, -margin * 2); wConfigOptions.setLayoutData(fdConfigOptions); - getData(); BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceMeta.java index 859c5ba09c0..eab35cc4dcb 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/BeamProduceMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.transforms.kafka; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord; import org.apache.beam.sdk.coders.AvroCoder; @@ -41,10 +44,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.dummy.DummyData; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamKafkaProduce", name = "Beam Kafka Produce", @@ -53,7 +52,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamProduceMeta.keyword", documentationUrl = "/pipeline/transforms/beamkafkaproduce.html") -public class BeamProduceMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamProduceMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty(key = "bootstrap_servers") private String bootstrapServers; @@ -133,18 +133,19 @@ public void handleTransform( parameters[i] = variables.resolve(option.getParameter()); values[i] = variables.resolve(option.getValue()); types[i] = - option.getType() == null ? ConfigOption.Type.String.name() : option.getType().name(); + option.getType() == null ? ConfigOption.Type.String.name() : option.getType().name(); } String messageFieldName = variables.resolve(getMessageField()); IValueMeta messageValueMeta = rowMeta.searchValueMeta(messageFieldName); - if (messageValueMeta==null) { - throw new HopException("Error finding message/value field "+messageFieldName+" in the input rows"); + if (messageValueMeta == null) { + throw new HopException( + "Error finding message/value field " + messageFieldName + " in the input rows"); } // Register a coder for the short time that KV exists in Beam // - if (messageValueMeta.getType()==IValueMeta.TYPE_AVRO) { + if (messageValueMeta.getType() == IValueMeta.TYPE_AVRO) { ValueMetaAvroRecord valueMetaAvroRecord = (ValueMetaAvroRecord) messageValueMeta; Schema schema = valueMetaAvroRecord.getSchema(); AvroCoder coder = AvroCoder.of(schema); @@ -190,7 +191,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -204,7 +207,9 @@ public String getKeyField() { return keyField; } - /** @param keyField The keyField to set */ + /** + * @param keyField The keyField to set + */ public void setKeyField(String keyField) { this.keyField = keyField; } @@ -218,7 +223,9 @@ public String getMessageField() { return messageField; } - /** @param messageField The messageField to set */ + /** + * @param messageField The messageField to set + */ public void setMessageField(String messageField) { this.messageField = messageField; } @@ -232,7 +239,9 @@ public String getBootstrapServers() { return bootstrapServers; } - /** @param bootstrapServers The bootstrapServers to set */ + /** + * @param bootstrapServers The bootstrapServers to set + */ public void setBootstrapServers(String bootstrapServers) { this.bootstrapServers = bootstrapServers; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/ConfigOption.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/ConfigOption.java index 2b81c639c11..e7a1f0e0a32 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/ConfigOption.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kafka/ConfigOption.java @@ -74,7 +74,9 @@ public String getParameter() { return parameter; } - /** @param parameter The parameter to set */ + /** + * @param parameter The parameter to set + */ public void setParameter(String parameter) { this.parameter = parameter; } @@ -88,7 +90,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } @@ -102,7 +106,9 @@ public Type getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(Type type) { this.type = type; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsume.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsume.java index 2010a677d0d..33566fc164e 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsume.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsume.java @@ -43,6 +43,7 @@ public boolean processRow() throws HopException { // Outside a Beam Runner this transform doesn't actually do anything, it's just metadata // This transform gets converted into Beam API calls in a pipeline // - throw new HopException("The Beam Kinesis Consume transform is only intended to be used in a Beam pipeline"); + throw new HopException( + "The Beam Kinesis Consume transform is only intended to be used in a Beam pipeline"); } } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeDialog.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeDialog.java index 8568a9bd9e1..1e1a39f5f72 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeDialog.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeDialog.java @@ -568,10 +568,10 @@ public String open() { private void enableFields() { /* - wArrivalTimeWatermarkPolicy.addListener(SWT.Selection, e -> enableFields()); - wProcessingTimeWatermarkPolicy.addListener(SWT.Selection, e -> enableFields()); - wFixedDelayRatePolicy.addListener(SWT.Selection, e -> enableFields()); - */ + wArrivalTimeWatermarkPolicy.addListener(SWT.Selection, e -> enableFields()); + wProcessingTimeWatermarkPolicy.addListener(SWT.Selection, e -> enableFields()); + wFixedDelayRatePolicy.addListener(SWT.Selection, e -> enableFields()); + */ } /** Populate the widgets. */ diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeMeta.java index d0eec24d416..2da4d7e6c7d 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeMeta.java @@ -19,6 +19,8 @@ package org.apache.hop.beam.transforms.kinesis; import com.amazonaws.regions.Regions; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.lang.StringUtils; import org.apache.hop.beam.core.HopRow; @@ -44,9 +46,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.dummy.DummyData; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamKinesisConsume", name = "i18n::BeamKinesisConsumeMeta.name", diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeTransform.java index 5719123b38d..07c2caeb6e6 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisConsumeTransform.java @@ -40,8 +40,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class BeamKinesisConsumeTransform extends PTransform> { // These non-transient privates get serialized to spread across nodes @@ -237,9 +235,7 @@ public static final class KVStringStringToHopRowFn extends DoFn PKG = BeamKinesisProduce.class; // For Translator private final BeamKinesisProduceMeta input; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceMeta.java index ee56afc44de..f063f5028b4 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceMeta.java @@ -18,6 +18,9 @@ package org.apache.hop.beam.transforms.kinesis; import com.amazonaws.regions.Regions; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.hop.beam.core.HopRow; import org.apache.hop.beam.engines.IBeamPipelineEngineRunConfiguration; @@ -37,10 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.dummy.DummyData; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamKinesisProduce", name = "i18n::BeamKinesisProduceMeta.name", diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceTransform.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceTransform.java index 9f4ade762c9..b038987dcec 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceTransform.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/BeamKinesisProduceTransform.java @@ -18,6 +18,9 @@ package org.apache.hop.beam.transforms.kinesis; import com.amazonaws.regions.Regions; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; import org.apache.beam.sdk.io.kinesis.KinesisIO; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -36,10 +39,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - public class BeamKinesisProduceTransform extends PTransform, PDone> { private String transformName; @@ -124,12 +123,7 @@ public PDone expand(PCollection input) { // Convert to PCollection of KV // PCollection messages = - input.apply( - ParDo.of( - new HopRowToMessage( - transformName, - rowMetaJson, - messageIndex))); + input.apply(ParDo.of(new HopRowToMessage(transformName, rowMetaJson, messageIndex))); // Write to Kinesis stream with // @@ -159,10 +153,7 @@ private static class HopRowToMessage extends DoFn { private transient Counter outputCounter; private transient Counter readCounter; - public HopRowToMessage( - String transformName, - String rowMetaJson, - int messageIndex) { + public HopRowToMessage(String transformName, String rowMetaJson, int messageIndex) { this.transformName = transformName; this.rowMetaJson = rowMetaJson; this.messageIndex = messageIndex; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/KinesisRecordToHopRowFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/KinesisRecordToHopRowFn.java index a25abc1b644..4e36bce3ed8 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/KinesisRecordToHopRowFn.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/kinesis/KinesisRecordToHopRowFn.java @@ -18,6 +18,7 @@ package org.apache.hop.beam.transforms.kinesis; +import java.nio.charset.StandardCharsets; import org.apache.beam.sdk.io.kinesis.KinesisRecord; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; @@ -32,9 +33,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.nio.charset.StandardCharsets; -import java.util.List; - public class KinesisRecordToHopRowFn extends DoFn { private final String rowMetaJson; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamPublishMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamPublishMeta.java index b84d6b6f815..c5745279ba3 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamPublishMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamPublishMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.pubsub; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.lang.StringUtils; import org.apache.hop.beam.core.HopRow; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamPublish", name = "i18n::BeamPublishDialog.DialogTitle", @@ -47,7 +46,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamPublishMeta.keyword", documentationUrl = "/pipeline/transforms/beamgcppublisher.html") -public class BeamPublishMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamPublishMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { public static final String TOPIC = "topic"; public static final String MESSAGE_TYPE = "message_type"; @@ -159,7 +159,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -173,7 +175,9 @@ public String getMessageType() { return messageType; } - /** @param messageType The messageType to set */ + /** + * @param messageType The messageType to set + */ public void setMessageType(String messageType) { this.messageType = messageType; } @@ -187,7 +191,9 @@ public String getMessageField() { return messageField; } - /** @param messageField The messageField to set */ + /** + * @param messageField The messageField to set + */ public void setMessageField(String messageField) { this.messageField = messageField; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamSubscribeMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamSubscribeMeta.java index 88a10d8333b..b39b43c78bb 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamSubscribeMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/pubsub/BeamSubscribeMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.pubsub; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.lang.StringUtils; import org.apache.hop.beam.core.BeamDefaults; @@ -40,9 +42,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamSubscribe", name = "i18n::BeamSubscribeDialog.DialogTitle", @@ -51,7 +50,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamSubscribeMeta.keyword", documentationUrl = "/pipeline/transforms/beamgcpsubscriber.html") -public class BeamSubscribeMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamSubscribeMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty private String topic; @HopMetadataProperty private String subscription; @@ -168,7 +168,9 @@ public String getSubscription() { return subscription; } - /** @param subscription The subscription to set */ + /** + * @param subscription The subscription to set + */ public void setSubscription(String subscription) { this.subscription = subscription; } @@ -182,7 +184,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -196,7 +200,9 @@ public String getMessageType() { return messageType; } - /** @param messageType The messageType to set */ + /** + * @param messageType The messageType to set + */ public void setMessageType(String messageType) { this.messageType = messageType; } @@ -210,7 +216,9 @@ public String getMessageField() { return messageField; } - /** @param messageField The messageField to set */ + /** + * @param messageField The messageField to set + */ public void setMessageField(String messageField) { this.messageField = messageField; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamTimestampMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamTimestampMeta.java index 0f426cfcd2a..22291dbc99d 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamTimestampMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamTimestampMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.window; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.lang.StringUtils; @@ -40,9 +42,6 @@ import org.apache.hop.pipeline.transforms.dummy.Dummy; import org.apache.hop.pipeline.transforms.dummy.DummyData; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamTimestamp", name = "Beam Timestamp", @@ -51,7 +50,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.BigData", keywords = "i18n::BeamTimestampMeta.keyword", documentationUrl = "/pipeline/transforms/beamtimestamp.html") -public class BeamTimestampMeta extends BaseTransformMeta implements IBeamPipelineTransformHandler { +public class BeamTimestampMeta extends BaseTransformMeta + implements IBeamPipelineTransformHandler { @HopMetadataProperty(key = "field_name") private String fieldName; @@ -148,7 +148,9 @@ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set */ + /** + * @param fieldName The fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } @@ -162,7 +164,9 @@ public boolean isReadingTimestamp() { return readingTimestamp; } - /** @param readingTimestamp The readingTimestamp to set */ + /** + * @param readingTimestamp The readingTimestamp to set + */ public void setReadingTimestamp(boolean readingTimestamp) { this.readingTimestamp = readingTimestamp; } diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamWindowMeta.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamWindowMeta.java index 302e0d1da43..dd5f6dc50aa 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamWindowMeta.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/BeamWindowMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.beam.transforms.window; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.transforms.windowing.AfterWatermark; import org.apache.beam.sdk.transforms.windowing.FixedWindows; @@ -51,9 +53,6 @@ import org.apache.hop.pipeline.transforms.dummy.DummyData; import org.joda.time.Duration; -import java.util.List; -import java.util.Map; - @Transform( id = "BeamWindow", name = "Beam Window", diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/WindowTriggerType.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/WindowTriggerType.java index baa118720e8..7e8fe9783c3 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/WindowTriggerType.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/window/WindowTriggerType.java @@ -20,7 +20,8 @@ public enum WindowTriggerType { None("No triggering"), - RepeatedlyForeverAfterWatermarkPastEndOfWindow("Repeatedly forever: after watermark, past the end of the window"); + RepeatedlyForeverAfterWatermarkPastEndOfWindow( + "Repeatedly forever: after watermark, past the end of the window"); private String description; diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/util/BeamConst.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/util/BeamConst.java index bf7c53a0b6c..d658c06e9fe 100644 --- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/util/BeamConst.java +++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/util/BeamConst.java @@ -17,10 +17,6 @@ package org.apache.hop.beam.util; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.exception.HopException; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -29,6 +25,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.exception.HopException; public class BeamConst { diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/HopRowTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/HopRowTest.java index fcd24235c22..efb194d277e 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/HopRowTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/HopRowTest.java @@ -17,14 +17,13 @@ package org.apache.hop.beam.core; -import org.junit.Test; - -import java.util.Date; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Date; +import org.junit.Test; + public class HopRowTest { @Test diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/coder/HopRowCoderTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/coder/HopRowCoderTest.java index 0f65b1ceed5..6ee9c814231 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/coder/HopRowCoderTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/coder/HopRowCoderTest.java @@ -17,6 +17,11 @@ package org.apache.hop.beam.core.coder; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.Date; import junit.framework.TestCase; import org.apache.avro.Schema; import org.apache.avro.generic.GenericData; @@ -25,12 +30,6 @@ import org.apache.hop.beam.core.HopRow; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.sql.Timestamp; -import java.util.Date; - public class HopRowCoderTest extends TestCase { ByteArrayOutputStream outputStream; @@ -49,7 +48,12 @@ public void testEncodeDecodeBasic() throws IOException { HopRow row1 = new HopRow( new Object[] { - "AAA", "BBB", Long.valueOf(100), Double.valueOf(1.234), new Date(876876868), new Timestamp(810311) + "AAA", + "BBB", + Long.valueOf(100), + Double.valueOf(1.234), + new Date(876876868), + new Timestamp(810311) }); hopRowCoder.encode(row1, outputStream); @@ -66,56 +70,56 @@ public void testEncodeDecodeBasic() throws IOException { @Test public void testEncodeDecodeAvro() throws Exception { String schemaJson = - "{\n" - + " \"doc\": \"No documentation URL for now\",\n" - + " \"fields\": [\n" - + " {\n" - + " \"name\": \"id\",\n" - + " \"type\": [\n" - + " \"long\",\n" - + " \"null\"\n" - + " ]\n" - + " },\n" - + " {\n" - + " \"name\": \"sysdate\",\n" - + " \"type\": [\n" - + " \"string\",\n" - + " \"null\"\n" - + " ]\n" - + " },\n" - + " {\n" - + " \"name\": \"num\",\n" - + " \"type\": [\n" - + " \"double\",\n" - + " \"null\"\n" - + " ]\n" - + " },\n" - + " {\n" - + " \"name\": \"int\",\n" - + " \"type\": [\n" - + " \"long\",\n" - + " \"null\"\n" - + " ]\n" - + " },\n" - + " {\n" - + " \"name\": \"str\",\n" - + " \"type\": [\n" - + " \"string\",\n" - + " \"null\"\n" - + " ]\n" - + " },\n" - + " {\n" - + " \"name\": \"uuid\",\n" - + " \"type\": [\n" - + " \"string\",\n" - + " \"null\"\n" - + " ]\n" - + " }\n" - + " ],\n" - + " \"name\": \"all_values\",\n" - + " \"namespace\": \"hop.apache.org\",\n" - + " \"type\": \"record\"\n" - + "}"; + "{\n" + + " \"doc\": \"No documentation URL for now\",\n" + + " \"fields\": [\n" + + " {\n" + + " \"name\": \"id\",\n" + + " \"type\": [\n" + + " \"long\",\n" + + " \"null\"\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"name\": \"sysdate\",\n" + + " \"type\": [\n" + + " \"string\",\n" + + " \"null\"\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"name\": \"num\",\n" + + " \"type\": [\n" + + " \"double\",\n" + + " \"null\"\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"name\": \"int\",\n" + + " \"type\": [\n" + + " \"long\",\n" + + " \"null\"\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"name\": \"str\",\n" + + " \"type\": [\n" + + " \"string\",\n" + + " \"null\"\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"name\": \"uuid\",\n" + + " \"type\": [\n" + + " \"string\",\n" + + " \"null\"\n" + + " ]\n" + + " }\n" + + " ],\n" + + " \"name\": \"all_values\",\n" + + " \"namespace\": \"hop.apache.org\",\n" + + " \"type\": \"record\"\n" + + "}"; Schema schema = new Schema.Parser().parse(schemaJson); GenericRecord genericRecord = new GenericData.Record(schema); @@ -128,11 +132,7 @@ public void testEncodeDecodeAvro() throws Exception { // Create a row with an ID, a name and an avro record... // - Object[] row = new Object[] { - 123L, - "Apache Hop", - genericRecord - }; + Object[] row = new Object[] {123L, "Apache Hop", genericRecord}; HopRow hopRow = new HopRow(row); HopRowCoder hopRowCoder = new HopRowCoder(); diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/transform/BeamBQOutputTransformTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/transform/BeamBQOutputTransformTest.java index 8274283dd82..f88848c095a 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/transform/BeamBQOutputTransformTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/core/transform/BeamBQOutputTransformTest.java @@ -17,39 +17,48 @@ package org.apache.hop.beam.core.transform; +import static org.apache.hop.beam.core.transform.BeamBQOutputTransform.validateBQFieldName; + import org.apache.hop.core.exception.HopException; import org.junit.Test; -import static org.apache.hop.beam.core.transform.BeamBQOutputTransform.validateBQFieldName; - public class BeamBQOutputTransformTest { - @Test - public void testValidateBQFieldName() throws Exception { - validateBQFieldName("_name1"); - validateBQFieldName("name2"); - validateBQFieldName("name_3"); + @Test + public void testValidateBQFieldName() throws Exception { + validateBQFieldName("_name1"); + validateBQFieldName("name2"); + validateBQFieldName("name_3"); - needsException(null, "no Exception thrown: BQ field name can not be null"); - needsException("", "no Exception thrown: BQ field name can not be empty"); - needsException("1name", "no Exception thrown: BQ field name starting with a digit"); - needsException(" name", "no Exception thrown: BQ field name starting with a space"); - needsException("_table_name", "no Exception thrown: BQ field name can't start with _table_"); - needsException("_file_name", "no Exception thrown: BQ field name can't start with _file_"); - needsException("_partition_", "no Exception thrown: BQ field name can't start with _partition_"); - needsException("$name", "no Exception thrown: BQ field name only start with letters or underscore"); - needsException("%name", "no Exception thrown: BQ field name only start with letters or underscore"); - needsException("first name", "no Exception thrown: BQ field name only contain letters, digits or underscore"); - needsException("some-name", "no Exception thrown: BQ field name only contain letters, digits or underscore"); - needsException("last*name", "no Exception thrown: BQ field name only contain letters, digits or underscore"); - } + needsException(null, "no Exception thrown: BQ field name can not be null"); + needsException("", "no Exception thrown: BQ field name can not be empty"); + needsException("1name", "no Exception thrown: BQ field name starting with a digit"); + needsException(" name", "no Exception thrown: BQ field name starting with a space"); + needsException("_table_name", "no Exception thrown: BQ field name can't start with _table_"); + needsException("_file_name", "no Exception thrown: BQ field name can't start with _file_"); + needsException( + "_partition_", "no Exception thrown: BQ field name can't start with _partition_"); + needsException( + "$name", "no Exception thrown: BQ field name only start with letters or underscore"); + needsException( + "%name", "no Exception thrown: BQ field name only start with letters or underscore"); + needsException( + "first name", + "no Exception thrown: BQ field name only contain letters, digits or underscore"); + needsException( + "some-name", + "no Exception thrown: BQ field name only contain letters, digits or underscore"); + needsException( + "last*name", + "no Exception thrown: BQ field name only contain letters, digits or underscore"); + } - public void needsException(String fieldName, String exceptionDescription) throws HopException { - try { - validateBQFieldName(fieldName); - throw new HopException(exceptionDescription); - } catch(Exception e) { - // OK! - } + public void needsException(String fieldName, String exceptionDescription) throws HopException { + try { + validateBQFieldName(fieldName); + throw new HopException(exceptionDescription); + } catch (Exception e) { + // OK! } -} \ No newline at end of file + } +} diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/BeamBasePipelineEngineTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/BeamBasePipelineEngineTest.java index 726e38b21eb..b4cd33b6b5e 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/BeamBasePipelineEngineTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/BeamBasePipelineEngineTest.java @@ -17,6 +17,10 @@ package org.apache.hop.beam.engines; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.List; import org.apache.hop.beam.transform.PipelineTestBase; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.IHopMetadataProvider; @@ -26,11 +30,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.pipeline.engine.PipelineEngineFactory; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class BeamBasePipelineEngineTest extends PipelineTestBase { protected IPipelineEngine createAndExecutePipeline( diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineEngineTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineEngineTest.java index 20fbb1c6a34..57a584e9f38 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineEngineTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/direct/BeamDirectPipelineEngineTest.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.engines.direct; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; import org.apache.hop.beam.engines.BeamBasePipelineEngineTest; import org.apache.hop.beam.util.BeamPipelineMetaUtil; import org.apache.hop.core.variables.DescribedVariable; @@ -26,10 +29,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.junit.Test; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; - public class BeamDirectPipelineEngineTest extends BeamBasePipelineEngineTest { @Test diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineEngineTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineEngineTest.java index b359adb040c..35e18b8c99f 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineEngineTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/flink/BeamFlinkPipelineEngineTest.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.engines.flink; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; import org.apache.hop.beam.engines.BeamBasePipelineEngineTest; import org.apache.hop.beam.util.BeamPipelineMetaUtil; import org.apache.hop.core.variables.DescribedVariable; @@ -26,10 +29,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.junit.Test; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; - public class BeamFlinkPipelineEngineTest extends BeamBasePipelineEngineTest { @Test diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/spark/BeamSparkPipelineEngineTest.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/spark/BeamSparkPipelineEngineTest.java index c36e64caf9a..45bc4c415e0 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/spark/BeamSparkPipelineEngineTest.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/engines/spark/BeamSparkPipelineEngineTest.java @@ -17,6 +17,9 @@ package org.apache.hop.beam.engines.spark; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; import org.apache.hop.beam.engines.BeamBasePipelineEngineTest; import org.apache.hop.beam.util.BeamPipelineMetaUtil; import org.apache.hop.core.variables.DescribedVariable; @@ -25,10 +28,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.junit.Test; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; - public class BeamSparkPipelineEngineTest extends BeamBasePipelineEngineTest { // Disabled because of log4j library dependency problems with Spark diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/transform/PipelineTestBase.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/transform/PipelineTestBase.java index bec512f0c8d..97860beb1e8 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/transform/PipelineTestBase.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/transform/PipelineTestBase.java @@ -17,6 +17,10 @@ package org.apache.hop.beam.transform; +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.hop.beam.core.BeamHop; import org.apache.hop.beam.engines.direct.BeamDirectPipelineEngine; @@ -70,11 +74,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - public class PipelineTestBase { public static final String INPUT_CUSTOMERS_FILE = diff --git a/plugins/engines/beam/src/test/java/org/apache/hop/beam/util/BeamPipelineMetaUtil.java b/plugins/engines/beam/src/test/java/org/apache/hop/beam/util/BeamPipelineMetaUtil.java index 8a3f54dc203..fb2f7ad267d 100644 --- a/plugins/engines/beam/src/test/java/org/apache/hop/beam/util/BeamPipelineMetaUtil.java +++ b/plugins/engines/beam/src/test/java/org/apache/hop/beam/util/BeamPipelineMetaUtil.java @@ -17,6 +17,7 @@ package org.apache.hop.beam.util; +import java.util.List; import org.apache.hop.beam.metadata.FieldDefinition; import org.apache.hop.beam.metadata.FileDefinition; import org.apache.hop.beam.transform.PipelineTestBase; @@ -42,8 +43,6 @@ import org.apache.hop.pipeline.transforms.switchcase.SwitchCaseMeta; import org.apache.hop.pipeline.transforms.switchcase.SwitchCaseTarget; -import java.util.List; - public class BeamPipelineMetaUtil { public static final PipelineMeta generateBeamInputOutputPipelineMeta( diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncGuiPlugin.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncGuiPlugin.java index 3496a9f8cf8..c69e6dbdf44 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncGuiPlugin.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncGuiPlugin.java @@ -17,6 +17,9 @@ package org.apache.hop.www.async; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.action.GuiContextActionFilter; import org.apache.hop.core.gui.plugin.GuiPlugin; @@ -29,10 +32,6 @@ import org.apache.hop.ui.hopgui.file.workflow.context.HopGuiWorkflowActionContext; import org.apache.hop.workflow.action.ActionMeta; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @GuiPlugin public class AsyncGuiPlugin { diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncRunServlet.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncRunServlet.java index fcb62b6f320..b356c890f06 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncRunServlet.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncRunServlet.java @@ -17,6 +17,19 @@ package org.apache.hop.www.async; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.UUID; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.TimeUnit; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.HopServerServlet; @@ -45,20 +58,6 @@ import org.apache.hop.www.WebServiceServlet; import org.json.simple.JSONObject; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.UUID; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.TimeUnit; - @HopServerServlet(id = "asyncRun", name = "Asynchronously run a workflow") public class AsyncRunServlet extends BaseHttpServlet implements IHopServerPlugin { @@ -125,7 +124,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) { throw new HopException("Asynchronous Web service '" + webServiceName + "' is disabled."); } - // If a run configuration is set in the async web service and none is specified here, we take it. + // If a run configuration is set in the async web service and none is specified here, we take + // it. // if (StringUtils.isEmpty(runConfigurationName)) { runConfigurationName = variables.resolve(webService.getRunConfigurationName()); diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncStatus.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncStatus.java index 6a22e2dff35..923f28601be 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncStatus.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncStatus.java @@ -18,13 +18,12 @@ package org.apache.hop.www.async; import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.hop.www.HopServerPipelineStatus; - import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.www.HopServerPipelineStatus; public class AsyncStatus { private String service; @@ -58,7 +57,9 @@ public String getService() { return service; } - /** @param service The service to set */ + /** + * @param service The service to set + */ public void setService(String service) { this.service = service; } @@ -72,7 +73,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -86,7 +89,9 @@ public Date getLogDate() { return logDate; } - /** @param logDate The logDate to set */ + /** + * @param logDate The logDate to set + */ public void setLogDate(Date logDate) { this.logDate = logDate; } @@ -100,7 +105,9 @@ public Date getStartDate() { return startDate; } - /** @param startDate The startDate to set */ + /** + * @param startDate The startDate to set + */ public void setStartDate(Date startDate) { this.startDate = startDate; } @@ -114,7 +121,9 @@ public Date getEndDate() { return endDate; } - /** @param endDate The endDate to set */ + /** + * @param endDate The endDate to set + */ public void setEndDate(Date endDate) { this.endDate = endDate; } @@ -128,7 +137,9 @@ public String getStatusDescription() { return statusDescription; } - /** @param statusDescription The statusDescription to set */ + /** + * @param statusDescription The statusDescription to set + */ public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } @@ -142,7 +153,9 @@ public Map getStatusVariables() { return statusVariables; } - /** @param statusVariables The statusVariables to set */ + /** + * @param statusVariables The statusVariables to set + */ public void setStatusVariables(Map statusVariables) { this.statusVariables = statusVariables; } @@ -156,7 +169,9 @@ public List getPipelineStatuses() { return pipelineStatuses; } - /** @param pipelineStatuses The pipelineStatuses to set */ + /** + * @param pipelineStatuses The pipelineStatuses to set + */ public void setPipelineStatuses(List pipelineStatuses) { this.pipelineStatuses = pipelineStatuses; } diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncWebService.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncWebService.java index a75c756cd68..5b9e9adbb57 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncWebService.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/AsyncWebService.java @@ -17,6 +17,8 @@ package org.apache.hop.www.async; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.variables.IVariables; @@ -25,9 +27,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "async-web-service", name = "Asynchronous Web Service", @@ -52,7 +51,8 @@ public AsyncWebService( boolean enabled, String filename, String statusVariables, - String bodyContentVariable, String runConfigurationName) { + String bodyContentVariable, + String runConfigurationName) { super(name); this.enabled = enabled; this.filename = filename; @@ -88,7 +88,9 @@ public boolean isEnabled() { return enabled; } - /** @param enabled The enabled to set */ + /** + * @param enabled The enabled to set + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -102,7 +104,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -116,7 +120,9 @@ public String getStatusVariables() { return statusVariables; } - /** @param statusVariables The statusVariables to set */ + /** + * @param statusVariables The statusVariables to set + */ public void setStatusVariables(String statusVariables) { this.statusVariables = statusVariables; } @@ -130,7 +136,9 @@ public String getBodyContentVariable() { return bodyContentVariable; } - /** @param bodyContentVariable The bodyContentVariable to set */ + /** + * @param bodyContentVariable The bodyContentVariable to set + */ public void setBodyContentVariable(String bodyContentVariable) { this.bodyContentVariable = bodyContentVariable; } diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/DrawAsyncLoggingIconExtensionPoint.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/DrawAsyncLoggingIconExtensionPoint.java index 396d9ab7d23..093b0640478 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/DrawAsyncLoggingIconExtensionPoint.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/DrawAsyncLoggingIconExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.www.async.xp; +import java.util.Map; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; import org.apache.hop.core.gui.AreaOwner; @@ -28,8 +29,6 @@ import org.apache.hop.workflow.WorkflowPainterExtension; import org.apache.hop.www.async.Defaults; -import java.util.Map; - @ExtensionPoint( id = "DrawAsyncLoggingIconExtensionPoint", description = diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/MarkAsyncWorkflowActionExtensionPoint.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/MarkAsyncWorkflowActionExtensionPoint.java index 8cdb1b724e9..c27c5b09e0a 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/MarkAsyncWorkflowActionExtensionPoint.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/MarkAsyncWorkflowActionExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.www.async.xp; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -30,8 +31,6 @@ import org.apache.hop.www.async.AsyncWebService; import org.apache.hop.www.async.Defaults; -import java.util.Map; - @ExtensionPoint( id = "MarkAsyncWorkflowActionExtensionPoint", extensionPointId = "WorkflowBeforeActionExecution", diff --git a/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/PeriodicPipelineStatusUpdateExtensionPoint.java b/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/PeriodicPipelineStatusUpdateExtensionPoint.java index 96490cda606..41b51d69081 100644 --- a/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/PeriodicPipelineStatusUpdateExtensionPoint.java +++ b/plugins/misc/async/src/main/java/org/apache/hop/www/async/xp/PeriodicPipelineStatusUpdateExtensionPoint.java @@ -17,6 +17,11 @@ package org.apache.hop.www.async.xp; +import java.io.IOException; +import java.util.Date; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -36,12 +41,6 @@ import org.apache.hop.www.async.AsyncWebService; import org.apache.hop.www.async.Defaults; -import java.io.IOException; -import java.util.Date; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; - @ExtensionPoint( id = "PeriodicPipelineStatusUpdateExtensionPoint", extensionPointId = "PipelinePrepareExecution", diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugGuiPlugin.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugGuiPlugin.java index 1b67040f9c5..97259f046ea 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugGuiPlugin.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugGuiPlugin.java @@ -17,6 +17,8 @@ package org.apache.hop.debug.action; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.gui.plugin.action.GuiActionType; @@ -28,9 +30,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.action.ActionMeta; -import java.util.HashMap; -import java.util.Map; - @GuiPlugin public class ActionDebugGuiPlugin { @@ -83,7 +82,8 @@ public void applyCustomActionLogging(HopGuiWorkflowActionContext context) { debugLevel = new ActionDebugLevel(); } - ActionDebugLevelDialog dialog = new ActionDebugLevelDialog(hopGui.getActiveShell(), debugLevel); + ActionDebugLevelDialog dialog = + new ActionDebugLevelDialog(hopGui.getActiveShell(), debugLevel); if (dialog.open()) { DebugLevelUtil.storeActionDebugLevel( debugGroupAttributesMap, action.toString(), debugLevel); diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugLevel.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugLevel.java index d084237f7af..32c0934e066 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugLevel.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ActionDebugLevel.java @@ -86,7 +86,9 @@ public LogLevel getLogLevel() { return logLevel; } - /** @param logLevel The logLevel to set */ + /** + * @param logLevel The logLevel to set + */ public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; } @@ -100,7 +102,9 @@ public boolean isLoggingResult() { return loggingResult; } - /** @param loggingResult The loggingResult to set */ + /** + * @param loggingResult The loggingResult to set + */ public void setLoggingResult(boolean loggingResult) { this.loggingResult = loggingResult; } @@ -114,7 +118,9 @@ public boolean isLoggingVariables() { return loggingVariables; } - /** @param loggingVariables The loggingVariables to set */ + /** + * @param loggingVariables The loggingVariables to set + */ public void setLoggingVariables(boolean loggingVariables) { this.loggingVariables = loggingVariables; } @@ -128,7 +134,9 @@ public boolean isLoggingResultRows() { return loggingResultRows; } - /** @param loggingResultRows The loggingResultRows to set */ + /** + * @param loggingResultRows The loggingResultRows to set + */ public void setLoggingResultRows(boolean loggingResultRows) { this.loggingResultRows = loggingResultRows; } @@ -142,7 +150,9 @@ public boolean isLoggingResultFiles() { return loggingResultFiles; } - /** @param loggingResultFiles The loggingResultFiles to set */ + /** + * @param loggingResultFiles The loggingResultFiles to set + */ public void setLoggingResultFiles(boolean loggingResultFiles) { this.loggingResultFiles = loggingResultFiles; } diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/DrawActionDebugLevelBeeExtensionPoint.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/DrawActionDebugLevelBeeExtensionPoint.java index 29466ca6389..4b6d4f1f7de 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/DrawActionDebugLevelBeeExtensionPoint.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/DrawActionDebugLevelBeeExtensionPoint.java @@ -17,6 +17,8 @@ package org.apache.hop.debug.action; +import java.awt.image.BufferedImage; +import java.util.Map; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; import org.apache.hop.core.gui.AreaOwner; @@ -28,9 +30,6 @@ import org.apache.hop.debug.util.Defaults; import org.apache.hop.workflow.WorkflowPainterExtension; -import java.awt.image.BufferedImage; -import java.util.Map; - @ExtensionPoint( id = "DrawActionDebugLevelBeeExtensionPoint", description = "Draw a bee over a workflow entry which has debug level information stored", diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ModifyActionLogLevelExtensionPoint.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ModifyActionLogLevelExtensionPoint.java index d00513cda56..11388be66ab 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ModifyActionLogLevelExtensionPoint.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/action/ModifyActionLogLevelExtensionPoint.java @@ -17,6 +17,9 @@ package org.apache.hop.debug.action; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Result; import org.apache.hop.core.ResultFile; import org.apache.hop.core.RowMetaAndData; @@ -37,10 +40,6 @@ import org.apache.hop.workflow.action.IAction; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - @ExtensionPoint( id = "ModifyActionLogLevelExtensionPoint", extensionPointId = "WorkflowStart", diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/pipeline/LogPipelineExecutionTimeExtensionPoint.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/pipeline/LogPipelineExecutionTimeExtensionPoint.java index 04756566fc8..e2c4c1f97d0 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/pipeline/LogPipelineExecutionTimeExtensionPoint.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/pipeline/LogPipelineExecutionTimeExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.debug.pipeline; +import java.util.Date; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.engine.IPipelineEngine; -import java.util.Date; - @ExtensionPoint( id = "LogPipelineExecutionTimeExtensionPoint", description = "Logs execution time of a transformation when it finishes", diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/DrawTransformDebugLevelBeeExtensionPoint.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/DrawTransformDebugLevelBeeExtensionPoint.java index 08ca3612400..2fbffe4f537 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/DrawTransformDebugLevelBeeExtensionPoint.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/DrawTransformDebugLevelBeeExtensionPoint.java @@ -17,6 +17,8 @@ package org.apache.hop.debug.transform; +import java.awt.image.BufferedImage; +import java.util.Map; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; import org.apache.hop.core.gui.AreaOwner; @@ -28,9 +30,6 @@ import org.apache.hop.debug.util.Defaults; import org.apache.hop.pipeline.PipelinePainterExtension; -import java.awt.image.BufferedImage; -import java.util.Map; - @ExtensionPoint( id = "DrawTransformDebugLevelBeeExtensionPoint", description = "Draw a bee over a transform which has debug level information stored", diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/SetTransformDebugLevelExtensionPoint.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/SetTransformDebugLevelExtensionPoint.java index 215d9dd45df..7de1a0b923e 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/SetTransformDebugLevelExtensionPoint.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/SetTransformDebugLevelExtensionPoint.java @@ -17,6 +17,10 @@ package org.apache.hop.debug.transform; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; import org.apache.hop.core.Condition; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -33,11 +37,6 @@ import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicLong; - @ExtensionPoint( id = "SetTransformDebugLevelExtensionPoint", description = "Set Transform Debug Level Extension Point Plugin", diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugGuiPlugin.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugGuiPlugin.java index e189b182d06..a86e3e1eaff 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugGuiPlugin.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugGuiPlugin.java @@ -17,6 +17,8 @@ package org.apache.hop.debug.transform; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.core.gui.plugin.action.GuiActionType; @@ -30,9 +32,6 @@ import org.apache.hop.ui.hopgui.HopGui; import org.apache.hop.ui.hopgui.file.pipeline.context.HopGuiPipelineTransformContext; -import java.util.HashMap; -import java.util.Map; - @GuiPlugin public class TransformDebugGuiPlugin { diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugLevel.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugLevel.java index 1af074c0683..4581bead224 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugLevel.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/transform/TransformDebugLevel.java @@ -74,7 +74,9 @@ public LogLevel getLogLevel() { return logLevel; } - /** @param logLevel The logLevel to set */ + /** + * @param logLevel The logLevel to set + */ public void setLogLevel(LogLevel logLevel) { this.logLevel = logLevel; } @@ -88,7 +90,9 @@ public int getStartRow() { return startRow; } - /** @param startRow The startRow to set */ + /** + * @param startRow The startRow to set + */ public void setStartRow(int startRow) { this.startRow = startRow; } @@ -102,7 +106,9 @@ public int getEndRow() { return endRow; } - /** @param endRow The endRow to set */ + /** + * @param endRow The endRow to set + */ public void setEndRow(int endRow) { this.endRow = endRow; } @@ -116,7 +122,9 @@ public Condition getCondition() { return condition; } - /** @param condition The condition to set */ + /** + * @param condition The condition to set + */ public void setCondition(Condition condition) { this.condition = condition; } diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/DebugLevelUtil.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/DebugLevelUtil.java index 5311ab98d71..d1232c66d3e 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/DebugLevelUtil.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/DebugLevelUtil.java @@ -17,6 +17,10 @@ package org.apache.hop.debug.util; +import java.io.UnsupportedEncodingException; +import java.util.Base64; +import java.util.Map; +import java.util.concurrent.TimeUnit; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Condition; import org.apache.hop.core.Const; @@ -26,11 +30,6 @@ import org.apache.hop.debug.action.ActionDebugLevel; import org.apache.hop.debug.transform.TransformDebugLevel; -import java.io.UnsupportedEncodingException; -import java.util.Base64; -import java.util.Map; -import java.util.concurrent.TimeUnit; - public class DebugLevelUtil { public static void storeTransformDebugLevel( diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/SvgLoader.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/SvgLoader.java index e55e1befc86..680201eccb5 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/SvgLoader.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/util/SvgLoader.java @@ -17,13 +17,6 @@ package org.apache.hop.debug.util; -import org.apache.batik.transcoder.Transcoder; -import org.apache.batik.transcoder.TranscoderInput; -import org.apache.batik.transcoder.TranscoderOutput; -import org.apache.batik.transcoder.image.PNGTranscoder; -import org.apache.hop.core.exception.HopException; - -import javax.swing.JPanel; import java.awt.Graphics2D; import java.awt.Image; import java.awt.MediaTracker; @@ -31,6 +24,12 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import javax.swing.JPanel; +import org.apache.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.image.PNGTranscoder; +import org.apache.hop.core.exception.HopException; public class SvgLoader { diff --git a/plugins/misc/debug/src/main/java/org/apache/hop/debug/workflow/LogWorkflowExecutionTimeExtensionPoint.java b/plugins/misc/debug/src/main/java/org/apache/hop/debug/workflow/LogWorkflowExecutionTimeExtensionPoint.java index 238b0c418e8..d73ac2b2139 100644 --- a/plugins/misc/debug/src/main/java/org/apache/hop/debug/workflow/LogWorkflowExecutionTimeExtensionPoint.java +++ b/plugins/misc/debug/src/main/java/org/apache/hop/debug/workflow/LogWorkflowExecutionTimeExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.debug.workflow; +import java.util.Date; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -27,8 +28,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.Date; - @ExtensionPoint( id = "LogWorkflowExecutionTimeExtensionPoint", description = "Logs execution time of a workflow when it finishes", diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnActionExtensionPoint.java b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnActionExtensionPoint.java index a3b4cb1277b..f5c9f3670c9 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnActionExtensionPoint.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnActionExtensionPoint.java @@ -18,6 +18,12 @@ package org.apache.hop.git; +import static org.apache.hop.git.HopDiff.ADDED; +import static org.apache.hop.git.HopDiff.ATTR_GIT; +import static org.apache.hop.git.HopDiff.ATTR_STATUS; +import static org.apache.hop.git.HopDiff.CHANGED; +import static org.apache.hop.git.HopDiff.REMOVED; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -32,12 +38,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.WorkflowPainter; -import static org.apache.hop.git.HopDiff.ADDED; -import static org.apache.hop.git.HopDiff.ATTR_GIT; -import static org.apache.hop.git.HopDiff.ATTR_STATUS; -import static org.apache.hop.git.HopDiff.CHANGED; -import static org.apache.hop.git.HopDiff.REMOVED; - @ExtensionPoint( id = "DrawDiffOnActionExtensionPoint", description = "Draws a marker on top of an action if it has some change", diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnPipelineHopExtensionPoint.java b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnPipelineHopExtensionPoint.java index 16a22b90df6..839d08621db 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnPipelineHopExtensionPoint.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnPipelineHopExtensionPoint.java @@ -18,6 +18,13 @@ package org.apache.hop.git; +import static org.apache.hop.git.HopDiff.ADDED; +import static org.apache.hop.git.HopDiff.ATTR_GIT_HOPS; +import static org.apache.hop.git.HopDiff.CHANGED; +import static org.apache.hop.git.HopDiff.REMOVED; +import static org.apache.hop.git.HopDiff.getPipelineHopName; + +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -30,14 +37,6 @@ import org.apache.hop.ui.core.ConstUi; import org.apache.hop.ui.core.PropsUi; -import java.util.Map; - -import static org.apache.hop.git.HopDiff.ADDED; -import static org.apache.hop.git.HopDiff.ATTR_GIT_HOPS; -import static org.apache.hop.git.HopDiff.CHANGED; -import static org.apache.hop.git.HopDiff.REMOVED; -import static org.apache.hop.git.HopDiff.getPipelineHopName; - @ExtensionPoint( id = "DrawDiffOnPipelineHopExtensionPoint", description = "Draws a marker on top of a pipeline Hop if it has added or removed", diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnTransformExtensionPoint.java b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnTransformExtensionPoint.java index 5d2e50545ab..96f1843f956 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnTransformExtensionPoint.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnTransformExtensionPoint.java @@ -18,6 +18,12 @@ package org.apache.hop.git; +import static org.apache.hop.git.HopDiff.ADDED; +import static org.apache.hop.git.HopDiff.ATTR_GIT; +import static org.apache.hop.git.HopDiff.ATTR_STATUS; +import static org.apache.hop.git.HopDiff.CHANGED; +import static org.apache.hop.git.HopDiff.REMOVED; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -32,12 +38,6 @@ import org.apache.hop.ui.core.ConstUi; import org.apache.hop.ui.core.PropsUi; -import static org.apache.hop.git.HopDiff.ADDED; -import static org.apache.hop.git.HopDiff.ATTR_GIT; -import static org.apache.hop.git.HopDiff.ATTR_STATUS; -import static org.apache.hop.git.HopDiff.CHANGED; -import static org.apache.hop.git.HopDiff.REMOVED; - @ExtensionPoint( id = "DrawDiffOnTransExtensionPoint", description = "Draws a marker on top of a transform if it has some change", diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnWorkflowHopExtensionPoint.java b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnWorkflowHopExtensionPoint.java index d74dd0dcd7a..aa171ec02b4 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnWorkflowHopExtensionPoint.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/DrawDiffOnWorkflowHopExtensionPoint.java @@ -18,6 +18,12 @@ package org.apache.hop.git; +import static org.apache.hop.git.HopDiff.ADDED; +import static org.apache.hop.git.HopDiff.ATTR_GIT_HOPS; +import static org.apache.hop.git.HopDiff.CHANGED; +import static org.apache.hop.git.HopDiff.REMOVED; + +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -30,13 +36,6 @@ import org.apache.hop.ui.core.PropsUi; import org.apache.hop.workflow.WorkflowPainterExtension; -import java.util.Map; - -import static org.apache.hop.git.HopDiff.ADDED; -import static org.apache.hop.git.HopDiff.ATTR_GIT_HOPS; -import static org.apache.hop.git.HopDiff.CHANGED; -import static org.apache.hop.git.HopDiff.REMOVED; - @ExtensionPoint( id = "DrawDiffOnWorkflowHopExtensionPoint", description = "Draws a marker on top of a workflow hop if it has added or removed", diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java b/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java index 8417911f060..b1d0124ae95 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java @@ -18,6 +18,12 @@ package org.apache.hop.git; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.hop.core.exception.HopFileException; @@ -50,13 +56,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - @GuiPlugin public class GitGuiPlugin implements IExplorerRootChangedListener, diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/HopDiff.java b/plugins/misc/git/src/main/java/org/apache/hop/git/HopDiff.java index 9405c55be02..130e0d7f55b 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/HopDiff.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/HopDiff.java @@ -18,6 +18,8 @@ package org.apache.hop.git; +import java.util.Map; +import java.util.Optional; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.PipelineHopMeta; import org.apache.hop.pipeline.PipelineMeta; @@ -26,9 +28,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.action.ActionMeta; -import java.util.Map; -import java.util.Optional; - public class HopDiff { public static String ATTR_GIT = "Git"; public static String ATTR_STATUS = "Status"; diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileType.java b/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileType.java index e95b0f68e71..b3ce8c3956c 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileType.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileType.java @@ -40,7 +40,13 @@ public class GitInfoExplorerFileType extends BaseExplorerFileType { public GitInfoExplorerFileType() { - super("Git info", "", new String[] {}, new String[] {}, FileTypeCapabilities.getCapabilities(IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY)); + super( + "Git info", + "", + new String[] {}, + new String[] {}, + FileTypeCapabilities.getCapabilities( + IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY)); } @Override diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileTypeHandler.java b/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileTypeHandler.java index 338eca3f4f8..4220548a973 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileTypeHandler.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/info/GitInfoExplorerFileTypeHandler.java @@ -18,6 +18,14 @@ package org.apache.hop.git.info; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -64,15 +72,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.InputStream; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - /** Show git information about a file or folder : revisions */ public class GitInfoExplorerFileTypeHandler extends BaseExplorerFileTypeHandler implements IExplorerFileTypeHandler, Listener { diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java b/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java index 9b37a531abb..4d998a82046 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/model/UIGit.java @@ -18,6 +18,19 @@ package org.apache.hop.git.model; import com.google.common.annotations.VisibleForTesting; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.apache.commons.io.FilenameUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -92,20 +105,6 @@ import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.SystemReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - public class UIGit extends VCS { protected static final Class PKG = UIGit.class; // For Translator diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/GitObjectRevision.java b/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/GitObjectRevision.java index e3a91d02356..c81dd02cbc7 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/GitObjectRevision.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/GitObjectRevision.java @@ -47,7 +47,9 @@ public String getRevisionId() { return revisionId; } - /** @param revisionId The revisionId to set */ + /** + * @param revisionId The revisionId to set + */ public void setRevisionId(String revisionId) { this.revisionId = revisionId; } @@ -62,7 +64,9 @@ public String getLogin() { return login; } - /** @param login The login to set */ + /** + * @param login The login to set + */ public void setLogin(String login) { this.login = login; } @@ -77,7 +81,9 @@ public Date getCreationDate() { return creationDate; } - /** @param creationDate The creationDate to set */ + /** + * @param creationDate The creationDate to set + */ public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } @@ -92,7 +98,9 @@ public String getComment() { return comment; } - /** @param comment The comment to set */ + /** + * @param comment The comment to set + */ public void setComment(String comment) { this.comment = comment; } diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/ObjectRevision.java b/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/ObjectRevision.java index 20e3cc445d2..c9a97ded97b 100644 --- a/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/ObjectRevision.java +++ b/plugins/misc/git/src/main/java/org/apache/hop/git/model/revision/ObjectRevision.java @@ -22,13 +22,19 @@ /** A revision is simply a name, a commit comment and a date */ public interface ObjectRevision { - /** @return The internal name or number of the revision */ + /** + * @return The internal name or number of the revision + */ public String getRevisionId(); - /** @return The creation date of the revision */ + /** + * @return The creation date of the revision + */ public Date getCreationDate(); - /** @return The user that caused the revision */ + /** + * @return The user that caused the revision + */ public String getLogin(); /** diff --git a/plugins/misc/git/src/test/java/org/apache/hop/git/HopDiffTest.java b/plugins/misc/git/src/test/java/org/apache/hop/git/HopDiffTest.java index 2a2a702a583..a6402ed98d0 100644 --- a/plugins/misc/git/src/test/java/org/apache/hop/git/HopDiffTest.java +++ b/plugins/misc/git/src/test/java/org/apache/hop/git/HopDiffTest.java @@ -18,6 +18,19 @@ package org.apache.hop.git; +import static org.apache.hop.git.HopDiff.ADDED; +import static org.apache.hop.git.HopDiff.ATTR_GIT; +import static org.apache.hop.git.HopDiff.ATTR_STATUS; +import static org.apache.hop.git.HopDiff.CHANGED; +import static org.apache.hop.git.HopDiff.REMOVED; +import static org.apache.hop.git.HopDiff.UNCHANGED; +import static org.apache.hop.git.HopDiff.compareActions; +import static org.apache.hop.git.HopDiff.compareTransforms; +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -29,20 +42,6 @@ import org.junit.Before; import org.junit.Test; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -import static org.apache.hop.git.HopDiff.ADDED; -import static org.apache.hop.git.HopDiff.ATTR_GIT; -import static org.apache.hop.git.HopDiff.ATTR_STATUS; -import static org.apache.hop.git.HopDiff.CHANGED; -import static org.apache.hop.git.HopDiff.REMOVED; -import static org.apache.hop.git.HopDiff.UNCHANGED; -import static org.apache.hop.git.HopDiff.compareActions; -import static org.apache.hop.git.HopDiff.compareTransforms; -import static org.junit.Assert.assertEquals; - public class HopDiffTest { IHopMetadataProvider metadataProvider; diff --git a/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java b/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java index e49dfd9ce68..84846660955 100644 --- a/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java +++ b/plugins/misc/git/src/test/java/org/apache/hop/git/model/UIGitTest.java @@ -18,6 +18,21 @@ package org.apache.hop.git.model; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.io.File; +import java.io.InputStream; +import java.io.StringWriter; +import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.hop.git.model.revision.ObjectRevision; @@ -40,22 +55,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import java.io.File; -import java.io.InputStream; -import java.io.StringWriter; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyString; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - public class UIGitTest extends RepositoryTestCase { private Git git; private UIGit uiGit; diff --git a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java index 060ace8f808..eb561e0ce47 100644 --- a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java +++ b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java @@ -76,9 +76,10 @@ public class KettleConst { {"sourceXMLstep", "sourceXMLTransform"}, // Multiway Merge Join, 0-9 for simplicity {"step0", "transform0"}, - // step1 and step2 are already covered earlier in the mapping. left in comments here for clarity. - //{"step1", "transform1"}, - //{"step2", "transform2"}, + // step1 and step2 are already covered earlier in the mapping. left in comments here + // for clarity. + // {"step1", "transform1"}, + // {"step2", "transform2"}, {"step3", "transform3"}, {"step4", "transform4"}, {"step5", "transform5"}, @@ -210,7 +211,6 @@ public class KettleConst { {"CURRENT_JOB", "CURRENT_WORKFLOW"}, // set variable {"PARENT_JOB", "PARENT_WORKFLOW"}, // set variable {"ROOT_JOB", "ROOT_WORKFLOW"} // set variable - }) .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1])); diff --git a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java index 2f5f766cc0b..595b7c6de28 100644 --- a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java +++ b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java @@ -17,6 +17,27 @@ package org.apache.hop.imports.kettle; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicInteger; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import org.apache.commons.lang3.StringUtils; import org.apache.commons.vfs2.FileFilterSelector; import org.apache.commons.vfs2.FileObject; @@ -49,28 +70,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; - @ImportPlugin( id = "kettle", name = "Kettle Import", @@ -575,7 +574,11 @@ private void processNode(Document doc, Node node, EntryType entryType, int depth entryType = EntryType.FORMULA; } if (childNode.getNodeName().equals("type") - && childNode.getChildNodes().item(0).getNodeValue().equals("PentahoGoogleSheetsPluginInputMeta")){ + && childNode + .getChildNodes() + .item(0) + .getNodeValue() + .equals("PentahoGoogleSheetsPluginInputMeta")) { entryType = EntryType.GOOGLE_SHEETS_INPUT; } if (childNode.getNodeName().equals("type") @@ -650,7 +653,9 @@ private void processNode(Document doc, Node node, EntryType entryType, int depth } else if (entryType == EntryType.FORMULA && currentNode.getNodeName().equals("value_type")) { String formulaType = currentNode.getFirstChild().getNodeValue(); - currentNode.getFirstChild().setNodeValue(Integer.toString(ValueMetaFactory.getIdForValueMeta(formulaType))); + currentNode + .getFirstChild() + .setNodeValue(Integer.toString(ValueMetaFactory.getIdForValueMeta(formulaType))); } if (entryType == EntryType.JOB || entryType == EntryType.TRANS) { @@ -690,29 +695,29 @@ else if (entryType == EntryType.TRANS) } } - if(entryType == EntryType.SIMPLE_MAPPING - && currentNode.getNodeName().equals("transform")){ + if (entryType == EntryType.SIMPLE_MAPPING && currentNode.getNodeName().equals("transform")) { Node filenameNode = null; String transName = ""; String directoryPath = ""; // get trans name, file name, path, set correct filename when needed. - for(int j=0; j listEnvironmentNames() { return names; } - public List listEnvironmentNamesForProject(String projectName){ + public List listEnvironmentNamesForProject(String projectName) { List names = new ArrayList<>(); - lifecycleEnvironments.stream().forEach(env -> { - if(env.getProjectName().equals(projectName)){ - names.add(env.getName()); - } - }); + lifecycleEnvironments.stream() + .forEach( + env -> { + if (env.getProjectName().equals(projectName)) { + names.add(env.getName()); + } + }); Collections.sort(names); return names; @@ -241,7 +242,9 @@ public boolean isEnabled() { return enabled; } - /** @param enabled The enabled to set */ + /** + * @param enabled The enabled to set + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -255,7 +258,9 @@ public List getProjectConfigurations() { return projectConfigurations; } - /** @param projectConfigurations The projectConfigurations to set */ + /** + * @param projectConfigurations The projectConfigurations to set + */ public void setProjectConfigurations(List projectConfigurations) { this.projectConfigurations = projectConfigurations; } @@ -269,7 +274,9 @@ public List getLifecycleEnvironments() { return lifecycleEnvironments; } - /** @param lifecycleEnvironments The lifecycleEnvironments to set */ + /** + * @param lifecycleEnvironments The lifecycleEnvironments to set + */ public void setLifecycleEnvironments(List lifecycleEnvironments) { this.lifecycleEnvironments = lifecycleEnvironments; } @@ -283,7 +290,9 @@ public String getDefaultProject() { return defaultProject; } - /** @param defaultProject The defaultProject to set */ + /** + * @param defaultProject The defaultProject to set + */ public void setDefaultProject(String defaultProject) { this.defaultProject = defaultProject; } @@ -297,7 +306,9 @@ public boolean isProjectMandatory() { return projectMandatory; } - /** @param projectMandatory The projectMandatory to set */ + /** + * @param projectMandatory The projectMandatory to set + */ public void setProjectMandatory(boolean projectMandatory) { this.projectMandatory = projectMandatory; } @@ -311,7 +322,9 @@ public boolean isEnvironmentMandatory() { return environmentMandatory; } - /** @param environmentMandatory The environmentMandatory to set */ + /** + * @param environmentMandatory The environmentMandatory to set + */ public void setEnvironmentMandatory(boolean environmentMandatory) { this.environmentMandatory = environmentMandatory; } @@ -325,7 +338,9 @@ public String getDefaultEnvironment() { return defaultEnvironment; } - /** @param defaultEnvironment The defaultEnvironment to set */ + /** + * @param defaultEnvironment The defaultEnvironment to set + */ public void setDefaultEnvironment(String defaultEnvironment) { this.defaultEnvironment = defaultEnvironment; } @@ -339,7 +354,9 @@ public String getStandardParentProject() { return standardParentProject; } - /** @param standardParentProject The standardParentProject to set */ + /** + * @param standardParentProject The standardParentProject to set + */ public void setStandardParentProject(String standardParentProject) { this.standardParentProject = standardParentProject; } @@ -353,7 +370,9 @@ public List getProjectLifecycles() { return projectLifecycles; } - /** @param projectLifecycles The projectLifecycles to set */ + /** + * @param projectLifecycles The projectLifecycles to set + */ public void setProjectLifecycles(List projectLifecycles) { this.projectLifecycles = projectLifecycles; } @@ -367,7 +386,9 @@ public String getStandardProjectsFolder() { return standardProjectsFolder; } - /** @param standardProjectsFolder The standardProjectsFolder to set */ + /** + * @param standardProjectsFolder The standardProjectsFolder to set + */ public void setStandardProjectsFolder(String standardProjectsFolder) { this.standardProjectsFolder = standardProjectsFolder; } @@ -381,7 +402,9 @@ public String getDefaultProjectConfigFile() { return defaultProjectConfigFile; } - /** @param defaultProjectConfigFile The defaultProjectConfigFile to set */ + /** + * @param defaultProjectConfigFile The defaultProjectConfigFile to set + */ public void setDefaultProjectConfigFile(String defaultProjectConfigFile) { this.defaultProjectConfigFile = defaultProjectConfigFile; } @@ -395,10 +418,10 @@ public boolean isEnvironmentsForActiveProject() { return environmentsForActiveProject; } - /** @param environmentsForActiveProject The environmentMandatory to set */ + /** + * @param environmentsForActiveProject The environmentMandatory to set + */ public void setEnvironmentsForActiveProject(boolean environmentsForActiveProject) { this.environmentsForActiveProject = environmentsForActiveProject; } - - } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigOptionPlugin.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigOptionPlugin.java index 581d7af9459..88857d405c2 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigOptionPlugin.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigOptionPlugin.java @@ -17,6 +17,8 @@ package org.apache.hop.projects.config; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.config.plugin.ConfigPlugin; import org.apache.hop.core.config.plugin.IConfigOptions; @@ -43,9 +45,6 @@ import org.eclipse.swt.widgets.Control; import picocli.CommandLine; -import java.util.ArrayList; -import java.util.List; - @ConfigPlugin( id = "ProjectsConfigOptionPlugin", description = "Configuration options for the global projects plugin") @@ -64,7 +63,8 @@ public class ProjectsConfigOptionPlugin private static final String WIDGET_ID_DEFAULT_ENVIRONMENT = "10040-default-environment"; private static final String WIDGET_ID_STANDARD_PARENT_PROJECT = "10050-standard-parent-project"; private static final String WIDGET_ID_STANDARD_PROJECTS_FOLDER = "10060-standard-projects-folder"; - private static final String WIDGET_ID_RESTRICT_ENVIRONMENTS_TO_ACTIVE_PROJECT="10070-restrict-environments-to-active-project"; + private static final String WIDGET_ID_RESTRICT_ENVIRONMENTS_TO_ACTIVE_PROJECT = + "10070-restrict-environments-to-active-project"; private static final String WIDGET_ID_DEFAULT_PROJECT_CONFIG_FILENAME = "10070-default-project-config-filename"; @@ -161,12 +161,10 @@ public class ProjectsConfigOptionPlugin parentId = ConfigPluginOptionsTab.GUI_WIDGETS_PARENT_ID, type = GuiElementType.CHECKBOX, variables = false, - label = "i18n::ProjectConfig.RestrictEnvsToActiveProject.Message" - ) + label = "i18n::ProjectConfig.RestrictEnvsToActiveProject.Message") @CommandLine.Option( - names = {"-eap", "--environments-for-active-project"}, - description = "i18n::ProjectConfig.RestrictEnvsToActiveProject.Message" - ) + names = {"-eap", "--environments-for-active-project"}, + description = "i18n::ProjectConfig.RestrictEnvsToActiveProject.Message") private Boolean environmentsForActiveProject; /** @@ -363,7 +361,8 @@ public void persistContents(GuiCompositeWidgets compositeWidgets) { break; case WIDGET_ID_RESTRICT_ENVIRONMENTS_TO_ACTIVE_PROJECT: environmentsForActiveProject = ((Button) control).getSelection(); - ProjectsConfigSingleton.getConfig().setEnvironmentsForActiveProject(environmentsForActiveProject); + ProjectsConfigSingleton.getConfig() + .setEnvironmentsForActiveProject(environmentsForActiveProject); break; } } @@ -389,7 +388,9 @@ public Boolean getProjectsEnabled() { return projectsEnabled; } - /** @param projectsEnabled The projectsEnabled to set */ + /** + * @param projectsEnabled The projectsEnabled to set + */ public void setProjectsEnabled(Boolean projectsEnabled) { this.projectsEnabled = projectsEnabled; } @@ -403,7 +404,9 @@ public Boolean getProjectMandatory() { return projectMandatory; } - /** @param projectMandatory The projectMandatory to set */ + /** + * @param projectMandatory The projectMandatory to set + */ public void setProjectMandatory(Boolean projectMandatory) { this.projectMandatory = projectMandatory; } @@ -417,7 +420,9 @@ public String getDefaultProject() { return defaultProject; } - /** @param defaultProject The defaultProject to set */ + /** + * @param defaultProject The defaultProject to set + */ public void setDefaultProject(String defaultProject) { this.defaultProject = defaultProject; } @@ -431,7 +436,9 @@ public String getStandardParentProject() { return standardParentProject; } - /** @param standardParentProject The standardParentProject to set */ + /** + * @param standardParentProject The standardParentProject to set + */ public void setStandardParentProject(String standardParentProject) { this.standardParentProject = standardParentProject; } @@ -445,7 +452,9 @@ public Boolean getEnvironmentMandatory() { return environmentMandatory; } - /** @param environmentMandatory The environmentMandatory to set */ + /** + * @param environmentMandatory The environmentMandatory to set + */ public void setEnvironmentMandatory(Boolean environmentMandatory) { this.environmentMandatory = environmentMandatory; } @@ -459,7 +468,9 @@ public String getDefaultEnvironment() { return defaultEnvironment; } - /** @param defaultEnvironment The defaultEnvironment to set */ + /** + * @param defaultEnvironment The defaultEnvironment to set + */ public void setDefaultEnvironment(String defaultEnvironment) { this.defaultEnvironment = defaultEnvironment; } @@ -473,7 +484,9 @@ public String getStandardProjectsFolder() { return standardProjectsFolder; } - /** @param standardProjectsFolder The standardProjectsFolder to set */ + /** + * @param standardProjectsFolder The standardProjectsFolder to set + */ public void setStandardProjectsFolder(String standardProjectsFolder) { this.standardProjectsFolder = standardProjectsFolder; } @@ -487,7 +500,9 @@ public String getDefaultProjectConfigFile() { return defaultProjectConfigFile; } - /** @param defaultProjectConfigFile The defaultProjectConfigFile to set */ + /** + * @param defaultProjectConfigFile The defaultProjectConfigFile to set + */ public void setDefaultProjectConfigFile(String defaultProjectConfigFile) { this.defaultProjectConfigFile = defaultProjectConfigFile; } @@ -501,7 +516,9 @@ public Boolean getEnvironmentsForActiveProject() { return environmentsForActiveProject; } - /** @param environmentsForActiveProject The environmentsForActiveProject flag to set */ + /** + * @param environmentsForActiveProject The environmentsForActiveProject flag to set + */ public void setEnvironmentsForActiveProject(Boolean environmentsForActiveProject) { this.environmentsForActiveProject = environmentsForActiveProject; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigSingleton.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigSingleton.java index bfd27de6afd..06a4098ec5c 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigSingleton.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/config/ProjectsConfigSingleton.java @@ -19,13 +19,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; +import java.util.List; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.json.HopJson; import org.apache.hop.core.logging.LogChannel; -import java.util.List; - public class ProjectsConfigSingleton { private static ProjectsConfigSingleton configSingleton; diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironment.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironment.java index 513a5c6c30c..9dbf5ed793f 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironment.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironment.java @@ -77,7 +77,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -91,7 +93,9 @@ public String getPurpose() { return purpose; } - /** @param purpose The purpose to set */ + /** + * @param purpose The purpose to set + */ public void setPurpose(String purpose) { this.purpose = purpose; } @@ -105,7 +109,9 @@ public String getProjectName() { return projectName; } - /** @param projectName The projectName to set */ + /** + * @param projectName The projectName to set + */ public void setProjectName(String projectName) { this.projectName = projectName; } @@ -119,7 +125,9 @@ public List getConfigurationFiles() { return configurationFiles; } - /** @param configurationFiles The configurationFiles to set */ + /** + * @param configurationFiles The configurationFiles to set + */ public void setConfigurationFiles(List configurationFiles) { this.configurationFiles = configurationFiles; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironmentDialog.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironmentDialog.java index c081ea05ac6..d53d9a78f86 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironmentDialog.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/LifecycleEnvironmentDialog.java @@ -263,8 +263,7 @@ private void editConfigFile(Event event) { FileObject file = HopVfs.getFileObject(realConfigFilename); if (!file.exists()) { - MessageBox box = - new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION); + MessageBox box = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION); box.setText("Create file?"); box.setMessage("This configuration file doesn't exist. Do you want to create it?"); int answer = box.open(); @@ -397,12 +396,12 @@ private void getData() { wProject.setItems(config.listProjectConfigNames().toArray(new String[0])); wPurpose.setItems( - BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Development"), - BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Testing"), - BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Acceptance"), - BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Production"), - BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.CI"), - BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.CB")); + BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Development"), + BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Testing"), + BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Acceptance"), + BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.Production"), + BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.CI"), + BaseMessages.getString(PKG, "LifecycleEnvironmentDialog.Purpose.Text.CB")); wName.setText(Const.NVL(environment.getName(), "")); wPurpose.setText(Const.NVL(environment.getPurpose(), "")); diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/ManageEnvironmentsOptionPlugin.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/ManageEnvironmentsOptionPlugin.java index e8997f236ea..db7cbe0e09e 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/ManageEnvironmentsOptionPlugin.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/environment/ManageEnvironmentsOptionPlugin.java @@ -17,6 +17,8 @@ package org.apache.hop.projects.environment; +import java.util.Arrays; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.config.DescribedVariablesConfigFile; import org.apache.hop.core.config.HopConfig; @@ -35,9 +37,6 @@ import org.apache.hop.projects.util.ProjectsUtil; import picocli.CommandLine; -import java.util.Arrays; -import java.util.List; - @ConfigPlugin( id = "ManageEnvironmentsOptionPlugin", description = "Allows command line editing of the lifecycle environments") @@ -292,7 +291,9 @@ public boolean isCreateEnvironment() { return createEnvironment; } - /** @param createEnvironment The createEnvironment to set */ + /** + * @param createEnvironment The createEnvironment to set + */ public void setCreateEnvironment(boolean createEnvironment) { this.createEnvironment = createEnvironment; } @@ -306,7 +307,9 @@ public String getEnvironmentName() { return environmentName; } - /** @param environmentName The environmentName to set */ + /** + * @param environmentName The environmentName to set + */ public void setEnvironmentName(String environmentName) { this.environmentName = environmentName; } @@ -320,7 +323,9 @@ public String getEnvironmentPurpose() { return environmentPurpose; } - /** @param environmentPurpose The environmentPurpose to set */ + /** + * @param environmentPurpose The environmentPurpose to set + */ public void setEnvironmentPurpose(String environmentPurpose) { this.environmentPurpose = environmentPurpose; } @@ -334,7 +339,9 @@ public String getEnvironmentProject() { return environmentProject; } - /** @param environmentProject The environmentProject to set */ + /** + * @param environmentProject The environmentProject to set + */ public void setEnvironmentProject(String environmentProject) { this.environmentProject = environmentProject; } @@ -348,7 +355,9 @@ public String[] getEnvironmentConfigFiles() { return environmentConfigFiles; } - /** @param environmentConfigFiles The environmentConfigFiles to set */ + /** + * @param environmentConfigFiles The environmentConfigFiles to set + */ public void setEnvironmentConfigFiles(String[] environmentConfigFiles) { this.environmentConfigFiles = environmentConfigFiles; } @@ -362,7 +371,9 @@ public boolean isModifyEnvironment() { return modifyEnvironment; } - /** @param modifyEnvironment The modifyEnvironment to set */ + /** + * @param modifyEnvironment The modifyEnvironment to set + */ public void setModifyEnvironment(boolean modifyEnvironment) { this.modifyEnvironment = modifyEnvironment; } @@ -376,7 +387,9 @@ public boolean isDeleteEnvironment() { return deleteEnvironment; } - /** @param deleteEnvironment The deleteEnvironment to set */ + /** + * @param deleteEnvironment The deleteEnvironment to set + */ public void setDeleteEnvironment(boolean deleteEnvironment) { this.deleteEnvironment = deleteEnvironment; } @@ -390,7 +403,9 @@ public boolean isListEnvironments() { return listEnvironments; } - /** @param listEnvironments The listEnvironments to set */ + /** + * @param listEnvironments The listEnvironments to set + */ public void setListEnvironments(boolean listEnvironments) { this.listEnvironments = listEnvironments; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java index 63723755e71..c0fd72b9068 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java @@ -23,7 +23,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -1142,8 +1141,10 @@ public void menuProjectExport() { HopVfs.getFileObject(projectHome).getParent().getName().getURI(); zipFile( projectDirectory, projectDirectory.getName().getURI(), zos, projectHomeFolder); - zipString(variablesJson,"variables.json",zos, projectDirectory.getName().getBaseName()); - zipString(metadataJson,"metadata.json",zos, projectDirectory.getName().getBaseName()); + zipString( + variablesJson, "variables.json", zos, projectDirectory.getName().getBaseName()); + zipString( + metadataJson, "metadata.json", zos, projectDirectory.getName().getBaseName()); zos.close(); outputStream.close(); monitor.done(); @@ -1223,7 +1224,7 @@ public void zipString( return; } ByteArrayInputStream bais = new ByteArrayInputStream(stringToZip.getBytes()); - zipOutputStream.putNextEntry(new ZipEntry(projectHomeParent + "/" +filename)); + zipOutputStream.putNextEntry(new ZipEntry(projectHomeParent + "/" + filename)); byte[] bytes = new byte[1024]; int length; while ((length = bais.read(bytes)) >= 0) { diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ManageLifecyclesOptionPlugin.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ManageLifecyclesOptionPlugin.java index bbf54c53f01..ae28ad1e2d6 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ManageLifecyclesOptionPlugin.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ManageLifecyclesOptionPlugin.java @@ -17,6 +17,8 @@ package org.apache.hop.projects.lifecycle; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.config.plugin.IConfigOptions; import org.apache.hop.core.exception.HopException; @@ -28,9 +30,6 @@ import org.apache.hop.projects.config.ProjectsConfigSingleton; import picocli.CommandLine; -import java.util.Arrays; -import java.util.List; - /* TODO: Re-enable when we have usage for it diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ProjectLifecycle.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ProjectLifecycle.java index a49332ce167..4594e158dca 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ProjectLifecycle.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/lifecycle/ProjectLifecycle.java @@ -67,7 +67,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -81,7 +83,9 @@ public List getLifecycleEnvironments() { return lifecycleEnvironments; } - /** @param lifecycleEnvironments The lifecycleEnvironments to set */ + /** + * @param lifecycleEnvironments The lifecycleEnvironments to set + */ public void setLifecycleEnvironments(List lifecycleEnvironments) { this.lifecycleEnvironments = lifecycleEnvironments; } @@ -95,7 +99,9 @@ public List getConfigurationFiles() { return configurationFiles; } - /** @param configurationFiles The configurationFiles to set */ + /** + * @param configurationFiles The configurationFiles to set + */ public void setConfigurationFiles(List configurationFiles) { this.configurationFiles = configurationFiles; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ManageProjectsOptionPlugin.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ManageProjectsOptionPlugin.java index 8d8953c56c9..65e7e53f82a 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ManageProjectsOptionPlugin.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ManageProjectsOptionPlugin.java @@ -17,6 +17,10 @@ package org.apache.hop.projects.project; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.config.HopConfig; @@ -36,11 +40,6 @@ import org.apache.hop.projects.util.ProjectsUtil; import picocli.CommandLine; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - @ConfigPlugin( id = "ManageProjectsOptionPlugin", description = "Allows command line editing of the projects") @@ -424,7 +423,9 @@ public boolean isCreateProject() { return createProject; } - /** @param createProject The createProject to set */ + /** + * @param createProject The createProject to set + */ public void setCreateProject(boolean createProject) { this.createProject = createProject; } @@ -438,7 +439,9 @@ public String getProjectName() { return projectName; } - /** @param projectName The projectName to set */ + /** + * @param projectName The projectName to set + */ public void setProjectName(String projectName) { this.projectName = projectName; } @@ -452,7 +455,9 @@ public String getProjectHome() { return projectHome; } - /** @param projectHome The projectHome to set */ + /** + * @param projectHome The projectHome to set + */ public void setProjectHome(String projectHome) { this.projectHome = projectHome; } @@ -466,7 +471,9 @@ public String getProjectConfigFile() { return projectConfigFile; } - /** @param projectConfigFile The projectConfigFile to set */ + /** + * @param projectConfigFile The projectConfigFile to set + */ public void setProjectConfigFile(String projectConfigFile) { this.projectConfigFile = projectConfigFile; } @@ -480,7 +487,9 @@ public String getProjectDescription() { return projectDescription; } - /** @param projectDescription The projectDescription to set */ + /** + * @param projectDescription The projectDescription to set + */ public void setProjectDescription(String projectDescription) { this.projectDescription = projectDescription; } @@ -494,7 +503,9 @@ public String getProjectCompany() { return projectCompany; } - /** @param projectCompany The projectCompany to set */ + /** + * @param projectCompany The projectCompany to set + */ public void setProjectCompany(String projectCompany) { this.projectCompany = projectCompany; } @@ -508,7 +519,9 @@ public String getProjectDepartment() { return projectDepartment; } - /** @param projectDepartment The projectDepartment to set */ + /** + * @param projectDepartment The projectDepartment to set + */ public void setProjectDepartment(String projectDepartment) { this.projectDepartment = projectDepartment; } @@ -522,7 +535,9 @@ public String getProjectMetadataBaseFolder() { return projectMetadataBaseFolder; } - /** @param projectMetadataBaseFolder The projectMetadataBaseFolder to set */ + /** + * @param projectMetadataBaseFolder The projectMetadataBaseFolder to set + */ public void setProjectMetadataBaseFolder(String projectMetadataBaseFolder) { this.projectMetadataBaseFolder = projectMetadataBaseFolder; } @@ -536,7 +551,9 @@ public String getProjectUnitTestsBasePath() { return projectUnitTestsBasePath; } - /** @param projectUnitTestsBasePath The projectUnitTestsBasePath to set */ + /** + * @param projectUnitTestsBasePath The projectUnitTestsBasePath to set + */ public void setProjectUnitTestsBasePath(String projectUnitTestsBasePath) { this.projectUnitTestsBasePath = projectUnitTestsBasePath; } @@ -550,7 +567,9 @@ public String getProjectDataSetsCsvFolder() { return projectDataSetsCsvFolder; } - /** @param projectDataSetsCsvFolder The projectDataSetsCsvFolder to set */ + /** + * @param projectDataSetsCsvFolder The projectDataSetsCsvFolder to set + */ public void setProjectDataSetsCsvFolder(String projectDataSetsCsvFolder) { this.projectDataSetsCsvFolder = projectDataSetsCsvFolder; } @@ -564,7 +583,9 @@ public String getProjectEnforceExecutionInHome() { return projectEnforceExecutionInHome; } - /** @param projectEnforceExecutionInHome The projectEnforceExecutionInHome to set */ + /** + * @param projectEnforceExecutionInHome The projectEnforceExecutionInHome to set + */ public void setProjectEnforceExecutionInHome(String projectEnforceExecutionInHome) { this.projectEnforceExecutionInHome = projectEnforceExecutionInHome; } @@ -578,7 +599,9 @@ public String[] getProjectVariables() { return projectVariables; } - /** @param projectVariables The projectVariables to set */ + /** + * @param projectVariables The projectVariables to set + */ public void setProjectVariables(String[] projectVariables) { this.projectVariables = projectVariables; } @@ -592,7 +615,9 @@ public boolean isModifyProject() { return modifyProject; } - /** @param modifyProject The modifyProject to set */ + /** + * @param modifyProject The modifyProject to set + */ public void setModifyProject(boolean modifyProject) { this.modifyProject = modifyProject; } @@ -606,7 +631,9 @@ public boolean isDeleteProject() { return deleteProject; } - /** @param deleteProject The deleteProject to set */ + /** + * @param deleteProject The deleteProject to set + */ public void setDeleteProject(boolean deleteProject) { this.deleteProject = deleteProject; } @@ -620,7 +647,9 @@ public boolean isListProjects() { return listProjects; } - /** @param listProjects The listProjects to set */ + /** + * @param listProjects The listProjects to set + */ public void setListProjects(boolean listProjects) { this.listProjects = listProjects; } @@ -634,7 +663,9 @@ public String getProjectParent() { return projectParent; } - /** @param projectParent The projectParent to set */ + /** + * @param projectParent The projectParent to set + */ public void setProjectParent(String projectParent) { this.projectParent = projectParent; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/Project.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/Project.java index b9259777f3a..19885941cca 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/Project.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/Project.java @@ -21,6 +21,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -39,11 +43,6 @@ import org.apache.hop.projects.util.Defaults; import org.apache.hop.projects.util.ProjectsUtil; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - public class Project extends ConfigFile implements IConfigFile { @JsonIgnore private String configFilename; diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectConfig.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectConfig.java index eefdfb2aa4c..c70d1746cac 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectConfig.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectConfig.java @@ -17,14 +17,13 @@ package org.apache.hop.projects.project; +import java.util.Objects; import org.apache.commons.io.FilenameUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.vfs.HopVfs; -import java.util.Objects; - public class ProjectConfig { protected String projectName; @@ -123,7 +122,9 @@ public String getProjectName() { return projectName; } - /** @param projectName The projectName to set */ + /** + * @param projectName The projectName to set + */ public void setProjectName(String projectName) { this.projectName = projectName; } @@ -137,7 +138,9 @@ public String getProjectHome() { return projectHome; } - /** @param projectHome The projectHome to set */ + /** + * @param projectHome The projectHome to set + */ public void setProjectHome(String projectHome) { this.projectHome = projectHome; } @@ -151,7 +154,9 @@ public String getConfigFilename() { return configFilename; } - /** @param configFilename The configFilename to set */ + /** + * @param configFilename The configFilename to set + */ public void setConfigFilename(String configFilename) { this.configFilename = configFilename; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/AddProjectsSearchablesLocationExtensionPoint.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/AddProjectsSearchablesLocationExtensionPoint.java index 2f082601d27..c5bd8fb3bdc 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/AddProjectsSearchablesLocationExtensionPoint.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/AddProjectsSearchablesLocationExtensionPoint.java @@ -17,6 +17,7 @@ package org.apache.hop.projects.search; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -27,8 +28,6 @@ import org.apache.hop.projects.project.ProjectConfig; import org.apache.hop.ui.core.gui.HopNamespace; -import java.util.List; - @ExtensionPoint( id = "AddProjectsSearchablesLocationExtensionPoint", description = "Adds a search location to the search perspective", diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectSearchablesIterator.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectSearchablesIterator.java index 8972f1445b6..475a9526684 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectSearchablesIterator.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectSearchablesIterator.java @@ -17,6 +17,10 @@ package org.apache.hop.projects.search; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.config.DescribedVariablesConfigFile; import org.apache.hop.core.config.HopConfig; @@ -40,11 +44,6 @@ import org.apache.hop.ui.hopgui.search.HopGuiWorkflowSearchable; import org.apache.hop.workflow.WorkflowMeta; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - // TODO: implement lazy loading of the searchables. // public class ProjectSearchablesIterator implements Iterator { diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectsSearchablesLocation.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectsSearchablesLocation.java index 52eb566bfd0..674d0cbc7ac 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectsSearchablesLocation.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/search/ProjectsSearchablesLocation.java @@ -17,6 +17,7 @@ package org.apache.hop.projects.search; +import java.util.Iterator; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.search.ISearchable; import org.apache.hop.core.search.ISearchablesLocation; @@ -24,8 +25,6 @@ import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.projects.project.ProjectConfig; -import java.util.Iterator; - public class ProjectsSearchablesLocation implements ISearchablesLocation { private ProjectConfig projectConfig; diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/util/ProjectsUtil.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/util/ProjectsUtil.java index 83c84a26152..0c7098da497 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/util/ProjectsUtil.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/util/ProjectsUtil.java @@ -17,6 +17,10 @@ package org.apache.hop.projects.util; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -35,11 +39,6 @@ import org.apache.hop.ui.core.gui.HopNamespace; import org.apache.hop.ui.hopgui.HopGui; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - public class ProjectsUtil { public static final String VARIABLE_PROJECT_HOME = "PROJECT_HOME"; @@ -239,7 +238,8 @@ public static List getParentProjectReferences(String projectName) throws return parentProjectReferences; } - public static List changeParentProjectReferences(String currentName, String newName) throws HopException { + public static List changeParentProjectReferences(String currentName, String newName) + throws HopException { ProjectsConfig config = ProjectsConfigSingleton.getConfig(); List prjs = config.listProjectConfigNames(); @@ -257,7 +257,7 @@ public static List changeParentProjectReferences(String currentName, Str Project thePrj = prjCfg.loadProject(hopGui.getVariables()); if (thePrj != null) { if (thePrj.getParentProjectName() != null - && thePrj.getParentProjectName().equals(currentName)) { + && thePrj.getParentProjectName().equals(currentName)) { thePrj.setParentProjectName(newName); } } else { diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/var/ManageConfigFileOptionPlugin.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/var/ManageConfigFileOptionPlugin.java index 8db1c9faab2..947affad9f4 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/var/ManageConfigFileOptionPlugin.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/var/ManageConfigFileOptionPlugin.java @@ -77,7 +77,9 @@ public boolean handleOption( if (equalsIndex > 0) { String variableName = varValue.substring(0, equalsIndex); String variableValue = varValue.substring(equalsIndex + 1); - if (variableValue != null && variableValue.startsWith("\"") && variableValue.endsWith("\"")) { + if (variableValue != null + && variableValue.startsWith("\"") + && variableValue.endsWith("\"")) { variableValue = variableValue.substring(1, variableValue.length() - 1); } DescribedVariable describedVariable = @@ -134,7 +136,9 @@ public String getConfigFile() { return configFile; } - /** @param configFile The configFile to set */ + /** + * @param configFile The configFile to set + */ public void setConfigFile(String configFile) { this.configFile = configFile; } @@ -148,7 +152,9 @@ public String[] getConfigSetVariables() { return configSetVariables; } - /** @param configSetVariables The configSetVariables to set */ + /** + * @param configSetVariables The configSetVariables to set + */ public void setConfigSetVariables(String[] configSetVariables) { this.configSetVariables = configSetVariables; } @@ -162,7 +168,9 @@ public String[] getConfigDescribeVariables() { return configDescribeVariables; } - /** @param configDescribeVariables The configDescribeVariables to set */ + /** + * @param configDescribeVariables The configDescribeVariables to set + */ public void setConfigDescribeVariables(String[] configDescribeVariables) { this.configDescribeVariables = configDescribeVariables; } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiFileDefaultFolder.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiFileDefaultFolder.java index 024e43bebf6..b0c5988af81 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiFileDefaultFolder.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiFileDefaultFolder.java @@ -84,11 +84,12 @@ public void callExtensionPoint( filterPath = projectConfig.getProjectHome(); } - //maybe we should clean this up and in the audit split folder and filename - //check if path ends with slash else remove filename + // maybe we should clean this up and in the audit split folder and filename + // check if path ends with slash else remove filename int dotFound = filterPath.lastIndexOf("."); int slashFound = filterPath.lastIndexOf("/"); - filterPath = dotFound > slashFound && slashFound > 0 ? filterPath.substring(0,slashFound) : filterPath; + filterPath = + dotFound > slashFound && slashFound > 0 ? filterPath.substring(0, slashFound) : filterPath; IFileDialog dialog = ext.getFileDialog(); dialog.setFilterPath(filterPath); diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiStartProjectLoad.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiStartProjectLoad.java index 26bc58aad1f..2e5ea6540cd 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiStartProjectLoad.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopGuiStartProjectLoad.java @@ -17,6 +17,7 @@ package org.apache.hop.projects.xp; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; @@ -35,8 +36,6 @@ import org.apache.hop.ui.core.dialog.ErrorDialog; import org.apache.hop.ui.hopgui.HopGui; -import java.util.List; - @ExtensionPoint( id = "HopGuiStartProjectLoad", description = "Load the previously used project", @@ -64,7 +63,8 @@ public void callExtensionPoint(ILogChannel logChannelInterface, IVariables varia // Let's see in the audit logs what the last opened project is. // - List auditEvents = AuditManager.findEvents( + List auditEvents = + AuditManager.findEvents( ProjectsUtil.STRING_PROJECTS_AUDIT_GROUP, ProjectsUtil.STRING_PROJECT_AUDIT_TYPE, "open", @@ -83,7 +83,7 @@ public void callExtensionPoint(ILogChannel logChannelInterface, IVariables varia if (config.findProjectConfig(lastProjectName) == null) { // The last existing project to open was not found. // - lastProjectName=null; + lastProjectName = null; } } @@ -98,7 +98,8 @@ public void callExtensionPoint(ILogChannel logChannelInterface, IVariables varia // What was the last environment for this project? // - List envEvents = AuditManager.findEvents( + List envEvents = + AuditManager.findEvents( ProjectsUtil.STRING_PROJECTS_AUDIT_GROUP, ProjectsUtil.STRING_ENVIRONMENT_AUDIT_TYPE, "open", @@ -109,7 +110,7 @@ public void callExtensionPoint(ILogChannel logChannelInterface, IVariables varia // for (AuditEvent envEvent : envEvents) { LifecycleEnvironment environment = config.findEnvironment(envEvent.getName()); - if (environment!=null && lastProjectName.equals(environment.getProjectName())) { + if (environment != null && lastProjectName.equals(environment.getProjectName())) { lastEnvironment = environment; break; } @@ -129,7 +130,8 @@ public void callExtensionPoint(ILogChannel logChannelInterface, IVariables varia logChannelInterface.logBasic("No last projects history found"); } } catch (Exception e) { - new ErrorDialog(hopGui.getActiveShell(), "Error", "Error initializing the Projects system", e); + new ErrorDialog( + hopGui.getActiveShell(), "Error", "Error initializing the Projects system", e); } } } diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportCreateProjectIfNotExists.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportCreateProjectIfNotExists.java index c11949b09b9..b7294c30daa 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportCreateProjectIfNotExists.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportCreateProjectIfNotExists.java @@ -17,6 +17,7 @@ package org.apache.hop.projects.xp; +import java.util.Collections; import org.apache.hop.core.config.HopConfig; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; @@ -30,8 +31,6 @@ import org.apache.hop.projects.project.ProjectConfig; import org.apache.hop.ui.hopgui.HopGui; -import java.util.Collections; - @ExtensionPoint( id = "HopImportCreateProject", description = "Creates a new project for a project path specified in Hop Import", diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportDbConnections.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportDbConnections.java index 8182f102f04..977a405a72c 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportDbConnections.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportDbConnections.java @@ -17,6 +17,14 @@ package org.apache.hop.projects.xp; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; @@ -33,15 +41,6 @@ import org.apache.hop.projects.util.ProjectsUtil; import org.apache.hop.ui.hopgui.HopGui; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - @ExtensionPoint( id = "HopImportConnections", description = "Import relational database connections into a Hop project", diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportMigratedFiles.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportMigratedFiles.java index 726366e6e56..0922360ed92 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportMigratedFiles.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/HopImportMigratedFiles.java @@ -17,6 +17,18 @@ package org.apache.hop.projects.xp; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import org.apache.commons.vfs2.FileFilterSelector; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -35,19 +47,6 @@ import org.apache.hop.ui.core.dialog.ProgressMonitorDialog; import org.apache.hop.ui.hopgui.HopGui; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; - @ExtensionPoint( id = "HopImportMigratedFiles", description = "Imports variables into a Hop project", @@ -95,7 +94,9 @@ private void importFiles( String projectHome, boolean skipExitingFiles, IProgressMonitor monitor) - throws TransformerConfigurationException, HopException, FileSystemException, + throws TransformerConfigurationException, + HopException, + FileSystemException, InterruptedException { TransformerFactory transformerFactory = XmlHandler.createSecureTransformerFactory(); Transformer transformer = transformerFactory.newTransformer(); diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/ProjectsVariablesControlSpaceSortOrderPrefix.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/ProjectsVariablesControlSpaceSortOrderPrefix.java index 4ebf0ccd034..26087335986 100644 --- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/ProjectsVariablesControlSpaceSortOrderPrefix.java +++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/xp/ProjectsVariablesControlSpaceSortOrderPrefix.java @@ -17,6 +17,7 @@ package org.apache.hop.projects.xp; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -25,8 +26,6 @@ import org.apache.hop.projects.util.Defaults; import org.apache.hop.projects.util.ProjectsUtil; -import java.util.Map; - @ExtensionPoint( id = "ProjectsVariablesControlSpaceSortOrderPrefix", extensionPointId = "HopGuiGetControlSpaceSortOrderPrefix", diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLog.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLog.java index eed14f185a8..f60d963b6f5 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLog.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLog.java @@ -18,14 +18,13 @@ package org.apache.hop.reflection.pipeline.meta; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.HopMetadataBase; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "pipeline-log", name = "Pipeline Log", @@ -89,7 +88,9 @@ public boolean isEnabled() { return enabled; } - /** @param enabled The enabled to set */ + /** + * @param enabled The enabled to set + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -103,7 +104,9 @@ public boolean isLoggingParentsOnly() { return loggingParentsOnly; } - /** @param loggingParentsOnly The loggingParentsOnly to set */ + /** + * @param loggingParentsOnly The loggingParentsOnly to set + */ public void setLoggingParentsOnly(boolean loggingParentsOnly) { this.loggingParentsOnly = loggingParentsOnly; } @@ -117,7 +120,9 @@ public String getPipelineFilename() { return pipelineFilename; } - /** @param pipelineFilename The pipelineFilename to set */ + /** + * @param pipelineFilename The pipelineFilename to set + */ public void setPipelineFilename(String pipelineFilename) { this.pipelineFilename = pipelineFilename; } @@ -131,7 +136,9 @@ public boolean isExecutingAtStart() { return executingAtStart; } - /** @param executingAtStart The executingAtStart to set */ + /** + * @param executingAtStart The executingAtStart to set + */ public void setExecutingAtStart(boolean executingAtStart) { this.executingAtStart = executingAtStart; } @@ -145,7 +152,9 @@ public boolean isExecutingPeriodically() { return executingPeriodically; } - /** @param executingPeriodically The executingPeriodically to set */ + /** + * @param executingPeriodically The executingPeriodically to set + */ public void setExecutingPeriodically(boolean executingPeriodically) { this.executingPeriodically = executingPeriodically; } @@ -159,7 +168,9 @@ public String getIntervalInSeconds() { return intervalInSeconds; } - /** @param intervalInSeconds The intervalInSeconds to set */ + /** + * @param intervalInSeconds The intervalInSeconds to set + */ public void setIntervalInSeconds(String intervalInSeconds) { this.intervalInSeconds = intervalInSeconds; } @@ -173,16 +184,18 @@ public boolean isExecutingAtEnd() { return executingAtEnd; } - /** @param executingAtEnd The executingAtEnd to set */ + /** + * @param executingAtEnd The executingAtEnd to set + */ public void setExecutingAtEnd(boolean executingAtEnd) { this.executingAtEnd = executingAtEnd; } - public List getPipelinesToLog(){ + public List getPipelinesToLog() { return pipelinesToLog; } - public void setPipelinesToLog(List pipelinesToLog){ + public void setPipelinesToLog(List pipelinesToLog) { this.pipelinesToLog = pipelinesToLog; } } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLogEditor.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLogEditor.java index 8ad1bef0e42..8490496b189 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLogEditor.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineLogEditor.java @@ -18,6 +18,8 @@ package org.apache.hop.reflection.pipeline.meta; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; @@ -49,9 +51,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - /** * Editor that allows you to change Pipeline Log metadata * @@ -71,7 +70,6 @@ public class PipelineLogEditor extends MetadataEditor { private TextVar wInterval; private TableView wPipelines; - public PipelineLogEditor( HopGui hopGui, MetadataManager manager, PipelineLog metadata) { super(hopGui, manager, metadata); @@ -291,21 +289,15 @@ public void createControl(Composite parent) { wlSources.setLayoutData(fdlSources); lastControl = wlSources; ColumnInfo[] columns = { - new ColumnInfo( - BaseMessages.getString(PKG, "PipelineLoggingEditor.SourcesTable.Column.Pipeline"), - ColumnInfo.COLUMN_TYPE_TEXT, - false, - false), + new ColumnInfo( + BaseMessages.getString(PKG, "PipelineLoggingEditor.SourcesTable.Column.Pipeline"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false), }; wPipelines = - new TableView( - manager.getVariables(), - parent, - SWT.BORDER, - columns, - 0, - e -> setChanged(), - props); + new TableView( + manager.getVariables(), parent, SWT.BORDER, columns, 0, e -> setChanged(), props); FormData fdSources = new FormData(); fdSources.left = new FormAttachment(0, 0); fdSources.top = new FormAttachment(lastControl, margin); @@ -440,7 +432,7 @@ public void setWidgetsContent() { wInterval.setText(Const.NVL(pl.getIntervalInSeconds(), "")); wPipelines.removeAll(); List pipelinesToLog = pl.getPipelinesToLog(); - for(PipelineToLogLocation pipelineToLog : pipelinesToLog){ + for (PipelineToLogLocation pipelineToLog : pipelinesToLog) { TableItem item = new TableItem(wPipelines.table, SWT.NONE); item.setText(1, Const.NVL(pipelineToLog.getPipelineToLogFilename(), "")); } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineToLogLocation.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineToLogLocation.java index 1e08b6fc174..b4b1ecbb609 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineToLogLocation.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/meta/PipelineToLogLocation.java @@ -17,46 +17,43 @@ package org.apache.hop.reflection.pipeline.meta; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class PipelineToLogLocation { - @HopMetadataProperty private String pipelineToLogFilename; + @HopMetadataProperty private String pipelineToLogFilename; - public PipelineToLogLocation(){ + public PipelineToLogLocation() {} - } + public PipelineToLogLocation(String pipelineTologFilename) { + this.pipelineToLogFilename = pipelineTologFilename; + } - public PipelineToLogLocation(String pipelineTologFilename){ - this.pipelineToLogFilename = pipelineTologFilename; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - @Override - public boolean equals(Object o){ - if(this == o){ - return true; - } - - if(o == null || getClass() != o.getClass()){ - return false; - } - - PipelineToLogLocation that = (PipelineToLogLocation) o; - return Objects.equals(pipelineToLogFilename, that.pipelineToLogFilename); + if (o == null || getClass() != o.getClass()) { + return false; } - @Override - public int hashCode(){ - return Objects.hash(pipelineToLogFilename); - } + PipelineToLogLocation that = (PipelineToLogLocation) o; + return Objects.equals(pipelineToLogFilename, that.pipelineToLogFilename); + } - public String getPipelineToLogFilename(){ - return pipelineToLogFilename; - } + @Override + public int hashCode() { + return Objects.hash(pipelineToLogFilename); + } - public void setPipelineToLogFilename(String pipelineToLogFilename){ - this.pipelineToLogFilename = pipelineToLogFilename; - } + public String getPipelineToLogFilename() { + return pipelineToLogFilename; + } + + public void setPipelineToLogFilename(String pipelineToLogFilename) { + this.pipelineToLogFilename = pipelineToLogFilename; + } } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLogging.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLogging.java index 936ff632e5a..e7ea55758ea 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLogging.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLogging.java @@ -18,6 +18,7 @@ package org.apache.hop.reflection.pipeline.transform; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILoggingObject; @@ -31,10 +32,7 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - -public class PipelineLogging extends BaseTransform -{ +public class PipelineLogging extends BaseTransform { private IPipelineEngine loggingPipeline; private String loggingPhase; @@ -189,7 +187,9 @@ public IPipelineEngine getLoggingPipeline() { return loggingPipeline; } - /** @param loggingPipeline The loggingPipeline to set */ + /** + * @param loggingPipeline The loggingPipeline to set + */ public void setLoggingPipeline(IPipelineEngine loggingPipeline) { this.loggingPipeline = loggingPipeline; } @@ -203,7 +203,9 @@ public String getLoggingPhase() { return loggingPhase; } - /** @param loggingPhase The loggingPhase to set */ + /** + * @param loggingPhase The loggingPhase to set + */ public void setLoggingPhase(String loggingPhase) { this.loggingPhase = loggingPhase; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLoggingMeta.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLoggingMeta.java index 2f034db29f4..f21e9f3cd24 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLoggingMeta.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/transform/PipelineLoggingMeta.java @@ -154,7 +154,9 @@ public boolean isLoggingTransforms() { return loggingTransforms; } - /** @param loggingTransforms The loggingTransforms to set */ + /** + * @param loggingTransforms The loggingTransforms to set + */ public void setLoggingTransforms(boolean loggingTransforms) { this.loggingTransforms = loggingTransforms; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/xp/PipelineStartLoggingXp.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/xp/PipelineStartLoggingXp.java index 26be24c89ff..fdfc0ce059a 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/xp/PipelineStartLoggingXp.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/pipeline/xp/PipelineStartLoggingXp.java @@ -17,6 +17,9 @@ package org.apache.hop.reflection.pipeline.xp; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -31,7 +34,6 @@ import org.apache.hop.metadata.api.IHopMetadataSerializer; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.engine.IEngineComponent; import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; import org.apache.hop.pipeline.transform.TransformMetaDataCombi; @@ -39,10 +41,6 @@ import org.apache.hop.reflection.pipeline.meta.PipelineToLogLocation; import org.apache.hop.reflection.pipeline.transform.PipelineLogging; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; - @ExtensionPoint( id = "PipelineStartLoggingXp", extensionPointId = "PipelinePrepareExecution", @@ -130,16 +128,15 @@ private void handlePipelineLog( for (PipelineToLogLocation pipelineToLogLocation : pipelineLog.getPipelinesToLog()) { // Check if ok to start logging. - if(logLocationExists(variables, pipelineToLogLocation, pipeline)){ + if (logLocationExists(variables, pipelineToLogLocation, pipeline)) { String pipelineUri = HopVfs.getFileObject(pipeline.getFilename()).getPublicURIString(); String pipelineToLogUri = - HopVfs.getFileObject( - variables.resolve(pipelineToLogLocation.getPipelineToLogFilename())) - .getPublicURIString(); + HopVfs.getFileObject( + variables.resolve(pipelineToLogLocation.getPipelineToLogFilename())) + .getPublicURIString(); if (pipelineUri.equals(pipelineToLogUri)) { logPipeline(pipelineLog, pipeline, loggingPipelineFilename, variables); } - } } } @@ -257,13 +254,13 @@ private synchronized void executeLoggingPipeline( } private boolean logLocationExists( - IVariables variables, - PipelineToLogLocation pipelineToLogLocation, - IPipelineEngine pipeline) - throws HopException { + IVariables variables, + PipelineToLogLocation pipelineToLogLocation, + IPipelineEngine pipeline) + throws HopException { // Not saved to a file, let's not probe - if(StringUtils.isEmpty(pipeline.getFilename())){ + if (StringUtils.isEmpty(pipeline.getFilename())) { return false; } @@ -273,14 +270,13 @@ private boolean logLocationExists( String parentFilename = parentFileObject.getName().getPath(); FileObject locationFileObject = - HopVfs.getFileObject(variables.resolve(pipelineToLogLocation.getPipelineToLogFilename())); + HopVfs.getFileObject(variables.resolve(pipelineToLogLocation.getPipelineToLogFilename())); String locationFilename = locationFileObject.getName().getPath(); - if(!parentFilename.equals(locationFilename)){ + if (!parentFilename.equals(locationFilename)) { // No match return false; } return true; } - } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/gui/DataProbeGuiPlugin.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/gui/DataProbeGuiPlugin.java index 5402668552b..ce8b782d08c 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/gui/DataProbeGuiPlugin.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/gui/DataProbeGuiPlugin.java @@ -18,6 +18,7 @@ package org.apache.hop.reflection.probe.gui; +import java.util.List; import org.apache.hop.core.action.GuiContextAction; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPointHandler; @@ -45,8 +46,6 @@ import org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective; import org.eclipse.swt.SWT; -import java.util.List; - @GuiPlugin public class DataProbeGuiPlugin { diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/DataProbeLocation.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/DataProbeLocation.java index 73fdc6fdd21..baf3135a687 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/DataProbeLocation.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/DataProbeLocation.java @@ -18,9 +18,8 @@ package org.apache.hop.reflection.probe.meta; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DataProbeLocation { @@ -62,7 +61,9 @@ public String getSourcePipelineFilename() { return sourcePipelineFilename; } - /** @param sourcePipelineFilename The sourcePipelineFilename to set */ + /** + * @param sourcePipelineFilename The sourcePipelineFilename to set + */ public void setSourcePipelineFilename(String sourcePipelineFilename) { this.sourcePipelineFilename = sourcePipelineFilename; } @@ -76,7 +77,9 @@ public String getSourceTransformName() { return sourceTransformName; } - /** @param sourceTransformName The sourceTransformName to set */ + /** + * @param sourceTransformName The sourceTransformName to set + */ public void setSourceTransformName(String sourceTransformName) { this.sourceTransformName = sourceTransformName; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbe.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbe.java index a705ac93aa5..6d2333835a1 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbe.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbe.java @@ -18,14 +18,13 @@ package org.apache.hop.reflection.probe.meta; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.HopMetadataBase; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "pipeline-probe", name = "Pipeline Probe", @@ -68,7 +67,9 @@ public boolean isEnabled() { return enabled; } - /** @param enabled The enabled to set */ + /** + * @param enabled The enabled to set + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -82,7 +83,9 @@ public String getPipelineFilename() { return pipelineFilename; } - /** @param pipelineFilename The pipelineFilename to set */ + /** + * @param pipelineFilename The pipelineFilename to set + */ public void setPipelineFilename(String pipelineFilename) { this.pipelineFilename = pipelineFilename; } @@ -96,7 +99,9 @@ public List getDataProbeLocations() { return dataProbeLocations; } - /** @param dataProbeLocations The dataProbeLocations to set */ + /** + * @param dataProbeLocations The dataProbeLocations to set + */ public void setDataProbeLocations(List dataProbeLocations) { this.dataProbeLocations = dataProbeLocations; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbeEditor.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbeEditor.java index 77471b86808..e1067eb4d7f 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbeEditor.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/meta/PipelineProbeEditor.java @@ -18,6 +18,8 @@ package org.apache.hop.reflection.probe.meta; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; @@ -48,9 +50,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - /** * Editor that allows you to change Pipeline Probe metadata * diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/transform/PipelineDataProbeMeta.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/transform/PipelineDataProbeMeta.java index bc875e0a3ee..fbbffc99870 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/transform/PipelineDataProbeMeta.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/transform/PipelineDataProbeMeta.java @@ -37,7 +37,8 @@ documentationUrl = "/pipeline/transforms/pipeline-data-probe.html", image = "probe.svg", keywords = "i18n::PipelineDataProbeMeta.keyword") -public class PipelineDataProbeMeta extends BaseTransformMeta { +public class PipelineDataProbeMeta + extends BaseTransformMeta { @HopMetadataProperty(key = "log_transforms") private boolean loggingTransforms; @@ -106,7 +107,9 @@ public boolean isLoggingTransforms() { return loggingTransforms; } - /** @param loggingTransforms The loggingTransforms to set */ + /** + * @param loggingTransforms The loggingTransforms to set + */ public void setLoggingTransforms(boolean loggingTransforms) { this.loggingTransforms = loggingTransforms; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/xp/PipelineDataProbeXp.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/xp/PipelineDataProbeXp.java index 544b99f6cc1..7a7cb5b5fe8 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/xp/PipelineDataProbeXp.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/probe/xp/PipelineDataProbeXp.java @@ -18,6 +18,7 @@ package org.apache.hop.reflection.probe.xp; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopException; @@ -44,8 +45,6 @@ import org.apache.hop.reflection.probe.meta.PipelineProbe; import org.apache.hop.reflection.probe.transform.PipelineDataProbe; -import java.util.List; - @ExtensionPoint( id = "PipelineDataProbeXp", extensionPointId = "PipelineStartThreads", diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/reader/meta/LogReader.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/reader/meta/LogReader.java index 1ac14d33086..77d9328ebb5 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/reader/meta/LogReader.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/reader/meta/LogReader.java @@ -106,7 +106,9 @@ public String getPipelineFilename() { return pipelineFilename; } - /** @param pipelineFilename The pipelineFilename to set */ + /** + * @param pipelineFilename The pipelineFilename to set + */ public void setPipelineFilename(String pipelineFilename) { this.pipelineFilename = pipelineFilename; } @@ -120,7 +122,9 @@ public String getTransformFilename() { return transformFilename; } - /** @param transformFilename The transformFilename to set */ + /** + * @param transformFilename The transformFilename to set + */ public void setTransformFilename(String transformFilename) { this.transformFilename = transformFilename; } @@ -134,7 +138,9 @@ public String getWorkflowFilename() { return workflowFilename; } - /** @param workflowFilename The workflowFilename to set */ + /** + * @param workflowFilename The workflowFilename to set + */ public void setWorkflowFilename(String workflowFilename) { this.workflowFilename = workflowFilename; } @@ -148,7 +154,9 @@ public String getActionFilename() { return actionFilename; } - /** @param actionFilename The actionFilename to set */ + /** + * @param actionFilename The actionFilename to set + */ public void setActionFilename(String actionFilename) { this.actionFilename = actionFilename; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLog.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLog.java index 407b5c7de5b..c9790f52952 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLog.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLog.java @@ -18,14 +18,13 @@ package org.apache.hop.reflection.workflow.meta; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.metadata.api.HopMetadata; import org.apache.hop.metadata.api.HopMetadataBase; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "workflow-log", name = "Workflow Log", @@ -89,7 +88,9 @@ public boolean isEnabled() { return enabled; } - /** @param enabled The enabled to set */ + /** + * @param enabled The enabled to set + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -103,7 +104,9 @@ public boolean isLoggingParentsOnly() { return loggingParentsOnly; } - /** @param loggingParentsOnly The loggingParentsOnly to set */ + /** + * @param loggingParentsOnly The loggingParentsOnly to set + */ public void setLoggingParentsOnly(boolean loggingParentsOnly) { this.loggingParentsOnly = loggingParentsOnly; } @@ -117,7 +120,9 @@ public String getPipelineFilename() { return pipelineFilename; } - /** @param pipelineFilename The pipelineFilename to set */ + /** + * @param pipelineFilename The pipelineFilename to set + */ public void setPipelineFilename(String pipelineFilename) { this.pipelineFilename = pipelineFilename; } @@ -131,7 +136,9 @@ public boolean isExecutingAtStart() { return executingAtStart; } - /** @param executingAtStart The executingAtStart to set */ + /** + * @param executingAtStart The executingAtStart to set + */ public void setExecutingAtStart(boolean executingAtStart) { this.executingAtStart = executingAtStart; } @@ -145,7 +152,9 @@ public boolean isExecutingPeriodically() { return executingPeriodically; } - /** @param executingPeriodically The executingPeriodically to set */ + /** + * @param executingPeriodically The executingPeriodically to set + */ public void setExecutingPeriodically(boolean executingPeriodically) { this.executingPeriodically = executingPeriodically; } @@ -159,7 +168,9 @@ public String getIntervalInSeconds() { return intervalInSeconds; } - /** @param intervalInSeconds The intervalInSeconds to set */ + /** + * @param intervalInSeconds The intervalInSeconds to set + */ public void setIntervalInSeconds(String intervalInSeconds) { this.intervalInSeconds = intervalInSeconds; } @@ -173,16 +184,18 @@ public boolean isExecutingAtEnd() { return executingAtEnd; } - /** @param executingAtEnd The executingAtEnd to set */ + /** + * @param executingAtEnd The executingAtEnd to set + */ public void setExecutingAtEnd(boolean executingAtEnd) { this.executingAtEnd = executingAtEnd; } - public List getWorkflowToLog(){ + public List getWorkflowToLog() { return workflowToLog; } - public void setWorkflowToLog(List workflowToLog){ + public void setWorkflowToLog(List workflowToLog) { this.workflowToLog = workflowToLog; } } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLogEditor.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLogEditor.java index fba00545a4b..c67663f3a35 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLogEditor.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/meta/WorkflowLogEditor.java @@ -18,6 +18,8 @@ package org.apache.hop.reflection.workflow.meta; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; @@ -49,9 +51,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - /** * Editor that allows you to change Workflow Log metadata * @@ -292,21 +291,15 @@ public void createControl(Composite parent) { wlSources.setLayoutData(fdlSources); lastControl = wlSources; ColumnInfo[] columns = { - new ColumnInfo( - BaseMessages.getString(PKG, "WorkflowLoggingEditor.SourcesTable.Column.Pipeline"), - ColumnInfo.COLUMN_TYPE_TEXT, - false, - false), + new ColumnInfo( + BaseMessages.getString(PKG, "WorkflowLoggingEditor.SourcesTable.Column.Pipeline"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false), }; wWorkflows = new TableView( - manager.getVariables(), - parent, - SWT.BORDER, - columns, - 0, - e -> setChanged(), - props); + manager.getVariables(), parent, SWT.BORDER, columns, 0, e -> setChanged(), props); FormData fdSources = new FormData(); fdSources.left = new FormAttachment(0, 0); fdSources.top = new FormAttachment(lastControl, margin); @@ -441,7 +434,7 @@ public void setWidgetsContent() { wInterval.setText(Const.NVL(wl.getIntervalInSeconds(), "")); wWorkflows.removeAll(); List workflowsToLog = wl.getWorkflowToLog(); - for(String workflowToLog : workflowsToLog){ + for (String workflowToLog : workflowsToLog) { TableItem item = new TableItem(wWorkflows.table, SWT.NONE); item.setText(1, Const.NVL(workflowToLog, "")); } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLogging.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLogging.java index daee3af4c9c..0093557e988 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLogging.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLogging.java @@ -18,6 +18,7 @@ package org.apache.hop.reflection.workflow.transform; +import java.util.List; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.HopLogStore; @@ -33,8 +34,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.List; - public class WorkflowLogging extends BaseTransform { private IWorkflowEngine loggingWorkflow; @@ -190,7 +189,9 @@ public IWorkflowEngine getLoggingWorkflow() { return loggingWorkflow; } - /** @param loggingWorkflow The loggingWorkflow to set */ + /** + * @param loggingWorkflow The loggingWorkflow to set + */ public void setLoggingWorkflow(IWorkflowEngine loggingWorkflow) { this.loggingWorkflow = loggingWorkflow; } @@ -204,7 +205,9 @@ public String getLoggingPhase() { return loggingPhase; } - /** @param loggingPhase The loggingPhase to set */ + /** + * @param loggingPhase The loggingPhase to set + */ public void setLoggingPhase(String loggingPhase) { this.loggingPhase = loggingPhase; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLoggingMeta.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLoggingMeta.java index 011f028a001..52d16e8aef9 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLoggingMeta.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/transform/WorkflowLoggingMeta.java @@ -149,7 +149,9 @@ public boolean isLoggingActionResults() { return loggingActionResults; } - /** @param loggingActionResults The loggingTransforms to set */ + /** + * @param loggingActionResults The loggingTransforms to set + */ public void setLoggingActionResults(boolean loggingActionResults) { this.loggingActionResults = loggingActionResults; } diff --git a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/xp/WorkflowStartLoggingXp.java b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/xp/WorkflowStartLoggingXp.java index 46393735a0d..7d4721d6f84 100644 --- a/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/xp/WorkflowStartLoggingXp.java +++ b/plugins/misc/reflection/src/main/java/org/apache/hop/reflection/workflow/xp/WorkflowStartLoggingXp.java @@ -17,6 +17,9 @@ package org.apache.hop.reflection.workflow.xp; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -37,10 +40,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; - @ExtensionPoint( id = "WorkflowStartLoggingXp", extensionPointId = "WorkflowStart", @@ -68,20 +67,19 @@ private void handleWorkflowLog( final IVariables variables) throws HopException { + // See if we need to do anything at all... + // + if (!workflowLog.isEnabled()) { + return; + } - // See if we need to do anything at all... - // - if (!workflowLog.isEnabled()) { + // If we log parent (root) workflows only we don't want a parent + // + if (workflowLog.isLoggingParentsOnly()) { + if (workflow.getParentPipeline() != null || workflow.getParentWorkflow() != null) { return; } - - // If we log parent (root) workflows only we don't want a parent - // - if (workflowLog.isLoggingParentsOnly()) { - if (workflow.getParentPipeline() != null || workflow.getParentWorkflow() != null) { - return; - } - } + } // Load the pipeline filename specified in the Workflow Log object... // @@ -112,7 +110,8 @@ private void handleWorkflowLog( } else { for (String workflowToLog : workflowLog.getWorkflowToLog()) { String workflowUri = HopVfs.getFileObject(workflow.getFilename()).getPublicURIString(); - String workflowToLogUri = HopVfs.getFileObject(variables.resolve(workflowToLog)).getPublicURIString(); + String workflowToLogUri = + HopVfs.getFileObject(variables.resolve(workflowToLog)).getPublicURIString(); if (workflowUri.equals(workflowToLogUri)) { logWorkflow(workflowLog, workflow, variables, loggingPipelineFilename); } @@ -120,7 +119,12 @@ private void handleWorkflowLog( } } - private void logWorkflow(WorkflowLog workflowLog, IWorkflowEngine workflow, IVariables variables, String loggingPipelineFilename) throws HopException { + private void logWorkflow( + WorkflowLog workflowLog, + IWorkflowEngine workflow, + IVariables variables, + String loggingPipelineFilename) + throws HopException { try { final Timer timer = new Timer(); diff --git a/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/metadata/SchemaDefinition.java b/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/metadata/SchemaDefinition.java index af3c16b7570..a94450516af 100644 --- a/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/metadata/SchemaDefinition.java +++ b/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/metadata/SchemaDefinition.java @@ -23,7 +23,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopPluginException; -import org.apache.hop.core.injection.Injection; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.RowMeta; @@ -74,17 +73,18 @@ public IRowMeta getRowMeta() throws HopPluginException { return rowMeta; } - - public void validate() throws HopException { -// if (StringUtils.isEmpty(separator)) { -// throw new HopException("Please specify a separator in file definition "+name); -// } + public void validate() throws HopException { + // if (StringUtils.isEmpty(separator)) { + // throw new HopException("Please specify a separator in file definition "+name); + // } for (IValueMeta valueMeta : getRowMeta().getValueMetaList()) { if (StringUtils.isEmpty(valueMeta.getName())) { - throw new HopException("Schema definition " + name + " should not contain fields without a name"); + throw new HopException( + "Schema definition " + name + " should not contain fields without a name"); } - if (valueMeta.getType()==IValueMeta.TYPE_NONE) { - throw new HopException("Schema definition " + name + " should not contain fields without a type"); + if (valueMeta.getType() == IValueMeta.TYPE_NONE) { + throw new HopException( + "Schema definition " + name + " should not contain fields without a type"); } } } @@ -98,7 +98,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -112,7 +114,9 @@ public List getFieldDefinitions() { return fieldDefinitions; } - /** @param fieldDefinitions The fieldDefinitions to set */ + /** + * @param fieldDefinitions The fieldDefinitions to set + */ public void setFieldDefinitions(List fieldDefinitions) { this.fieldDefinitions = fieldDefinitions; } @@ -126,7 +130,9 @@ public String getSeparator() { return separator; } - /** @param separator The separator to set */ + /** + * @param separator The separator to set + */ public void setSeparator(String separator) { this.separator = separator; } @@ -140,9 +146,10 @@ public String getEnclosure() { return enclosure; } - /** @param enclosure The enclosure to set */ + /** + * @param enclosure The enclosure to set + */ public void setEnclosure(String enclosure) { this.enclosure = enclosure; } - } diff --git a/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/util/SchemaDefinitionUtil.java b/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/util/SchemaDefinitionUtil.java index e3c7e78e047..3ecc4e4d666 100644 --- a/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/util/SchemaDefinitionUtil.java +++ b/plugins/misc/static-schema/src/main/java/org/apache/hop/staticschema/util/SchemaDefinitionUtil.java @@ -25,33 +25,33 @@ public class SchemaDefinitionUtil { - public SchemaDefinition loadSchemaDefinition(IHopMetadataProvider metadataProvider, String schemaDefinitionName) - throws HopTransformException { - if (StringUtils.isEmpty(schemaDefinitionName)) { - throw new HopTransformException("No schema definition name provided"); - } - SchemaDefinition schemaDefinition; - try { - IHopMetadataSerializer serializer = - metadataProvider.getSerializer(SchemaDefinition.class); - schemaDefinition = serializer.load(schemaDefinitionName); - } catch (Exception e) { - throw new HopTransformException( - "Unable to schema definition '" + schemaDefinitionName + "' from the metadata", e); - } - if (schemaDefinition == null) { - throw new HopTransformException( - "Unable to find schema definition '" + schemaDefinitionName + "' in the metadata"); - } - - try { - schemaDefinition.validate(); - } catch (Exception e) { - throw new HopTransformException( - "There was an error validating file definition " + schemaDefinition.getName(), e); - } + public SchemaDefinition loadSchemaDefinition( + IHopMetadataProvider metadataProvider, String schemaDefinitionName) + throws HopTransformException { + if (StringUtils.isEmpty(schemaDefinitionName)) { + throw new HopTransformException("No schema definition name provided"); + } + SchemaDefinition schemaDefinition; + try { + IHopMetadataSerializer serializer = + metadataProvider.getSerializer(SchemaDefinition.class); + schemaDefinition = serializer.load(schemaDefinitionName); + } catch (Exception e) { + throw new HopTransformException( + "Unable to schema definition '" + schemaDefinitionName + "' from the metadata", e); + } + if (schemaDefinition == null) { + throw new HopTransformException( + "Unable to find schema definition '" + schemaDefinitionName + "' in the metadata"); + } - return schemaDefinition; + try { + schemaDefinition.validate(); + } catch (Exception e) { + throw new HopTransformException( + "There was an error validating file definition " + schemaDefinition.getName(), e); } + return schemaDefinition; + } } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSet.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSet.java index 7a1de5741e6..a0ad15f0c13 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSet.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSet.java @@ -17,6 +17,8 @@ package org.apache.hop.testing; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -32,9 +34,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.ArrayList; -import java.util.List; - @HopMetadata( key = "dataset", name = "Data Set", @@ -151,7 +150,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -165,7 +166,9 @@ public String getFolderName() { return folderName; } - /** @param folderName The folderName to set */ + /** + * @param folderName The folderName to set + */ public void setFolderName(String folderName) { this.folderName = folderName; } @@ -179,7 +182,9 @@ public String getBaseFilename() { return baseFilename; } - /** @param baseFilename The base filename to set */ + /** + * @param baseFilename The base filename to set + */ public void setBaseFilename(String baseFilename) { this.baseFilename = baseFilename; } @@ -193,7 +198,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetCsvUtil.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetCsvUtil.java index 9bf3ebe296d..4633eb0fb9c 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetCsvUtil.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetCsvUtil.java @@ -17,6 +17,16 @@ package org.apache.hop.testing; +import java.io.BufferedInputStream; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVPrinter; @@ -34,17 +44,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.vfs.HopVfs; -import java.io.BufferedInputStream; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - /** * The implementation of a CSV Data Set Group We simply write/read the rows without a header into a * file defined by the tableName in the data set @@ -68,11 +67,11 @@ private static void setValueFormats(IRowMeta rowMeta) { break; } } - + // Force decimal separator for non English system (HOP-4190). - if ( valueMeta.isNumber() || valueMeta.isBigNumber() ) { + if (valueMeta.isNumber() || valueMeta.isBigNumber()) { valueMeta.setDecimalSymbol("."); - } + } } } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetField.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetField.java index a0dc380da23..83ac8d4419d 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetField.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetField.java @@ -17,9 +17,8 @@ package org.apache.hop.testing; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DataSetField { @HopMetadataProperty(key = "field_name") @@ -81,7 +80,9 @@ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set */ + /** + * @param fieldName The fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } @@ -95,7 +96,9 @@ public int getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(int type) { this.type = type; } @@ -109,7 +112,9 @@ public int getLength() { return length; } - /** @param length The length to set */ + /** + * @param length The length to set + */ public void setLength(int length) { this.length = length; } @@ -123,7 +128,9 @@ public int getPrecision() { return precision; } - /** @param precision The precision to set */ + /** + * @param precision The precision to set + */ public void setPrecision(int precision) { this.precision = precision; } @@ -137,7 +144,9 @@ public String getComment() { return comment; } - /** @param comment The comment to set */ + /** + * @param comment The comment to set + */ public void setComment(String comment) { this.comment = comment; } @@ -151,7 +160,9 @@ public String getFormat() { return format; } - /** @param format The format to set */ + /** + * @param format The format to set + */ public void setFormat(String format) { this.format = format; } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetSearchableAnalyser.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetSearchableAnalyser.java index d837fbca34d..b5f25a615c4 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetSearchableAnalyser.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetSearchableAnalyser.java @@ -17,6 +17,8 @@ package org.apache.hop.testing; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.core.search.BaseMetadataSearchableAnalyser; import org.apache.hop.core.search.ISearchQuery; @@ -25,9 +27,6 @@ import org.apache.hop.core.search.ISearchableAnalyser; import org.apache.hop.core.search.SearchableAnalyserPlugin; -import java.util.ArrayList; -import java.util.List; - @SearchableAnalyserPlugin(id = "DataSetSearchableAnalyser", name = "Search in data set metadata") public class DataSetSearchableAnalyser extends BaseMetadataSearchableAnalyser implements ISearchableAnalyser { diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTest.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTest.java index 44b8d2b996a..973849bd97d 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTest.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTest.java @@ -17,6 +17,9 @@ package org.apache.hop.testing; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -35,10 +38,6 @@ import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.testing.util.DataSetConst; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** This class describes a test-case where a pipeline output is verified against golden data. */ @HopMetadata( key = "unit-test", @@ -274,7 +273,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -288,7 +289,9 @@ public String getPipelineFilename() { return pipelineFilename; } - /** @param pipelineFilename The transFilename to set */ + /** + * @param pipelineFilename The transFilename to set + */ public void setPipelineFilename(String pipelineFilename) { this.pipelineFilename = pipelineFilename; } @@ -302,7 +305,9 @@ public List getInputDataSets() { return inputDataSets; } - /** @param inputDataSets The inputDataSets to set */ + /** + * @param inputDataSets The inputDataSets to set + */ public void setInputDataSets(List inputDataSets) { this.inputDataSets = inputDataSets; } @@ -316,7 +321,9 @@ public List getGoldenDataSets() { return goldenDataSets; } - /** @param goldenDataSets The goldenDataSets to set */ + /** + * @param goldenDataSets The goldenDataSets to set + */ public void setGoldenDataSets(List goldenDataSets) { this.goldenDataSets = goldenDataSets; } @@ -330,7 +337,9 @@ public List getTweaks() { return tweaks; } - /** @param tweaks The tweaks to set */ + /** + * @param tweaks The tweaks to set + */ public void setTweaks(List tweaks) { this.tweaks = tweaks; } @@ -344,7 +353,9 @@ public TestType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(TestType type) { this.type = type; } @@ -358,7 +369,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -372,7 +385,9 @@ public String getBasePath() { return basePath; } - /** @param basePath The basePath to set */ + /** + * @param basePath The basePath to set + */ public void setBasePath(String basePath) { this.basePath = basePath; } @@ -386,7 +401,9 @@ public List getDatabaseReplacements() { return databaseReplacements; } - /** @param databaseReplacements The databaseReplacements to set */ + /** + * @param databaseReplacements The databaseReplacements to set + */ public void setDatabaseReplacements( List databaseReplacements) { this.databaseReplacements = databaseReplacements; @@ -401,7 +418,9 @@ public List getVariableValues() { return variableValues; } - /** @param variableValues The variableValues to set */ + /** + * @param variableValues The variableValues to set + */ public void setVariableValues(List variableValues) { this.variableValues = variableValues; } @@ -415,7 +434,9 @@ public boolean isAutoOpening() { return autoOpening; } - /** @param autoOpening The autoOpening to set */ + /** + * @param autoOpening The autoOpening to set + */ public void setAutoOpening(boolean autoOpening) { this.autoOpening = autoOpening; } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSearchableAnalyser.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSearchableAnalyser.java index f7cd5150872..895a4fd6b90 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSearchableAnalyser.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSearchableAnalyser.java @@ -17,6 +17,8 @@ package org.apache.hop.testing; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.search.BaseMetadataSearchableAnalyser; import org.apache.hop.core.search.ISearchQuery; import org.apache.hop.core.search.ISearchResult; @@ -24,9 +26,6 @@ import org.apache.hop.core.search.ISearchableAnalyser; import org.apache.hop.core.search.SearchableAnalyserPlugin; -import java.util.ArrayList; -import java.util.List; - @SearchableAnalyserPlugin( id = "PipelineUnitTestSearchableAnalyser", name = "Search in pipeline unit test metadata") diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSetLocation.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSetLocation.java index 5b739a3e5b6..a9e9442c4d2 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSetLocation.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/PipelineUnitTestSetLocation.java @@ -17,10 +17,9 @@ package org.apache.hop.testing; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; /** This defines the place where we need to inject an input data set */ public class PipelineUnitTestSetLocation { diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/UnitTestResult.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/UnitTestResult.java index 21fd6ad2ec7..31887576f14 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/UnitTestResult.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/UnitTestResult.java @@ -17,6 +17,8 @@ package org.apache.hop.testing; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowDataUtil; import org.apache.hop.core.row.RowMeta; @@ -24,9 +26,6 @@ import org.apache.hop.core.row.value.ValueMetaString; import org.apache.hop.i18n.BaseMessages; -import java.util.ArrayList; -import java.util.List; - public class UnitTestResult { private static final Class PKG = UnitTestResult.class; // For Translator diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/VariableValue.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/VariableValue.java index 38ba94c2d05..b21878d372e 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/VariableValue.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/VariableValue.java @@ -40,7 +40,9 @@ public String getKey() { return key; } - /** @param key The key to set */ + /** + * @param key The key to set + */ public void setKey(String key) { this.key = key; } @@ -54,7 +56,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java index 86951da0d2c..ec5b250c8d1 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java @@ -17,6 +17,9 @@ package org.apache.hop.testing.actions.runtests; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; import org.apache.hop.core.exception.HopException; @@ -33,10 +36,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - @Action( id = "RunPipelineTests", name = "i18n::RunPipelineTests.Name", @@ -118,7 +117,8 @@ public Result execute(Result prevResult, int nr) throws HopException { if (test == null) { this.logError("Unable to load unit test for '" + testName, e); } else { - this.logError("There was an exception executing pipeline unit test '" + test.getName(), e); + this.logError( + "There was an exception executing pipeline unit test '" + test.getName(), e); } success.set(false); }); @@ -217,7 +217,9 @@ public List getTestNames() { return testNames; } - /** @param testNames The testNames to set */ + /** + * @param testNames The testNames to set + */ public void setTestNames(List testNames) { this.testNames = testNames; } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTestsDialog.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTestsDialog.java index e9ecb52c807..848a55832b9 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTestsDialog.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTestsDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.testing.actions.runtests; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -46,8 +47,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class RunPipelineTestsDialog extends ActionDialog implements IActionDialog { private static final Class PKG = RunPipelineTestsDialog.class; // For Translator @@ -142,7 +141,11 @@ public IAction open() { ColumnInfo[] columnInfos = new ColumnInfo[] { - new ColumnInfo(BaseMessages.getString(PKG, "RunTestsDialog.TestsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), + new ColumnInfo( + BaseMessages.getString(PKG, "RunTestsDialog.TestsTable.Name.Column"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false), }; wTestNames = diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java index b2c4bbd5f39..8c04ed15253 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java @@ -17,6 +17,10 @@ package org.apache.hop.testing.gui; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.RowMetaAndData; @@ -73,11 +77,6 @@ import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Control; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - @GuiPlugin public class TestingGuiPlugin { public static final String ACTION_ID_PIPELINE_GRAPH_TRANSFORM_DEFINE_INPUT_DATA_SET = @@ -643,7 +642,11 @@ public void createDataSetFromTransform(HopGuiPipelineTransformContext context) { } MetadataManager manager = - new MetadataManager<>(hopGui.getVariables(), hopGui.getMetadataProvider(), DataSet.class, hopGui.getShell()); + new MetadataManager<>( + hopGui.getVariables(), + hopGui.getMetadataProvider(), + DataSet.class, + hopGui.getShell()); if (manager.newMetadata(dataSet) != null) { PipelineUnitTest unitTest = getCurrentUnitTest(pipelineMeta); @@ -873,7 +876,10 @@ public void editUnitTest() { MetadataManager manager = new MetadataManager<>( - hopGui.getVariables(), hopGui.getMetadataProvider(), PipelineUnitTest.class, hopGui.getShell()); + hopGui.getVariables(), + hopGui.getMetadataProvider(), + PipelineUnitTest.class, + hopGui.getShell()); if (manager.editMetadata(unitTest.getName())) { // Activate the test refreshUnitTestsList(); @@ -896,7 +902,10 @@ public void createUnitTest() { MetadataManager manager = new MetadataManager<>( - hopGui.getVariables(), hopGui.getMetadataProvider(), PipelineUnitTest.class, hopGui.getShell()); + hopGui.getVariables(), + hopGui.getMetadataProvider(), + PipelineUnitTest.class, + hopGui.getShell()); PipelineUnitTest test = manager.newMetadata(); if (test != null) { // Activate the test @@ -1014,7 +1023,10 @@ public void editPipelineUnitTest() { try { MetadataManager manager = new MetadataManager<>( - hopGui.getVariables(), hopGui.getMetadataProvider(), PipelineUnitTest.class, hopGui.getShell()); + hopGui.getVariables(), + hopGui.getMetadataProvider(), + PipelineUnitTest.class, + hopGui.getShell()); if (manager.editMetadata(unitTestName)) { refreshUnitTestsList(); selectUnitTestInList(unitTestName); diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTests.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTests.java index 4fb7362163b..b4605be8261 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTests.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTests.java @@ -17,6 +17,7 @@ package org.apache.hop.testing.transforms.exectests; +import java.util.ArrayList; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Result; @@ -33,8 +34,6 @@ import org.apache.hop.testing.gui.TestingGuiPlugin; import org.apache.hop.testing.util.UnitTestUtil; -import java.util.ArrayList; - public class ExecuteTests extends BaseTransform { public ExecuteTests( diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsData.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsData.java index 96a7f48b19a..675f9079c0b 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsData.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsData.java @@ -17,14 +17,13 @@ package org.apache.hop.testing.transforms.exectests; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.testing.PipelineUnitTest; -import java.util.Iterator; -import java.util.List; - public class ExecuteTestsData extends BaseTransformData implements ITransformData { public List tests; diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsMeta.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsMeta.java index 76576529da2..2b2ff789251 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsMeta.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/transforms/exectests/ExecuteTestsMeta.java @@ -150,7 +150,9 @@ public String getTestNameInputField() { return testNameInputField; } - /** @param testNameInputField The testNameInputField to set */ + /** + * @param testNameInputField The testNameInputField to set + */ public void setTestNameInputField(String testNameInputField) { this.testNameInputField = testNameInputField; } @@ -164,7 +166,9 @@ public TestType getTypeToExecute() { return typeToExecute; } - /** @param typeToExecute The typeToExecute to set */ + /** + * @param typeToExecute The typeToExecute to set + */ public void setTypeToExecute(TestType typeToExecute) { this.typeToExecute = typeToExecute; } @@ -178,7 +182,9 @@ public String getPipelineNameField() { return pipelineNameField; } - /** @param pipelineNameField The pipelineNameField to set */ + /** + * @param pipelineNameField The pipelineNameField to set + */ public void setPipelineNameField(String pipelineNameField) { this.pipelineNameField = pipelineNameField; } @@ -192,7 +198,9 @@ public String getUnitTestNameField() { return unitTestNameField; } - /** @param unitTestNameField The unitTestNameField to set */ + /** + * @param unitTestNameField The unitTestNameField to set + */ public void setUnitTestNameField(String unitTestNameField) { this.unitTestNameField = unitTestNameField; } @@ -206,7 +214,9 @@ public String getDataSetNameField() { return dataSetNameField; } - /** @param dataSetNameField The dataSetNameField to set */ + /** + * @param dataSetNameField The dataSetNameField to set + */ public void setDataSetNameField(String dataSetNameField) { this.dataSetNameField = dataSetNameField; } @@ -220,7 +230,9 @@ public String getTransformNameField() { return transformNameField; } - /** @param transformNameField The transform name field to set */ + /** + * @param transformNameField The transform name field to set + */ public void setTransformNameField(String transformNameField) { this.transformNameField = transformNameField; } @@ -234,7 +246,9 @@ public String getErrorField() { return errorField; } - /** @param errorField The errorField to set */ + /** + * @param errorField The errorField to set + */ public void setErrorField(String errorField) { this.errorField = errorField; } @@ -248,7 +262,9 @@ public String getCommentField() { return commentField; } - /** @param commentField The commentField to set */ + /** + * @param commentField The commentField to set + */ public void setCommentField(String commentField) { this.commentField = commentField; } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/DataSetConst.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/DataSetConst.java index 36c3fadc939..ea29264950b 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/DataSetConst.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/DataSetConst.java @@ -17,6 +17,10 @@ package org.apache.hop.testing.util; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.math3.util.Precision; import org.apache.hop.core.Const; @@ -39,11 +43,6 @@ import org.apache.hop.testing.UnitTestResult; import org.apache.hop.testing.xp.RowCollection; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - public class DataSetConst { private static final Class PKG = DataSetConst.class; // For Translator diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/ITestResultsEvaluator.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/ITestResultsEvaluator.java index 6ffae68d970..d939807bce8 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/ITestResultsEvaluator.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/ITestResultsEvaluator.java @@ -18,12 +18,11 @@ package org.apache.hop.testing.util; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.engine.IPipelineEngine; import org.apache.hop.testing.UnitTestResult; -import java.util.List; - public interface ITestResultsEvaluator { void evaluateTestResults(IPipelineEngine pipeline, List testResults) diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java index 2b0f864671d..00cfa03ae63 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java @@ -17,6 +17,8 @@ package org.apache.hop.testing.util; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; @@ -30,9 +32,6 @@ import org.apache.hop.testing.PipelineUnitTest; import org.apache.hop.testing.UnitTestResult; -import java.util.ArrayList; -import java.util.List; - public class UnitTestUtil { public static final PipelineMeta loadTestPipeline( diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/AutoOpenTestExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/AutoOpenTestExtensionPoint.java index 8f3821ba465..731495e2114 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/AutoOpenTestExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/AutoOpenTestExtensionPoint.java @@ -17,6 +17,8 @@ package org.apache.hop.testing.xp; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -28,9 +30,6 @@ import org.apache.hop.ui.hopgui.HopGui; import org.apache.hop.ui.hopgui.file.pipeline.HopGuiPipelineGraph; -import java.util.ArrayList; -import java.util.List; - @ExtensionPoint( id = "AutoOpenTestExtensionPoint", extensionPointId = "PipelineAfterOpen", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ChangePipelineMetaPriorToExecutionExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ChangePipelineMetaPriorToExecutionExtensionPoint.java index fdcec8f7504..39f2023ffb6 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ChangePipelineMetaPriorToExecutionExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ChangePipelineMetaPriorToExecutionExtensionPoint.java @@ -17,6 +17,8 @@ package org.apache.hop.testing.xp; +import java.io.OutputStream; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -34,9 +36,6 @@ import org.apache.hop.testing.VariableValue; import org.apache.hop.testing.util.DataSetConst; -import java.io.OutputStream; -import java.util.List; - @ExtensionPoint( extensionPointId = "PipelinePrepareExecution", id = "ChangePipelineMetaPriorToExecutionExtensionPoint", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawGoldenDataSetOnTransformExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawGoldenDataSetOnTransformExtensionPoint.java index 738b7078a53..e2cdae000ba 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawGoldenDataSetOnTransformExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawGoldenDataSetOnTransformExtensionPoint.java @@ -17,12 +17,13 @@ package org.apache.hop.testing.xp; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; import org.apache.hop.core.gui.AreaOwner; -import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.IGc; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.ILogChannel; @@ -37,9 +38,6 @@ import org.apache.hop.testing.util.DataSetConst; import org.apache.hop.ui.core.ConstUi; -import java.util.List; -import java.util.Map; - @ExtensionPoint( id = "DrawGoldenDataSetOnTransformExtensionPoint", description = @@ -142,7 +140,7 @@ protected void drawGoldenSetMarker( iconY + 5, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE, - ext.offset, + ext.offset, DataSetConst.AREA_DRAWN_GOLDEN_DATA_RESULT, transformMeta.getName())); } catch (Exception e) { @@ -153,4 +151,3 @@ protected void drawGoldenSetMarker( } } } - diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawInputDataSetOnTransformExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawInputDataSetOnTransformExtensionPoint.java index 96f98343e00..d103e449e32 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawInputDataSetOnTransformExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/DrawInputDataSetOnTransformExtensionPoint.java @@ -17,12 +17,12 @@ package org.apache.hop.testing.xp; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; import org.apache.hop.core.gui.AreaOwner; -import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.IGc; import org.apache.hop.core.gui.Point; import org.apache.hop.core.logging.ILogChannel; @@ -35,8 +35,6 @@ import org.apache.hop.testing.gui.TestingGuiPlugin; import org.apache.hop.testing.util.DataSetConst; -import java.util.List; - @ExtensionPoint( id = "DrawInputDataSetOnTransformExtensionPoint", description = "Draws a marker on top of a transform if it has an input data set defined for it", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiPipelineAfterClose.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiPipelineAfterClose.java index 1488676f28c..4692a600f16 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiPipelineAfterClose.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiPipelineAfterClose.java @@ -17,6 +17,7 @@ package org.apache.hop.testing.xp; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -26,8 +27,6 @@ import org.apache.hop.testing.gui.TestingGuiPlugin; import org.apache.hop.testing.util.DataSetConst; -import java.util.Map; - @ExtensionPoint( extensionPointId = "HopGuiPipelineAfterClose", id = "HopGuiPipelineAfterClose", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiUpdateStateMapExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiUpdateStateMapExtensionPoint.java index bfb541e2861..535a24b9f4a 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiUpdateStateMapExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/HopGuiUpdateStateMapExtensionPoint.java @@ -17,6 +17,9 @@ package org.apache.hop.testing.xp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; @@ -27,10 +30,6 @@ import org.apache.hop.testing.util.DataSetConst; import org.apache.hop.ui.hopgui.file.pipeline.extension.HopGuiPipelineFinishedExtension; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @ExtensionPoint( id = "HopGuiUpdateStateMapExtensionPoint", description = diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/InjectDataSetIntoTransformExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/InjectDataSetIntoTransformExtensionPoint.java index 2724c30a59c..da653e23019 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/InjectDataSetIntoTransformExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/InjectDataSetIntoTransformExtensionPoint.java @@ -17,6 +17,10 @@ package org.apache.hop.testing.xp; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopPluginException; @@ -45,11 +49,6 @@ import org.apache.hop.testing.PipelineUnitTestSetLocation; import org.apache.hop.testing.util.DataSetConst; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @ExtensionPoint( extensionPointId = "PipelineStartThreads", id = "InjectDataSetIntoTransformExtensionPoint", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/LocationMouseDoubleClickExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/LocationMouseDoubleClickExtensionPoint.java index 6fc35235738..b7959c67893 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/LocationMouseDoubleClickExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/LocationMouseDoubleClickExtensionPoint.java @@ -17,6 +17,9 @@ package org.apache.hop.testing.xp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -42,10 +45,6 @@ import org.apache.hop.ui.testing.PipelineUnitTestSetLocationDialog; import org.eclipse.swt.events.MouseEvent; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @ExtensionPoint( extensionPointId = "PipelineGraphMouseDown", id = "LocationMouseDoubleClickExtensionPoint", @@ -170,7 +169,8 @@ private void openDataSet(String dataSetName) { HopGui hopGui = HopGui.getInstance(); MetadataManager manager = - new MetadataManager<>(hopGui.getVariables(), hopGui.getMetadataProvider(), DataSet.class, hopGui.getShell()); + new MetadataManager<>( + hopGui.getVariables(), hopGui.getMetadataProvider(), DataSet.class, hopGui.getShell()); manager.editMetadata(dataSetName); } } diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/PipelineMetaModifier.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/PipelineMetaModifier.java index 9d767ffbfcb..5e1f1f34196 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/PipelineMetaModifier.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/PipelineMetaModifier.java @@ -17,6 +17,10 @@ package org.apache.hop.testing.xp; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; @@ -40,11 +44,6 @@ import org.apache.hop.testing.PipelineUnitTestTweak; import org.apache.hop.testing.util.DataSetConst; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.List; - public class PipelineMetaModifier { private final IVariables variables; diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/RowCollection.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/RowCollection.java index 16bc7f9e3b7..4abda801bf2 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/RowCollection.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/RowCollection.java @@ -17,10 +17,9 @@ package org.apache.hop.testing.xp; -import org.apache.hop.core.row.IRowMeta; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.row.IRowMeta; public class RowCollection { diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/TestingVariablesControlSpaceSortOrderPrefix.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/TestingVariablesControlSpaceSortOrderPrefix.java index 1554314c024..2dc3201ca87 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/TestingVariablesControlSpaceSortOrderPrefix.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/TestingVariablesControlSpaceSortOrderPrefix.java @@ -17,6 +17,7 @@ package org.apache.hop.testing.xp; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -24,8 +25,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.testing.util.DataSetConst; -import java.util.Map; - @ExtensionPoint( id = "TestingVariablesControlSpaceSortOrderPrefix", extensionPointId = "HopGuiGetControlSpaceSortOrderPrefix", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ValidatePipelineUnitTestExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ValidatePipelineUnitTestExtensionPoint.java index e7d039a6395..8fea276cb93 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ValidatePipelineUnitTestExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/ValidatePipelineUnitTestExtensionPoint.java @@ -17,6 +17,8 @@ package org.apache.hop.testing.xp; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.IExtensionPoint; @@ -34,9 +36,6 @@ import org.apache.hop.ui.hopgui.HopGui; import org.eclipse.swt.SWT; -import java.util.ArrayList; -import java.util.List; - @ExtensionPoint( extensionPointId = "PipelineFinish", id = "ValidatePipelineUnitTestExtensionPoint", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/WriteToDataSetExtensionPoint.java b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/WriteToDataSetExtensionPoint.java index b7b587612c3..d4743e8a2a0 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/WriteToDataSetExtensionPoint.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/WriteToDataSetExtensionPoint.java @@ -17,6 +17,10 @@ package org.apache.hop.testing.xp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.SourceToTargetMapping; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -36,11 +40,6 @@ import org.apache.hop.testing.DataSetCsvUtil; import org.apache.hop.testing.util.DataSetConst; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @ExtensionPoint( id = "WriteToDataSetExtensionPoint", extensionPointId = "PipelineStartThreads", diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/DataSetEditor.java b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/DataSetEditor.java index 85c8ea25e0e..b60da725a4e 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/DataSetEditor.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/DataSetEditor.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.testing; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -50,8 +51,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class DataSetEditor extends MetadataEditor { private static final Class PKG = DataSetEditor.class; // For Translator diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/EditRowsDialog.java b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/EditRowsDialog.java index 16a74a259b8..a54e7984968 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/EditRowsDialog.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/EditRowsDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.testing; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -48,12 +50,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.ArrayList; -import java.util.List; - -/** - * Allows the user to edit a list of rows in a TableView. - */ +/** Allows the user to edit a list of rows in a TableView. */ public class EditRowsDialog { private static final Class PKG = EditRowsDialog.class; // For Translator diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestEditor.java b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestEditor.java index 17f496ea210..64d4d7ca5d6 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestEditor.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestEditor.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.testing; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; @@ -47,9 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.Collections; -import java.util.List; - public class PipelineUnitTestEditor extends MetadataEditor { private static final Class PKG = PipelineUnitTestEditor.class; // For Translator diff --git a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestSetLocationDialog.java b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestSetLocationDialog.java index 02388dcb3f4..e2c3eaac041 100644 --- a/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestSetLocationDialog.java +++ b/plugins/misc/testing/src/main/java/org/apache/hop/ui/testing/PipelineUnitTestSetLocationDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.ui.testing; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.SourceToTargetMapping; @@ -51,10 +54,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - public class PipelineUnitTestSetLocationDialog extends Dialog { private static final Class PKG = PipelineUnitTestSetLocationDialog.class; // For Translator @@ -399,7 +398,9 @@ private void cancel() { dispose(); } - /** @param loc The data set to load the dialog information into */ + /** + * @param loc The data set to load the dialog information into + */ public void getInfo(PipelineUnitTestSetLocation loc) { loc.setTransformName(wTransformName.getText()); diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecode.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecode.java index 2b90209e1ec..460b2133d26 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecode.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecode.java @@ -17,6 +17,7 @@ package org.apache.hop.avro.transforms.avrodecode; +import java.util.Map; import org.apache.avro.Schema; import org.apache.avro.generic.GenericContainer; import org.apache.avro.generic.GenericData; @@ -32,8 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Map; - public class AvroDecode extends BaseTransform { public AvroDecode( TransformMeta transformMeta, diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeDialog.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeDialog.java index f1ed0887d47..874b71dfbc4 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeDialog.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeDialog.java @@ -17,6 +17,11 @@ package org.apache.hop.avro.transforms.avrodecode; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord; import org.apache.commons.lang.StringUtils; @@ -61,12 +66,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class AvroDecodeDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = AvroDecodeMeta.class; // For Translator diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeMeta.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeMeta.java index ea51fcf8d40..b2b03bf34f8 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeMeta.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/AvroDecodeMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.avro.transforms.avrodecode; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -28,9 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "AvroDecode", name = "Avro Decode", @@ -90,7 +89,9 @@ public String getSourceFieldName() { return sourceFieldName; } - /** @param sourceFieldName The sourceFieldName to set */ + /** + * @param sourceFieldName The sourceFieldName to set + */ public void setSourceFieldName(String sourceFieldName) { this.sourceFieldName = sourceFieldName; } @@ -112,7 +113,9 @@ public boolean isIgnoringMissingPaths() { return ignoringMissingPaths; } - /** @param ignoringMissingPaths The ignoringMissingPaths to set */ + /** + * @param ignoringMissingPaths The ignoringMissingPaths to set + */ public void setIgnoringMissingPaths(boolean ignoringMissingPaths) { this.ignoringMissingPaths = ignoringMissingPaths; } @@ -126,7 +129,9 @@ public List getTargetFields() { return targetFields; } - /** @param targetFields The targetFields to set */ + /** + * @param targetFields The targetFields to set + */ public void setTargetFields(List targetFields) { this.targetFields = targetFields; } diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/TargetField.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/TargetField.java index 56597906591..f2255f5b5a3 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/TargetField.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrodecode/TargetField.java @@ -17,6 +17,7 @@ package org.apache.hop.avro.transforms.avrodecode; +import java.util.Objects; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; @@ -24,8 +25,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class TargetField { @HopMetadataProperty(key = "source_field") private String sourceField; @@ -118,7 +117,9 @@ public String getSourceField() { return sourceField; } - /** @param sourceField The sourcePath to set */ + /** + * @param sourceField The sourcePath to set + */ public void setSourceField(String sourceField) { this.sourceField = sourceField; } @@ -132,7 +133,9 @@ public String getSourceAvroType() { return sourceAvroType; } - /** @param sourceAvroType The sourceAvroType to set */ + /** + * @param sourceAvroType The sourceAvroType to set + */ public void setSourceAvroType(String sourceAvroType) { this.sourceAvroType = sourceAvroType; } @@ -146,7 +149,9 @@ public String getTargetFieldName() { return targetFieldName; } - /** @param targetFieldName The targetFieldName to set */ + /** + * @param targetFieldName The targetFieldName to set + */ public void setTargetFieldName(String targetFieldName) { this.targetFieldName = targetFieldName; } @@ -160,7 +165,9 @@ public String getTargetType() { return targetType; } - /** @param targetType The targetType to set */ + /** + * @param targetType The targetType to set + */ public void setTargetType(String targetType) { this.targetType = targetType; } @@ -174,7 +181,9 @@ public String getTargetFormat() { return targetFormat; } - /** @param targetFormat The targetFormat to set */ + /** + * @param targetFormat The targetFormat to set + */ public void setTargetFormat(String targetFormat) { this.targetFormat = targetFormat; } @@ -188,7 +197,9 @@ public String getTargetLength() { return targetLength; } - /** @param targetLength The targetLength to set */ + /** + * @param targetLength The targetLength to set + */ public void setTargetLength(String targetLength) { this.targetLength = targetLength; } @@ -202,7 +213,9 @@ public String getTargetPrecision() { return targetPrecision; } - /** @param targetPrecision The targetPrecision to set */ + /** + * @param targetPrecision The targetPrecision to set + */ public void setTargetPrecision(String targetPrecision) { this.targetPrecision = targetPrecision; } diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncode.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncode.java index fdbe3f2244e..ed5b49c4f8c 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncode.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncode.java @@ -18,6 +18,7 @@ package org.apache.hop.avro.transforms.avroencode; +import java.util.ArrayList; import org.apache.avro.generic.GenericData; import org.apache.avro.generic.GenericRecord; import org.apache.hop.core.exception.HopException; @@ -28,8 +29,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; - public class AvroEncode extends BaseTransform { public AvroEncode( TransformMeta transformMeta, diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeData.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeData.java index e50e46df0c0..90c03b98d91 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeData.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeData.java @@ -18,13 +18,12 @@ package org.apache.hop.avro.transforms.avroencode; +import java.util.List; import org.apache.avro.Schema; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class AvroEncodeData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public List sourceFieldIndexes; diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeDialog.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeDialog.java index b4d46c1ca71..b09b42ae4c8 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeDialog.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeDialog.java @@ -187,7 +187,7 @@ public String open() { fdDocumentation.right = new FormAttachment(100, 0); wDocumentation.setLayoutData(fdDocumentation); lastControl = wDocumentation; - + Label wlFields = new Label(shell, SWT.RIGHT); wlFields.setText(BaseMessages.getString(PKG, "AvroEncodeDialog.Fields.Label")); PropsUi.setLook(wlFields); diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeMeta.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeMeta.java index f7661b8fa7f..5d4086e762f 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeMeta.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/AvroEncodeMeta.java @@ -18,6 +18,8 @@ package org.apache.hop.avro.transforms.avroencode; +import java.util.ArrayList; +import java.util.List; import org.apache.avro.LogicalTypes; import org.apache.avro.Schema; import org.apache.avro.SchemaBuilder; @@ -34,9 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "AvroEncode", name = "Avro Encode", @@ -74,7 +73,8 @@ public void getFields( IRowMeta[] info, TransformMeta nextTransform, IVariables variables, - IHopMetadataProvider metadataProvider) throws HopTransformException { + IHopMetadataProvider metadataProvider) + throws HopTransformException { try { Schema schema = @@ -84,7 +84,8 @@ public void getFields( variables.resolve(getDocumentation()), rowMeta, sourceFields); - ValueMetaAvroRecord valueMeta = new ValueMetaAvroRecord(variables.resolve(outputFieldName), schema); + ValueMetaAvroRecord valueMeta = + new ValueMetaAvroRecord(variables.resolve(outputFieldName), schema); rowMeta.addValueMeta(valueMeta); } catch (Exception e) { throw new HopTransformException( diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/SourceField.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/SourceField.java index e86ca82378d..789e6ac5b92 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/SourceField.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroencode/SourceField.java @@ -18,11 +18,10 @@ package org.apache.hop.avro.transforms.avroencode; +import java.util.Objects; import org.apache.hop.core.Const; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class SourceField { @HopMetadataProperty(key = "source_field") private String sourceFieldName; @@ -32,9 +31,7 @@ public class SourceField { public SourceField() {} - public SourceField( - String sourceFieldName, - String targetFieldName) { + public SourceField(String sourceFieldName, String targetFieldName) { this.sourceFieldName = sourceFieldName; this.targetFieldName = targetFieldName; } @@ -84,7 +81,9 @@ public String getSourceFieldName() { return sourceFieldName; } - /** @param sourceFieldName The sourcePath to set */ + /** + * @param sourceFieldName The sourcePath to set + */ public void setSourceFieldName(String sourceFieldName) { this.sourceFieldName = sourceFieldName; } @@ -98,9 +97,10 @@ public String getTargetFieldName() { return targetFieldName; } - /** @param targetFieldName The targetFieldName to set */ + /** + * @param targetFieldName The targetFieldName to set + */ public void setTargetFieldName(String targetFieldName) { this.targetFieldName = targetFieldName; } - } diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroinput/AvroFileInput.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroinput/AvroFileInput.java index b59bc194293..5bde05bfe83 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroinput/AvroFileInput.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avroinput/AvroFileInput.java @@ -17,6 +17,7 @@ package org.apache.hop.avro.transforms.avroinput; +import java.io.InputStream; import org.apache.avro.file.DataFileStream; import org.apache.avro.generic.GenericDatumReader; import org.apache.avro.generic.GenericRecord; @@ -30,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.InputStream; - public class AvroFileInput extends BaseTransform { /** * This is the base transform that forms that basis for all transforms. You can derive from this diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutput.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutput.java index e0bb5a4c0ad..30e5968f9ac 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutput.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutput.java @@ -17,6 +17,13 @@ package org.apache.hop.avro.transforms.avrooutput; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.avro.Schema; import org.apache.avro.Schema.Field; import org.apache.avro.Schema.Type; @@ -39,14 +46,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - /** Converts input rows to avro and then writes this avro to one or more files. */ public class AvroOutput extends BaseTransform { private static final Class PKG = diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputData.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputData.java index 63d1acdbee6..a63f79f350e 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputData.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputData.java @@ -17,6 +17,10 @@ package org.apache.hop.avro.transforms.avrooutput; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.text.DateFormatSymbols; +import java.text.SimpleDateFormat; import org.apache.avro.Schema; import org.apache.avro.file.DataFileWriter; import org.apache.avro.generic.GenericRecord; @@ -28,11 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; -import java.text.DateFormatSymbols; -import java.text.SimpleDateFormat; - public class AvroOutputData extends BaseTransformData implements ITransformData { public int splitNr; diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputDialog.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputDialog.java index 7263144bcd9..df36eae0a93 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputDialog.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.avro.transforms.avrooutput; +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.apache.avro.Schema; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -59,11 +63,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - public class AvroOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = AvroOutputMeta.class; // for i18n purposes, needed by Translator2!! @@ -205,7 +204,7 @@ public String open() { wOutputType = new CCombo(wFileComp, SWT.BORDER | SWT.READ_ONLY); wOutputType.setEditable(false); PropsUi.setLook(wOutputType); - wOutputType.addListener(SWT.Selection, e->enableFields()); + wOutputType.addListener(SWT.Selection, e -> enableFields()); FormData fdOutputType = new FormData(); fdOutputType.left = new FormAttachment(middle, 0); fdOutputType.top = new FormAttachment(0, margin); @@ -298,7 +297,7 @@ public String open() { fdCreateSchemaFile.top = new FormAttachment(wlCreateSchemaFile, 0, SWT.CENTER); fdCreateSchemaFile.right = new FormAttachment(100, 0); wCreateSchemaFile.setLayoutData(fdCreateSchemaFile); - wCreateSchemaFile.addListener(SWT.Selection, e->enableFields()); + wCreateSchemaFile.addListener(SWT.Selection, e -> enableFields()); // Write Schema File // @@ -620,7 +619,7 @@ public void widgetSelected(SelectionEvent e) { fdSpecifyFormat.top = new FormAttachment(wlSpecifyFormat, 0, SWT.CENTER); fdSpecifyFormat.right = new FormAttachment(100, 0); wSpecifyFormat.setLayoutData(fdSpecifyFormat); - wSpecifyFormat.addListener(SWT.Selection, e->enableFields()); + wSpecifyFormat.addListener(SWT.Selection, e -> enableFields()); // The date-time format // @@ -986,7 +985,7 @@ private void enableFields() { wDateTimeFormat.setEnabled(true); wOutputField.setEnabled(false); } else if (outputTypeId == AvroOutputMeta.OUTPUT_TYPE_FIELD - || outputTypeId == AvroOutputMeta.OUTPUT_TYPE_JSON_FIELD) { + || outputTypeId == AvroOutputMeta.OUTPUT_TYPE_JSON_FIELD) { wFilename.setEnabled(false); wCompression.setEnabled(false); wAddTransformNr.setEnabled(false); diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputField.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputField.java index ec970c6b2e7..60f507ff8d8 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputField.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputField.java @@ -17,15 +17,14 @@ package org.apache.hop.avro.transforms.avrooutput; -import org.apache.avro.Schema; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; +import org.apache.avro.Schema; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.metadata.api.HopMetadataProperty; /** Describes a single field in a text file */ public class AvroOutputField implements Cloneable, Comparable { diff --git a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputMeta.java b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputMeta.java index e6c4ec2c5f1..1dcf634aaf3 100644 --- a/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputMeta.java +++ b/plugins/tech/avro/src/main/java/org/apache/hop/avro/transforms/avrooutput/AvroOutputMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.avro.transforms.avrooutput; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,11 +39,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - @Transform( id = "AvroOutput", name = "i18n::AvroOutputDialog.DialogTitle", @@ -118,7 +117,6 @@ public class AvroOutputMeta extends BaseTransformMeta>" + + this.awsKey + + "<<"); + + } else { + AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain(); + snsClient = + (AmazonSNSClient) AmazonSNSClientBuilder.standard().withCredentials(provider).build(); + + baseTransform.logBasic("Connected to SNS with provided Credentials Chain"); + } + return true; + + } catch (Exception e) { + baseTransform.logError(e.getMessage()); } - /** - * - * Establishing new Connection to Amazon Webservices - * - * @return true on successful connection - */ - public boolean getAWSConnection() { - try { - baseTransform.logBasic("Starting connection to AWS SNS"); - - if (this.awsCredChain.equalsIgnoreCase("N")) { - BasicAWSCredentials awsCreds = new BasicAWSCredentials(this.awsKey, this.awsKeySecret); - snsClient = (AmazonSNSClient) AmazonSNSClientBuilder.standard() - .withCredentials(new AWSStaticCredentialsProvider(awsCreds)) - .withRegion(this.awsRegion) - .build(); - - baseTransform.logBasic("Connected to SNS in Region " + this.awsRegion + " with API-Key >>" + this.awsKey + "<<"); - - } else { - AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain(); - snsClient = (AmazonSNSClient) AmazonSNSClientBuilder.standard() - .withCredentials(provider) - .build(); - - baseTransform.logBasic("Connected to SNS with provided Credentials Chain"); - } - return true; - - } catch (Exception e) { - baseTransform.logError(e.getMessage()); - - } - - return false; - } - - /** - * Disconnects from AWS - */ - public void disconnectAWSConnection() { - try { - snsClient.shutdown(); + return false; + } - baseTransform.logBasic("Disconnected from SNS in Region " + this.awsRegion); + /** Disconnects from AWS */ + public void disconnectAWSConnection() { + try { + snsClient.shutdown(); - } catch (AmazonClientException e) { - baseTransform.logError(e.getMessage()); - baseTransform.setErrors(1); - } + baseTransform.logBasic("Disconnected from SNS in Region " + this.awsRegion); + } catch (AmazonClientException e) { + baseTransform.logError(e.getMessage()); + baseTransform.setErrors(1); } - - /** - * - * Publish Message with Subject to a topicARN - * - * @param tARN AWS ARN for SNS topic - * @param subj Subject for Message - * @param msg Message Content - * @return SNS messageID on successful publish - */ - public String publishToSNS(String tARN, String subj, String msg) throws AmazonSNSException { - - String topicARN = baseTransform.resolve(tARN); - String subject = baseTransform.resolve(subj); - String message = baseTransform.resolve(msg); - - try { - - PublishRequest publishRequest = new PublishRequest(topicARN, message, subject); - PublishResult publishResult = snsClient.publish(publishRequest); - String messageId = publishResult.getMessageId(); - baseTransform.logBasic(messageId); - return messageId; - - } catch (AmazonSNSException e) { - throw e; - - } + } + + /** + * Publish Message with Subject to a topicARN + * + * @param tARN AWS ARN for SNS topic + * @param subj Subject for Message + * @param msg Message Content + * @return SNS messageID on successful publish + */ + public String publishToSNS(String tARN, String subj, String msg) throws AmazonSNSException { + + String topicARN = baseTransform.resolve(tARN); + String subject = baseTransform.resolve(subj); + String message = baseTransform.resolve(msg); + + try { + + PublishRequest publishRequest = new PublishRequest(topicARN, message, subject); + PublishResult publishResult = snsClient.publish(publishRequest); + String messageId = publishResult.getMessageId(); + baseTransform.logBasic(messageId); + return messageId; + + } catch (AmazonSNSException e) { + throw e; } + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotify.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotify.java index 75688ab255b..8055cc5a0b4 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotify.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotify.java @@ -27,225 +27,216 @@ public class SnsNotify extends BaseTransform { - public SnsNotify( - TransformMeta transformMeta, - SnsNotifyMeta meta, - SnsNotifyData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline){ - super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); + public SnsNotify( + TransformMeta transformMeta, + SnsNotifyMeta meta, + SnsNotifyData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { + super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); + } + + @Override + public boolean init() { + data.aws_sns = new AwsSns(meta, getPipelineMeta(), this); + if (!data.aws_sns.getAWSConnection()) { + setErrors(1); + stopAll(); + setOutputDone(); + return false; } - @Override - public boolean init(){ - data.aws_sns = new AwsSns(meta, getPipelineMeta(), this); - if (!data.aws_sns.getAWSConnection()) { - setErrors(1); - stopAll(); - setOutputDone(); - return false; - } - - data.realMessageIDField = resolve(meta.getTFldMessageID()); + data.realMessageIDField = resolve(meta.getTFldMessageID()); - return super.init(); - } + return super.init(); + } - /** - * - * This methods gets the Input-Fields indices (if defined) or set them to -1 - * - */ - private void setFieldIndices() { - // topicARN + /** This methods gets the Input-Fields indices (if defined) or set them to -1 */ + private void setFieldIndices() { + // topicARN - IRowMeta inputMeta = (IRowMeta) getInputRowMeta(); - - if (meta.getCInputtopicArn().equals("Y")) { - data.indexOfFieldtopARN = inputMeta.indexOfValue(meta.getTFldtopicARN()); - } else { - data.indexOfFieldtopARN = -1; - } - - // Subject - if (meta.getCInputSubject().equals("Y")) { - data.indexOfFieldSubject = inputMeta.indexOfValue(meta.getTFldSubject()); - } else { - data.indexOfFieldSubject = -1; - } - - // Message - if (meta.getCInputMessage().equals("Y")) { - data.indexOfFieldMessage = inputMeta.indexOfValue(meta.getTFldMessage()); - } else { - data.indexOfFieldMessage = -1; - } + IRowMeta inputMeta = (IRowMeta) getInputRowMeta(); + if (meta.getCInputtopicArn().equals("Y")) { + data.indexOfFieldtopARN = inputMeta.indexOfValue(meta.getTFldtopicARN()); + } else { + data.indexOfFieldtopARN = -1; } - /** - * Once the pipeline starts executing, the processRow() method is called repeatedly - * by Apache Hop for as long as it returns true. To indicate that a transform has finished processing rows - * this method must call setOutputDone() and return false; - * - * Transforms which process incoming rows typically call getRow() to read a single row from the - * input stream, change or add row content, call putRow() to pass the changed row on - * and return true. If getRow() returns null, no more rows are expected to come in, - * and the processRow() implementation calls setOutputDone() and returns false to - * indicate that it is done too. - * - * Transforms which generate rows typically construct a new row Object[] using a call to - * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to - * pass the new row on. Above process may happen in a loop to generate multiple rows, - * at the end of which processRow() would call setOutputDone() and return false; - * - * @return true to indicate that the function should be called again, false if the transform is done - */ - @Override - public boolean processRow() throws HopException { - - // get incoming row, getRow() potentially blocks waiting for more rows, returns null if no more rows expected - Object[] r = getRow(); - - // if no more rows are expected, indicate transform is finished and processRow() should not be called again - if (r == null){ - setOutputDone(); - return false; - } - - // Get Field Indices of InputRow - setFieldIndices(); - - // the "first" flag is inherited from the base transform implementation - // it is used to guard some processing tasks, like figuring out field indexes - // in the row structure that only need to be done once - boolean firstrow = false; - - if (first) { - firstrow = true; - first = false; - // clone the input row structure and place it in our data object - data.outputRowMeta = (IRowMeta) getInputRowMeta().clone(); - // use meta.getFields() to change it, so it reflects the output row structure - meta.getFields(data.outputRowMeta, getTransformName(), null, null, this, metadataProvider); - } + // Subject + if (meta.getCInputSubject().equals("Y")) { + data.indexOfFieldSubject = inputMeta.indexOfValue(meta.getTFldSubject()); + } else { + data.indexOfFieldSubject = -1; + } - // Check if it is first row or notification is set for each row - if (meta.getNotifyPointShort().equals("each") || firstrow) { + // Message + if (meta.getCInputMessage().equals("Y")) { + data.indexOfFieldMessage = inputMeta.indexOfValue(meta.getTFldMessage()); + } else { + data.indexOfFieldMessage = -1; + } + } + + /** + * Once the pipeline starts executing, the processRow() method is called repeatedly by Apache Hop + * for as long as it returns true. To indicate that a transform has finished processing rows this + * method must call setOutputDone() and return false; + * + *

Transforms which process incoming rows typically call getRow() to read a single row from the + * input stream, change or add row content, call putRow() to pass the changed row on and return + * true. If getRow() returns null, no more rows are expected to come in, and the processRow() + * implementation calls setOutputDone() and returns false to indicate that it is done too. + * + *

Transforms which generate rows typically construct a new row Object[] using a call to + * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to pass the new + * row on. Above process may happen in a loop to generate multiple rows, at the end of which + * processRow() would call setOutputDone() and return false; + * + * @return true to indicate that the function should be called again, false if the transform is + * done + */ + @Override + public boolean processRow() throws HopException { + + // get incoming row, getRow() potentially blocks waiting for more rows, returns null if no more + // rows expected + Object[] r = getRow(); + + // if no more rows are expected, indicate transform is finished and processRow() should not be + // called again + if (r == null) { + setOutputDone(); + return false; + } - try { + // Get Field Indices of InputRow + setFieldIndices(); + + // the "first" flag is inherited from the base transform implementation + // it is used to guard some processing tasks, like figuring out field indexes + // in the row structure that only need to be done once + boolean firstrow = false; + + if (first) { + firstrow = true; + first = false; + // clone the input row structure and place it in our data object + data.outputRowMeta = (IRowMeta) getInputRowMeta().clone(); + // use meta.getFields() to change it, so it reflects the output row structure + meta.getFields(data.outputRowMeta, getTransformName(), null, null, this, metadataProvider); + } - Object[] outputRow = sendSnsNotification(r); - if (outputRow != null) { - putRow(data.outputRowMeta, outputRow); - incrementLinesOutput(); - incrementLinesWritten(); - } + // Check if it is first row or notification is set for each row + if (meta.getNotifyPointShort().equals("each") || firstrow) { - } catch (Exception e) { + try { - if (getTransformMeta().isDoingErrorHandling()) { - putError(getInputRowMeta(), r, 1L, e.getMessage(), "", "SNSNotifyError"); + Object[] outputRow = sendSnsNotification(r); + if (outputRow != null) { + putRow(data.outputRowMeta, outputRow); + incrementLinesOutput(); + incrementLinesWritten(); + } - } else { - logError( "AWS SNS Error: " + e.getMessage() ); - setErrors( 1 ); - stopAll(); - setOutputDone(); // signal end to receiver(s) - return false; + } catch (Exception e) { - } - } + if (getTransformMeta().isDoingErrorHandling()) { + putError(getInputRowMeta(), r, 1L, e.getMessage(), "", "SNSNotifyError"); } else { - putRow(data.outputRowMeta, r); - incrementLinesWritten(); - } - - // log progress if it is time to do so - if (checkFeedback(getLinesRead())) { - logBasic("Linenr " + getLinesRead()); // Some basic logging + logError("AWS SNS Error: " + e.getMessage()); + setErrors(1); + stopAll(); + setOutputDone(); // signal end to receiver(s) + return false; } + } - // indicate that processRow() should be called again - return true; + } else { + putRow(data.outputRowMeta, r); + incrementLinesWritten(); } - /** - * - * Prepare SNS Notification, send it and store MessageID - * - * @param row Current processed row Object - * @return Modified row Object or null on error - * @throws Exception - */ - private Object[] sendSnsNotification(Object[] row) throws Exception { - - try { - - // Notification Content from fields or static input - String tARN = ""; - String subject = ""; - String message = ""; - - // topicARN - if (data.indexOfFieldtopARN >= 0) { - tARN = getInputRowMeta().getString(row, data.indexOfFieldtopARN); - } else { - tARN = resolve(meta.getTValuetopicARN()); - } - // Subject - if (data.indexOfFieldSubject >= 0) { - subject = getInputRowMeta().getString(row, data.indexOfFieldSubject); - } else { - subject = resolve(meta.getTValueSubject()); - } - // Message - if (data.indexOfFieldMessage >= 0) { - message = getInputRowMeta().getString(row, data.indexOfFieldMessage); - } else { - message = resolve(meta.getTValueMessage()); - } - - // Send notification and catch messageID - Object[] outputRowData = row; - - String messageID = data.aws_sns.publishToSNS(tARN, subject, message); - - if (messageID != null) { - - outputRowData = RowDataUtil.resizeArray(outputRowData, data.outputRowMeta.size()); - - int indexOfMessID = data.outputRowMeta.indexOfValue( data.realMessageIDField ); - if (indexOfMessID >= 0) { - outputRowData[indexOfMessID] = messageID; - } - } - - return outputRowData; - - } catch (Exception e) { - - //logError(e.getMessage()); - throw e; + // log progress if it is time to do so + if (checkFeedback(getLinesRead())) { + logBasic("Linenr " + getLinesRead()); // Some basic logging + } + // indicate that processRow() should be called again + return true; + } + + /** + * Prepare SNS Notification, send it and store MessageID + * + * @param row Current processed row Object + * @return Modified row Object or null on error + * @throws Exception + */ + private Object[] sendSnsNotification(Object[] row) throws Exception { + + try { + + // Notification Content from fields or static input + String tARN = ""; + String subject = ""; + String message = ""; + + // topicARN + if (data.indexOfFieldtopARN >= 0) { + tARN = getInputRowMeta().getString(row, data.indexOfFieldtopARN); + } else { + tARN = resolve(meta.getTValuetopicARN()); + } + // Subject + if (data.indexOfFieldSubject >= 0) { + subject = getInputRowMeta().getString(row, data.indexOfFieldSubject); + } else { + subject = resolve(meta.getTValueSubject()); + } + // Message + if (data.indexOfFieldMessage >= 0) { + message = getInputRowMeta().getString(row, data.indexOfFieldMessage); + } else { + message = resolve(meta.getTValueMessage()); + } + + // Send notification and catch messageID + Object[] outputRowData = row; + + String messageID = data.aws_sns.publishToSNS(tARN, subject, message); + + if (messageID != null) { + + outputRowData = RowDataUtil.resizeArray(outputRowData, data.outputRowMeta.size()); + + int indexOfMessID = data.outputRowMeta.indexOfValue(data.realMessageIDField); + if (indexOfMessID >= 0) { + outputRowData[indexOfMessID] = messageID; } - } + } - /** - * This method is called by Apache Hop once the transform is done processing. - * - * The dispose() method is the counterpart to init() and should release any resources - * acquired for transform execution like file handles or database connections. - * - */ - public void dispose() { + return outputRowData; - data.aws_sns.disconnectAWSConnection(); + } catch (Exception e) { - super.dispose(); + // logError(e.getMessage()); + throw e; } + } + + /** + * This method is called by Apache Hop once the transform is done processing. + * + *

The dispose() method is the counterpart to init() and should release any resources acquired + * for transform execution like file handles or database connections. + */ + public void dispose() { + data.aws_sns.disconnectAWSConnection(); + super.dispose(); + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyData.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyData.java index 5345f4ef7a0..3f49afbcaca 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyData.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyData.java @@ -23,13 +23,14 @@ public class SnsNotifyData extends BaseTransformData implements ITransformData { - public IRowMeta outputRowMeta; - public int indexOfFieldtopARN; - public int indexOfFieldSubject; - public int indexOfFieldMessage; - public AwsSns aws_sns; - public String realMessageIDField; - public SnsNotifyData(){ - super(); - } + public IRowMeta outputRowMeta; + public int indexOfFieldtopARN; + public int indexOfFieldSubject; + public int indexOfFieldMessage; + public AwsSns aws_sns; + public String realMessageIDField; + + public SnsNotifyData() { + super(); + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyDialog.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyDialog.java index 1ce1d30dc17..aea86286a1c 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyDialog.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyDialog.java @@ -21,6 +21,9 @@ import com.amazonaws.regions.Region; import com.amazonaws.regions.RegionUtils; import com.amazonaws.services.sns.AmazonSNS; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -61,618 +64,640 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - public class SnsNotifyDialog extends BaseTransformDialog implements ITransformDialog { - /** - * The PKG member is used when looking up internationalized strings. - * The properties file with localized keys is expected to reside in - * {the package of the class specified}/messages/messages_{locale}.properties - */ - private static Class PKG = SnsNotifyMeta.class; // for i18n purposes - - // this is the object the stores the transform's settings - // the dialog reads the settings from it when opening - // the dialog writes the settings to it when confirmed - private SnsNotifyMeta meta; - - // text field holding the name of the field to add to the row stream - private CTabFolder tabFolder; - private CTabItem tbtmSettings; - private ScrolledComposite scrlSettingsComp; - private Composite settingsComp; - private Label lblAWSKey; - private TextVar tAWSKey; - private Label lblAWSKeySecret; - private PasswordTextVar tAWSKeySecret; - private Label lblAWSRegion; - private ComboVar tAWSRegion; - private CTabItem tbtmNotifications; - private ScrolledComposite scrlNotificationsComp; - private Composite notificationsComp; - private Label lblnotifyPoint; - private Combo tnotifyPoint; - private Label lblMessageID; - private TextVar tMessageID; - private ColumnInfo fieldColumn; - private TableView tTableNotifyProps; - - private Label lblDevInfo; - - private Label lblAWSCredChain; - - private ComboVar tAWSCredChain; - - /** - * The constructor should simply invoke super() and save the incoming meta - * object to a local variable, so it can conveniently read and write settings - * from/to it. - * - * @param parent the SWT shell to open the dialog in - * @param in the meta object holding the transform's settings - * @param pipelineMeta pipeline description - * @param transformName the transform name - */ - public SnsNotifyDialog(Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String transformName) { - super(parent, variables, (BaseTransformMeta)in, pipelineMeta, transformName); - meta = (SnsNotifyMeta) in; - } - - /** - * This method is called by Hop Gui when the user opens the settings dialog of the transform. - * It should open the dialog and return only once the dialog has been closed by the user. - * - * If the user confirms the dialog, the meta object (passed in the constructor) must - * be updated to reflect the new transform settings. The changed flag of the meta object must - * reflect whether the transform configuration was changed by the dialog. - * - * If the user cancels the dialog, the meta object must not be updated, and its changed flag - * must remain unaltered. - * - * The open() method must return the name of the transform after the user has confirmed the dialog, - * or null if the user cancelled the dialog. - */ - @Override - public String open() { - - // store some convenient SWT variables - Shell parent = getParent(); - Display display = parent.getDisplay(); - - // SWT code for preparing the dialog - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); - props.setLook(shell); - setShellImage(shell, meta); - - // Save the value of the changed flag on the meta object. If the user cancels - // the dialog, it will be restored to this saved value. - // The "changed" variable is inherited from BaseTransformDialog - changed = meta.hasChanged(); - - // The ModifyListener used on all controls. It will update the meta object to - // indicate that changes are being made. - ModifyListener lsMod = new ModifyListener() { - public void modifyText(ModifyEvent e) { - meta.setChanged(); - } + /** + * The PKG member is used when looking up internationalized strings. The properties file with + * localized keys is expected to reside in {the package of the class + * specified}/messages/messages_{locale}.properties + */ + private static Class PKG = SnsNotifyMeta.class; // for i18n purposes + + // this is the object the stores the transform's settings + // the dialog reads the settings from it when opening + // the dialog writes the settings to it when confirmed + private SnsNotifyMeta meta; + + // text field holding the name of the field to add to the row stream + private CTabFolder tabFolder; + private CTabItem tbtmSettings; + private ScrolledComposite scrlSettingsComp; + private Composite settingsComp; + private Label lblAWSKey; + private TextVar tAWSKey; + private Label lblAWSKeySecret; + private PasswordTextVar tAWSKeySecret; + private Label lblAWSRegion; + private ComboVar tAWSRegion; + private CTabItem tbtmNotifications; + private ScrolledComposite scrlNotificationsComp; + private Composite notificationsComp; + private Label lblnotifyPoint; + private Combo tnotifyPoint; + private Label lblMessageID; + private TextVar tMessageID; + private ColumnInfo fieldColumn; + private TableView tTableNotifyProps; + + private Label lblDevInfo; + + private Label lblAWSCredChain; + + private ComboVar tAWSCredChain; + + /** + * The constructor should simply invoke super() and save the incoming meta object to a local + * variable, so it can conveniently read and write settings from/to it. + * + * @param parent the SWT shell to open the dialog in + * @param in the meta object holding the transform's settings + * @param pipelineMeta pipeline description + * @param transformName the transform name + */ + public SnsNotifyDialog( + Shell parent, + IVariables variables, + Object in, + PipelineMeta pipelineMeta, + String transformName) { + super(parent, variables, (BaseTransformMeta) in, pipelineMeta, transformName); + meta = (SnsNotifyMeta) in; + } + + /** + * This method is called by Hop Gui when the user opens the settings dialog of the transform. It + * should open the dialog and return only once the dialog has been closed by the user. + * + *

If the user confirms the dialog, the meta object (passed in the constructor) must be updated + * to reflect the new transform settings. The changed flag of the meta object must reflect whether + * the transform configuration was changed by the dialog. + * + *

If the user cancels the dialog, the meta object must not be updated, and its changed flag + * must remain unaltered. + * + *

The open() method must return the name of the transform after the user has confirmed the + * dialog, or null if the user cancelled the dialog. + */ + @Override + public String open() { + + // store some convenient SWT variables + Shell parent = getParent(); + Display display = parent.getDisplay(); + + // SWT code for preparing the dialog + shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); + props.setLook(shell); + setShellImage(shell, meta); + + // Save the value of the changed flag on the meta object. If the user cancels + // the dialog, it will be restored to this saved value. + // The "changed" variable is inherited from BaseTransformDialog + changed = meta.hasChanged(); + + // The ModifyListener used on all controls. It will update the meta object to + // indicate that changes are being made. + ModifyListener lsMod = + new ModifyListener() { + public void modifyText(ModifyEvent e) { + meta.setChanged(); + } }; - // ------------------------------------------------------- // - // SWT code for building the actual settings dialog // - // ------------------------------------------------------- // - FormLayout formLayout = new FormLayout(); - formLayout.marginWidth = Const.FORM_MARGIN; - formLayout.marginHeight = Const.FORM_MARGIN; - - shell.setLayout(formLayout); - shell.setText(BaseMessages.getString(PKG, "SNSNotify.Shell.Title")); - - int middle = props.getMiddlePct(); - int margin = Const.MARGIN; - - // transformName line - wlTransformName = new Label(shell, SWT.RIGHT); - wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName")); - props.setLook(wlTransformName); - fdlTransformName = new FormData(); - fdlTransformName.left = new FormAttachment(0, 0); - fdlTransformName.right = new FormAttachment(middle, -margin); - fdlTransformName.top = new FormAttachment(0, margin); - wlTransformName.setLayoutData(fdlTransformName); - - wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wTransformName.setText(transformName); - props.setLook(wTransformName); - wTransformName.addModifyListener(lsMod); - fdTransformName = new FormData(); - fdTransformName.left = new FormAttachment(middle, 0); - fdTransformName.top = new FormAttachment(0, margin); - fdTransformName.right = new FormAttachment(100, 0); - wTransformName.setLayoutData(fdTransformName); - - // ------------------------------------------------------- // - // TABULATOREN START // - // ------------------------------------------------------- // - - // TABS - ANFANG - tabFolder = new CTabFolder(shell, SWT.BORDER); - FormData fd_tabFolder = new FormData(); - fd_tabFolder.right = new FormAttachment(100, 0); - fd_tabFolder.top = new FormAttachment(wTransformName, margin); - fd_tabFolder.left = new FormAttachment(0, 0); - fd_tabFolder.bottom = new FormAttachment(100, -50); - tabFolder.setLayoutData(fd_tabFolder); - props.setLook(tabFolder); - - // ------------------------------------------------------- // - // - TAB Settings START // - // ------------------------------------------------------- // - - // Settings-TAB - ANFANG - tbtmSettings = new CTabItem(tabFolder, SWT.NONE); - tbtmSettings.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.Title")); - - scrlSettingsComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); - scrlSettingsComp.setLayout(new FillLayout()); - props.setLook(scrlSettingsComp); - - settingsComp = new Composite(scrlSettingsComp, SWT.NONE); - props.setLook(settingsComp); - - FormLayout settingsLayout = new FormLayout(); - settingsLayout.marginWidth = 3; - settingsLayout.marginHeight = 3; - settingsComp.setLayout(settingsLayout); - - // Use AWS Credentials Provider Chain - // Credentials Chain - lblAWSCredChain = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSCredChain); - FormData fd_lblAWSCredChain = new FormData(); - fd_lblAWSCredChain.left = new FormAttachment(0, 0); - fd_lblAWSCredChain.top = new FormAttachment(0, margin); - fd_lblAWSCredChain.right = new FormAttachment(middle, -margin); - lblAWSCredChain.setLayoutData(fd_lblAWSCredChain); - lblAWSCredChain.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSCredChain.Label")); - - tAWSCredChain = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tAWSCredChain); - FormData fd_tAWSCredChain = new FormData(); - fd_tAWSCredChain.top = new FormAttachment(0, margin); - fd_tAWSCredChain.left = new FormAttachment(middle, 0); - fd_tAWSCredChain.right = new FormAttachment(100, 0); - tAWSCredChain.setLayoutData(fd_tAWSCredChain); - tAWSCredChain.setToolTipText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSCredChain.Tooltip")); - tAWSCredChain.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent arg0) { - changeCredentialChainSelection(); - } + // ------------------------------------------------------- // + // SWT code for building the actual settings dialog // + // ------------------------------------------------------- // + FormLayout formLayout = new FormLayout(); + formLayout.marginWidth = Const.FORM_MARGIN; + formLayout.marginHeight = Const.FORM_MARGIN; + + shell.setLayout(formLayout); + shell.setText(BaseMessages.getString(PKG, "SNSNotify.Shell.Title")); + + int middle = props.getMiddlePct(); + int margin = Const.MARGIN; + + // transformName line + wlTransformName = new Label(shell, SWT.RIGHT); + wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName")); + props.setLook(wlTransformName); + fdlTransformName = new FormData(); + fdlTransformName.left = new FormAttachment(0, 0); + fdlTransformName.right = new FormAttachment(middle, -margin); + fdlTransformName.top = new FormAttachment(0, margin); + wlTransformName.setLayoutData(fdlTransformName); + + wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wTransformName.setText(transformName); + props.setLook(wTransformName); + wTransformName.addModifyListener(lsMod); + fdTransformName = new FormData(); + fdTransformName.left = new FormAttachment(middle, 0); + fdTransformName.top = new FormAttachment(0, margin); + fdTransformName.right = new FormAttachment(100, 0); + wTransformName.setLayoutData(fdTransformName); + + // ------------------------------------------------------- // + // TABULATOREN START // + // ------------------------------------------------------- // + + // TABS - ANFANG + tabFolder = new CTabFolder(shell, SWT.BORDER); + FormData fd_tabFolder = new FormData(); + fd_tabFolder.right = new FormAttachment(100, 0); + fd_tabFolder.top = new FormAttachment(wTransformName, margin); + fd_tabFolder.left = new FormAttachment(0, 0); + fd_tabFolder.bottom = new FormAttachment(100, -50); + tabFolder.setLayoutData(fd_tabFolder); + props.setLook(tabFolder); + + // ------------------------------------------------------- // + // - TAB Settings START // + // ------------------------------------------------------- // + + // Settings-TAB - ANFANG + tbtmSettings = new CTabItem(tabFolder, SWT.NONE); + tbtmSettings.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.Title")); + + scrlSettingsComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); + scrlSettingsComp.setLayout(new FillLayout()); + props.setLook(scrlSettingsComp); + + settingsComp = new Composite(scrlSettingsComp, SWT.NONE); + props.setLook(settingsComp); + + FormLayout settingsLayout = new FormLayout(); + settingsLayout.marginWidth = 3; + settingsLayout.marginHeight = 3; + settingsComp.setLayout(settingsLayout); + + // Use AWS Credentials Provider Chain + // Credentials Chain + lblAWSCredChain = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSCredChain); + FormData fd_lblAWSCredChain = new FormData(); + fd_lblAWSCredChain.left = new FormAttachment(0, 0); + fd_lblAWSCredChain.top = new FormAttachment(0, margin); + fd_lblAWSCredChain.right = new FormAttachment(middle, -margin); + lblAWSCredChain.setLayoutData(fd_lblAWSCredChain); + lblAWSCredChain.setText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSCredChain.Label")); + + tAWSCredChain = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSCredChain); + FormData fd_tAWSCredChain = new FormData(); + fd_tAWSCredChain.top = new FormAttachment(0, margin); + fd_tAWSCredChain.left = new FormAttachment(middle, 0); + fd_tAWSCredChain.right = new FormAttachment(100, 0); + tAWSCredChain.setLayoutData(fd_tAWSCredChain); + tAWSCredChain.setToolTipText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSCredChain.Tooltip")); + tAWSCredChain.addModifyListener( + new ModifyListener() { + + @Override + public void modifyText(ModifyEvent arg0) { + changeCredentialChainSelection(); + } }); - // AWS Key - lblAWSKey = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSKey); - FormData fd_lblAWSKey = new FormData(); - fd_lblAWSKey.left = new FormAttachment(0, 0); - fd_lblAWSKey.top = new FormAttachment(tAWSCredChain, margin); - fd_lblAWSKey.right = new FormAttachment(middle, -margin); - lblAWSKey.setLayoutData(fd_lblAWSKey); - lblAWSKey.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKey.Label")); - - tAWSKey = new TextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tAWSKey); - FormData fd_tAWSKey = new FormData(); - fd_tAWSKey.top = new FormAttachment(tAWSCredChain, margin); - fd_tAWSKey.left = new FormAttachment(middle, 0); - fd_tAWSKey.right = new FormAttachment(100, 0); - tAWSKey.setLayoutData(fd_tAWSKey); - tAWSKey.setToolTipText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKey.Tooltip")); - - // AWS Key Secret - lblAWSKeySecret = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSKeySecret); - FormData fd_lblAWSKeySecret = new FormData(); - fd_lblAWSKeySecret.left = new FormAttachment(0, 0); - fd_lblAWSKeySecret.top = new FormAttachment(tAWSKey, margin); - fd_lblAWSKeySecret.right = new FormAttachment(middle, -margin); - lblAWSKeySecret.setLayoutData(fd_lblAWSKeySecret); - lblAWSKeySecret.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKeySecret.Label")); - - tAWSKeySecret = new PasswordTextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tAWSKeySecret); - FormData fd_tAWSKeySecret = new FormData(); - fd_tAWSKeySecret.top = new FormAttachment(tAWSKey, margin); - fd_tAWSKeySecret.left = new FormAttachment(middle, 0); - fd_tAWSKeySecret.right = new FormAttachment(100, 0); - tAWSKeySecret.setLayoutData(fd_tAWSKeySecret); - tAWSKeySecret.setToolTipText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKeySecret.Tooltip")); - - // AWS Region - lblAWSRegion = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSRegion); - FormData fd_lblAWSRegion = new FormData(); - fd_lblAWSRegion.left = new FormAttachment(0, 0); - fd_lblAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); - fd_lblAWSRegion.right = new FormAttachment(middle, -margin); - lblAWSRegion.setLayoutData(fd_lblAWSRegion); - lblAWSRegion.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSRegion.Label")); - - tAWSRegion = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); - props.setLook(tAWSRegion); - FormData fd_tAWSRegion = new FormData(); - fd_tAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); - fd_tAWSRegion.left = new FormAttachment(middle, 0); - fd_tAWSRegion.right = new FormAttachment(100, 0); - tAWSRegion.setLayoutData(fd_tAWSRegion); - tAWSRegion - .setToolTipText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSRegion.Tooltip")); - populateAWSRegion(tAWSRegion); - - Control[] queueTabList = new Control[] { tAWSKey, tAWSKeySecret, tAWSRegion }; - settingsComp.setTabList(queueTabList); - - settingsComp.pack(); - Rectangle settingsBounds = settingsComp.getBounds(); - - scrlSettingsComp.setContent(settingsComp); - scrlSettingsComp.setExpandHorizontal(true); - scrlSettingsComp.setExpandVertical(true); - scrlSettingsComp.setMinWidth(settingsBounds.width); - scrlSettingsComp.setMinHeight(settingsBounds.height); - // Settings-TAB - ENDE - - - // ------------------------------------------------------- // - // - TAB Notifications START // - // ------------------------------------------------------- // - - // Notifications-TAB - ANFANG - tbtmNotifications = new CTabItem(tabFolder, SWT.NONE); - tbtmNotifications.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.Title")); - - scrlNotificationsComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); - scrlNotificationsComp.setLayout(new FillLayout()); - props.setLook(scrlNotificationsComp); - - notificationsComp = new Composite(scrlNotificationsComp, SWT.NONE); - props.setLook(notificationsComp); - - FormLayout notificationsLayout = new FormLayout(); - notificationsLayout.marginWidth = 3; - notificationsLayout.marginHeight = 3; - notificationsComp.setLayout(notificationsLayout); - - // FELDER - // Notification Point - lblnotifyPoint = new Label(notificationsComp, SWT.RIGHT); - props.setLook(lblnotifyPoint); - FormData fd_lblnotifyPoint = new FormData(); - fd_lblnotifyPoint.left = new FormAttachment(0, 0); - fd_lblnotifyPoint.top = new FormAttachment(0, margin); - fd_lblnotifyPoint.right = new FormAttachment(middle, -margin); - lblnotifyPoint.setLayoutData(fd_lblnotifyPoint); - lblnotifyPoint.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.notifyPoint.Label")); - - tnotifyPoint = new Combo(notificationsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY); - props.setLook(tnotifyPoint); - FormData fd_tnotifyPoint = new FormData(); - fd_tnotifyPoint.top = new FormAttachment(0, margin); - fd_tnotifyPoint.left = new FormAttachment(middle, 0); - fd_tnotifyPoint.right = new FormAttachment(100, 0); - tnotifyPoint.setLayoutData(fd_tnotifyPoint); - tnotifyPoint - .setToolTipText(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.notifyPoint.Tooltip")); - tnotifyPoint.setItems(meta.getNotifyPointValues()); - - // MessageID - lblMessageID = new Label(notificationsComp, SWT.RIGHT); - props.setLook(lblMessageID); - FormData fd_lblMessageID = new FormData(); - fd_lblMessageID.left = new FormAttachment(0, 0); - fd_lblMessageID.top = new FormAttachment(tnotifyPoint, margin); - fd_lblMessageID.right = new FormAttachment(middle, -margin); - lblMessageID.setLayoutData(fd_lblMessageID); - lblMessageID.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.MessageID.Label")); - - tMessageID = new TextVar(variables, notificationsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tMessageID); - FormData fd_tMessageID = new FormData(); - fd_tMessageID.top = new FormAttachment(tnotifyPoint, margin); - fd_tMessageID.left = new FormAttachment(middle, 0); - fd_tMessageID.right = new FormAttachment(100, 0); - tMessageID.setLayoutData(fd_tMessageID); - tMessageID - .setToolTipText(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.MessageID.Tooltip")); - - // Notification-Value-Settings-Table - // Properties Table - int keyWidgetCols = 4; - int keyWidgetRows = 3; - - // Create columns - ColumnInfo[] ciNotifyProps = new ColumnInfo[keyWidgetCols]; - ciNotifyProps[0] = new ColumnInfo( - BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Property.Label"), - ColumnInfo.COLUMN_TYPE_TEXT, false); - ciNotifyProps[1] = new ColumnInfo( - BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.InField.Label"), - ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {"Y", "N"}, false); - ciNotifyProps[2] = new ColumnInfo( - BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Field.Label"), - ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false); - ciNotifyProps[3] = new ColumnInfo( - BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Value.Label"), - ColumnInfo.COLUMN_TYPE_TEXT, false); - - ciNotifyProps[0].setToolTip(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Property.Tooltip")); - ciNotifyProps[0].setReadOnly(true); - ciNotifyProps[1].setToolTip(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.InField.Tooltip")); - ciNotifyProps[2].setToolTip(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Field.Tooltip")); - ciNotifyProps[3].setToolTip(BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Value.Tooltip")); - ciNotifyProps[3].setUsingVariables(true); - - fieldColumn = ciNotifyProps[2]; - - // Create Table - tTableNotifyProps = new TableView(variables, notificationsComp, - SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciNotifyProps, - keyWidgetRows, lsMod, props); - - FormData fd_TableNotifyProps = new FormData(); - fd_TableNotifyProps.left = new FormAttachment(0, 0); - fd_TableNotifyProps.top = new FormAttachment(tMessageID, margin); - fd_TableNotifyProps.right = new FormAttachment(100, 0); - fd_TableNotifyProps.bottom = new FormAttachment(100, -margin); - tTableNotifyProps.setLayoutData(fd_TableNotifyProps); - - Control[] notificationTabList = new Control[] { tnotifyPoint, tMessageID, tTableNotifyProps }; - notificationsComp.setTabList(notificationTabList); - - notificationsComp.pack(); - Rectangle NotificationsBounds = notificationsComp.getBounds(); - - scrlNotificationsComp.setContent(notificationsComp); - scrlNotificationsComp.setExpandHorizontal(true); - scrlNotificationsComp.setExpandVertical(true); - scrlNotificationsComp.setMinWidth(NotificationsBounds.width); - scrlNotificationsComp.setMinHeight(NotificationsBounds.height); - // Notifications-TAB - Ende - - scrlSettingsComp.layout(); - tbtmSettings.setControl(scrlSettingsComp); - - scrlNotificationsComp.layout(); - tbtmNotifications.setControl(scrlNotificationsComp); - - tabFolder.setSelection(0); - - // TABS ENDE - - // OK and cancel buttons - wOk = new Button(shell, SWT.PUSH); - wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); - wCancel = new Button(shell, SWT.PUSH); - wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); - - BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null); - - // Add listeners for cancel and OK - wOk.addListener(SWT.Selection, c -> ok()); - wCancel.addListener(SWT.Selection, c -> cancel()); - - // default listener (for hitting "enter") - SelectionAdapter lsDef = new SelectionAdapter() { - public void widgetDefaultSelected(SelectionEvent e) {ok();} + // AWS Key + lblAWSKey = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSKey); + FormData fd_lblAWSKey = new FormData(); + fd_lblAWSKey.left = new FormAttachment(0, 0); + fd_lblAWSKey.top = new FormAttachment(tAWSCredChain, margin); + fd_lblAWSKey.right = new FormAttachment(middle, -margin); + lblAWSKey.setLayoutData(fd_lblAWSKey); + lblAWSKey.setText(BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKey.Label")); + + tAWSKey = new TextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSKey); + FormData fd_tAWSKey = new FormData(); + fd_tAWSKey.top = new FormAttachment(tAWSCredChain, margin); + fd_tAWSKey.left = new FormAttachment(middle, 0); + fd_tAWSKey.right = new FormAttachment(100, 0); + tAWSKey.setLayoutData(fd_tAWSKey); + tAWSKey.setToolTipText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKey.Tooltip")); + + // AWS Key Secret + lblAWSKeySecret = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSKeySecret); + FormData fd_lblAWSKeySecret = new FormData(); + fd_lblAWSKeySecret.left = new FormAttachment(0, 0); + fd_lblAWSKeySecret.top = new FormAttachment(tAWSKey, margin); + fd_lblAWSKeySecret.right = new FormAttachment(middle, -margin); + lblAWSKeySecret.setLayoutData(fd_lblAWSKeySecret); + lblAWSKeySecret.setText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKeySecret.Label")); + + tAWSKeySecret = + new PasswordTextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSKeySecret); + FormData fd_tAWSKeySecret = new FormData(); + fd_tAWSKeySecret.top = new FormAttachment(tAWSKey, margin); + fd_tAWSKeySecret.left = new FormAttachment(middle, 0); + fd_tAWSKeySecret.right = new FormAttachment(100, 0); + tAWSKeySecret.setLayoutData(fd_tAWSKeySecret); + tAWSKeySecret.setToolTipText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSKeySecret.Tooltip")); + + // AWS Region + lblAWSRegion = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSRegion); + FormData fd_lblAWSRegion = new FormData(); + fd_lblAWSRegion.left = new FormAttachment(0, 0); + fd_lblAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); + fd_lblAWSRegion.right = new FormAttachment(middle, -margin); + lblAWSRegion.setLayoutData(fd_lblAWSRegion); + lblAWSRegion.setText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSRegion.Label")); + + tAWSRegion = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSRegion); + FormData fd_tAWSRegion = new FormData(); + fd_tAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); + fd_tAWSRegion.left = new FormAttachment(middle, 0); + fd_tAWSRegion.right = new FormAttachment(100, 0); + tAWSRegion.setLayoutData(fd_tAWSRegion); + tAWSRegion.setToolTipText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Settings.AWSRegion.Tooltip")); + populateAWSRegion(tAWSRegion); + + Control[] queueTabList = new Control[] {tAWSKey, tAWSKeySecret, tAWSRegion}; + settingsComp.setTabList(queueTabList); + + settingsComp.pack(); + Rectangle settingsBounds = settingsComp.getBounds(); + + scrlSettingsComp.setContent(settingsComp); + scrlSettingsComp.setExpandHorizontal(true); + scrlSettingsComp.setExpandVertical(true); + scrlSettingsComp.setMinWidth(settingsBounds.width); + scrlSettingsComp.setMinHeight(settingsBounds.height); + // Settings-TAB - ENDE + + // ------------------------------------------------------- // + // - TAB Notifications START // + // ------------------------------------------------------- // + + // Notifications-TAB - ANFANG + tbtmNotifications = new CTabItem(tabFolder, SWT.NONE); + tbtmNotifications.setText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.Title")); + + scrlNotificationsComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); + scrlNotificationsComp.setLayout(new FillLayout()); + props.setLook(scrlNotificationsComp); + + notificationsComp = new Composite(scrlNotificationsComp, SWT.NONE); + props.setLook(notificationsComp); + + FormLayout notificationsLayout = new FormLayout(); + notificationsLayout.marginWidth = 3; + notificationsLayout.marginHeight = 3; + notificationsComp.setLayout(notificationsLayout); + + // FELDER + // Notification Point + lblnotifyPoint = new Label(notificationsComp, SWT.RIGHT); + props.setLook(lblnotifyPoint); + FormData fd_lblnotifyPoint = new FormData(); + fd_lblnotifyPoint.left = new FormAttachment(0, 0); + fd_lblnotifyPoint.top = new FormAttachment(0, margin); + fd_lblnotifyPoint.right = new FormAttachment(middle, -margin); + lblnotifyPoint.setLayoutData(fd_lblnotifyPoint); + lblnotifyPoint.setText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.notifyPoint.Label")); + + tnotifyPoint = new Combo(notificationsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY); + props.setLook(tnotifyPoint); + FormData fd_tnotifyPoint = new FormData(); + fd_tnotifyPoint.top = new FormAttachment(0, margin); + fd_tnotifyPoint.left = new FormAttachment(middle, 0); + fd_tnotifyPoint.right = new FormAttachment(100, 0); + tnotifyPoint.setLayoutData(fd_tnotifyPoint); + tnotifyPoint.setToolTipText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.notifyPoint.Tooltip")); + tnotifyPoint.setItems(meta.getNotifyPointValues()); + + // MessageID + lblMessageID = new Label(notificationsComp, SWT.RIGHT); + props.setLook(lblMessageID); + FormData fd_lblMessageID = new FormData(); + fd_lblMessageID.left = new FormAttachment(0, 0); + fd_lblMessageID.top = new FormAttachment(tnotifyPoint, margin); + fd_lblMessageID.right = new FormAttachment(middle, -margin); + lblMessageID.setLayoutData(fd_lblMessageID); + lblMessageID.setText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.MessageID.Label")); + + tMessageID = new TextVar(variables, notificationsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tMessageID); + FormData fd_tMessageID = new FormData(); + fd_tMessageID.top = new FormAttachment(tnotifyPoint, margin); + fd_tMessageID.left = new FormAttachment(middle, 0); + fd_tMessageID.right = new FormAttachment(100, 0); + tMessageID.setLayoutData(fd_tMessageID); + tMessageID.setToolTipText( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.MessageID.Tooltip")); + + // Notification-Value-Settings-Table + // Properties Table + int keyWidgetCols = 4; + int keyWidgetRows = 3; + + // Create columns + ColumnInfo[] ciNotifyProps = new ColumnInfo[keyWidgetCols]; + ciNotifyProps[0] = + new ColumnInfo( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Property.Label"), + ColumnInfo.COLUMN_TYPE_TEXT, + false); + ciNotifyProps[1] = + new ColumnInfo( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.InField.Label"), + ColumnInfo.COLUMN_TYPE_CCOMBO, + new String[] {"Y", "N"}, + false); + ciNotifyProps[2] = + new ColumnInfo( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Field.Label"), + ColumnInfo.COLUMN_TYPE_CCOMBO, + new String[] {}, + false); + ciNotifyProps[3] = + new ColumnInfo( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Value.Label"), + ColumnInfo.COLUMN_TYPE_TEXT, + false); + + ciNotifyProps[0].setToolTip( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Property.Tooltip")); + ciNotifyProps[0].setReadOnly(true); + ciNotifyProps[1].setToolTip( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.InField.Tooltip")); + ciNotifyProps[2].setToolTip( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Field.Tooltip")); + ciNotifyProps[3].setToolTip( + BaseMessages.getString(PKG, "SNSNotifyTransform.Notifications.ValueDef.Value.Tooltip")); + ciNotifyProps[3].setUsingVariables(true); + + fieldColumn = ciNotifyProps[2]; + + // Create Table + tTableNotifyProps = + new TableView( + variables, + notificationsComp, + SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, + ciNotifyProps, + keyWidgetRows, + lsMod, + props); + + FormData fd_TableNotifyProps = new FormData(); + fd_TableNotifyProps.left = new FormAttachment(0, 0); + fd_TableNotifyProps.top = new FormAttachment(tMessageID, margin); + fd_TableNotifyProps.right = new FormAttachment(100, 0); + fd_TableNotifyProps.bottom = new FormAttachment(100, -margin); + tTableNotifyProps.setLayoutData(fd_TableNotifyProps); + + Control[] notificationTabList = new Control[] {tnotifyPoint, tMessageID, tTableNotifyProps}; + notificationsComp.setTabList(notificationTabList); + + notificationsComp.pack(); + Rectangle NotificationsBounds = notificationsComp.getBounds(); + + scrlNotificationsComp.setContent(notificationsComp); + scrlNotificationsComp.setExpandHorizontal(true); + scrlNotificationsComp.setExpandVertical(true); + scrlNotificationsComp.setMinWidth(NotificationsBounds.width); + scrlNotificationsComp.setMinHeight(NotificationsBounds.height); + // Notifications-TAB - Ende + + scrlSettingsComp.layout(); + tbtmSettings.setControl(scrlSettingsComp); + + scrlNotificationsComp.layout(); + tbtmNotifications.setControl(scrlNotificationsComp); + + tabFolder.setSelection(0); + + // TABS ENDE + + // OK and cancel buttons + wOk = new Button(shell, SWT.PUSH); + wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); + wCancel = new Button(shell, SWT.PUSH); + wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); + + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); + + // Add listeners for cancel and OK + wOk.addListener(SWT.Selection, c -> ok()); + wCancel.addListener(SWT.Selection, c -> cancel()); + + // default listener (for hitting "enter") + SelectionAdapter lsDef = + new SelectionAdapter() { + public void widgetDefaultSelected(SelectionEvent e) { + ok(); + } }; - wTransformName.addSelectionListener(lsDef); - tAWSKey.addSelectionListener(lsDef); - tAWSKeySecret.addSelectionListener(lsDef); - tAWSRegion.addSelectionListener(lsDef); - - // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly - shell.addShellListener(new ShellAdapter() { - public void shellClosed(ShellEvent e) {cancel();} + wTransformName.addSelectionListener(lsDef); + tAWSKey.addSelectionListener(lsDef); + tAWSKeySecret.addSelectionListener(lsDef); + tAWSRegion.addSelectionListener(lsDef); + + // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly + shell.addShellListener( + new ShellAdapter() { + public void shellClosed(ShellEvent e) { + cancel(); + } }); - // Set/Restore the dialog size based on last position on screen - // The setSize() method is inherited from BaseTransformDialog - setSize(); + // Set/Restore the dialog size based on last position on screen + // The setSize() method is inherited from BaseTransformDialog + setSize(); - // populate the dialog with the values from the meta object - populateYesNoSelection(); - populateDialog(); + // populate the dialog with the values from the meta object + populateYesNoSelection(); + populateDialog(); - // restore the changed flag to original value, as the modify listeners fire during dialog population - meta.setChanged(changed); + // restore the changed flag to original value, as the modify listeners fire during dialog + // population + meta.setChanged(changed); - // open dialog and enter event loop - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - // at this point the dialog has closed, so either ok() or cancel() have been executed - // The "transformName" variable is inherited from BaseTransformDialog - return transformName; + // open dialog and enter event loop + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) display.sleep(); } - protected void changeCredentialChainSelection() { - // Output-Info set in fields - if (tAWSCredChain.getText().equalsIgnoreCase("Y")) { - - // Settings-Fields - lblAWSKey.setEnabled(false); - tAWSKey.setEnabled(false); - lblAWSKeySecret.setEnabled(false); - tAWSKeySecret.setEnabled(false); - lblAWSRegion.setEnabled(false); - tAWSRegion.setEnabled(false); - - // Output-Info set in Config - } else { - - // Settings-Fields - lblAWSKey.setEnabled(true); - tAWSKey.setEnabled(true); - lblAWSKeySecret.setEnabled(true); - tAWSKeySecret.setEnabled(true); - lblAWSRegion.setEnabled(true); - tAWSRegion.setEnabled(true); - - } - - meta.setChanged(); - + // at this point the dialog has closed, so either ok() or cancel() have been executed + // The "transformName" variable is inherited from BaseTransformDialog + return transformName; + } + + protected void changeCredentialChainSelection() { + // Output-Info set in fields + if (tAWSCredChain.getText().equalsIgnoreCase("Y")) { + + // Settings-Fields + lblAWSKey.setEnabled(false); + tAWSKey.setEnabled(false); + lblAWSKeySecret.setEnabled(false); + tAWSKeySecret.setEnabled(false); + lblAWSRegion.setEnabled(false); + tAWSRegion.setEnabled(false); + + // Output-Info set in Config + } else { + + // Settings-Fields + lblAWSKey.setEnabled(true); + tAWSKey.setEnabled(true); + lblAWSKeySecret.setEnabled(true); + tAWSKeySecret.setEnabled(true); + lblAWSRegion.setEnabled(true); + tAWSRegion.setEnabled(true); } - private void populateYesNoSelection() { + meta.setChanged(); + } - tAWSCredChain.removeAll(); - tAWSCredChain.add("Y"); - tAWSCredChain.add("N"); - tAWSCredChain.select(0); + private void populateYesNoSelection() { - } + tAWSCredChain.removeAll(); + tAWSCredChain.add("Y"); + tAWSCredChain.add("N"); + tAWSCredChain.select(0); + } + /** This methods set the Input-Fields in Column Field for each table-row */ + private void setComboValues() { + Runnable fieldLoader = + new Runnable() { + public void run() { - /** - * This methods set the Input-Fields in Column Field for each table-row - */ - private void setComboValues() { - Runnable fieldLoader = new Runnable() { - public void run() { - - IRowMeta prevFields; - - try { - prevFields = pipelineMeta.getPrevTransformFields(variables, transformName); - } catch (HopException e) { - prevFields = new RowMeta(); - logError(BaseMessages.getString(PKG, "SNSNotifyTransform.ErrorText.NoPrevFields")); - } - String[] prevTransformFieldNames = prevFields.getFieldNames(); - Arrays.sort(prevTransformFieldNames); - fieldColumn.setComboValues(prevTransformFieldNames); + IRowMeta prevFields; + + try { + prevFields = pipelineMeta.getPrevTransformFields(variables, transformName); + } catch (HopException e) { + prevFields = new RowMeta(); + logError(BaseMessages.getString(PKG, "SNSNotifyTransform.ErrorText.NoPrevFields")); } + String[] prevTransformFieldNames = prevFields.getFieldNames(); + Arrays.sort(prevTransformFieldNames); + fieldColumn.setComboValues(prevTransformFieldNames); + } }; - new Thread(fieldLoader).start(); - } - - /** - * This method fills the CombarVar with all available AWS Regions - * - */ - private void populateAWSRegion(ComboVar tAWSRegion2) { - - tAWSRegion2.removeAll(); - - try { - - List snsRegions = RegionUtils.getRegionsForService(AmazonSNS.ENDPOINT_PREFIX); + new Thread(fieldLoader).start(); + } - for (Iterator i = snsRegions.iterator(); i.hasNext();) { - Region region = i.next(); - tAWSRegion2.add(region.getName()); - } + /** This method fills the CombarVar with all available AWS Regions */ + private void populateAWSRegion(ComboVar tAWSRegion2) { - } catch (AmazonClientException e) { - logError(BaseMessages.getString(PKG, e.getMessage())); - } + tAWSRegion2.removeAll(); - } + try { - /** - * This helper method puts the transform configuration stored in the meta object - * and puts it into the dialog controls. - */ - private void populateDialog() { - wTransformName.selectAll(); - - tAWSCredChain.setText(meta.getAwsCredChain()); - tAWSKey.setText(meta.getAwsKey()); - tAWSKeySecret.setText(meta.getAwsKeySecret()); - tAWSRegion.setText(meta.getAwsRegion()); - tnotifyPoint.setText(meta.getNotifyPoint()); - tMessageID.setText(meta.getTFldMessageID()); - - // Populate NotifyProperties - setComboValues(); - - tTableNotifyProps.setText("topicARN", 1, 0); - tTableNotifyProps.setText(meta.getCInputtopicArn(), 2, 0); - tTableNotifyProps.setText(meta.getTFldtopicARN(), 3, 0); - tTableNotifyProps.setText(meta.getTValuetopicARN(), 4, 0); - - tTableNotifyProps.setText("Subject", 1, 1); - tTableNotifyProps.setText(meta.getCInputSubject(), 2, 1); - tTableNotifyProps.setText(meta.getTFldSubject(), 3, 1); - tTableNotifyProps.setText(meta.getTValueSubject(), 4, 1); - - tTableNotifyProps.setText("Message", 1, 2); - tTableNotifyProps.setText(meta.getCInputMessage(), 2, 2); - tTableNotifyProps.setText(meta.getTFldMessage(), 3, 2); - tTableNotifyProps.setText(meta.getTValueMessage(), 4, 2); + List snsRegions = RegionUtils.getRegionsForService(AmazonSNS.ENDPOINT_PREFIX); - } + for (Iterator i = snsRegions.iterator(); i.hasNext(); ) { + Region region = i.next(); + tAWSRegion2.add(region.getName()); + } - /** - * Called when the user cancels the dialog. - */ - private void cancel() { - // The "transformName" variable will be the return value for the open() method. - // Setting to null to indicate that dialog was cancelled. - transformName = null; - // Restoring original "changed" flag on the meta object - meta.setChanged(changed); - // close the SWT dialog window - dispose(); + } catch (AmazonClientException e) { + logError(BaseMessages.getString(PKG, e.getMessage())); } - - /** - * Called when the user confirms the dialog - */ - private void ok() { - // The "transformName" variable will be the return value for the open() method. - // Setting to transform name from the dialog control - transformName = wTransformName.getText(); - - // Setting the settings to the meta object - meta.setAwsCredChain(tAWSCredChain.getText()); - meta.setAwsKey(tAWSKey.getText()); - meta.setAwsKeySecret(tAWSKeySecret.getText()); - meta.setAwsRegion(tAWSRegion.getText()); - meta.setNotifyPoint(tnotifyPoint.getText()); - meta.setTFldMessageID(tMessageID.getText()); - - int nrKeys = tTableNotifyProps.nrNonEmpty(); - - for (int i = 0; i < nrKeys; i++) { - TableItem item = tTableNotifyProps.getNonEmpty(i); - if (item.getText(1).equals("topicARN")) { - meta.setCInputtopicArn(item.getText(2).isEmpty() ? "N" : item.getText(2)); - meta.setTFldtopicARN(item.getText(3)); - meta.setTValuetopicARN(item.getText(4)); - } - if (item.getText(1).equals("Subject")) { - meta.setCInputSubject(item.getText(2).isEmpty() ? "N" : item.getText(2)); - meta.setTFldSubject(item.getText(3)); - meta.setTValueSubject(item.getText(4)); - } - if (item.getText(1).equals("Message")) { - meta.setCInputMessage(item.getText(2).isEmpty() ? "N" : item.getText(2)); - meta.setTFldMessage(item.getText(3)); - meta.setTValueMessage(item.getText(4)); - } - } - - // close the SWT dialog window - dispose(); + } + + /** + * This helper method puts the transform configuration stored in the meta object and puts it into + * the dialog controls. + */ + private void populateDialog() { + wTransformName.selectAll(); + + tAWSCredChain.setText(meta.getAwsCredChain()); + tAWSKey.setText(meta.getAwsKey()); + tAWSKeySecret.setText(meta.getAwsKeySecret()); + tAWSRegion.setText(meta.getAwsRegion()); + tnotifyPoint.setText(meta.getNotifyPoint()); + tMessageID.setText(meta.getTFldMessageID()); + + // Populate NotifyProperties + setComboValues(); + + tTableNotifyProps.setText("topicARN", 1, 0); + tTableNotifyProps.setText(meta.getCInputtopicArn(), 2, 0); + tTableNotifyProps.setText(meta.getTFldtopicARN(), 3, 0); + tTableNotifyProps.setText(meta.getTValuetopicARN(), 4, 0); + + tTableNotifyProps.setText("Subject", 1, 1); + tTableNotifyProps.setText(meta.getCInputSubject(), 2, 1); + tTableNotifyProps.setText(meta.getTFldSubject(), 3, 1); + tTableNotifyProps.setText(meta.getTValueSubject(), 4, 1); + + tTableNotifyProps.setText("Message", 1, 2); + tTableNotifyProps.setText(meta.getCInputMessage(), 2, 2); + tTableNotifyProps.setText(meta.getTFldMessage(), 3, 2); + tTableNotifyProps.setText(meta.getTValueMessage(), 4, 2); + } + + /** Called when the user cancels the dialog. */ + private void cancel() { + // The "transformName" variable will be the return value for the open() method. + // Setting to null to indicate that dialog was cancelled. + transformName = null; + // Restoring original "changed" flag on the meta object + meta.setChanged(changed); + // close the SWT dialog window + dispose(); + } + + /** Called when the user confirms the dialog */ + private void ok() { + // The "transformName" variable will be the return value for the open() method. + // Setting to transform name from the dialog control + transformName = wTransformName.getText(); + + // Setting the settings to the meta object + meta.setAwsCredChain(tAWSCredChain.getText()); + meta.setAwsKey(tAWSKey.getText()); + meta.setAwsKeySecret(tAWSKeySecret.getText()); + meta.setAwsRegion(tAWSRegion.getText()); + meta.setNotifyPoint(tnotifyPoint.getText()); + meta.setTFldMessageID(tMessageID.getText()); + + int nrKeys = tTableNotifyProps.nrNonEmpty(); + + for (int i = 0; i < nrKeys; i++) { + TableItem item = tTableNotifyProps.getNonEmpty(i); + if (item.getText(1).equals("topicARN")) { + meta.setCInputtopicArn(item.getText(2).isEmpty() ? "N" : item.getText(2)); + meta.setTFldtopicARN(item.getText(3)); + meta.setTValuetopicARN(item.getText(4)); + } + if (item.getText(1).equals("Subject")) { + meta.setCInputSubject(item.getText(2).isEmpty() ? "N" : item.getText(2)); + meta.setTFldSubject(item.getText(3)); + meta.setTValueSubject(item.getText(4)); + } + if (item.getText(1).equals("Message")) { + meta.setCInputMessage(item.getText(2).isEmpty() ? "N" : item.getText(2)); + meta.setTFldMessage(item.getText(3)); + meta.setTValueMessage(item.getText(4)); + } } + // close the SWT dialog window + dispose(); + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyMeta.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyMeta.java index 156ef1b8747..bb7af3f9f2c 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyMeta.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sns/SnsNotifyMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.aws.sns; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,388 +34,415 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( - id = "SnsNotify", - image = "aws-sns.svg", - name = "i18n::System.Label.TransformName", - description = "i18n::SNSNotifyTransform.TooltipDesc", - categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Output", - keywords = "", - documentationUrl = "/pipeline/transforms/aws-sns-notify.html" -) + id = "SnsNotify", + image = "aws-sns.svg", + name = "i18n::System.Label.TransformName", + description = "i18n::SNSNotifyTransform.TooltipDesc", + categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Output", + keywords = "", + documentationUrl = "/pipeline/transforms/aws-sns-notify.html") public class SnsNotifyMeta extends BaseTransformMeta { - /** - * The PKG member is used when looking up internationalized strings. - * The properties file with localized keys is expected to reside in - * {the package of the class specified}/messages/messages_{locale}.properties - */ - private static Class PKG = SnsNotifyMeta.class; // for i18n purposes - - @HopMetadataProperty( - key = "AwsCredChain", - injectionKey = "AWS_CRED_CHAIN" - ) - private String awsCredChain; - @HopMetadataProperty( - key = "aws_key", - injectionKey = "AWS_KEY" - ) - private String awsKey; - @HopMetadataProperty( - key = "aws_key_secret", - injectionKey = "AWS_KEY_SECRET" - ) - private String awsKeySecret; - @HopMetadataProperty( - key = "aws_region", - injectionKey = "AWS_REGION" - ) - private String awsRegion; - @HopMetadataProperty( - key = "notify_point", - injectionKey = "NOTIFY_POINT" - ) - private String notifyPoint; - @HopMetadataProperty( - key = "chooser_topic_arn", - injectionKey = "CHOOSER_TOPIC_ARN" - ) - private String cInputtopicArn; - @HopMetadataProperty( - key = "chooser_subject", - injectionKey = "CHOOSER_SUBJECT" - ) - private String cInputSubject; - @HopMetadataProperty( - key = "chooser_message", - injectionKey = "CHOOSER_MESSAGE" - ) - private String cInputMessage; - @HopMetadataProperty( - key = "field_topic_arn", - injectionKey = "FIELD_TOPIC_ARN" - ) - private String tFldtopicARN; - @HopMetadataProperty( - key = "field_subject", - injectionKey = "FIELD_SUBJECT" - ) - private String tFldSubject; - @HopMetadataProperty( - key = "field_message", - injectionKey = "FIELD_MESSAGE" - ) - private String tFldMessage; - @HopMetadataProperty( - key = "value_topic_arn", - injectionKey = "VALUE_TOPIC_ARN" - ) - private String tValuetopicARN; - @HopMetadataProperty( - key = "value_subject", - injectionKey = "VALUE_SUBJECT" - ) - private String tValueSubject; - @HopMetadataProperty( - key = "value_message", - injectionKey = "VALUE_MESSAGE" - ) - private String tValueMessage; - @HopMetadataProperty( - key = "field_message_id", - injectionKey = "FIELD_MESSAGE_ID" - ) - private String tFldMessageID; - - - /** - * Constructor should call super() to make sure the base class has a chance to initialize properly. - */ - public SnsNotifyMeta() { - super(); - } + /** + * The PKG member is used when looking up internationalized strings. The properties file with + * localized keys is expected to reside in {the package of the class + * specified}/messages/messages_{locale}.properties + */ + private static Class PKG = SnsNotifyMeta.class; // for i18n purposes - /** - * This method is called every time a new transform is created and should allocate/set the transform configuration - * to sensible defaults. The values set here will be used by Hop Gui when a new transform is created. - */ - public void setDefault() { - // outputField = "demo_field"; - } + @HopMetadataProperty(key = "AwsCredChain", injectionKey = "AWS_CRED_CHAIN") + private String awsCredChain; - public String getAwsCredChain() { - return awsCredChain == null ? "N" : awsCredChain; - } + @HopMetadataProperty(key = "aws_key", injectionKey = "AWS_KEY") + private String awsKey; - public void setAwsCredChain(String awsCredChain) { - this.awsCredChain = awsCredChain; - } + @HopMetadataProperty(key = "aws_key_secret", injectionKey = "AWS_KEY_SECRET") + private String awsKeySecret; - public String getAwsKey() { - return awsKey == null ? "" : awsKey; - } + @HopMetadataProperty(key = "aws_region", injectionKey = "AWS_REGION") + private String awsRegion; - public void setAwsKey(String aws_key) { - this.awsKey = aws_key; - } + @HopMetadataProperty(key = "notify_point", injectionKey = "NOTIFY_POINT") + private String notifyPoint; - public String getAwsKeySecret() { - return awsKeySecret == null ? "" : awsKeySecret; - } + @HopMetadataProperty(key = "chooser_topic_arn", injectionKey = "CHOOSER_TOPIC_ARN") + private String cInputtopicArn; - public void setAwsKeySecret(String awsKeySecret) { - this.awsKeySecret = awsKeySecret; - } + @HopMetadataProperty(key = "chooser_subject", injectionKey = "CHOOSER_SUBJECT") + private String cInputSubject; - public String getAwsRegion() { - return awsRegion == null ? "" : awsRegion; - } + @HopMetadataProperty(key = "chooser_message", injectionKey = "CHOOSER_MESSAGE") + private String cInputMessage; - public void setAwsRegion(String awsRegion) { - this.awsRegion = awsRegion; - } + @HopMetadataProperty(key = "field_topic_arn", injectionKey = "FIELD_TOPIC_ARN") + private String tFldtopicARN; - public String getNotifyPoint() { - return notifyPoint == null ? "Send once with first row" : notifyPoint; - } + @HopMetadataProperty(key = "field_subject", injectionKey = "FIELD_SUBJECT") + private String tFldSubject; - public String[] getNotifyPointValues() { + @HopMetadataProperty(key = "field_message", injectionKey = "FIELD_MESSAGE") + private String tFldMessage; - String[] values = new String[] { - "Send once with first row", - //"Send once with last row", - "Send for each row (be careful!)" - }; + @HopMetadataProperty(key = "value_topic_arn", injectionKey = "VALUE_TOPIC_ARN") + private String tValuetopicARN; - return values; - } + @HopMetadataProperty(key = "value_subject", injectionKey = "VALUE_SUBJECT") + private String tValueSubject; - public String getNotifyPointShort() { - if (notifyPoint.contains("last")) { - return "last"; - } else if (notifyPoint.contains("each")) { - return "each"; - } else { - return "first"; - } - } + @HopMetadataProperty(key = "value_message", injectionKey = "VALUE_MESSAGE") + private String tValueMessage; - public void setNotifyPoint(String notifyPoint) { - this.notifyPoint = notifyPoint; - } + @HopMetadataProperty(key = "field_message_id", injectionKey = "FIELD_MESSAGE_ID") + private String tFldMessageID; - public String getCInputtopicArn() { - return cInputtopicArn == null ? "N" : cInputtopicArn; - } + /** + * Constructor should call super() to make sure the base class has a chance to initialize + * properly. + */ + public SnsNotifyMeta() { + super(); + } - public void setCInputtopicArn(String cInputtopicArn) { - this.cInputtopicArn = cInputtopicArn; - } + /** + * This method is called every time a new transform is created and should allocate/set the + * transform configuration to sensible defaults. The values set here will be used by Hop Gui when + * a new transform is created. + */ + public void setDefault() { + // outputField = "demo_field"; + } - public String getTFldtopicARN() { - return tFldtopicARN == null ? "" : tFldtopicARN; - } + public String getAwsCredChain() { + return awsCredChain == null ? "N" : awsCredChain; + } - public void setTFldtopicARN(String tFldtopicARN) { - this.tFldtopicARN = tFldtopicARN; - } + public void setAwsCredChain(String awsCredChain) { + this.awsCredChain = awsCredChain; + } - public String getTValuetopicARN() { - return tValuetopicARN == null ? "" : tValuetopicARN; - } + public String getAwsKey() { + return awsKey == null ? "" : awsKey; + } - public void setTValuetopicARN(String tValuetopicARN) { - this.tValuetopicARN = tValuetopicARN; - } + public void setAwsKey(String aws_key) { + this.awsKey = aws_key; + } - public String getCInputSubject() { - return cInputSubject == null ? "N" : cInputSubject; - } + public String getAwsKeySecret() { + return awsKeySecret == null ? "" : awsKeySecret; + } - public void setCInputSubject(String cInputSubject) { - this.cInputSubject = cInputSubject; - } + public void setAwsKeySecret(String awsKeySecret) { + this.awsKeySecret = awsKeySecret; + } - public String getTFldSubject() { - return tFldSubject == null ? "" : tFldSubject; - } + public String getAwsRegion() { + return awsRegion == null ? "" : awsRegion; + } - public void setTFldSubject(String tFldSubject) { - this.tFldSubject = tFldSubject; - } + public void setAwsRegion(String awsRegion) { + this.awsRegion = awsRegion; + } - public String getTValueSubject() { - return tValueSubject == null ? "" : tValueSubject; - } + public String getNotifyPoint() { + return notifyPoint == null ? "Send once with first row" : notifyPoint; + } - public void setTValueSubject(String tValueSubject) { - this.tValueSubject = tValueSubject; - } - - public String getCInputMessage() { - return cInputMessage == null ? "N" : cInputMessage; - } - - public void setCInputMessage(String cInputMessage) { - this.cInputMessage = cInputMessage; - } - - public String getTFldMessage() { - return tFldMessage == null ? "N" : tFldMessage; - } - - public void setTFldMessage(String tFldMessage) { - this.tFldMessage = tFldMessage; - } - - public String getTValueMessage() { - return tValueMessage == null ? "" : tValueMessage; - } - - public void setTValueMessage(String tValueMessage) { - this.tValueMessage = tValueMessage; - } - - public String getTFldMessageID() { - return tFldMessageID == null ? "" : tFldMessageID; - } + public String[] getNotifyPointValues() { - public void setTFldMessageID(String tFldMessageID) { - this.tFldMessageID = tFldMessageID; - } - - /** - * This method is used when a transform is duplicated in hop gui. It needs to return a deep copy of this - * transform's meta object. Be sure to create proper deep copies if the transform configuration is stored in - * modifiable objects. - * - * See org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta.clone() for an example on creating - * a deep copy. - * - * @return a deep copy of this - */ - public Object clone() { - Object retval = super.clone(); - return retval; - } - - /** - * This method is called to determine the changes the transform is making to the row-stream. - * To that end a IRowMeta object is passed in, containing the row-stream structure as it is when entering - * the transform. This method must apply any changes the transform makes to the row stream. Usually a transform adds fields to the - * row-stream. - * - * @param inputRowMeta the row structure coming in to the transform - * @param name the name of the transform making the changes - * @param info row structures of any info transform coming in - * @param nextTransform the description of a transform this transform is passing rows to - * @param space the variable space for resolving variables - * @param metadataProvider the metadataProvider to optionally read from - */ - @Override - public void getFields(IRowMeta inputRowMeta, String name, IRowMeta[] info, TransformMeta nextTransform, IVariables space, IHopMetadataProvider metadataProvider) throws HopTransformException { - - /* - * This implementation appends the outputField to the row-stream - */ - - try { - - if (tFldMessageID != null && !tFldMessageID.equals("")) { - IValueMeta valueMeta = ValueMetaFactory.createValueMeta(tFldMessageID, IValueMeta.TYPE_STRING ); - valueMeta.setName(tFldMessageID.toUpperCase()); - valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); - valueMeta.setOrigin(name); - inputRowMeta.addValueMeta(valueMeta); - } - - } catch (HopPluginException e) { - logBasic(e.getMessage()); - throw new HopTransformException( e ); - } - - } + String[] values = + new String[] { + "Send once with first row", + // "Send once with last row", + "Send for each row (be careful!)" + }; - /** - * This method is called when the user selects the "Verify Transformation" option in Hop Gui. - * A list of remarks is passed in that this method should add to. Each remark is a comment, warning, error, or ok. - * The method should perform as many checks as necessary to catch design-time errors. - * - * Typical checks include: - * - verify that all mandatory configuration is given - * - verify that the transform receives any input, unless it's a row generating transform - * - verify that the transform does not receive any input if it does not take them into account - * - verify that the transform finds fields it relies on in the row-stream - * - * @param remarks the list of remarks to append to - * @param transMeta the description of the pipeline - * @param transformMeta the description of the transform - * @param prev the structure of the incoming row-stream - * @param input names of transforms sending input to the transform - * @param output names of transforms this transform is sending output to - * @param info fields coming in from info transform - * @param metaStore metaStore to optionally read from + return values; + } + + public String getNotifyPointShort() { + if (notifyPoint.contains("last")) { + return "last"; + } else if (notifyPoint.contains("each")) { + return "each"; + } else { + return "first"; + } + } + + public void setNotifyPoint(String notifyPoint) { + this.notifyPoint = notifyPoint; + } + + public String getCInputtopicArn() { + return cInputtopicArn == null ? "N" : cInputtopicArn; + } + + public void setCInputtopicArn(String cInputtopicArn) { + this.cInputtopicArn = cInputtopicArn; + } + + public String getTFldtopicARN() { + return tFldtopicARN == null ? "" : tFldtopicARN; + } + + public void setTFldtopicARN(String tFldtopicARN) { + this.tFldtopicARN = tFldtopicARN; + } + + public String getTValuetopicARN() { + return tValuetopicARN == null ? "" : tValuetopicARN; + } + + public void setTValuetopicARN(String tValuetopicARN) { + this.tValuetopicARN = tValuetopicARN; + } + + public String getCInputSubject() { + return cInputSubject == null ? "N" : cInputSubject; + } + + public void setCInputSubject(String cInputSubject) { + this.cInputSubject = cInputSubject; + } + + public String getTFldSubject() { + return tFldSubject == null ? "" : tFldSubject; + } + + public void setTFldSubject(String tFldSubject) { + this.tFldSubject = tFldSubject; + } + + public String getTValueSubject() { + return tValueSubject == null ? "" : tValueSubject; + } + + public void setTValueSubject(String tValueSubject) { + this.tValueSubject = tValueSubject; + } + + public String getCInputMessage() { + return cInputMessage == null ? "N" : cInputMessage; + } + + public void setCInputMessage(String cInputMessage) { + this.cInputMessage = cInputMessage; + } + + public String getTFldMessage() { + return tFldMessage == null ? "N" : tFldMessage; + } + + public void setTFldMessage(String tFldMessage) { + this.tFldMessage = tFldMessage; + } + + public String getTValueMessage() { + return tValueMessage == null ? "" : tValueMessage; + } + + public void setTValueMessage(String tValueMessage) { + this.tValueMessage = tValueMessage; + } + + public String getTFldMessageID() { + return tFldMessageID == null ? "" : tFldMessageID; + } + + public void setTFldMessageID(String tFldMessageID) { + this.tFldMessageID = tFldMessageID; + } + + /** + * This method is used when a transform is duplicated in hop gui. It needs to return a deep copy + * of this transform's meta object. Be sure to create proper deep copies if the transform + * configuration is stored in modifiable objects. + * + *

See org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta.clone() for an example + * on creating a deep copy. + * + * @return a deep copy of this + */ + public Object clone() { + Object retval = super.clone(); + return retval; + } + + /** + * This method is called to determine the changes the transform is making to the row-stream. To + * that end a IRowMeta object is passed in, containing the row-stream structure as it is when + * entering the transform. This method must apply any changes the transform makes to the row + * stream. Usually a transform adds fields to the row-stream. + * + * @param inputRowMeta the row structure coming in to the transform + * @param name the name of the transform making the changes + * @param info row structures of any info transform coming in + * @param nextTransform the description of a transform this transform is passing rows to + * @param space the variable space for resolving variables + * @param metadataProvider the metadataProvider to optionally read from + */ + @Override + public void getFields( + IRowMeta inputRowMeta, + String name, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables space, + IHopMetadataProvider metadataProvider) + throws HopTransformException { + + /* + * This implementation appends the outputField to the row-stream */ - public void check(List remarks, PipelineMeta transMeta, TransformMeta transformMeta, IRowMeta prev, String input[], String output[], IRowMeta info, IVariables space, IHopMetadataProvider metaStore) { - - CheckResult cr; - - // See if there are input streams leading to this transform! - if (input.length > 0) { - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.ReceivingRows.OK"), transformMeta); - remarks.add(cr); - } else { - cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "SNSNotify.CheckResult.ReceivingRows.ERROR"), transformMeta); - remarks.add(cr); - } - - // Check for Credentials - if ((getAwsCredChain() == "N") && (getAwsKey().isEmpty() || getAwsKeySecret().isEmpty() || getAwsRegion().isEmpty())) { - cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "SNSNotify.CheckResult.AWSCredentials.ERROR"), transformMeta); - remarks.add(cr); - } else { - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.AWSCredentials.OK"), transformMeta); - remarks.add(cr); - } - - // Check for NotifyPoint - if (getNotifyPoint().isEmpty()) { - cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyPoint.ERROR"), transformMeta); - remarks.add(cr); - } else { - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyPoint.OK"), transformMeta); - remarks.add(cr); - } - - // Check for NotifySettings - boolean notifyPropsError = false; - if ((getCInputtopicArn().equals("Y") && getTFldtopicARN().isEmpty()) || (getCInputtopicArn().equals("N") && getTValuetopicARN().isEmpty())) { - notifyPropsError = true; - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.topicARN.ERROR"), transformMeta); - remarks.add(cr); - } - if ((getCInputSubject().equals("Y") && getTFldSubject().isEmpty()) || (getCInputSubject().equals("N") && getTValueSubject().isEmpty())) { - notifyPropsError = true; - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.Subject.ERROR"), transformMeta); - remarks.add(cr); - } - if ((getCInputMessage().equals("Y") && getTFldMessage().isEmpty()) || (getCInputMessage().equals("N") && getTValueMessage().isEmpty())) { - notifyPropsError = true; - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.Message.ERROR"), transformMeta); - remarks.add(cr); - } - - if (!notifyPropsError) { - cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.OK"), transformMeta); - remarks.add(cr); - } - } - - public boolean supportsErrorHandling() { - return true; - } + try { + + if (tFldMessageID != null && !tFldMessageID.equals("")) { + IValueMeta valueMeta = + ValueMetaFactory.createValueMeta(tFldMessageID, IValueMeta.TYPE_STRING); + valueMeta.setName(tFldMessageID.toUpperCase()); + valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); + valueMeta.setOrigin(name); + inputRowMeta.addValueMeta(valueMeta); + } + + } catch (HopPluginException e) { + logBasic(e.getMessage()); + throw new HopTransformException(e); + } + } + + /** + * This method is called when the user selects the "Verify Transformation" option in Hop Gui. A + * list of remarks is passed in that this method should add to. Each remark is a comment, warning, + * error, or ok. The method should perform as many checks as necessary to catch design-time + * errors. + * + *

Typical checks include: - verify that all mandatory configuration is given - verify that the + * transform receives any input, unless it's a row generating transform - verify that the + * transform does not receive any input if it does not take them into account - verify that the + * transform finds fields it relies on in the row-stream + * + * @param remarks the list of remarks to append to + * @param transMeta the description of the pipeline + * @param transformMeta the description of the transform + * @param prev the structure of the incoming row-stream + * @param input names of transforms sending input to the transform + * @param output names of transforms this transform is sending output to + * @param info fields coming in from info transform + * @param metaStore metaStore to optionally read from + */ + public void check( + List remarks, + PipelineMeta transMeta, + TransformMeta transformMeta, + IRowMeta prev, + String input[], + String output[], + IRowMeta info, + IVariables space, + IHopMetadataProvider metaStore) { + + CheckResult cr; + + // See if there are input streams leading to this transform! + if (input.length > 0) { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.ReceivingRows.OK"), + transformMeta); + remarks.add(cr); + } else { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_ERROR, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.ReceivingRows.ERROR"), + transformMeta); + remarks.add(cr); + } + + // Check for Credentials + if ((getAwsCredChain() == "N") + && (getAwsKey().isEmpty() || getAwsKeySecret().isEmpty() || getAwsRegion().isEmpty())) { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_ERROR, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.AWSCredentials.ERROR"), + transformMeta); + remarks.add(cr); + } else { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.AWSCredentials.OK"), + transformMeta); + remarks.add(cr); + } + + // Check for NotifyPoint + if (getNotifyPoint().isEmpty()) { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_ERROR, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyPoint.ERROR"), + transformMeta); + remarks.add(cr); + } else { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyPoint.OK"), + transformMeta); + remarks.add(cr); + } + + // Check for NotifySettings + boolean notifyPropsError = false; + if ((getCInputtopicArn().equals("Y") && getTFldtopicARN().isEmpty()) + || (getCInputtopicArn().equals("N") && getTValuetopicARN().isEmpty())) { + notifyPropsError = true; + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.topicARN.ERROR"), + transformMeta); + remarks.add(cr); + } + if ((getCInputSubject().equals("Y") && getTFldSubject().isEmpty()) + || (getCInputSubject().equals("N") && getTValueSubject().isEmpty())) { + notifyPropsError = true; + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.Subject.ERROR"), + transformMeta); + remarks.add(cr); + } + if ((getCInputMessage().equals("Y") && getTFldMessage().isEmpty()) + || (getCInputMessage().equals("N") && getTValueMessage().isEmpty())) { + notifyPropsError = true; + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.Message.ERROR"), + transformMeta); + remarks.add(cr); + } + + if (!notifyPropsError) { + cr = + new CheckResult( + CheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "SNSNotify.CheckResult.NotifyProps.OK"), + transformMeta); + remarks.add(cr); + } + } + + public boolean supportsErrorHandling() { + return true; + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/AwsSqsReader.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/AwsSqsReader.java index b18eedfd78b..1c3081744de 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/AwsSqsReader.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/AwsSqsReader.java @@ -27,130 +27,130 @@ import com.amazonaws.services.sqs.model.AmazonSQSException; import com.amazonaws.services.sqs.model.Message; import com.amazonaws.services.sqs.model.ReceiveMessageRequest; +import java.util.List; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransform; -import java.util.List; - public class AwsSqsReader { - private AmazonSQSClient sqsClient; - private SqsReaderMeta meta; - private String awsKey; - private String awsRegion; - private String awsKeySecret; - private BaseTransform baseTransform; - private PipelineMeta pipelineMeta; - private String awsCredChain; - private String deleteMessage; - - /** - * - * Constructor for new AWS SQS Object - * - * @param transformMeta SqsReaderMeta - * @param t PipelineMeta - * @param bst BaseTransform - */ - public AwsSqsReader(SqsReaderMeta transformMeta, PipelineMeta t, BaseTransform bst) { - - this.meta = transformMeta; - this.baseTransform = bst; - this.pipelineMeta = t; - - this.awsCredChain = this.baseTransform.resolve(meta.getAwsCredChain()); - this.awsKey = this.baseTransform.resolve(meta.getAwsKey()); - this.awsKeySecret = this.baseTransform.resolve(meta.getAwsKeySecret()); - this.awsRegion = this.baseTransform.resolve(meta.getAwsRegion()); - this.deleteMessage = this.baseTransform.resolve(meta.getTFldMessageDelete()); - } - - /** - * - * Establishing new Connection to Amazon Webservices - * - * @return true on successful connection - */ - public boolean getAWSConnection() { - try { - baseTransform.logBasic("Starting connection to AWS SQS"); - - if (this.awsCredChain.equalsIgnoreCase("N")) { - BasicAWSCredentials awsCreds = new BasicAWSCredentials(this.awsKey, this.awsKeySecret); - sqsClient = (AmazonSQSClient) AmazonSQSClientBuilder.standard() - .withCredentials(new AWSStaticCredentialsProvider(awsCreds)) - .withRegion(this.awsRegion) - .build(); - - baseTransform.logBasic("Connected to SQS in Region " + this.awsRegion + " with API-Key >>" + this.awsKey + "<<"); - - } else { - AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain(); - sqsClient = (AmazonSQSClient) AmazonSQSClientBuilder.standard() - .withCredentials(provider) - .build(); - - baseTransform.logBasic("Connected to SQS with provided Credentials Chain"); - } - return true; - - } catch (AmazonClientException e) { - baseTransform.logError(e.getMessage()); - - } catch (Exception e) { - baseTransform.logError(e.getMessage()); - } - return false; + private AmazonSQSClient sqsClient; + private SqsReaderMeta meta; + private String awsKey; + private String awsRegion; + private String awsKeySecret; + private BaseTransform baseTransform; + private PipelineMeta pipelineMeta; + private String awsCredChain; + private String deleteMessage; + + /** + * Constructor for new AWS SQS Object + * + * @param transformMeta SqsReaderMeta + * @param t PipelineMeta + * @param bst BaseTransform + */ + public AwsSqsReader(SqsReaderMeta transformMeta, PipelineMeta t, BaseTransform bst) { + + this.meta = transformMeta; + this.baseTransform = bst; + this.pipelineMeta = t; + + this.awsCredChain = this.baseTransform.resolve(meta.getAwsCredChain()); + this.awsKey = this.baseTransform.resolve(meta.getAwsKey()); + this.awsKeySecret = this.baseTransform.resolve(meta.getAwsKeySecret()); + this.awsRegion = this.baseTransform.resolve(meta.getAwsRegion()); + this.deleteMessage = this.baseTransform.resolve(meta.getTFldMessageDelete()); + } + + /** + * Establishing new Connection to Amazon Webservices + * + * @return true on successful connection + */ + public boolean getAWSConnection() { + try { + baseTransform.logBasic("Starting connection to AWS SQS"); + + if (this.awsCredChain.equalsIgnoreCase("N")) { + BasicAWSCredentials awsCreds = new BasicAWSCredentials(this.awsKey, this.awsKeySecret); + sqsClient = + (AmazonSQSClient) + AmazonSQSClientBuilder.standard() + .withCredentials(new AWSStaticCredentialsProvider(awsCreds)) + .withRegion(this.awsRegion) + .build(); + + baseTransform.logBasic( + "Connected to SQS in Region " + + this.awsRegion + + " with API-Key >>" + + this.awsKey + + "<<"); + + } else { + AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain(); + sqsClient = + (AmazonSQSClient) AmazonSQSClientBuilder.standard().withCredentials(provider).build(); + + baseTransform.logBasic("Connected to SQS with provided Credentials Chain"); + } + return true; + + } catch (AmazonClientException e) { + baseTransform.logError(e.getMessage()); + + } catch (Exception e) { + baseTransform.logError(e.getMessage()); } + return false; + } - /** - * Disconnects from AWS - */ - public void disconnectAWSConnection() { - try { - sqsClient.shutdown(); + /** Disconnects from AWS */ + public void disconnectAWSConnection() { + try { + sqsClient.shutdown(); - baseTransform.logBasic("Disconnected from SQS"); + baseTransform.logBasic("Disconnected from SQS"); - } catch (AmazonClientException e) { - baseTransform.logError(e.getMessage()); - baseTransform.setErrors(1); - } + } catch (AmazonClientException e) { + baseTransform.logError(e.getMessage()); + baseTransform.setErrors(1); } + } - /** - * - * @param queueURL - * @param numMsgs - * @param isPreview - * @return - * @throws AmazonSQSException - */ - public List readMessages(String queueURL, int numMsgs, boolean isPreview) throws AmazonSQSException { - - int numMessages = (numMsgs > 10) ? 10 : numMsgs; + /** + * @param queueURL + * @param numMsgs + * @param isPreview + * @return + * @throws AmazonSQSException + */ + public List readMessages(String queueURL, int numMsgs, boolean isPreview) + throws AmazonSQSException { - try { + int numMessages = (numMsgs > 10) ? 10 : numMsgs; - ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueURL); - receiveMessageRequest.setMaxNumberOfMessages(numMessages); - List messages = sqsClient.receiveMessage(receiveMessageRequest).getMessages(); + try { - baseTransform.logDebug(messages.size() + " Message(s) retrieved from queue"); + ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueURL); + receiveMessageRequest.setMaxNumberOfMessages(numMessages); + List messages = sqsClient.receiveMessage(receiveMessageRequest).getMessages(); - if (this.deleteMessage.equalsIgnoreCase("Y") && !isPreview) { + baseTransform.logDebug(messages.size() + " Message(s) retrieved from queue"); - for (Message m : messages) { - sqsClient.deleteMessage(queueURL, m.getReceiptHandle()); - } - baseTransform.logDebug(messages.size() + " Message(s) deleted from queue"); - } + if (this.deleteMessage.equalsIgnoreCase("Y") && !isPreview) { - return messages; + for (Message m : messages) { + sqsClient.deleteMessage(queueURL, m.getReceiptHandle()); + } + baseTransform.logDebug(messages.size() + " Message(s) deleted from queue"); + } - } catch (AmazonSQSException e) { - throw e; + return messages; - } + } catch (AmazonSQSException e) { + throw e; } + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReader.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReader.java index 5b7db4ceb49..cf904d1f3c5 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReader.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReader.java @@ -23,6 +23,8 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; import org.apache.hop.core.row.RowMeta; @@ -33,183 +35,183 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.IOException; -import java.util.List; - public class SqsReader extends BaseTransform { - /** - * The PKG member is used when looking up internationalized strings. - * The properties file with localized keys is expected to reside in - * {the package of the class specified}/messages/messages_{locale}.properties - */ - private static Class PKG = SqsReaderMeta.class; // for i18n purposes - - public SqsReader( - TransformMeta transformMeta, - SqsReaderMeta meta, - SqsReaderData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline - ){ - super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); + /** + * The PKG member is used when looking up internationalized strings. The properties file with + * localized keys is expected to reside in {the package of the class + * specified}/messages/messages_{locale}.properties + */ + private static Class PKG = SqsReaderMeta.class; // for i18n purposes + + public SqsReader( + TransformMeta transformMeta, + SqsReaderMeta meta, + SqsReaderData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { + super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); + } + + @Override + public boolean init() { + + data.aws_sqs = new AwsSqsReader(meta, getPipelineMeta(), this); + if (!data.aws_sqs.getAWSConnection()) { + setErrors(1); + stopAll(); + setOutputDone(); + return false; } - @Override - public boolean init(){ - - data.aws_sqs = new AwsSqsReader(meta, getPipelineMeta(), this); - if (!data.aws_sqs.getAWSConnection()) { - setErrors(1); - stopAll(); - setOutputDone(); - return false; - } - - data.realSQSQueue = resolve(meta.getSqsQueue()); - - data.realMessageIDFieldName = resolve(meta.getTFldMessageID()); - data.realMessageBodyFieldName = resolve(meta.getTFldMessageBody()); - data.realReceiptHandleFieldName = resolve(meta.getTFldReceiptHandle()); - data.realBodyMD5FieldName = resolve(meta.getTFldBodyMD5()); - data.realSNSMessageFieldName = resolve(meta.getTFldSNSMessage()); + data.realSQSQueue = resolve(meta.getSqsQueue()); - try { - data.realMaxMessages = Integer.valueOf(resolve(meta.getTFldMaxMessages())); - if (data.realMaxMessages < 0) { - throw new NumberFormatException("Max Messages value < 0"); - } + data.realMessageIDFieldName = resolve(meta.getTFldMessageID()); + data.realMessageBodyFieldName = resolve(meta.getTFldMessageBody()); + data.realReceiptHandleFieldName = resolve(meta.getTFldReceiptHandle()); + data.realBodyMD5FieldName = resolve(meta.getTFldBodyMD5()); + data.realSNSMessageFieldName = resolve(meta.getTFldSNSMessage()); - } catch(NumberFormatException e) { + try { + data.realMaxMessages = Integer.valueOf(resolve(meta.getTFldMaxMessages())); + if (data.realMaxMessages < 0) { + throw new NumberFormatException("Max Messages value < 0"); + } - logError (BaseMessages.getString( PKG, "SQSReader.Log.MaxMessagesNumber.ERROR" )); - setErrors(1); - stopAll(); - setOutputDone(); - return false; - } + } catch (NumberFormatException e) { - return super.init(); + logError(BaseMessages.getString(PKG, "SQSReader.Log.MaxMessagesNumber.ERROR")); + setErrors(1); + stopAll(); + setOutputDone(); + return false; } - /** - * Once the pipeline starts executing, the processRow() method is called repeatedly - * by Hop for as long as it returns true. To indicate that a transform has finished processing rows - * this method must call setOutputDone() and return false; - * - * Transforms which process incoming rows typically call getRow() to read a single row from the - * input stream, change or add row content, call putRow() to pass the changed row on - * and return true. If getRow() returns null, no more rows are expected to come in, - * and the processRow() implementation calls setOutputDone() and returns false to - * indicate that it is done too. - * - * Transforms which generate rows typically construct a new row Object[] using a call to - * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to - * pass the new row on. Above process may happen in a loop to generate multiple rows, - * at the end of which processRow() would call setOutputDone() and return false; - * - * @return true to indicate that the function should be called again, false if the transform is done - */ - @Override - public boolean processRow() throws HopException { - - // the "first" flag is inherited from the base transform implementation - // it is used to guard some processing tasks, like figuring out field indexes - // in the row structure that only need to be done once - - if (first) { - first = false; - // clone the input row structure and place it in our data object - data.outputRowMeta = new RowMeta(); - // use meta.getFields() to change it, so it reflects the output row structure - meta.getFields(data.outputRowMeta, getTransformName(), null, null, variables, null); - - logBasic ("Start reading from queue"); - } - - if (Utils.isEmpty( data.realMessageIDFieldName ) || Utils.isEmpty( data.realMessageBodyFieldName)) { - logError ( BaseMessages.getString( PKG, "SQSReader.Log.NoMessageFields.ERROR" ) ); - throw new HopException( BaseMessages.getString( PKG, "SQSReader.Log.NoMessageFields.ERROR" ) ); - } + return super.init(); + } + + /** + * Once the pipeline starts executing, the processRow() method is called repeatedly by Hop for as + * long as it returns true. To indicate that a transform has finished processing rows this method + * must call setOutputDone() and return false; + * + *

Transforms which process incoming rows typically call getRow() to read a single row from the + * input stream, change or add row content, call putRow() to pass the changed row on and return + * true. If getRow() returns null, no more rows are expected to come in, and the processRow() + * implementation calls setOutputDone() and returns false to indicate that it is done too. + * + *

Transforms which generate rows typically construct a new row Object[] using a call to + * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to pass the new + * row on. Above process may happen in a loop to generate multiple rows, at the end of which + * processRow() would call setOutputDone() and return false; + * + * @return true to indicate that the function should be called again, false if the transform is + * done + */ + @Override + public boolean processRow() throws HopException { + + // the "first" flag is inherited from the base transform implementation + // it is used to guard some processing tasks, like figuring out field indexes + // in the row structure that only need to be done once + + if (first) { + first = false; + // clone the input row structure and place it in our data object + data.outputRowMeta = new RowMeta(); + // use meta.getFields() to change it, so it reflects the output row structure + meta.getFields(data.outputRowMeta, getTransformName(), null, null, variables, null); + + logBasic("Start reading from queue"); + } - // Catch Messages from Queue - if ((data.realMaxMessages == 0) || (getLinesInput() < data.realMaxMessages)) { + if (Utils.isEmpty(data.realMessageIDFieldName) + || Utils.isEmpty(data.realMessageBodyFieldName)) { + logError(BaseMessages.getString(PKG, "SQSReader.Log.NoMessageFields.ERROR")); + throw new HopException(BaseMessages.getString(PKG, "SQSReader.Log.NoMessageFields.ERROR")); + } - int numMessages = (int) ((data.realMaxMessages == 0) ? 10 : (data.realMaxMessages - getLinesInput())); + // Catch Messages from Queue + if ((data.realMaxMessages == 0) || (getLinesInput() < data.realMaxMessages)) { - List messages = data.aws_sqs.readMessages(data.realSQSQueue, numMessages, getPipeline().isPreview()); + int numMessages = + (int) ((data.realMaxMessages == 0) ? 10 : (data.realMaxMessages - getLinesInput())); - if (!messages.isEmpty()) { + List messages = + data.aws_sqs.readMessages(data.realSQSQueue, numMessages, getPipeline().isPreview()); - for (Message m : messages) { + if (!messages.isEmpty()) { - Object[] outputRow = RowDataUtil.allocateRowData( data.outputRowMeta.size() ); + for (Message m : messages) { - int idxMessageIdField = data.outputRowMeta.indexOfValue( data.realMessageIDFieldName); - if (idxMessageIdField >= 0) { - outputRow[idxMessageIdField] = m.getMessageId(); - } + Object[] outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size()); - int idxMessageBodyField = data.outputRowMeta.indexOfValue( data.realMessageBodyFieldName); - if (idxMessageBodyField >= 0) { - outputRow[idxMessageBodyField] = m.getBody(); - } + int idxMessageIdField = data.outputRowMeta.indexOfValue(data.realMessageIDFieldName); + if (idxMessageIdField >= 0) { + outputRow[idxMessageIdField] = m.getMessageId(); + } - int idxReceiptHandleField = data.outputRowMeta.indexOfValue( data.realReceiptHandleFieldName); - if (idxReceiptHandleField >= 0) { - outputRow[idxReceiptHandleField] = m.getReceiptHandle(); - } + int idxMessageBodyField = data.outputRowMeta.indexOfValue(data.realMessageBodyFieldName); + if (idxMessageBodyField >= 0) { + outputRow[idxMessageBodyField] = m.getBody(); + } - int idxBodyMD5Field = data.outputRowMeta.indexOfValue( data.realBodyMD5FieldName); - if (idxBodyMD5Field >= 0) { - outputRow[idxBodyMD5Field] = m.getMD5OfBody(); - } + int idxReceiptHandleField = + data.outputRowMeta.indexOfValue(data.realReceiptHandleFieldName); + if (idxReceiptHandleField >= 0) { + outputRow[idxReceiptHandleField] = m.getReceiptHandle(); + } - int idxSNSMessageField = data.outputRowMeta.indexOfValue( data.realSNSMessageFieldName); - if (idxSNSMessageField >= 0) { - outputRow[idxSNSMessageField] = getSNSMessageContent(m.getBody()); - } + int idxBodyMD5Field = data.outputRowMeta.indexOfValue(data.realBodyMD5FieldName); + if (idxBodyMD5Field >= 0) { + outputRow[idxBodyMD5Field] = m.getMD5OfBody(); + } - putRow(data.outputRowMeta, outputRow); - incrementLinesInput(); - } - } else { - setOutputDone(); - logBasic ("Finished reading from queue"); - return false; - } - } else { - setOutputDone(); - logBasic ("Finished reading from queue"); - return false; - } + int idxSNSMessageField = data.outputRowMeta.indexOfValue(data.realSNSMessageFieldName); + if (idxSNSMessageField >= 0) { + outputRow[idxSNSMessageField] = getSNSMessageContent(m.getBody()); + } - // log progress if it is time to to so - if (checkFeedback(getLinesRead())) { - logBasic("Linenr " + getLinesRead()); // Some basic logging + putRow(data.outputRowMeta, outputRow); + incrementLinesInput(); } + } else { + setOutputDone(); + logBasic("Finished reading from queue"); + return false; + } + } else { + setOutputDone(); + logBasic("Finished reading from queue"); + return false; + } - // indicate that processRow() should be called again - return true; + // log progress if it is time to to so + if (checkFeedback(getLinesRead())) { + logBasic("Linenr " + getLinesRead()); // Some basic logging } - private String getSNSMessageContent(String body) { - - try { - ObjectMapper mapper = new ObjectMapper(); - JsonFactory factory = new JsonFactory(); - factory.setCodec(mapper); - JsonParser parser = factory.createParser(body); - JsonNode jsonNode = parser.readValueAsTree(); - JsonNode statusNode = jsonNode.get("Message"); - return statusNode.textValue(); - } catch (JsonParseException e) { - logError("Error parsing JSON: " + e.getMessage()); - return ""; - } catch (IOException e) { - logError("IO Error: "+ e.getMessage()); - return ""; - } + // indicate that processRow() should be called again + return true; + } + + private String getSNSMessageContent(String body) { + + try { + ObjectMapper mapper = new ObjectMapper(); + JsonFactory factory = new JsonFactory(); + factory.setCodec(mapper); + JsonParser parser = factory.createParser(body); + JsonNode jsonNode = parser.readValueAsTree(); + JsonNode statusNode = jsonNode.get("Message"); + return statusNode.textValue(); + } catch (JsonParseException e) { + logError("Error parsing JSON: " + e.getMessage()); + return ""; + } catch (IOException e) { + logError("IO Error: " + e.getMessage()); + return ""; } + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderData.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderData.java index db6a486da1b..d093f492acf 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderData.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderData.java @@ -23,18 +23,17 @@ public class SqsReaderData extends BaseTransformData implements ITransformData { - public IRowMeta outputRowMeta; - public AwsSqsReader aws_sqs; - public String realMessageIDFieldName; - public String realMessageBodyFieldName; - public String realReceiptHandleFieldName; - public String realBodyMD5FieldName; - public String realSQSQueue; - public Integer realMaxMessages; - public String realSNSMessageFieldName; + public IRowMeta outputRowMeta; + public AwsSqsReader aws_sqs; + public String realMessageIDFieldName; + public String realMessageBodyFieldName; + public String realReceiptHandleFieldName; + public String realBodyMD5FieldName; + public String realSQSQueue; + public Integer realMaxMessages; + public String realSNSMessageFieldName; - public SqsReaderData() - { - super(); - } + public SqsReaderData() { + super(); + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderDialog.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderDialog.java index b1147093996..d268161f99a 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderDialog.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderDialog.java @@ -21,6 +21,8 @@ import com.amazonaws.regions.Region; import com.amazonaws.regions.RegionUtils; import com.amazonaws.services.sqs.AmazonSQS; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; @@ -55,703 +57,715 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.Iterator; -import java.util.List; - public class SqsReaderDialog extends BaseTransformDialog implements ITransformDialog { - /** - * The PKG member is used when looking up internationalized strings. - * The properties file with localized keys is expected to reside in - * {the package of the class specified}/messages/messages_{locale}.properties - */ - private static Class PKG = SqsReaderMeta.class; // for i18n purposes - - // this is the object the stores the transform's settings - // the dialog reads the settings from it when opening - // the dialog writes the settings to it when confirmed - private SqsReaderMeta meta; - - // text field holding the name of the field to add to the row stream - private CTabFolder tabFolder; - private CTabItem tbtmSettings; - private ScrolledComposite scrlSettingsComp; - private Composite settingsComp; - private Label lblAWSCredChain; - private ComboVar tAWSCredChain; - private Label lblAWSKey; - private TextVar tAWSKey; - private Label lblAWSKeySecret; - private PasswordTextVar tAWSKeySecret; - private Label lblAWSRegion; - private ComboVar tAWSRegion; - private CTabItem tbtmReaderOutput; - private ScrolledComposite scrlreaderOutputComp; - private Composite readerOutputComp; - private Label lblMessageID; - private TextVar tMessageID; - private Label lblMessageBody; - private TextVar tMessageBody; - private Label lblReceiptHandle; - private TextVar tReceiptHandle; - private Label lblBodyMD5; - private TextVar tBodyMD5; - private Label lblMessageDelete; - private ComboVar tMessageDelete; - private Label lblSQSQueue; - private TextVar tSQSQueue; - private Label lblDevInfo; - private Group grpOutputField; - private Group grpOutputSettings; - private Label lblMaxMessages; - private TextVar tMaxMessages; - private Label lblSNSMessage; - private TextVar tSNSMessage; - - - /** - * The constructor should simply invoke super() and save the incoming meta - * object to a local variable, so it can conveniently read and write settings - * from/to it. - * - * @param parent the SWT shell to open the dialog in - * @param in the meta object holding the transform's settings - * @param pipelineMeta pipeline description - * @param sname the transform name - */ - public SqsReaderDialog(Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { - super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); - meta = (SqsReaderMeta) in; - } - - /** - * This method is called by Hop Gui when the user opens the settings dialog of the transform. - * It should open the dialog and return only once the dialog has been closed by the user. - * - * If the user confirms the dialog, the meta object (passed in the constructor) must - * be updated to reflect the new transform settings. The changed flag of the meta object must - * reflect whether the transform configuration was changed by the dialog. - * - * If the user cancels the dialog, the meta object must not be updated, and its changed flag - * must remain unaltered. - * - * The open() method must return the name of the transform after the user has confirmed the dialog, - * or null if the user cancelled the dialog. - */ - public String open() { - - // store some convenient SWT variables - Shell parent = getParent(); - Display display = parent.getDisplay(); - - // SWT code for preparing the dialog - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); - props.setLook(shell); - setShellImage(shell, meta); - - // Save the value of the changed flag on the meta object. If the user cancels - // the dialog, it will be restored to this saved value. - // The "changed" variable is inherited from BaseTransformDialog - changed = meta.hasChanged(); - - // The ModifyListener used on all controls. It will update the meta object to - // indicate that changes are being made. - ModifyListener lsMod = new ModifyListener() { - public void modifyText(ModifyEvent e) { - meta.setChanged(); - } + /** + * The PKG member is used when looking up internationalized strings. The properties file with + * localized keys is expected to reside in {the package of the class + * specified}/messages/messages_{locale}.properties + */ + private static Class PKG = SqsReaderMeta.class; // for i18n purposes + + // this is the object the stores the transform's settings + // the dialog reads the settings from it when opening + // the dialog writes the settings to it when confirmed + private SqsReaderMeta meta; + + // text field holding the name of the field to add to the row stream + private CTabFolder tabFolder; + private CTabItem tbtmSettings; + private ScrolledComposite scrlSettingsComp; + private Composite settingsComp; + private Label lblAWSCredChain; + private ComboVar tAWSCredChain; + private Label lblAWSKey; + private TextVar tAWSKey; + private Label lblAWSKeySecret; + private PasswordTextVar tAWSKeySecret; + private Label lblAWSRegion; + private ComboVar tAWSRegion; + private CTabItem tbtmReaderOutput; + private ScrolledComposite scrlreaderOutputComp; + private Composite readerOutputComp; + private Label lblMessageID; + private TextVar tMessageID; + private Label lblMessageBody; + private TextVar tMessageBody; + private Label lblReceiptHandle; + private TextVar tReceiptHandle; + private Label lblBodyMD5; + private TextVar tBodyMD5; + private Label lblMessageDelete; + private ComboVar tMessageDelete; + private Label lblSQSQueue; + private TextVar tSQSQueue; + private Label lblDevInfo; + private Group grpOutputField; + private Group grpOutputSettings; + private Label lblMaxMessages; + private TextVar tMaxMessages; + private Label lblSNSMessage; + private TextVar tSNSMessage; + + /** + * The constructor should simply invoke super() and save the incoming meta object to a local + * variable, so it can conveniently read and write settings from/to it. + * + * @param parent the SWT shell to open the dialog in + * @param in the meta object holding the transform's settings + * @param pipelineMeta pipeline description + * @param sname the transform name + */ + public SqsReaderDialog( + Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { + super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); + meta = (SqsReaderMeta) in; + } + + /** + * This method is called by Hop Gui when the user opens the settings dialog of the transform. It + * should open the dialog and return only once the dialog has been closed by the user. + * + *

If the user confirms the dialog, the meta object (passed in the constructor) must be updated + * to reflect the new transform settings. The changed flag of the meta object must reflect whether + * the transform configuration was changed by the dialog. + * + *

If the user cancels the dialog, the meta object must not be updated, and its changed flag + * must remain unaltered. + * + *

The open() method must return the name of the transform after the user has confirmed the + * dialog, or null if the user cancelled the dialog. + */ + public String open() { + + // store some convenient SWT variables + Shell parent = getParent(); + Display display = parent.getDisplay(); + + // SWT code for preparing the dialog + shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); + props.setLook(shell); + setShellImage(shell, meta); + + // Save the value of the changed flag on the meta object. If the user cancels + // the dialog, it will be restored to this saved value. + // The "changed" variable is inherited from BaseTransformDialog + changed = meta.hasChanged(); + + // The ModifyListener used on all controls. It will update the meta object to + // indicate that changes are being made. + ModifyListener lsMod = + new ModifyListener() { + public void modifyText(ModifyEvent e) { + meta.setChanged(); + } }; - // ------------------------------------------------------- // - // SWT code for building the actual settings dialog // - // ------------------------------------------------------- // - FormLayout formLayout = new FormLayout(); - formLayout.marginWidth = Const.FORM_MARGIN; - formLayout.marginHeight = Const.FORM_MARGIN; - - shell.setLayout(formLayout); - shell.setText(BaseMessages.getString(PKG, "SQSReader.Shell.Title")); - - int middle = props.getMiddlePct(); - int margin = Const.MARGIN; - - // transformName line - wlTransformName = new Label(shell, SWT.RIGHT); - wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName")); - props.setLook(wlTransformName); - fdlTransformName = new FormData(); - fdlTransformName.left = new FormAttachment(0, 0); - fdlTransformName.right = new FormAttachment(middle, -margin); - fdlTransformName.top = new FormAttachment(0, margin); - wlTransformName.setLayoutData(fdlTransformName); - - wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wTransformName.setText(transformName); - props.setLook(wTransformName); - wTransformName.addModifyListener(lsMod); - fdTransformName = new FormData(); - fdTransformName.left = new FormAttachment(middle, 0); - fdTransformName.top = new FormAttachment(0, margin); - fdTransformName.right = new FormAttachment(100, 0); - wTransformName.setLayoutData(fdTransformName); - - // ------------------------------------------------------- // - // TABULATOREN START // - // ------------------------------------------------------- // - - // TABS - ANFANG - tabFolder = new CTabFolder(shell, SWT.BORDER); - FormData fd_tabFolder = new FormData(); - fd_tabFolder.right = new FormAttachment(100, 0); - fd_tabFolder.top = new FormAttachment(wTransformName, margin); - fd_tabFolder.left = new FormAttachment(0, 0); - fd_tabFolder.bottom = new FormAttachment(100, -50); - tabFolder.setLayoutData(fd_tabFolder); - props.setLook(tabFolder); - - // ------------------------------------------------------- // - // - TAB Settings START // - // ------------------------------------------------------- // - - // Settings-TAB - ANFANG - tbtmSettings = new CTabItem(tabFolder, SWT.NONE); - tbtmSettings.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.Title")); - - scrlSettingsComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); - scrlSettingsComp.setLayout(new FillLayout()); - props.setLook(scrlSettingsComp); - - settingsComp = new Composite(scrlSettingsComp, SWT.NONE); - props.setLook(settingsComp); - - FormLayout settingsLayout = new FormLayout(); - settingsLayout.marginWidth = 3; - settingsLayout.marginHeight = 3; - settingsComp.setLayout(settingsLayout); - - // Use AWS Credentials Provider Chain - // Credentials Chain - lblAWSCredChain = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSCredChain); - FormData fd_lblAWSCredChain = new FormData(); - fd_lblAWSCredChain.left = new FormAttachment(0, 0); - fd_lblAWSCredChain.top = new FormAttachment(0, margin); - fd_lblAWSCredChain.right = new FormAttachment(middle, -margin); - lblAWSCredChain.setLayoutData(fd_lblAWSCredChain); - lblAWSCredChain.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSCredChain.Label")); - - tAWSCredChain = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tAWSCredChain); - FormData fd_tAWSCredChain = new FormData(); - fd_tAWSCredChain.top = new FormAttachment(0, margin); - fd_tAWSCredChain.left = new FormAttachment(middle, 0); - fd_tAWSCredChain.right = new FormAttachment(100, 0); - tAWSCredChain.setLayoutData(fd_tAWSCredChain); - tAWSCredChain.setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSCredChain.Tooltip")); - tAWSCredChain.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent arg0) { - changeCredentialChainSelection(); - } + // ------------------------------------------------------- // + // SWT code for building the actual settings dialog // + // ------------------------------------------------------- // + FormLayout formLayout = new FormLayout(); + formLayout.marginWidth = Const.FORM_MARGIN; + formLayout.marginHeight = Const.FORM_MARGIN; + + shell.setLayout(formLayout); + shell.setText(BaseMessages.getString(PKG, "SQSReader.Shell.Title")); + + int middle = props.getMiddlePct(); + int margin = Const.MARGIN; + + // transformName line + wlTransformName = new Label(shell, SWT.RIGHT); + wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName")); + props.setLook(wlTransformName); + fdlTransformName = new FormData(); + fdlTransformName.left = new FormAttachment(0, 0); + fdlTransformName.right = new FormAttachment(middle, -margin); + fdlTransformName.top = new FormAttachment(0, margin); + wlTransformName.setLayoutData(fdlTransformName); + + wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wTransformName.setText(transformName); + props.setLook(wTransformName); + wTransformName.addModifyListener(lsMod); + fdTransformName = new FormData(); + fdTransformName.left = new FormAttachment(middle, 0); + fdTransformName.top = new FormAttachment(0, margin); + fdTransformName.right = new FormAttachment(100, 0); + wTransformName.setLayoutData(fdTransformName); + + // ------------------------------------------------------- // + // TABULATOREN START // + // ------------------------------------------------------- // + + // TABS - ANFANG + tabFolder = new CTabFolder(shell, SWT.BORDER); + FormData fd_tabFolder = new FormData(); + fd_tabFolder.right = new FormAttachment(100, 0); + fd_tabFolder.top = new FormAttachment(wTransformName, margin); + fd_tabFolder.left = new FormAttachment(0, 0); + fd_tabFolder.bottom = new FormAttachment(100, -50); + tabFolder.setLayoutData(fd_tabFolder); + props.setLook(tabFolder); + + // ------------------------------------------------------- // + // - TAB Settings START // + // ------------------------------------------------------- // + + // Settings-TAB - ANFANG + tbtmSettings = new CTabItem(tabFolder, SWT.NONE); + tbtmSettings.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.Title")); + + scrlSettingsComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); + scrlSettingsComp.setLayout(new FillLayout()); + props.setLook(scrlSettingsComp); + + settingsComp = new Composite(scrlSettingsComp, SWT.NONE); + props.setLook(settingsComp); + + FormLayout settingsLayout = new FormLayout(); + settingsLayout.marginWidth = 3; + settingsLayout.marginHeight = 3; + settingsComp.setLayout(settingsLayout); + + // Use AWS Credentials Provider Chain + // Credentials Chain + lblAWSCredChain = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSCredChain); + FormData fd_lblAWSCredChain = new FormData(); + fd_lblAWSCredChain.left = new FormAttachment(0, 0); + fd_lblAWSCredChain.top = new FormAttachment(0, margin); + fd_lblAWSCredChain.right = new FormAttachment(middle, -margin); + lblAWSCredChain.setLayoutData(fd_lblAWSCredChain); + lblAWSCredChain.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSCredChain.Label")); + + tAWSCredChain = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSCredChain); + FormData fd_tAWSCredChain = new FormData(); + fd_tAWSCredChain.top = new FormAttachment(0, margin); + fd_tAWSCredChain.left = new FormAttachment(middle, 0); + fd_tAWSCredChain.right = new FormAttachment(100, 0); + tAWSCredChain.setLayoutData(fd_tAWSCredChain); + tAWSCredChain.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSCredChain.Tooltip")); + tAWSCredChain.addModifyListener( + new ModifyListener() { + + @Override + public void modifyText(ModifyEvent arg0) { + changeCredentialChainSelection(); + } }); - // AWS Key - lblAWSKey = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSKey); - FormData fd_lblAWSKey = new FormData(); - fd_lblAWSKey.left = new FormAttachment(0, 0); - fd_lblAWSKey.top = new FormAttachment(tAWSCredChain, margin); - fd_lblAWSKey.right = new FormAttachment(middle, -margin); - lblAWSKey.setLayoutData(fd_lblAWSKey); - lblAWSKey.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKey.Label")); - - tAWSKey = new TextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tAWSKey); - FormData fd_tAWSKey = new FormData(); - fd_tAWSKey.top = new FormAttachment(tAWSCredChain, margin); - fd_tAWSKey.left = new FormAttachment(middle, 0); - fd_tAWSKey.right = new FormAttachment(100, 0); - tAWSKey.setLayoutData(fd_tAWSKey); - tAWSKey.setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKey.Tooltip")); - - // AWS Key Secret - lblAWSKeySecret = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSKeySecret); - FormData fd_lblAWSKeySecret = new FormData(); - fd_lblAWSKeySecret.left = new FormAttachment(0, 0); - fd_lblAWSKeySecret.top = new FormAttachment(tAWSKey, margin); - fd_lblAWSKeySecret.right = new FormAttachment(middle, -margin); - lblAWSKeySecret.setLayoutData(fd_lblAWSKeySecret); - lblAWSKeySecret.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKeySecret.Label")); - - tAWSKeySecret = new PasswordTextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tAWSKeySecret); - FormData fd_tAWSKeySecret = new FormData(); - fd_tAWSKeySecret.top = new FormAttachment(tAWSKey, margin); - fd_tAWSKeySecret.left = new FormAttachment(middle, 0); - fd_tAWSKeySecret.right = new FormAttachment(100, 0); - tAWSKeySecret.setLayoutData(fd_tAWSKeySecret); - tAWSKeySecret.setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKeySecret.Tooltip")); - - // AWS Region - lblAWSRegion = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblAWSRegion); - FormData fd_lblAWSRegion = new FormData(); - fd_lblAWSRegion.left = new FormAttachment(0, 0); - fd_lblAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); - fd_lblAWSRegion.right = new FormAttachment(middle, -margin); - lblAWSRegion.setLayoutData(fd_lblAWSRegion); - lblAWSRegion.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSRegion.Label")); - - tAWSRegion = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); - props.setLook(tAWSRegion); - FormData fd_tAWSRegion = new FormData(); - fd_tAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); - fd_tAWSRegion.left = new FormAttachment(middle, 0); - fd_tAWSRegion.right = new FormAttachment(100, 0); - tAWSRegion.setLayoutData(fd_tAWSRegion); - tAWSRegion - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSRegion.Tooltip")); - populateAWSRegion(tAWSRegion); - - // SQS Queue - lblSQSQueue = new Label(settingsComp, SWT.RIGHT); - props.setLook(lblSQSQueue); - FormData fd_lblSQSQueue = new FormData(); - fd_lblSQSQueue.left = new FormAttachment(0, 0); - fd_lblSQSQueue.top = new FormAttachment(tAWSRegion, margin); - fd_lblSQSQueue.right = new FormAttachment(middle, -margin); - lblSQSQueue.setLayoutData(fd_lblSQSQueue); - lblSQSQueue.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.SQSQueue.Label")); - - tSQSQueue = new TextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); - props.setLook(tSQSQueue); - FormData fd_tSQSQueue = new FormData(); - fd_tSQSQueue.top = new FormAttachment(tAWSRegion, margin); - fd_tSQSQueue.left = new FormAttachment(middle, 0); - fd_tSQSQueue.right = new FormAttachment(100, 0); - tSQSQueue.setLayoutData(fd_tSQSQueue); - tSQSQueue - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.SQSQueue.Tooltip")); - - Control[] queueTabList = new Control[] { tAWSCredChain, tAWSKey, tAWSKeySecret, tAWSRegion }; - settingsComp.setTabList(queueTabList); - - settingsComp.pack(); - Rectangle settingsBounds = settingsComp.getBounds(); - - scrlSettingsComp.setContent(settingsComp); - scrlSettingsComp.setExpandHorizontal(true); - scrlSettingsComp.setExpandVertical(true); - scrlSettingsComp.setMinWidth(settingsBounds.width); - scrlSettingsComp.setMinHeight(settingsBounds.height); - // Settings-TAB - ENDE - - - // ------------------------------------------------------- // - // - TAB Output START // - // ------------------------------------------------------- // - - // Output-TAB - ANFANG - tbtmReaderOutput = new CTabItem(tabFolder, SWT.NONE); - tbtmReaderOutput.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.Title")); - - scrlreaderOutputComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); - scrlreaderOutputComp.setLayout(new FillLayout()); - props.setLook(scrlreaderOutputComp); - - readerOutputComp = new Composite(scrlreaderOutputComp, SWT.NONE); - props.setLook(readerOutputComp); - - FormLayout ReaderOutputLayout = new FormLayout(); - ReaderOutputLayout.marginWidth = 3; - ReaderOutputLayout.marginHeight = 3; - readerOutputComp.setLayout(ReaderOutputLayout); - - // ------------------------------------------------------- // - // --- GROUP Output Settings START // - // ------------------------------------------------------- // - - grpOutputSettings = new Group(readerOutputComp, SWT.SHADOW_NONE); - props.setLook(grpOutputSettings); - grpOutputSettings.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.OutputSettings.GroupTitle")); - FormData fd_grpOutputSettings = new FormData(); - fd_grpOutputSettings.top = new FormAttachment(0, margin); - fd_grpOutputSettings.left = new FormAttachment(0, margin); - fd_grpOutputSettings.right = new FormAttachment(100, -margin); - fd_grpOutputSettings.bottom = new FormAttachment(40, -margin); - grpOutputSettings.setLayoutData(fd_grpOutputSettings); - - FormLayout outputSettingsLayout = new FormLayout(); - outputSettingsLayout.marginWidth = 10; - outputSettingsLayout.marginHeight = 10; - grpOutputSettings.setLayout(outputSettingsLayout); - - // FELDER - // Message Deletion - lblMessageDelete = new Label(grpOutputSettings, SWT.RIGHT); - props.setLook(lblMessageDelete); - FormData fd_lblMessageDelete = new FormData(); - fd_lblMessageDelete.left = new FormAttachment(0, 0); - fd_lblMessageDelete.top = new FormAttachment(0, margin); - fd_lblMessageDelete.right = new FormAttachment(middle, -margin); - lblMessageDelete.setLayoutData(fd_lblMessageDelete); - lblMessageDelete.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageDelete.Label")); - - tMessageDelete = new ComboVar(variables, grpOutputSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tMessageDelete); - FormData fd_tMessageDelete = new FormData(); - fd_tMessageDelete.top = new FormAttachment(0, margin); - fd_tMessageDelete.left = new FormAttachment(middle, 0); - fd_tMessageDelete.right = new FormAttachment(100, 0); - tMessageDelete.setLayoutData(fd_tMessageDelete); - tMessageDelete.setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageDelete.Tooltip")); - - // Max Messages - lblMaxMessages = new Label(grpOutputSettings, SWT.RIGHT); - props.setLook(lblMaxMessages); - FormData fd_lblMaxMessages = new FormData(); - fd_lblMaxMessages.left = new FormAttachment(0, 0); - fd_lblMaxMessages.top = new FormAttachment(tMessageDelete, margin); - fd_lblMaxMessages.right = new FormAttachment(middle, -margin); - lblMaxMessages.setLayoutData(fd_lblMaxMessages); - lblMaxMessages.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MaxMessages.Label")); - - tMaxMessages = new TextVar(variables, grpOutputSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tMaxMessages); - FormData fd_tMaxMessages = new FormData(); - fd_tMaxMessages.top = new FormAttachment(tMessageDelete, margin); - fd_tMaxMessages.left = new FormAttachment(middle, 0); - fd_tMaxMessages.right = new FormAttachment(100, 0); - tMaxMessages.setLayoutData(fd_tMaxMessages); - tMaxMessages.setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MaxMessages.Tooltip")); - - Control[] readerSettingsTabList = new Control[] { tMessageDelete, tMaxMessages }; - grpOutputSettings.setTabList(readerSettingsTabList); - - // ------------------------------------------------------- // - // --- GROUP Output Fields START // - // ------------------------------------------------------- // - - grpOutputField = new Group(readerOutputComp, SWT.SHADOW_NONE); - props.setLook(grpOutputField); - grpOutputField.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.OutputFields.GroupTitle")); - FormData fd_grpOutputField = new FormData(); - fd_grpOutputField.top = new FormAttachment(40, margin); - fd_grpOutputField.left = new FormAttachment(0, margin); - fd_grpOutputField.right = new FormAttachment(100, -margin); - fd_grpOutputField.bottom = new FormAttachment(100, -margin); - grpOutputField.setLayoutData(fd_grpOutputField); - - FormLayout outputFieldsLayout = new FormLayout(); - outputFieldsLayout.marginWidth = 10; - outputFieldsLayout.marginHeight = 10; - grpOutputField.setLayout(outputFieldsLayout); - - // FELDER - // MessageID - lblMessageID = new Label(grpOutputField, SWT.RIGHT); - props.setLook(lblMessageID); - FormData fd_lblMessageID = new FormData(); - fd_lblMessageID.left = new FormAttachment(0, 0); - fd_lblMessageID.top = new FormAttachment(0, margin); - fd_lblMessageID.right = new FormAttachment(middle, -margin); - lblMessageID.setLayoutData(fd_lblMessageID); - lblMessageID.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageID.Label")); - - tMessageID = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tMessageID); - FormData fd_tMessageID = new FormData(); - fd_tMessageID.top = new FormAttachment(0, margin); - fd_tMessageID.left = new FormAttachment(middle, 0); - fd_tMessageID.right = new FormAttachment(100, 0); - tMessageID.setLayoutData(fd_tMessageID); - tMessageID - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageID.Tooltip")); - - // MessageBody - lblMessageBody = new Label(grpOutputField, SWT.RIGHT); - props.setLook(lblMessageBody); - FormData fd_lblMessageBody = new FormData(); - fd_lblMessageBody.left = new FormAttachment(0, 0); - fd_lblMessageBody.top = new FormAttachment(tMessageID, margin); - fd_lblMessageBody.right = new FormAttachment(middle, -margin); - lblMessageBody.setLayoutData(fd_lblMessageBody); - lblMessageBody.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageBody.Label")); - - tMessageBody = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tMessageBody); - FormData fd_tMessageBody = new FormData(); - fd_tMessageBody.top = new FormAttachment(tMessageID, margin); - fd_tMessageBody.left = new FormAttachment(middle, 0); - fd_tMessageBody.right = new FormAttachment(100, 0); - tMessageBody.setLayoutData(fd_tMessageBody); - tMessageBody - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageBody.Tooltip")); - - // ReceiptHandle - lblReceiptHandle = new Label(grpOutputField, SWT.RIGHT); - props.setLook(lblReceiptHandle); - FormData fd_lblReceiptHandle = new FormData(); - fd_lblReceiptHandle.left = new FormAttachment(0, 0); - fd_lblReceiptHandle.top = new FormAttachment(tMessageBody, margin); - fd_lblReceiptHandle.right = new FormAttachment(middle, -margin); - lblReceiptHandle.setLayoutData(fd_lblReceiptHandle); - lblReceiptHandle.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.ReceiptHandle.Label")); - - tReceiptHandle = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tReceiptHandle); - FormData fd_tReceiptHandle = new FormData(); - fd_tReceiptHandle.top = new FormAttachment(tMessageBody, margin); - fd_tReceiptHandle.left = new FormAttachment(middle, 0); - fd_tReceiptHandle.right = new FormAttachment(100, 0); - tReceiptHandle.setLayoutData(fd_tReceiptHandle); - tReceiptHandle - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.ReceiptHandle.Tooltip")); - - // BodyMD5 - lblBodyMD5 = new Label(grpOutputField, SWT.RIGHT); - props.setLook(lblBodyMD5); - FormData fd_lblBodyMD5 = new FormData(); - fd_lblBodyMD5.left = new FormAttachment(0, 0); - fd_lblBodyMD5.top = new FormAttachment(tReceiptHandle, margin); - fd_lblBodyMD5.right = new FormAttachment(middle, -margin); - lblBodyMD5.setLayoutData(fd_lblBodyMD5); - lblBodyMD5.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.BodyMD5.Label")); - - tBodyMD5 = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tBodyMD5); - FormData fd_tBodyMD5 = new FormData(); - fd_tBodyMD5.top = new FormAttachment(tReceiptHandle, margin); - fd_tBodyMD5.left = new FormAttachment(middle, 0); - fd_tBodyMD5.right = new FormAttachment(100, 0); - tBodyMD5.setLayoutData(fd_tBodyMD5); - tBodyMD5 - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.BodyMD5.Tooltip")); - - // SNSMessage - lblSNSMessage = new Label(grpOutputField, SWT.RIGHT); - props.setLook(lblSNSMessage); - FormData fd_lblSNSMessage = new FormData(); - fd_lblSNSMessage.left = new FormAttachment(0, 0); - fd_lblSNSMessage.top = new FormAttachment(tBodyMD5, margin); - fd_lblSNSMessage.right = new FormAttachment(middle, -margin); - lblSNSMessage.setLayoutData(fd_lblSNSMessage); - lblSNSMessage.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.SNSMessage.Label")); - - tSNSMessage = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - props.setLook(tSNSMessage); - FormData fd_tSNSMessage = new FormData(); - fd_tSNSMessage.top = new FormAttachment(tBodyMD5, margin); - fd_tSNSMessage.left = new FormAttachment(middle, 0); - fd_tSNSMessage.right = new FormAttachment(100, 0); - tSNSMessage.setLayoutData(fd_tSNSMessage); - tSNSMessage - .setToolTipText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.SNSMessage.Tooltip")); - - Control[] readerOutputTabList = new Control[] { tMessageID, tMessageBody, tReceiptHandle, tBodyMD5, tSNSMessage }; - grpOutputField.setTabList(readerOutputTabList); - - - - readerOutputComp.pack(); - Rectangle ReaderOutputBounds = readerOutputComp.getBounds(); - - scrlreaderOutputComp.setContent(readerOutputComp); - scrlreaderOutputComp.setExpandHorizontal(true); - scrlreaderOutputComp.setExpandVertical(true); - scrlreaderOutputComp.setMinWidth(ReaderOutputBounds.width); - scrlreaderOutputComp.setMinHeight(ReaderOutputBounds.height); - // ReaderOutput-TAB - Ende - - scrlSettingsComp.layout(); - tbtmSettings.setControl(scrlSettingsComp); - - scrlreaderOutputComp.layout(); - tbtmReaderOutput.setControl(scrlreaderOutputComp); - - tabFolder.setSelection(0); - - // TABS ENDE - - // OK and cancel buttons - wOk = new Button(shell, SWT.PUSH); - wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); - wCancel = new Button(shell, SWT.PUSH); - wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); - - BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null); - - // Add listeners for cancel and OK - wOk.addListener(SWT.Selection, c -> ok()); - wCancel.addListener(SWT.Selection, c -> cancel()); - - // default listener (for hitting "enter") - SelectionAdapter lsDef = new SelectionAdapter() { - public void widgetDefaultSelected(SelectionEvent e) {ok();} + // AWS Key + lblAWSKey = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSKey); + FormData fd_lblAWSKey = new FormData(); + fd_lblAWSKey.left = new FormAttachment(0, 0); + fd_lblAWSKey.top = new FormAttachment(tAWSCredChain, margin); + fd_lblAWSKey.right = new FormAttachment(middle, -margin); + lblAWSKey.setLayoutData(fd_lblAWSKey); + lblAWSKey.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKey.Label")); + + tAWSKey = new TextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSKey); + FormData fd_tAWSKey = new FormData(); + fd_tAWSKey.top = new FormAttachment(tAWSCredChain, margin); + fd_tAWSKey.left = new FormAttachment(middle, 0); + fd_tAWSKey.right = new FormAttachment(100, 0); + tAWSKey.setLayoutData(fd_tAWSKey); + tAWSKey.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKey.Tooltip")); + + // AWS Key Secret + lblAWSKeySecret = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSKeySecret); + FormData fd_lblAWSKeySecret = new FormData(); + fd_lblAWSKeySecret.left = new FormAttachment(0, 0); + fd_lblAWSKeySecret.top = new FormAttachment(tAWSKey, margin); + fd_lblAWSKeySecret.right = new FormAttachment(middle, -margin); + lblAWSKeySecret.setLayoutData(fd_lblAWSKeySecret); + lblAWSKeySecret.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKeySecret.Label")); + + tAWSKeySecret = + new PasswordTextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSKeySecret); + FormData fd_tAWSKeySecret = new FormData(); + fd_tAWSKeySecret.top = new FormAttachment(tAWSKey, margin); + fd_tAWSKeySecret.left = new FormAttachment(middle, 0); + fd_tAWSKeySecret.right = new FormAttachment(100, 0); + tAWSKeySecret.setLayoutData(fd_tAWSKeySecret); + tAWSKeySecret.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSKeySecret.Tooltip")); + + // AWS Region + lblAWSRegion = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblAWSRegion); + FormData fd_lblAWSRegion = new FormData(); + fd_lblAWSRegion.left = new FormAttachment(0, 0); + fd_lblAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); + fd_lblAWSRegion.right = new FormAttachment(middle, -margin); + lblAWSRegion.setLayoutData(fd_lblAWSRegion); + lblAWSRegion.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSRegion.Label")); + + tAWSRegion = new ComboVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tAWSRegion); + FormData fd_tAWSRegion = new FormData(); + fd_tAWSRegion.top = new FormAttachment(tAWSKeySecret, margin); + fd_tAWSRegion.left = new FormAttachment(middle, 0); + fd_tAWSRegion.right = new FormAttachment(100, 0); + tAWSRegion.setLayoutData(fd_tAWSRegion); + tAWSRegion.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.AWSRegion.Tooltip")); + populateAWSRegion(tAWSRegion); + + // SQS Queue + lblSQSQueue = new Label(settingsComp, SWT.RIGHT); + props.setLook(lblSQSQueue); + FormData fd_lblSQSQueue = new FormData(); + fd_lblSQSQueue.left = new FormAttachment(0, 0); + fd_lblSQSQueue.top = new FormAttachment(tAWSRegion, margin); + fd_lblSQSQueue.right = new FormAttachment(middle, -margin); + lblSQSQueue.setLayoutData(fd_lblSQSQueue); + lblSQSQueue.setText(BaseMessages.getString(PKG, "SQSReaderTransform.Settings.SQSQueue.Label")); + + tSQSQueue = new TextVar(variables, settingsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tSQSQueue); + FormData fd_tSQSQueue = new FormData(); + fd_tSQSQueue.top = new FormAttachment(tAWSRegion, margin); + fd_tSQSQueue.left = new FormAttachment(middle, 0); + fd_tSQSQueue.right = new FormAttachment(100, 0); + tSQSQueue.setLayoutData(fd_tSQSQueue); + tSQSQueue.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.Settings.SQSQueue.Tooltip")); + + Control[] queueTabList = new Control[] {tAWSCredChain, tAWSKey, tAWSKeySecret, tAWSRegion}; + settingsComp.setTabList(queueTabList); + + settingsComp.pack(); + Rectangle settingsBounds = settingsComp.getBounds(); + + scrlSettingsComp.setContent(settingsComp); + scrlSettingsComp.setExpandHorizontal(true); + scrlSettingsComp.setExpandVertical(true); + scrlSettingsComp.setMinWidth(settingsBounds.width); + scrlSettingsComp.setMinHeight(settingsBounds.height); + // Settings-TAB - ENDE + + // ------------------------------------------------------- // + // - TAB Output START // + // ------------------------------------------------------- // + + // Output-TAB - ANFANG + tbtmReaderOutput = new CTabItem(tabFolder, SWT.NONE); + tbtmReaderOutput.setText(BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.Title")); + + scrlreaderOutputComp = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); + scrlreaderOutputComp.setLayout(new FillLayout()); + props.setLook(scrlreaderOutputComp); + + readerOutputComp = new Composite(scrlreaderOutputComp, SWT.NONE); + props.setLook(readerOutputComp); + + FormLayout ReaderOutputLayout = new FormLayout(); + ReaderOutputLayout.marginWidth = 3; + ReaderOutputLayout.marginHeight = 3; + readerOutputComp.setLayout(ReaderOutputLayout); + + // ------------------------------------------------------- // + // --- GROUP Output Settings START // + // ------------------------------------------------------- // + + grpOutputSettings = new Group(readerOutputComp, SWT.SHADOW_NONE); + props.setLook(grpOutputSettings); + grpOutputSettings.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.OutputSettings.GroupTitle")); + FormData fd_grpOutputSettings = new FormData(); + fd_grpOutputSettings.top = new FormAttachment(0, margin); + fd_grpOutputSettings.left = new FormAttachment(0, margin); + fd_grpOutputSettings.right = new FormAttachment(100, -margin); + fd_grpOutputSettings.bottom = new FormAttachment(40, -margin); + grpOutputSettings.setLayoutData(fd_grpOutputSettings); + + FormLayout outputSettingsLayout = new FormLayout(); + outputSettingsLayout.marginWidth = 10; + outputSettingsLayout.marginHeight = 10; + grpOutputSettings.setLayout(outputSettingsLayout); + + // FELDER + // Message Deletion + lblMessageDelete = new Label(grpOutputSettings, SWT.RIGHT); + props.setLook(lblMessageDelete); + FormData fd_lblMessageDelete = new FormData(); + fd_lblMessageDelete.left = new FormAttachment(0, 0); + fd_lblMessageDelete.top = new FormAttachment(0, margin); + fd_lblMessageDelete.right = new FormAttachment(middle, -margin); + lblMessageDelete.setLayoutData(fd_lblMessageDelete); + lblMessageDelete.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageDelete.Label")); + + tMessageDelete = new ComboVar(variables, grpOutputSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tMessageDelete); + FormData fd_tMessageDelete = new FormData(); + fd_tMessageDelete.top = new FormAttachment(0, margin); + fd_tMessageDelete.left = new FormAttachment(middle, 0); + fd_tMessageDelete.right = new FormAttachment(100, 0); + tMessageDelete.setLayoutData(fd_tMessageDelete); + tMessageDelete.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageDelete.Tooltip")); + + // Max Messages + lblMaxMessages = new Label(grpOutputSettings, SWT.RIGHT); + props.setLook(lblMaxMessages); + FormData fd_lblMaxMessages = new FormData(); + fd_lblMaxMessages.left = new FormAttachment(0, 0); + fd_lblMaxMessages.top = new FormAttachment(tMessageDelete, margin); + fd_lblMaxMessages.right = new FormAttachment(middle, -margin); + lblMaxMessages.setLayoutData(fd_lblMaxMessages); + lblMaxMessages.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MaxMessages.Label")); + + tMaxMessages = new TextVar(variables, grpOutputSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tMaxMessages); + FormData fd_tMaxMessages = new FormData(); + fd_tMaxMessages.top = new FormAttachment(tMessageDelete, margin); + fd_tMaxMessages.left = new FormAttachment(middle, 0); + fd_tMaxMessages.right = new FormAttachment(100, 0); + tMaxMessages.setLayoutData(fd_tMaxMessages); + tMaxMessages.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MaxMessages.Tooltip")); + + Control[] readerSettingsTabList = new Control[] {tMessageDelete, tMaxMessages}; + grpOutputSettings.setTabList(readerSettingsTabList); + + // ------------------------------------------------------- // + // --- GROUP Output Fields START // + // ------------------------------------------------------- // + + grpOutputField = new Group(readerOutputComp, SWT.SHADOW_NONE); + props.setLook(grpOutputField); + grpOutputField.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.OutputFields.GroupTitle")); + FormData fd_grpOutputField = new FormData(); + fd_grpOutputField.top = new FormAttachment(40, margin); + fd_grpOutputField.left = new FormAttachment(0, margin); + fd_grpOutputField.right = new FormAttachment(100, -margin); + fd_grpOutputField.bottom = new FormAttachment(100, -margin); + grpOutputField.setLayoutData(fd_grpOutputField); + + FormLayout outputFieldsLayout = new FormLayout(); + outputFieldsLayout.marginWidth = 10; + outputFieldsLayout.marginHeight = 10; + grpOutputField.setLayout(outputFieldsLayout); + + // FELDER + // MessageID + lblMessageID = new Label(grpOutputField, SWT.RIGHT); + props.setLook(lblMessageID); + FormData fd_lblMessageID = new FormData(); + fd_lblMessageID.left = new FormAttachment(0, 0); + fd_lblMessageID.top = new FormAttachment(0, margin); + fd_lblMessageID.right = new FormAttachment(middle, -margin); + lblMessageID.setLayoutData(fd_lblMessageID); + lblMessageID.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageID.Label")); + + tMessageID = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tMessageID); + FormData fd_tMessageID = new FormData(); + fd_tMessageID.top = new FormAttachment(0, margin); + fd_tMessageID.left = new FormAttachment(middle, 0); + fd_tMessageID.right = new FormAttachment(100, 0); + tMessageID.setLayoutData(fd_tMessageID); + tMessageID.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageID.Tooltip")); + + // MessageBody + lblMessageBody = new Label(grpOutputField, SWT.RIGHT); + props.setLook(lblMessageBody); + FormData fd_lblMessageBody = new FormData(); + fd_lblMessageBody.left = new FormAttachment(0, 0); + fd_lblMessageBody.top = new FormAttachment(tMessageID, margin); + fd_lblMessageBody.right = new FormAttachment(middle, -margin); + lblMessageBody.setLayoutData(fd_lblMessageBody); + lblMessageBody.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageBody.Label")); + + tMessageBody = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tMessageBody); + FormData fd_tMessageBody = new FormData(); + fd_tMessageBody.top = new FormAttachment(tMessageID, margin); + fd_tMessageBody.left = new FormAttachment(middle, 0); + fd_tMessageBody.right = new FormAttachment(100, 0); + tMessageBody.setLayoutData(fd_tMessageBody); + tMessageBody.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.MessageBody.Tooltip")); + + // ReceiptHandle + lblReceiptHandle = new Label(grpOutputField, SWT.RIGHT); + props.setLook(lblReceiptHandle); + FormData fd_lblReceiptHandle = new FormData(); + fd_lblReceiptHandle.left = new FormAttachment(0, 0); + fd_lblReceiptHandle.top = new FormAttachment(tMessageBody, margin); + fd_lblReceiptHandle.right = new FormAttachment(middle, -margin); + lblReceiptHandle.setLayoutData(fd_lblReceiptHandle); + lblReceiptHandle.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.ReceiptHandle.Label")); + + tReceiptHandle = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tReceiptHandle); + FormData fd_tReceiptHandle = new FormData(); + fd_tReceiptHandle.top = new FormAttachment(tMessageBody, margin); + fd_tReceiptHandle.left = new FormAttachment(middle, 0); + fd_tReceiptHandle.right = new FormAttachment(100, 0); + tReceiptHandle.setLayoutData(fd_tReceiptHandle); + tReceiptHandle.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.ReceiptHandle.Tooltip")); + + // BodyMD5 + lblBodyMD5 = new Label(grpOutputField, SWT.RIGHT); + props.setLook(lblBodyMD5); + FormData fd_lblBodyMD5 = new FormData(); + fd_lblBodyMD5.left = new FormAttachment(0, 0); + fd_lblBodyMD5.top = new FormAttachment(tReceiptHandle, margin); + fd_lblBodyMD5.right = new FormAttachment(middle, -margin); + lblBodyMD5.setLayoutData(fd_lblBodyMD5); + lblBodyMD5.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.BodyMD5.Label")); + + tBodyMD5 = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tBodyMD5); + FormData fd_tBodyMD5 = new FormData(); + fd_tBodyMD5.top = new FormAttachment(tReceiptHandle, margin); + fd_tBodyMD5.left = new FormAttachment(middle, 0); + fd_tBodyMD5.right = new FormAttachment(100, 0); + tBodyMD5.setLayoutData(fd_tBodyMD5); + tBodyMD5.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.BodyMD5.Tooltip")); + + // SNSMessage + lblSNSMessage = new Label(grpOutputField, SWT.RIGHT); + props.setLook(lblSNSMessage); + FormData fd_lblSNSMessage = new FormData(); + fd_lblSNSMessage.left = new FormAttachment(0, 0); + fd_lblSNSMessage.top = new FormAttachment(tBodyMD5, margin); + fd_lblSNSMessage.right = new FormAttachment(middle, -margin); + lblSNSMessage.setLayoutData(fd_lblSNSMessage); + lblSNSMessage.setText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.SNSMessage.Label")); + + tSNSMessage = new TextVar(variables, grpOutputField, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + props.setLook(tSNSMessage); + FormData fd_tSNSMessage = new FormData(); + fd_tSNSMessage.top = new FormAttachment(tBodyMD5, margin); + fd_tSNSMessage.left = new FormAttachment(middle, 0); + fd_tSNSMessage.right = new FormAttachment(100, 0); + tSNSMessage.setLayoutData(fd_tSNSMessage); + tSNSMessage.setToolTipText( + BaseMessages.getString(PKG, "SQSReaderTransform.ReaderOutput.SNSMessage.Tooltip")); + + Control[] readerOutputTabList = + new Control[] {tMessageID, tMessageBody, tReceiptHandle, tBodyMD5, tSNSMessage}; + grpOutputField.setTabList(readerOutputTabList); + + readerOutputComp.pack(); + Rectangle ReaderOutputBounds = readerOutputComp.getBounds(); + + scrlreaderOutputComp.setContent(readerOutputComp); + scrlreaderOutputComp.setExpandHorizontal(true); + scrlreaderOutputComp.setExpandVertical(true); + scrlreaderOutputComp.setMinWidth(ReaderOutputBounds.width); + scrlreaderOutputComp.setMinHeight(ReaderOutputBounds.height); + // ReaderOutput-TAB - Ende + + scrlSettingsComp.layout(); + tbtmSettings.setControl(scrlSettingsComp); + + scrlreaderOutputComp.layout(); + tbtmReaderOutput.setControl(scrlreaderOutputComp); + + tabFolder.setSelection(0); + + // TABS ENDE + + // OK and cancel buttons + wOk = new Button(shell, SWT.PUSH); + wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); + wCancel = new Button(shell, SWT.PUSH); + wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); + + BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null); + + // Add listeners for cancel and OK + wOk.addListener(SWT.Selection, c -> ok()); + wCancel.addListener(SWT.Selection, c -> cancel()); + + // default listener (for hitting "enter") + SelectionAdapter lsDef = + new SelectionAdapter() { + public void widgetDefaultSelected(SelectionEvent e) { + ok(); + } }; - wTransformName.addSelectionListener(lsDef); - tAWSKey.addSelectionListener(lsDef); - tAWSKeySecret.addSelectionListener(lsDef); - tAWSRegion.addSelectionListener(lsDef); - - // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly - shell.addShellListener(new ShellAdapter() { - public void shellClosed(ShellEvent e) {cancel();} + wTransformName.addSelectionListener(lsDef); + tAWSKey.addSelectionListener(lsDef); + tAWSKeySecret.addSelectionListener(lsDef); + tAWSRegion.addSelectionListener(lsDef); + + // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly + shell.addShellListener( + new ShellAdapter() { + public void shellClosed(ShellEvent e) { + cancel(); + } }); - // Set/Restore the dialog size based on last position on screen - // The setSize() method is inherited from BaseTransformDialog - setSize(); + // Set/Restore the dialog size based on last position on screen + // The setSize() method is inherited from BaseTransformDialog + setSize(); - // populate the dialog with the values from the meta object - populateYesNoSelection(); - populateDialog(); + // populate the dialog with the values from the meta object + populateYesNoSelection(); + populateDialog(); - // restore the changed flag to original value, as the modify listeners fire during dialog population - meta.setChanged(changed); + // restore the changed flag to original value, as the modify listeners fire during dialog + // population + meta.setChanged(changed); - // open dialog and enter event loop - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - // at this point the dialog has closed, so either ok() or cancel() have been executed - // The "transformName" variable is inherited from BaseTransformDialog - return transformName; + // open dialog and enter event loop + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) display.sleep(); } - protected void changeCredentialChainSelection() { - // Output-Info set in fields - if (tAWSCredChain.getText().equalsIgnoreCase("Y")) { - - // Settings-Fields - lblAWSKey.setEnabled(false); - tAWSKey.setEnabled(false); - lblAWSKeySecret.setEnabled(false); - tAWSKeySecret.setEnabled(false); - lblAWSRegion.setEnabled(false); - tAWSRegion.setEnabled(false); - - // Output-Info set in Config - } else { - - // Settings-Fields - lblAWSKey.setEnabled(true); - tAWSKey.setEnabled(true); - lblAWSKeySecret.setEnabled(true); - tAWSKeySecret.setEnabled(true); - lblAWSRegion.setEnabled(true); - tAWSRegion.setEnabled(true); - - } - - meta.setChanged(); - - } - - private void populateYesNoSelection() { - - tAWSCredChain.removeAll(); - tAWSCredChain.add("Y"); - tAWSCredChain.add("N"); - tAWSCredChain.select(0); - - tMessageDelete.removeAll(); - tMessageDelete.add("Y"); - tMessageDelete.add("N"); - tMessageDelete.select(0); + // at this point the dialog has closed, so either ok() or cancel() have been executed + // The "transformName" variable is inherited from BaseTransformDialog + return transformName; + } + + protected void changeCredentialChainSelection() { + // Output-Info set in fields + if (tAWSCredChain.getText().equalsIgnoreCase("Y")) { + + // Settings-Fields + lblAWSKey.setEnabled(false); + tAWSKey.setEnabled(false); + lblAWSKeySecret.setEnabled(false); + tAWSKeySecret.setEnabled(false); + lblAWSRegion.setEnabled(false); + tAWSRegion.setEnabled(false); + + // Output-Info set in Config + } else { + + // Settings-Fields + lblAWSKey.setEnabled(true); + tAWSKey.setEnabled(true); + lblAWSKeySecret.setEnabled(true); + tAWSKeySecret.setEnabled(true); + lblAWSRegion.setEnabled(true); + tAWSRegion.setEnabled(true); } - /** - * This method fills the CombarVar with all available AWS Regions - * - * @param ComboVar tAWSRegion2 - */ - private void populateAWSRegion(ComboVar tAWSRegion2) { - - tAWSRegion2.removeAll(); + meta.setChanged(); + } - try { + private void populateYesNoSelection() { - List snsRegions = RegionUtils.getRegionsForService(AmazonSQS.ENDPOINT_PREFIX); + tAWSCredChain.removeAll(); + tAWSCredChain.add("Y"); + tAWSCredChain.add("N"); + tAWSCredChain.select(0); - for (Iterator i = snsRegions.iterator(); i.hasNext();) { - Region region = i.next(); - tAWSRegion2.add(region.getName()); - } + tMessageDelete.removeAll(); + tMessageDelete.add("Y"); + tMessageDelete.add("N"); + tMessageDelete.select(0); + } - } catch (AmazonClientException e) { - logError(BaseMessages.getString(PKG, e.getMessage())); - } + /** + * This method fills the CombarVar with all available AWS Regions + * + * @param ComboVar tAWSRegion2 + */ + private void populateAWSRegion(ComboVar tAWSRegion2) { - } - - /** - * This helper method puts the transform configuration stored in the meta object - * and puts it into the dialog controls. - */ - private void populateDialog() { - wTransformName.selectAll(); - - tAWSCredChain.setText(meta.getAwsCredChain()); - tAWSKey.setText(meta.getAwsKey()); - tAWSKeySecret.setText(meta.getAwsKeySecret()); - tAWSRegion.setText(meta.getAwsRegion()); - tSQSQueue.setText(meta.getSqsQueue()); + tAWSRegion2.removeAll(); - tMessageDelete.setText(meta.getTFldMessageDelete()); - tMaxMessages.setText(meta.getTFldMaxMessages()); + try { - tMessageID.setText(meta.getTFldMessageID()); - tMessageBody.setText(meta.getTFldMessageBody()); - tReceiptHandle.setText(meta.getTFldReceiptHandle()); - tBodyMD5.setText(meta.getTFldBodyMD5()); - tSNSMessage.setText(meta.getTFldSNSMessage()); + List snsRegions = RegionUtils.getRegionsForService(AmazonSQS.ENDPOINT_PREFIX); - } - - /** - * Called when the user cancels the dialog. - */ - private void cancel() { - // The "transformName" variable will be the return value for the open() method. - // Setting to null to indicate that dialog was cancelled. - transformName = null; - // Restoring original "changed" flag on the met aobject - meta.setChanged(changed); - // close the SWT dialog window - dispose(); - } + for (Iterator i = snsRegions.iterator(); i.hasNext(); ) { + Region region = i.next(); + tAWSRegion2.add(region.getName()); + } - /** - * Called when the user confirms the dialog - */ - private void ok() { - // The "transformName" variable will be the return value for the open() method. - // Setting to transform name from the dialog control - transformName = wTransformName.getText(); - - // Setting the settings to the meta object - meta.setAwsCredChain(tAWSCredChain.getText()); - meta.setAwsKey(tAWSKey.getText()); - meta.setAwsKeySecret(tAWSKeySecret.getText()); - meta.setAwsRegion(tAWSRegion.getText()); - meta.setSqsQueue(tSQSQueue.getText()); - - meta.setTFldMessageDelete(tMessageDelete.getText()); - meta.setTFldMaxMessages(tMaxMessages.getText()); - - meta.setTFldMessageID(tMessageID.getText()); - meta.setTFldMessageBody(tMessageBody.getText()); - meta.setTFldReceiptHandle(tReceiptHandle.getText()); - meta.setTFldBodyMD5(tBodyMD5.getText()); - meta.setTFldSNSMessage(tSNSMessage.getText()); - - // close the SWT dialog window - dispose(); + } catch (AmazonClientException e) { + logError(BaseMessages.getString(PKG, e.getMessage())); } + } + + /** + * This helper method puts the transform configuration stored in the meta object and puts it into + * the dialog controls. + */ + private void populateDialog() { + wTransformName.selectAll(); + + tAWSCredChain.setText(meta.getAwsCredChain()); + tAWSKey.setText(meta.getAwsKey()); + tAWSKeySecret.setText(meta.getAwsKeySecret()); + tAWSRegion.setText(meta.getAwsRegion()); + tSQSQueue.setText(meta.getSqsQueue()); + + tMessageDelete.setText(meta.getTFldMessageDelete()); + tMaxMessages.setText(meta.getTFldMaxMessages()); + + tMessageID.setText(meta.getTFldMessageID()); + tMessageBody.setText(meta.getTFldMessageBody()); + tReceiptHandle.setText(meta.getTFldReceiptHandle()); + tBodyMD5.setText(meta.getTFldBodyMD5()); + tSNSMessage.setText(meta.getTFldSNSMessage()); + } + + /** Called when the user cancels the dialog. */ + private void cancel() { + // The "transformName" variable will be the return value for the open() method. + // Setting to null to indicate that dialog was cancelled. + transformName = null; + // Restoring original "changed" flag on the met aobject + meta.setChanged(changed); + // close the SWT dialog window + dispose(); + } + + /** Called when the user confirms the dialog */ + private void ok() { + // The "transformName" variable will be the return value for the open() method. + // Setting to transform name from the dialog control + transformName = wTransformName.getText(); + + // Setting the settings to the meta object + meta.setAwsCredChain(tAWSCredChain.getText()); + meta.setAwsKey(tAWSKey.getText()); + meta.setAwsKeySecret(tAWSKeySecret.getText()); + meta.setAwsRegion(tAWSRegion.getText()); + meta.setSqsQueue(tSQSQueue.getText()); + + meta.setTFldMessageDelete(tMessageDelete.getText()); + meta.setTFldMaxMessages(tMaxMessages.getText()); + + meta.setTFldMessageID(tMessageID.getText()); + meta.setTFldMessageBody(tMessageBody.getText()); + meta.setTFldReceiptHandle(tReceiptHandle.getText()); + meta.setTFldBodyMD5(tBodyMD5.getText()); + meta.setTFldSNSMessage(tSNSMessage.getText()); + + // close the SWT dialog window + dispose(); + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderMeta.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderMeta.java index 41a3c8534e3..6e922eb9409 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderMeta.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/aws/sqs/SqsReaderMeta.java @@ -30,287 +30,267 @@ import org.apache.hop.pipeline.transform.TransformMeta; @Transform( - id = "AwsSqSreader", - image = "aws-sqs.svg", - name= "i18n::SQSReaderTransform.Name", - description = "i18n::SQSReaderTransform.TooltipDesc", - categoryDescription="i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", - keywords = "", - documentationUrl="/pipeline/transforms/aws-sqs-reader.html" -) + id = "AwsSqSreader", + image = "aws-sqs.svg", + name = "i18n::SQSReaderTransform.Name", + description = "i18n::SQSReaderTransform.TooltipDesc", + categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", + keywords = "", + documentationUrl = "/pipeline/transforms/aws-sqs-reader.html") public class SqsReaderMeta extends BaseTransformMeta { - /** - * The PKG member is used when looking up internationalized strings. - * The properties file with localized keys is expected to reside in - * {the package of the class specified}/messages/messages_{locale}.properties - */ - private static Class PKG = SqsReaderMeta.class; // for i18n purposes - - @HopMetadataProperty( - key = "AwsCredChain", - injectionKey = "AWS_CRED_CHAIN" - ) - private String awsCredChain; - @HopMetadataProperty( - key = "aws_key", - injectionKey = "AWS_KEY" - ) - private String awsKey; - @HopMetadataProperty( - key = "aws_key_secret", - injectionKey = "AWS_KEY_SECRET" - ) - private String awsKeySecret; - @HopMetadataProperty( - key = "aws_region", - injectionKey = "AWS_REGION" - ) - private String awsRegion; - @HopMetadataProperty( - key = "sqs_queue", - injectionKey = "SQS_QUEUE" - ) - private String sqsQueue; - @HopMetadataProperty( - key = "field_message_id", - injectionKey = "FIELD_MESSAGE_ID" - ) - private String tFldMessageID; - @HopMetadataProperty( - key = "field_message_body", - injectionKey = "FIELD_MESSAGE_BODY" - ) - private String tFldMessageBody; - @HopMetadataProperty( - key = "field_receipt_handle", - injectionKey = "FIELD_RECEIPT_HANDLE" - ) - private String tFldReceiptHandle; - @HopMetadataProperty( - key = "field_body_md5", - injectionKey = "FIELD_BODY_MD5" - ) - private String tFldBodyMD5; - @HopMetadataProperty( - key = "field_sns_messages", - injectionKey = "FIELD_SNS_MESSAGE" - ) - private String tFldSNSMessage; - @HopMetadataProperty( - key = "field_message_delete", - injectionKey = "FIELD_MESSAGE_DELETE" - ) - private String tFldMessageDelete; - @HopMetadataProperty( - key = "field_max_messages", - injectionKey = "FIELD_MAX_MESSAGES" - ) - private String tFldMaxMessages; - - /** - * Constructor should call super() to make sure the base class has a chance to initialize properly. - */ - public SqsReaderMeta() { - super(); - } - - /** - * This method is called every time a new transform is created and should allocate/set the transform configuration - * to sensible defaults. The values set here will be used by Hop Gui when a new transform is created. - */ - public void setDefault() { - // outputField = "demo_field"; - } - - public String getAwsCredChain() { - return awsCredChain = awsCredChain == null ? "N" : awsCredChain; - } - - public void setAwsCredChain(String awsCredChain) { - this.awsCredChain = awsCredChain; - } - - public String getAwsKey() { - return awsKey == null ? "" : awsKey; - } - - public void setAwsKey(String aws_key) { - this.awsKey = aws_key; - } - - public String getAwsKeySecret() { - return awsKeySecret == null ? "" : awsKeySecret; - } - - public void setAwsKeySecret(String awsKeySecret) { - this.awsKeySecret = awsKeySecret; - } - - public String getAwsRegion() { - return awsRegion == null ? "" : awsRegion; - } - - public void setAwsRegion(String awsRegion) { - this.awsRegion = awsRegion; - } + /** + * The PKG member is used when looking up internationalized strings. The properties file with + * localized keys is expected to reside in {the package of the class + * specified}/messages/messages_{locale}.properties + */ + private static Class PKG = SqsReaderMeta.class; // for i18n purposes - public String getSqsQueue() { - return sqsQueue == null ? "" : sqsQueue; - } - - public void setSqsQueue(String sqsQueue) { - this.sqsQueue = sqsQueue; - } + @HopMetadataProperty(key = "AwsCredChain", injectionKey = "AWS_CRED_CHAIN") + private String awsCredChain; - public String getTFldMessageID() { - return tFldMessageID == null ? "" : tFldMessageID; - } + @HopMetadataProperty(key = "aws_key", injectionKey = "AWS_KEY") + private String awsKey; - public void setTFldMessageID(String tFldMessageID) { - this.tFldMessageID = tFldMessageID; - } + @HopMetadataProperty(key = "aws_key_secret", injectionKey = "AWS_KEY_SECRET") + private String awsKeySecret; - public String getTFldMessageBody() { - return tFldMessageBody == null ? "" : tFldMessageBody; - } + @HopMetadataProperty(key = "aws_region", injectionKey = "AWS_REGION") + private String awsRegion; - public void setTFldMessageBody(String tFldMessageBody) { - this.tFldMessageBody = tFldMessageBody; - } - - public String getTFldReceiptHandle() { - return tFldReceiptHandle == null ? "" : tFldReceiptHandle; - } - - public void setTFldReceiptHandle(String tFldReceiptHandle) { - this.tFldReceiptHandle = tFldReceiptHandle; - } + @HopMetadataProperty(key = "sqs_queue", injectionKey = "SQS_QUEUE") + private String sqsQueue; - public String getTFldBodyMD5() { - return tFldBodyMD5 == null ? "" : tFldBodyMD5; - } + @HopMetadataProperty(key = "field_message_id", injectionKey = "FIELD_MESSAGE_ID") + private String tFldMessageID; - public void setTFldBodyMD5(String tFldBodyMD5) { - this.tFldBodyMD5 = tFldBodyMD5; - } + @HopMetadataProperty(key = "field_message_body", injectionKey = "FIELD_MESSAGE_BODY") + private String tFldMessageBody; - public String getTFldSNSMessage() { - return tFldSNSMessage == null ? "" : tFldSNSMessage; - } + @HopMetadataProperty(key = "field_receipt_handle", injectionKey = "FIELD_RECEIPT_HANDLE") + private String tFldReceiptHandle; - public void setTFldSNSMessage(String tFldSNSMessage) { - this.tFldSNSMessage = tFldSNSMessage; - } + @HopMetadataProperty(key = "field_body_md5", injectionKey = "FIELD_BODY_MD5") + private String tFldBodyMD5; - public String getTFldMessageDelete() { - return tFldMessageDelete == null ? "N" : tFldMessageDelete; - } + @HopMetadataProperty(key = "field_sns_messages", injectionKey = "FIELD_SNS_MESSAGE") + private String tFldSNSMessage; - public void setTFldMessageDelete(String tFldMessageDelete) { - this.tFldMessageDelete = tFldMessageDelete; - } + @HopMetadataProperty(key = "field_message_delete", injectionKey = "FIELD_MESSAGE_DELETE") + private String tFldMessageDelete; - public String getTFldMaxMessages() { - return tFldMaxMessages == null ? "0" : tFldMaxMessages; - } + @HopMetadataProperty(key = "field_max_messages", injectionKey = "FIELD_MAX_MESSAGES") + private String tFldMaxMessages; - public void setTFldMaxMessages(String tFldMaxMessages) { - this.tFldMaxMessages = tFldMaxMessages; - } + /** + * Constructor should call super() to make sure the base class has a chance to initialize + * properly. + */ + public SqsReaderMeta() { + super(); + } - /** - * This method is used when a transform is duplicated in Hop Gui. It needs to return a deep copy of this - * transform meta object. Be sure to create proper deep copies if the transform configuration is stored in - * modifiable objects. - * - * See org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta.clone() for an example on creating - * a deep copy. - * - * @return a deep copy of this - */ - public Object clone() { - Object retval = super.clone(); - return retval; - } + /** + * This method is called every time a new transform is created and should allocate/set the + * transform configuration to sensible defaults. The values set here will be used by Hop Gui when + * a new transform is created. + */ + public void setDefault() { + // outputField = "demo_field"; + } - /** - * This method is called to determine the changes the transform is making to the row-stream. - * To that end a RowMetaInterface object is passed in, containing the row-stream structure as it is when entering - * the transform. This method must apply any changes the transform makes to the row stream. Usually a transform adds fields to the - * row-stream. - * - * @param inputRowMeta the row structure coming in to the transform - * @param origin the origin of the transform making the changes - * @param info row structures of any info transforms coming in - * @param nextTransform the description of a transform this transform is passing rows to - * @param variables the variable variables for resolving variables - * @param metadataProvider the metadataProvider to optionally read from + public String getAwsCredChain() { + return awsCredChain = awsCredChain == null ? "N" : awsCredChain; + } + + public void setAwsCredChain(String awsCredChain) { + this.awsCredChain = awsCredChain; + } + + public String getAwsKey() { + return awsKey == null ? "" : awsKey; + } + + public void setAwsKey(String aws_key) { + this.awsKey = aws_key; + } + + public String getAwsKeySecret() { + return awsKeySecret == null ? "" : awsKeySecret; + } + + public void setAwsKeySecret(String awsKeySecret) { + this.awsKeySecret = awsKeySecret; + } + + public String getAwsRegion() { + return awsRegion == null ? "" : awsRegion; + } + + public void setAwsRegion(String awsRegion) { + this.awsRegion = awsRegion; + } + + public String getSqsQueue() { + return sqsQueue == null ? "" : sqsQueue; + } + + public void setSqsQueue(String sqsQueue) { + this.sqsQueue = sqsQueue; + } + + public String getTFldMessageID() { + return tFldMessageID == null ? "" : tFldMessageID; + } + + public void setTFldMessageID(String tFldMessageID) { + this.tFldMessageID = tFldMessageID; + } + + public String getTFldMessageBody() { + return tFldMessageBody == null ? "" : tFldMessageBody; + } + + public void setTFldMessageBody(String tFldMessageBody) { + this.tFldMessageBody = tFldMessageBody; + } + + public String getTFldReceiptHandle() { + return tFldReceiptHandle == null ? "" : tFldReceiptHandle; + } + + public void setTFldReceiptHandle(String tFldReceiptHandle) { + this.tFldReceiptHandle = tFldReceiptHandle; + } + + public String getTFldBodyMD5() { + return tFldBodyMD5 == null ? "" : tFldBodyMD5; + } + + public void setTFldBodyMD5(String tFldBodyMD5) { + this.tFldBodyMD5 = tFldBodyMD5; + } + + public String getTFldSNSMessage() { + return tFldSNSMessage == null ? "" : tFldSNSMessage; + } + + public void setTFldSNSMessage(String tFldSNSMessage) { + this.tFldSNSMessage = tFldSNSMessage; + } + + public String getTFldMessageDelete() { + return tFldMessageDelete == null ? "N" : tFldMessageDelete; + } + + public void setTFldMessageDelete(String tFldMessageDelete) { + this.tFldMessageDelete = tFldMessageDelete; + } + + public String getTFldMaxMessages() { + return tFldMaxMessages == null ? "0" : tFldMaxMessages; + } + + public void setTFldMaxMessages(String tFldMaxMessages) { + this.tFldMaxMessages = tFldMaxMessages; + } + + /** + * This method is used when a transform is duplicated in Hop Gui. It needs to return a deep copy + * of this transform meta object. Be sure to create proper deep copies if the transform + * configuration is stored in modifiable objects. + * + *

See org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta.clone() for an example + * on creating a deep copy. + * + * @return a deep copy of this + */ + public Object clone() { + Object retval = super.clone(); + return retval; + } + + /** + * This method is called to determine the changes the transform is making to the row-stream. To + * that end a RowMetaInterface object is passed in, containing the row-stream structure as it is + * when entering the transform. This method must apply any changes the transform makes to the row + * stream. Usually a transform adds fields to the row-stream. + * + * @param inputRowMeta the row structure coming in to the transform + * @param origin the origin of the transform making the changes + * @param info row structures of any info transforms coming in + * @param nextTransform the description of a transform this transform is passing rows to + * @param variables the variable variables for resolving variables + * @param metadataProvider the metadataProvider to optionally read from + */ + @Override + public void getFields( + IRowMeta inputRowMeta, + String origin, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables variables, + IHopMetadataProvider metadataProvider) + throws HopTransformException { + + /* + * This implementation appends the outputField to the row-stream */ - @Override - public void getFields( - IRowMeta inputRowMeta, - String origin, - IRowMeta[] info, - TransformMeta nextTransform, - IVariables variables, - IHopMetadataProvider metadataProvider) throws HopTransformException { - - /* - * This implementation appends the outputField to the row-stream - */ - - try { - if (tFldMessageID != null && !tFldMessageID.equals("")) { - String realMessageIDFieldName = variables.resolve(tFldMessageID); - IValueMeta valueMeta = ValueMetaFactory.createValueMeta(realMessageIDFieldName, IValueMeta.TYPE_STRING ); - valueMeta.setName(realMessageIDFieldName.toUpperCase()); - valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); - valueMeta.setOrigin(origin); - inputRowMeta.addValueMeta(valueMeta); - } - - if (tFldMessageBody != null && !tFldMessageBody.equals("")) { - String realMessageBodyFieldName = variables.resolve(tFldMessageBody); - IValueMeta valueMeta = ValueMetaFactory.createValueMeta(realMessageBodyFieldName, IValueMeta.TYPE_STRING ); - valueMeta.setName(realMessageBodyFieldName.toUpperCase()); - valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); - valueMeta.setOrigin(origin); - inputRowMeta.addValueMeta(valueMeta); - } - - if (tFldReceiptHandle != null && !tFldReceiptHandle.equals("")) { - String realReceiptHandleFieldName = variables.resolve(tFldReceiptHandle); - IValueMeta valueMeta = ValueMetaFactory.createValueMeta(realReceiptHandleFieldName, IValueMeta.TYPE_STRING ); - valueMeta.setName(realReceiptHandleFieldName.toUpperCase()); - valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); - valueMeta.setOrigin(origin); - inputRowMeta.addValueMeta(valueMeta); - } - - if (tFldBodyMD5 != null && !tFldBodyMD5.equals("")) { - String realBodyMD5FieldName = variables.resolve(tFldBodyMD5); - IValueMeta valueMeta = ValueMetaFactory.createValueMeta(realBodyMD5FieldName, IValueMeta.TYPE_STRING ); - valueMeta.setName(realBodyMD5FieldName.toUpperCase()); - valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); - valueMeta.setOrigin(origin); - inputRowMeta.addValueMeta(valueMeta); - } - - if (tFldSNSMessage != null && !tFldSNSMessage.equals("")) { - String realSNSMessageFieldName = variables.resolve(tFldSNSMessage); - IValueMeta valueMeta = ValueMetaFactory.createValueMeta(realSNSMessageFieldName, IValueMeta.TYPE_STRING ); - valueMeta.setName(realSNSMessageFieldName.toUpperCase()); - valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); - valueMeta.setOrigin(origin); - inputRowMeta.addValueMeta(valueMeta); - } - - } catch (HopPluginException e) { - logBasic(e.getMessage()); - throw new HopTransformException( e ); - } + try { + if (tFldMessageID != null && !tFldMessageID.equals("")) { + String realMessageIDFieldName = variables.resolve(tFldMessageID); + IValueMeta valueMeta = + ValueMetaFactory.createValueMeta(realMessageIDFieldName, IValueMeta.TYPE_STRING); + valueMeta.setName(realMessageIDFieldName.toUpperCase()); + valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); + valueMeta.setOrigin(origin); + inputRowMeta.addValueMeta(valueMeta); + } + + if (tFldMessageBody != null && !tFldMessageBody.equals("")) { + String realMessageBodyFieldName = variables.resolve(tFldMessageBody); + IValueMeta valueMeta = + ValueMetaFactory.createValueMeta(realMessageBodyFieldName, IValueMeta.TYPE_STRING); + valueMeta.setName(realMessageBodyFieldName.toUpperCase()); + valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); + valueMeta.setOrigin(origin); + inputRowMeta.addValueMeta(valueMeta); + } + + if (tFldReceiptHandle != null && !tFldReceiptHandle.equals("")) { + String realReceiptHandleFieldName = variables.resolve(tFldReceiptHandle); + IValueMeta valueMeta = + ValueMetaFactory.createValueMeta(realReceiptHandleFieldName, IValueMeta.TYPE_STRING); + valueMeta.setName(realReceiptHandleFieldName.toUpperCase()); + valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); + valueMeta.setOrigin(origin); + inputRowMeta.addValueMeta(valueMeta); + } + + if (tFldBodyMD5 != null && !tFldBodyMD5.equals("")) { + String realBodyMD5FieldName = variables.resolve(tFldBodyMD5); + IValueMeta valueMeta = + ValueMetaFactory.createValueMeta(realBodyMD5FieldName, IValueMeta.TYPE_STRING); + valueMeta.setName(realBodyMD5FieldName.toUpperCase()); + valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); + valueMeta.setOrigin(origin); + inputRowMeta.addValueMeta(valueMeta); + } + + if (tFldSNSMessage != null && !tFldSNSMessage.equals("")) { + String realSNSMessageFieldName = variables.resolve(tFldSNSMessage); + IValueMeta valueMeta = + ValueMetaFactory.createValueMeta(realSNSMessageFieldName, IValueMeta.TYPE_STRING); + valueMeta.setName(realSNSMessageFieldName.toUpperCase()); + valueMeta.setTrimType(IValueMeta.TRIM_TYPE_BOTH); + valueMeta.setOrigin(origin); + inputRowMeta.addValueMeta(valueMeta); + } + + } catch (HopPluginException e) { + logBasic(e.getMessage()); + throw new HopTransformException(e); } - + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoader.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoader.java index 64c40f088f3..3b4114e129b 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoader.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoader.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.redshift.bulkloader; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; @@ -37,18 +45,8 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class RedshiftBulkLoader extends BaseTransform { +public class RedshiftBulkLoader + extends BaseTransform { private static final Class PKG = RedshiftBulkLoader.class; // for i18n purposes, needed by Translator2!! @@ -71,7 +69,7 @@ public boolean init() { verifyDatabaseConnection(); data.databaseMeta = this.getPipelineMeta().findDatabase(meta.getConnection(), variables); - if(meta.isStreamToS3Csv()){ + if (meta.isStreamToS3Csv()) { // get the file output stream to write to S3 data.writer = HopVfs.getOutputStream(resolve(meta.getCopyFromFilename()), false); } @@ -81,7 +79,9 @@ public boolean init() { getDbFields(); if (log.isBasic()) { - logBasic(BaseMessages.getString(PKG, "RedshiftBulkLoader.Connection.Connected", data.db.getDatabaseMeta())); + logBasic( + BaseMessages.getString( + PKG, "RedshiftBulkLoader.Connection.Connected", data.db.getDatabaseMeta())); } initBinaryDataFields(); @@ -107,7 +107,7 @@ public boolean processRow() throws HopException { truncateTable(); } - if(!first){ + if (!first) { try { data.close(); closeFile(); @@ -118,7 +118,7 @@ public boolean processRow() throws HopException { conn.commit(); stmt.close(); conn.close(); - }catch(SQLException sqle){ + } catch (SQLException sqle) { setErrors(1); stopAll(); setOutputDone(); // signal end to receiver(s) @@ -146,19 +146,18 @@ public boolean processRow() throws HopException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields(data.insertRowMeta, getTransformName(), null, null, this, metadataProvider); - if(meta.isStreamToS3Csv()){ + if (meta.isStreamToS3Csv()) {} - } // write all fields in the stream to Redshift - if (!meta.specifyFields()){ + if (!meta.specifyFields()) { // Just take the whole input row data.insertRowMeta = getInputRowMeta().clone(); data.selectedRowFieldIndices = new int[data.insertRowMeta.size()]; - try{ + try { getDbFields(); - }catch(HopException e){ + } catch (HopException e) { logError("Error getting database fields", e); setErrors(1); stopAll(); @@ -168,34 +167,31 @@ public boolean processRow() throws HopException { for (int i = 0; i < meta.getFields().size(); i++) { int streamFieldLocation = - data.insertRowMeta.indexOfValue( - meta.getFields().get(i).getStreamField()); + data.insertRowMeta.indexOfValue(meta.getFields().get(i).getStreamField()); if (streamFieldLocation < 0) { throw new HopTransformException( - "Field [" - + meta.getFields().get(i).getStreamField() - + "] couldn't be found in the input stream!"); + "Field [" + + meta.getFields().get(i).getStreamField() + + "] couldn't be found in the input stream!"); } int dbFieldLocation = -1; for (int e = 0; e < data.dbFields.size(); e++) { String[] field = data.dbFields.get(e); - if (field[0].equalsIgnoreCase( - meta.getFields().get(i).getDatabaseField())) { + if (field[0].equalsIgnoreCase(meta.getFields().get(i).getDatabaseField())) { dbFieldLocation = e; break; } } if (dbFieldLocation < 0) { throw new HopException( - "Field [" - + meta.getFields().get(i).getDatabaseField() - + "] couldn't be found in the table!"); + "Field [" + + meta.getFields().get(i).getDatabaseField() + + "] couldn't be found in the table!"); } data.fieldnrs.put( - meta.getFields().get(i).getDatabaseField().toUpperCase(), - streamFieldLocation); + meta.getFields().get(i).getDatabaseField().toUpperCase(), streamFieldLocation); } } else { @@ -206,7 +202,7 @@ public boolean processRow() throws HopException { // Cache the position of the selected fields in the row array data.selectedRowFieldIndices = new int[numberOfInsertFields]; - for(int i=0; i < meta.getFields().size(); i++){ + for (int i = 0; i < meta.getFields().size(); i++) { RedshiftBulkLoaderField vbf = meta.getFields().get(i); String inputFieldName = vbf.getStreamField(); int inputFieldIdx = i; @@ -231,12 +227,13 @@ public boolean processRow() throws HopException { IValueMeta insertValueMeta = inputValueMeta.clone(); insertValueMeta.setName(insertFieldName); data.insertRowMeta.addValueMeta(insertValueMeta); - data.fieldnrs.put(meta.getFields().get(i).getDatabaseField().toUpperCase(), inputFieldIdx); + data.fieldnrs.put( + meta.getFields().get(i).getDatabaseField().toUpperCase(), inputFieldIdx); } } } - if(meta.isStreamToS3Csv()){ + if (meta.isStreamToS3Csv()) { writeRowToFile(data.outputRowMeta, r); putRow(data.outputRowMeta, r); } @@ -283,14 +280,14 @@ private String buildCopyStatementSqlString() { data.db.resolve(meta.getSchemaName()), data.db.resolve(meta.getTableName()))); - if(meta.isStreamToS3Csv() || meta.getLoadFromExistingFileFormat().equals("CSV")){ + if (meta.isStreamToS3Csv() || meta.getLoadFromExistingFileFormat().equals("CSV")) { sb.append(" ("); List fieldList = meta.getFields(); - for(int i=0; i < fieldList.size(); i++){ + for (int i = 0; i < fieldList.size(); i++) { RedshiftBulkLoaderField field = fieldList.get(i); - if( i > 0){ + if (i > 0) { sb.append(", " + field.getDatabaseField()); - }else{ + } else { sb.append(field.getDatabaseField()); } } @@ -298,7 +295,7 @@ private String buildCopyStatementSqlString() { } sb.append(" FROM '" + resolve(meta.getCopyFromFilename()) + "'"); - if(meta.isStreamToS3Csv() || meta.getLoadFromExistingFileFormat().equals("CSV")){ + if (meta.isStreamToS3Csv() || meta.getLoadFromExistingFileFormat().equals("CSV")) { sb.append(" DELIMITER ',' "); sb.append(" CSV QUOTE AS '\"'"); sb.append(" NULL '' "); @@ -306,21 +303,27 @@ private String buildCopyStatementSqlString() { sb.append("DATEFORMAT AS 'YYYY/MM/DD' "); sb.append("TIMEFORMAT AS 'YYYY/MM/DD HH:MI:SS'"); } - if(meta.isUseAwsIamRole()){ + if (meta.isUseAwsIamRole()) { sb.append(" iam_role '" + meta.getAwsIamRole() + "'"); - }else if(meta.isUseCredentials()){ + } else if (meta.isUseCredentials()) { String awsAccessKeyId = ""; String awsSecretAccessKey = ""; - if(meta.isUseSystemEnvVars()) { + if (meta.isUseSystemEnvVars()) { awsAccessKeyId = System.getenv("AWS_ACCESS_KEY_ID"); awsSecretAccessKey = System.getenv("AWS_SECRET_ACCESS_KEY"); - }else{ + } else { awsAccessKeyId = resolve(meta.getAwsAccessKeyId()); awsSecretAccessKey = resolve(meta.getAwsSecretAccessKey()); } - sb.append(" CREDENTIALS 'aws_access_key_id=" + awsAccessKeyId + ";aws_secret_access_key=" + awsSecretAccessKey + "'"); + sb.append( + " CREDENTIALS 'aws_access_key_id=" + + awsAccessKeyId + + ";aws_secret_access_key=" + + awsSecretAccessKey + + "'"); } - if(!StringUtils.isEmpty(meta.getLoadFromExistingFileFormat()) && meta.getLoadFromExistingFileFormat().equals("Parquet")){ + if (!StringUtils.isEmpty(meta.getLoadFromExistingFileFormat()) + && meta.getLoadFromExistingFileFormat().equals("Parquet")) { sb.append(" FORMAT AS PARQUET;"); } @@ -360,15 +363,15 @@ private void getDbFields() throws HopException { if (!StringUtils.isEmpty(resolve(meta.getSchemaName()))) { rowMeta = data.db.getTableFields(meta.getSchemaName() + "." + meta.getTableName()); - }else { + } else { rowMeta = data.db.getTableFields(meta.getTableName()); } try { - if(rowMeta.size() == 0) { + if (rowMeta.size() == 0) { throw new HopException("No fields found in table"); } - for(int i=0; i < rowMeta.size(); i++) { + for (int i = 0; i < rowMeta.size(); i++) { String field[] = new String[2]; field[0] = rowMeta.getValueMeta(i).getName().toUpperCase(); field[1] = rowMeta.getValueMeta(i).getTypeDesc().toUpperCase(); @@ -379,7 +382,6 @@ private void getDbFields() throws HopException { } } - protected void verifyDatabaseConnection() throws HopException { // Confirming Database Connection is defined. if (meta.getConnection() == null) { @@ -401,13 +403,13 @@ private void initBinaryDataFields() throws HopException { data.escapeCharacters = new byte[] {}; data.binarySeparator = - resolve(RedshiftBulkLoaderMeta.CSV_DELIMITER).getBytes(StandardCharsets.UTF_8); + resolve(RedshiftBulkLoaderMeta.CSV_DELIMITER).getBytes(StandardCharsets.UTF_8); data.binaryEnclosure = - resolve(RedshiftBulkLoaderMeta.ENCLOSURE).getBytes(StandardCharsets.UTF_8); + resolve(RedshiftBulkLoaderMeta.ENCLOSURE).getBytes(StandardCharsets.UTF_8); data.binaryNewline = - RedshiftBulkLoaderMeta.CSV_RECORD_DELIMITER.getBytes(StandardCharsets.UTF_8); + RedshiftBulkLoaderMeta.CSV_RECORD_DELIMITER.getBytes(StandardCharsets.UTF_8); data.escapeCharacters = - RedshiftBulkLoaderMeta.CSV_ESCAPE_CHAR.getBytes(StandardCharsets.UTF_8); + RedshiftBulkLoaderMeta.CSV_ESCAPE_CHAR.getBytes(StandardCharsets.UTF_8); data.binaryNullValue = "".getBytes(StandardCharsets.UTF_8); } catch (Exception e) { @@ -425,7 +427,7 @@ private void initBinaryDataFields() throws HopException { private void writeRowToFile(IRowMeta rowMeta, Object[] row) throws HopTransformException { try { - if(meta.isStreamToS3Csv() && !meta.isSpecifyFields()) { + if (meta.isStreamToS3Csv() && !meta.isSpecifyFields()) { /* * Write all values in stream to text file. */ @@ -446,8 +448,8 @@ private void writeRowToFile(IRowMeta rowMeta, Object[] row) throws HopTransformE /* * Only write the fields specified! */ - for(int i=0; i < meta.getFields().size(); i++){ - if(meta.getFields().get(i).getDatabaseField() != null){ + for (int i = 0; i < meta.getFields().size(); i++) { + if (meta.getFields().get(i).getDatabaseField() != null) { if (i > 0 && data.binarySeparator.length > 0) { data.writer.write(data.binarySeparator); } @@ -457,8 +459,8 @@ private void writeRowToFile(IRowMeta rowMeta, Object[] row) throws HopTransformE String[] rowFields = data.outputRowMeta.getFieldNames(); String streamFieldType = ""; int streamIndex = -1; - for(int j=0; j < rowFields.length ; j++){ - if(streamFieldName.equals(rowFields[j])){ + for (int j = 0; j < rowFields.length; j++) { + if (streamFieldName.equals(rowFields[j])) { v = rowMeta.getValueMeta(j); streamIndex = j; } @@ -476,19 +478,19 @@ private void writeRowToFile(IRowMeta rowMeta, Object[] row) throws HopTransformE } Object valueData = null; - if(streamIndex >= 0){ - if(needConversion){ + if (streamIndex >= 0) { + if (needConversion) { IValueMeta valueMeta = rowMeta.getValueMeta(streamIndex); Object obj = row[streamIndex]; valueData = v.convertData(valueMeta, obj); - }else{ + } else { valueData = row[streamIndex]; } } else if (meta.isErrorColumnMismatch()) { throw new HopException( - "Error column mismatch: Database streamField " - + meta.getFields().get(i).getStreamField() - + " not found on stream."); + "Error column mismatch: Database streamField " + + meta.getFields().get(i).getStreamField() + + " not found on stream."); } writeField(v, valueData, data.binaryNullValue); } @@ -497,7 +499,7 @@ private void writeRowToFile(IRowMeta rowMeta, Object[] row) throws HopTransformE } else { int jsonField = data.fieldnrs.get("json"); data.writer.write( - data.insertRowMeta.getString(row, jsonField).getBytes(StandardCharsets.UTF_8)); + data.insertRowMeta.getString(row, jsonField).getBytes(StandardCharsets.UTF_8)); data.writer.write(data.binaryNewline); } } catch (Exception e) { @@ -514,7 +516,7 @@ private void writeRowToFile(IRowMeta rowMeta, Object[] row) throws HopTransformE * @throws HopTransformException */ private void writeField(IValueMeta v, Object valueData, byte[] nullString) - throws HopTransformException { + throws HopTransformException { try { byte[] str; @@ -535,7 +537,7 @@ private void writeField(IValueMeta v, Object valueData, byte[] nullString) writeEnclosures = true; if (containsSeparatorOrEnclosure( - str, data.binarySeparator, data.binaryEnclosure, data.escapeCharacters)) { + str, data.binarySeparator, data.binaryEnclosure, data.escapeCharacters)) { writeEnclosures = true; } } @@ -582,9 +584,9 @@ private void writeField(IValueMeta v, Object valueData, byte[] nullString) private byte[] formatField(IValueMeta v, Object valueData) throws HopValueException { if (v.isString()) { if (v.isStorageBinaryString() - && v.getTrimType() == IValueMeta.TRIM_TYPE_NONE - && v.getLength() < 0 - && StringUtils.isEmpty(v.getStringEncoding())) { + && v.getTrimType() == IValueMeta.TRIM_TYPE_NONE + && v.getLength() < 0 + && StringUtils.isEmpty(v.getStringEncoding())) { return (byte[]) valueData; } else { String svalue = (valueData instanceof String) ? (String) valueData : v.getString(valueData); @@ -636,7 +638,7 @@ private byte[] convertStringToBinaryString(IValueMeta v, String string) { * @return True if the string contains separators or enclosures */ private boolean containsSeparatorOrEnclosure( - byte[] source, byte[] separator, byte[] enclosure, byte[] escape) { + byte[] source, byte[] separator, byte[] enclosure, byte[] escape) { boolean result = false; boolean enclosureExists = enclosure != null && enclosure.length > 0; diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderData.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderData.java index 1de1d017379..415dfc9483a 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderData.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderData.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.redshift.bulkloader; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.IOException; import java.io.OutputStream; import java.io.PipedInputStream; import java.util.ArrayList; import java.util.Map; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class RedshiftBulkLoaderData extends BaseTransformData implements ITransformData { protected Database db; @@ -68,6 +67,5 @@ public IRowMeta getInsertRowMeta() { return insertRowMeta; } - public void close() throws IOException { - } + public void close() throws IOException {} } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderDialog.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderDialog.java index 85f5f8b1373..e33487d6a25 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderDialog.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderDialog.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.redshift.bulkloader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -74,13 +80,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class RedshiftBulkLoaderDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = @@ -118,7 +117,7 @@ public class RedshiftBulkLoaderDialog extends BaseTransformDialog implements ITr private static final String AWS_CREDENTIALS = "Credentials"; private static final String AWS_IAM_ROLE = "IAM Role"; - private String[] awsAuthOptions = new String[]{AWS_CREDENTIALS, AWS_IAM_ROLE}; + private String[] awsAuthOptions = new String[] {AWS_CREDENTIALS, AWS_IAM_ROLE}; private Label wlAwsAuthentication; private ComboVar wAwsAuthentication; @@ -131,7 +130,6 @@ public class RedshiftBulkLoaderDialog extends BaseTransformDialog implements ITr private Label wlAwsIamRole; private TextVar wAwsIamRole; - /** List of ColumnInfo that should have the field names of the selected database table */ private List tableFieldColumns = new ArrayList<>(); @@ -195,7 +193,7 @@ public void focusLost(FocusEvent arg0) { fdlTransformName = new FormData(); fdlTransformName.left = new FormAttachment(0, 0); fdlTransformName.right = new FormAttachment(middle, -margin); - fdlTransformName.top = new FormAttachment(0, margin*2); + fdlTransformName.top = new FormAttachment(0, margin * 2); wlTransformName.setLayoutData(fdlTransformName); wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wTransformName.setText(transformName); @@ -203,7 +201,7 @@ public void focusLost(FocusEvent arg0) { wTransformName.addModifyListener(lsMod); fdTransformName = new FormData(); fdTransformName.left = new FormAttachment(middle, 0); - fdTransformName.top = new FormAttachment(0, margin*2); + fdTransformName.top = new FormAttachment(0, margin * 2); fdTransformName.right = new FormAttachment(100, 0); wTransformName.setLayoutData(fdTransformName); @@ -275,14 +273,15 @@ public void widgetSelected(SelectionEvent arg0) { }; wlAwsAuthentication = new Label(shell, SWT.RIGHT); - wlAwsAuthentication.setText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.Authenticate.Options.Label")); + wlAwsAuthentication.setText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.Authenticate.Options.Label")); PropsUi.setLook(wlAwsAuthentication); FormData fdlAwsAuthentication = new FormData(); fdlAwsAuthentication.top = new FormAttachment(lastControl, margin); fdlAwsAuthentication.left = new FormAttachment(0, 0); fdlAwsAuthentication.right = new FormAttachment(middle, -margin); wlAwsAuthentication.setLayoutData(fdlAwsAuthentication); - wAwsAuthentication = new ComboVar(variables, shell, SWT.BORDER|SWT.READ_ONLY); + wAwsAuthentication = new ComboVar(variables, shell, SWT.BORDER | SWT.READ_ONLY); wAwsAuthentication.setItems(awsAuthOptions); wAwsAuthentication.setText(awsAuthOptions[0]); PropsUi.setLook(wAwsAuthentication); @@ -295,7 +294,8 @@ public void widgetSelected(SelectionEvent arg0) { wlUseSystemVars = new Label(shell, SWT.RIGHT); wlUseSystemVars.setText("Use AWS system variables"); - wlUseSystemVars.setToolTipText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.Authenticate.UseSystemVars.Tooltip")); + wlUseSystemVars.setToolTipText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.Authenticate.UseSystemVars.Tooltip")); PropsUi.setLook(wlUseSystemVars); FormData fdlUseSystemVars = new FormData(); fdlUseSystemVars.top = new FormAttachment(lastControl, margin); @@ -306,18 +306,19 @@ public void widgetSelected(SelectionEvent arg0) { wUseSystemVars.setSelection(true); PropsUi.setLook(wUseSystemVars); FormData fdUseSystemVars = new FormData(); - fdUseSystemVars.top = new FormAttachment(lastControl, margin*3); + fdUseSystemVars.top = new FormAttachment(lastControl, margin * 3); fdUseSystemVars.left = new FormAttachment(middle, 0); fdUseSystemVars.right = new FormAttachment(100, 0); wUseSystemVars.setLayoutData(fdUseSystemVars); lastControl = wlUseSystemVars; - wUseSystemVars.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - toggleKeysSelection(); - } - }); + wUseSystemVars.addSelectionListener( + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + toggleKeysSelection(); + } + }); wlAccessKeyId = new Label(shell, SWT.RIGHT); wlAccessKeyId.setText("AWS_ACCESS_KEY_ID"); @@ -340,7 +341,7 @@ public void widgetSelected(SelectionEvent e) { wlSecretAccessKey.setText("AWS_SECRET_ACCESS_KEY"); PropsUi.setLook(wlSecretAccessKey); FormData fdlSecretAccessKey = new FormData(); - fdlSecretAccessKey.top = new FormAttachment(lastControl,margin); + fdlSecretAccessKey.top = new FormAttachment(lastControl, margin); fdlSecretAccessKey.left = new FormAttachment(0, 0); fdlSecretAccessKey.right = new FormAttachment(middle, -margin); wlSecretAccessKey.setLayoutData(fdlSecretAccessKey); @@ -348,7 +349,7 @@ public void widgetSelected(SelectionEvent e) { PropsUi.setLook(wSecretAccessKey); FormData fdSecretAccessKey = new FormData(); fdSecretAccessKey.top = new FormAttachment(lastControl, margin); - fdSecretAccessKey.left = new FormAttachment(middle,0); + fdSecretAccessKey.left = new FormAttachment(middle, 0); fdSecretAccessKey.right = new FormAttachment(100, 0); wSecretAccessKey.setLayoutData(fdSecretAccessKey); lastControl = wSecretAccessKey; @@ -359,7 +360,6 @@ public void widgetSelected(SelectionEvent e) { wlSecretAccessKey.setEnabled(false); wSecretAccessKey.setEnabled(false); - wlAwsIamRole = new Label(shell, SWT.RIGHT); wlAwsIamRole.setText("IAM Role"); PropsUi.setLook(wlAwsIamRole); @@ -381,12 +381,13 @@ public void widgetSelected(SelectionEvent e) { wlAwsIamRole.setEnabled(false); wAwsIamRole.setEnabled(false); - wAwsAuthentication.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - toggleAuthSelection(); - } - }); + wAwsAuthentication.addSelectionListener( + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + toggleAuthSelection(); + } + }); // Truncate table wlTruncate = new Label(shell, SWT.RIGHT); @@ -400,7 +401,7 @@ public void widgetSelected(SelectionEvent e) { wTruncate = new Button(shell, SWT.CHECK); PropsUi.setLook(wTruncate); FormData fdTruncate = new FormData(); - fdTruncate.top = new FormAttachment(lastControl, margin*3); + fdTruncate.top = new FormAttachment(lastControl, margin * 3); fdTruncate.left = new FormAttachment(middle, 0); fdTruncate.right = new FormAttachment(100, 0); wTruncate.setLayoutData(fdTruncate); @@ -436,7 +437,7 @@ public void widgetSelected(SelectionEvent e) { BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.OnlyWhenHaveRows.Tooltip")); PropsUi.setLook(wOnlyWhenHaveRows); FormData fdTruncateWhenHaveRows = new FormData(); - fdTruncateWhenHaveRows.top = new FormAttachment(lastControl, margin*3); + fdTruncateWhenHaveRows.top = new FormAttachment(lastControl, margin * 3); fdTruncateWhenHaveRows.left = new FormAttachment(middle, 0); fdTruncateWhenHaveRows.right = new FormAttachment(100, 0); wOnlyWhenHaveRows.setLayoutData(fdTruncateWhenHaveRows); @@ -456,7 +457,7 @@ public void widgetSelected(SelectionEvent e) { wSpecifyFields = new Button(shell, SWT.CHECK); PropsUi.setLook(wSpecifyFields); fdSpecifyFields = new FormData(); - fdSpecifyFields.top = new FormAttachment(lastControl, margin*3); + fdSpecifyFields.top = new FormAttachment(lastControl, margin * 3); fdSpecifyFields.left = new FormAttachment(middle, 0); fdSpecifyFields.right = new FormAttachment(100, 0); wSpecifyFields.setLayoutData(fdSpecifyFields); @@ -498,20 +499,23 @@ public void widgetSelected(SelectionEvent arg0) { wMainComp.setLayoutData(fdMainComp); Label wlStreamToS3Csv = new Label(wMainComp, SWT.RIGHT); - wlStreamToS3Csv.setText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.StreamCsvToS3.Label")); - wlStreamToS3Csv.setToolTipText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.StreamCsvToS3.ToolTip")); + wlStreamToS3Csv.setText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.StreamCsvToS3.Label")); + wlStreamToS3Csv.setToolTipText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.StreamCsvToS3.ToolTip")); PropsUi.setLook(wlStreamToS3Csv); FormData fdlStreamToS3Csv = new FormData(); - fdlStreamToS3Csv.top = new FormAttachment(0, margin*2); + fdlStreamToS3Csv.top = new FormAttachment(0, margin * 2); fdlStreamToS3Csv.left = new FormAttachment(0, 0); fdlStreamToS3Csv.right = new FormAttachment(middle, -margin); wlStreamToS3Csv.setLayoutData(fdlStreamToS3Csv); wStreamToS3Csv = new Button(wMainComp, SWT.CHECK); - wStreamToS3Csv.setToolTipText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.StreamCsvToS3.ToolTip")); + wStreamToS3Csv.setToolTipText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.StreamCsvToS3.ToolTip")); PropsUi.setLook(wStreamToS3Csv); FormData fdStreamToS3Csv = new FormData(); - fdStreamToS3Csv.top = new FormAttachment(0, margin*4); + fdStreamToS3Csv.top = new FormAttachment(0, margin * 4); fdStreamToS3Csv.left = new FormAttachment(middle, 0); fdStreamToS3Csv.right = new FormAttachment(100, 0); wStreamToS3Csv.setLayoutData(fdStreamToS3Csv); @@ -519,30 +523,32 @@ public void widgetSelected(SelectionEvent arg0) { lastControl = wlStreamToS3Csv; wStreamToS3Csv.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if(wStreamToS3Csv.getSelection()){ - wLoadFromExistingFileFormat.setText(""); - } - wLoadFromExistingFileFormat.setEnabled(!wStreamToS3Csv.getSelection()); - } + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (wStreamToS3Csv.getSelection()) { + wLoadFromExistingFileFormat.setText(""); } - ); + wLoadFromExistingFileFormat.setEnabled(!wStreamToS3Csv.getSelection()); + } + }); Label wlLoadFromExistingFile = new Label(wMainComp, SWT.RIGHT); - wlLoadFromExistingFile.setText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.LoadFromExistingFile.Label")); - wlLoadFromExistingFile.setToolTipText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.LoadFromExistingFile.Tooltip")); + wlLoadFromExistingFile.setText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.LoadFromExistingFile.Label")); + wlLoadFromExistingFile.setToolTipText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.LoadFromExistingFile.Tooltip")); PropsUi.setLook(wlLoadFromExistingFile); FormData fdlLoadFromExistingFile = new FormData(); - fdlLoadFromExistingFile.top = new FormAttachment(lastControl, margin*2); + fdlLoadFromExistingFile.top = new FormAttachment(lastControl, margin * 2); fdlLoadFromExistingFile.left = new FormAttachment(0, 0); fdlLoadFromExistingFile.right = new FormAttachment(middle, -margin); wlLoadFromExistingFile.setLayoutData(fdlLoadFromExistingFile); - wLoadFromExistingFileFormat = new ComboVar(variables, wMainComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); + wLoadFromExistingFileFormat = + new ComboVar(variables, wMainComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); FormData fdLoadFromExistingFile = new FormData(); - fdLoadFromExistingFile.top = new FormAttachment(lastControl, margin*2); + fdLoadFromExistingFile.top = new FormAttachment(lastControl, margin * 2); fdLoadFromExistingFile.left = new FormAttachment(middle, 0); fdLoadFromExistingFile.right = new FormAttachment(100, 0); wLoadFromExistingFileFormat.setLayoutData(fdLoadFromExistingFile); @@ -551,10 +557,11 @@ public void widgetSelected(SelectionEvent e) { lastControl = wLoadFromExistingFileFormat; Label wlCopyFromFile = new Label(wMainComp, SWT.RIGHT); - wlCopyFromFile.setText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.CopyFromFile.Label")); + wlCopyFromFile.setText( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.CopyFromFile.Label")); PropsUi.setLook(wlCopyFromFile); FormData fdlCopyFromFile = new FormData(); - fdlCopyFromFile.top = new FormAttachment(lastControl, margin*2); + fdlCopyFromFile.top = new FormAttachment(lastControl, margin * 2); fdlCopyFromFile.left = new FormAttachment(0, 0); fdlCopyFromFile.right = new FormAttachment(middle, -margin); wlCopyFromFile.setLayoutData(fdlCopyFromFile); @@ -563,7 +570,7 @@ public void widgetSelected(SelectionEvent e) { PropsUi.setLook(wbCopyFromFile); wbCopyFromFile.setText(BaseMessages.getString("System.Button.Browse")); FormData fdbCopyFromFile = new FormData(); - fdbCopyFromFile.top = new FormAttachment(lastControl, margin*2); + fdbCopyFromFile.top = new FormAttachment(lastControl, margin * 2); fdbCopyFromFile.right = new FormAttachment(100, 0); wbCopyFromFile.setLayoutData(fdbCopyFromFile); @@ -574,7 +581,7 @@ public void widgetSelected(SelectionEvent e) { wCopyFromFilename.getTextWidget().setMessage("s3://"); FormData fdCopyFromFile = new FormData(); - fdCopyFromFile.top = new FormAttachment(lastControl, margin*2); + fdCopyFromFile.top = new FormAttachment(lastControl, margin * 2); fdCopyFromFile.left = new FormAttachment(middle, 0); fdCopyFromFile.right = new FormAttachment(wbCopyFromFile, -margin); wCopyFromFilename.setLayoutData(fdCopyFromFile); @@ -770,7 +777,7 @@ private void generateMappings() { // refresh data input.setTablename(variables.resolve(wTable.getText())); ITransformMeta transformMeta = this.transformMeta.getTransform(); - if(StringUtils.isEmpty(input.getConnection())){ + if (StringUtils.isEmpty(input.getConnection())) { input.setConnection(wConnection.getText()); } try { @@ -955,38 +962,38 @@ public void setFlags() { /** Copy information from the meta-data input to the dialog fields. */ public void getData() { - if(!StringUtils.isEmpty(input.getConnection())) { + if (!StringUtils.isEmpty(input.getConnection())) { wConnection.setText(input.getConnection()); } - if(!StringUtils.isEmpty(input.getSchemaName())) { + if (!StringUtils.isEmpty(input.getSchemaName())) { wSchema.setText(input.getSchemaName()); } - if(!StringUtils.isEmpty(input.getTableName())) { + if (!StringUtils.isEmpty(input.getTableName())) { wTable.setText(input.getTableName()); } - if(input.isUseCredentials()){ + if (input.isUseCredentials()) { wAwsAuthentication.setText(awsAuthOptions[0]); wUseSystemVars.setSelection(input.isUseSystemEnvVars()); - if(!input.isUseSystemEnvVars()){ - if(!StringUtil.isEmpty(input.getAwsAccessKeyId())){ + if (!input.isUseSystemEnvVars()) { + if (!StringUtil.isEmpty(input.getAwsAccessKeyId())) { wAccessKeyId.setText(input.getAwsAccessKeyId()); } - if(!StringUtils.isEmpty(input.getAwsSecretAccessKey())){ + if (!StringUtils.isEmpty(input.getAwsSecretAccessKey())) { wAccessKeyId.setText(input.getAwsSecretAccessKey()); } } - }else if(input.isUseAwsIamRole()){ + } else if (input.isUseAwsIamRole()) { wAwsAuthentication.setText(awsAuthOptions[1]); - if(!StringUtils.isEmpty(input.getAwsIamRole())){ + if (!StringUtils.isEmpty(input.getAwsIamRole())) { wAwsIamRole.setText(input.getAwsIamRole()); } } wStreamToS3Csv.setSelection(input.isStreamToS3Csv()); - if(!StringUtils.isEmpty(input.getLoadFromExistingFileFormat())){ + if (!StringUtils.isEmpty(input.getLoadFromExistingFileFormat())) { wLoadFromExistingFileFormat.setText(input.getLoadFromExistingFileFormat()); } - if(!StringUtils.isEmpty(input.getCopyFromFilename())){ + if (!StringUtils.isEmpty(input.getCopyFromFilename())) { wCopyFromFilename.setText(input.getCopyFromFilename()); } @@ -1018,43 +1025,43 @@ private void cancel() { } private void getInfo(RedshiftBulkLoaderMeta info) { - if(!StringUtils.isEmpty(wConnection.getText())){ + if (!StringUtils.isEmpty(wConnection.getText())) { info.setConnection(wConnection.getText()); } - if(!StringUtils.isEmpty(wSchema.getText())){ + if (!StringUtils.isEmpty(wSchema.getText())) { info.setSchemaName(wSchema.getText()); } - if(!StringUtils.isEmpty(wTable.getText())){ + if (!StringUtils.isEmpty(wTable.getText())) { info.setTablename(wTable.getText()); } - if(wAwsAuthentication.getText().equals(AWS_CREDENTIALS)){ + if (wAwsAuthentication.getText().equals(AWS_CREDENTIALS)) { info.setUseCredentials(true); info.setUseAwsIamRole(false); - if(wUseSystemVars.getSelection()){ + if (wUseSystemVars.getSelection()) { info.setUseSystemEnvVars(true); - }else{ + } else { info.setUseSystemEnvVars(false); - if(!StringUtils.isEmpty(wAccessKeyId.getText())){ + if (!StringUtils.isEmpty(wAccessKeyId.getText())) { info.setAwsAccessKeyId(wAccessKeyId.getText()); } - if(!StringUtil.isEmpty(wSecretAccessKey.getText())){ + if (!StringUtil.isEmpty(wSecretAccessKey.getText())) { info.setAwsSecretAccessKey(wSecretAccessKey.getText()); } } - }else if(wAwsAuthentication.getText().equals(AWS_IAM_ROLE)){ + } else if (wAwsAuthentication.getText().equals(AWS_IAM_ROLE)) { info.setUseCredentials(false); info.setUseAwsIamRole(true); - if(!StringUtils.isEmpty(wAwsIamRole.getText())){ + if (!StringUtils.isEmpty(wAwsIamRole.getText())) { info.setAwsIamRole(wAwsIamRole.getText()); } } info.setTruncateTable(wTruncate.getSelection()); info.setOnlyWhenHaveRows(wOnlyWhenHaveRows.getSelection()); info.setStreamToS3Csv(wStreamToS3Csv.getSelection()); - if(!StringUtils.isEmpty(wLoadFromExistingFileFormat.getText())){ + if (!StringUtils.isEmpty(wLoadFromExistingFileFormat.getText())) { info.setLoadFromExistingFileFormat(wLoadFromExistingFileFormat.getText()); } - if(!StringUtils.isEmpty(wCopyFromFilename.getText())){ + if (!StringUtils.isEmpty(wCopyFromFilename.getText())) { info.setCopyFromFilename(wCopyFromFilename.getText()); } @@ -1185,7 +1192,8 @@ private void sql() { sqledit.open(); } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION); - mb.setMessage(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.NoSQL.DialogMessage")); + mb.setMessage( + BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.NoSQL.DialogMessage")); mb.setText(BaseMessages.getString(PKG, "RedshiftBulkLoaderDialog.NoSQL.DialogTitle")); mb.open(); } @@ -1209,8 +1217,8 @@ public String toString() { return this.getClass().getName(); } - public void toggleAuthSelection(){ - if(wAwsAuthentication.getText().equals("Credentials")){ + public void toggleAuthSelection() { + if (wAwsAuthentication.getText().equals("Credentials")) { wlUseSystemVars.setEnabled(true); wUseSystemVars.setEnabled(true); wlAccessKeyId.setEnabled(true); @@ -1221,7 +1229,7 @@ public void toggleAuthSelection(){ wlAwsIamRole.setEnabled(false); wAwsIamRole.setEnabled(false); } - if(wAwsAuthentication.getText().equals("IAM Role")){ + if (wAwsAuthentication.getText().equals("IAM Role")) { wlUseSystemVars.setEnabled(false); wUseSystemVars.setEnabled(false); wlAccessKeyId.setEnabled(false); @@ -1234,13 +1242,13 @@ public void toggleAuthSelection(){ } } - public void toggleKeysSelection(){ - if(wUseSystemVars.getSelection()){ + public void toggleKeysSelection() { + if (wUseSystemVars.getSelection()) { wlAccessKeyId.setEnabled(false); wAccessKeyId.setEnabled(false); wlSecretAccessKey.setEnabled(false); wSecretAccessKey.setEnabled(false); - }else{ + } else { wlAccessKeyId.setEnabled(true); wAccessKeyId.setEnabled(true); wlSecretAccessKey.setEnabled(true); diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderField.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderField.java index 656fe859a55..36254cb54d3 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderField.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderField.java @@ -17,62 +17,56 @@ package org.apache.hop.pipeline.transforms.redshift.bulkloader; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class RedshiftBulkLoaderField { - public RedshiftBulkLoaderField(){ + public RedshiftBulkLoaderField() {} - } + public RedshiftBulkLoaderField(String fieldDatabase, String fieldStream) { + this.databaseField = fieldDatabase; + this.streamField = fieldStream; + } - public RedshiftBulkLoaderField(String fieldDatabase, String fieldStream){ - this.databaseField = fieldDatabase; - this.streamField = fieldStream; - } - - @HopMetadataProperty( + @HopMetadataProperty( key = "stream_name", injectionKey = "STREAM_FIELDNAME", - injectionKeyDescription = "RedshiftBulkLoader.Inject.FIELDSTREAM" - ) - private String streamField; - - @HopMetadataProperty( - key = "column_name", - injectionKey = "DATABASE_FIELDNAME", - injectionKeyDescription = "RedshiftBulkLoader.Inject.FIELDDATABASE" - ) - private String databaseField; - - public String getStreamField(){ - return streamField; - } - - public void setStreamField(String streamField){ - this.streamField = streamField; - } - - public String getDatabaseField(){ - return databaseField; - } - - public void setDatabaseField(String databaseField){ - this.databaseField = databaseField; - } - - @Override - public boolean equals(Object o){ - if(this == o) return true; - if(o == null || getClass() != o.getClass()) return false; - RedshiftBulkLoaderField that = (RedshiftBulkLoaderField) o; - return streamField.equals(that.streamField) && databaseField.equals(that.databaseField); - } - - @Override - public int hashCode(){ - return Objects.hash(streamField, databaseField); - } - + injectionKeyDescription = "RedshiftBulkLoader.Inject.FIELDSTREAM") + private String streamField; + + @HopMetadataProperty( + key = "column_name", + injectionKey = "DATABASE_FIELDNAME", + injectionKeyDescription = "RedshiftBulkLoader.Inject.FIELDDATABASE") + private String databaseField; + + public String getStreamField() { + return streamField; + } + + public void setStreamField(String streamField) { + this.streamField = streamField; + } + + public String getDatabaseField() { + return databaseField; + } + + public void setDatabaseField(String databaseField) { + this.databaseField = databaseField; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RedshiftBulkLoaderField that = (RedshiftBulkLoaderField) o; + return streamField.equals(that.streamField) && databaseField.equals(that.databaseField); + } + + @Override + public int hashCode() { + return Objects.hash(streamField, databaseField); + } } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderMeta.java b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderMeta.java index bde9cf04452..4031a5f57f4 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderMeta.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/pipeline/transforms/redshift/bulkloader/RedshiftBulkLoaderMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.redshift.bulkloader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -42,10 +45,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - @Transform( id = "RedshiftBulkLoader", image = "redshift.svg", @@ -86,43 +85,37 @@ public class RedshiftBulkLoaderMeta @HopMetadataProperty( key = "use_credentials", injectionKey = "USE_CREDENTIALS", - injectionKeyDescription = "" - ) + injectionKeyDescription = "") private boolean useCredentials; @HopMetadataProperty( key = "use_system_env_vars", injectionKey = "USE_SYSTEM_ENV_VARS", - injectionKeyDescription = "" - ) + injectionKeyDescription = "") private boolean useSystemEnvVars; @HopMetadataProperty( key = "aws_access_key_id", injectionKey = "AWS_ACCESS_KEY_ID", - injectionKeyDescription = "" - ) + injectionKeyDescription = "") private String awsAccessKeyId; @HopMetadataProperty( key = "aws_secret_access_key", injectionKey = "AWS_SECRET_ACCESS_KEY", - injectionKeyDescription = "" - ) + injectionKeyDescription = "") private String awsSecretAccessKey; @HopMetadataProperty( key = "use_aws_iam_role", injectionKey = "USE_AWS_IAM_ROLE", - injectionKeyDescription = "" - ) + injectionKeyDescription = "") private boolean useAwsIamRole; @HopMetadataProperty( key = "aws_iam_role", injectionKey = "AWS_IAM_ROLE", - injectionKeyDescription = "" - ) + injectionKeyDescription = "") private String awsIamRole; @HopMetadataProperty( @@ -138,10 +131,9 @@ public class RedshiftBulkLoaderMeta private boolean onlyWhenHaveRows; @HopMetadataProperty( - key = "stream_to_s3", - injectionKey = "STREAM_TO_S3", - injectionKeyDescription = "" - ) + key = "stream_to_s3", + injectionKey = "STREAM_TO_S3", + injectionKeyDescription = "") private boolean streamToS3Csv = true; /** CSV: Trim whitespace */ @@ -163,12 +155,10 @@ public class RedshiftBulkLoaderMeta @HopMetadataProperty(key = "strip_null", injectionKeyDescription = "") private boolean stripNull; - @HopMetadataProperty( - key = "load_from_existing_file", - injectionKey = "LOAD_FROM_EXISTING_FILE", - injectionKeyDescription = "" - ) + key = "load_from_existing_file", + injectionKey = "LOAD_FROM_EXISTING_FILE", + injectionKeyDescription = "") private String loadFromExistingFileFormat; /** Do we explicitly select the fields to update in the database */ @@ -176,10 +166,9 @@ public class RedshiftBulkLoaderMeta private boolean specifyFields; @HopMetadataProperty( - key = "load_from_filename", - injectionKey = "LOAD_FROM_FILENAME", - injectionKeyDescription = "" - ) + key = "load_from_filename", + injectionKey = "LOAD_FROM_FILENAME", + injectionKeyDescription = "") private String copyFromFilename; @HopMetadataProperty( @@ -374,7 +363,6 @@ public void setStripNull(boolean stripNull) { this.stripNull = stripNull; } - public String getLoadFromExistingFileFormat() { return loadFromExistingFileFormat; } @@ -674,7 +662,8 @@ public void check( cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, - BaseMessages.getString(PKG, "RedshiftBulkLoaderMeta.CheckResult.NoFields"), + BaseMessages.getString( + PKG, "RedshiftBulkLoaderMeta.CheckResult.NoFields"), transformMeta); remarks.add(cr); } diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3/vfs/S3FileObject.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3/vfs/S3FileObject.java index ad993042513..cbd28fcf5de 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3/vfs/S3FileObject.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3/vfs/S3FileObject.java @@ -17,6 +17,8 @@ package org.apache.hop.vfs.s3.s3.vfs; +import static java.util.AbstractMap.SimpleEntry; + import com.amazonaws.SdkClientException; import com.amazonaws.services.s3.model.AmazonS3Exception; import com.amazonaws.services.s3.model.CopyObjectRequest; @@ -25,6 +27,9 @@ import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; import com.amazonaws.services.s3.model.S3Object; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.provider.AbstractFileName; @@ -32,12 +37,6 @@ import org.apache.hop.vfs.s3.s3common.S3CommonFileObject; import org.apache.hop.vfs.s3.s3common.S3CommonPipedOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; - -import static java.util.AbstractMap.SimpleEntry; - public class S3FileObject extends S3CommonFileObject { public S3FileObject(final AbstractFileName name, final S3FileSystem fileSystem) { diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileInputStream.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileInputStream.java index a5b67de9f93..b3ab75a696b 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileInputStream.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileInputStream.java @@ -17,10 +17,9 @@ package org.apache.hop.vfs.s3.s3common; import com.amazonaws.services.s3.model.S3Object; -import org.apache.commons.vfs2.util.MonitorInputStream; - import java.io.IOException; import java.io.InputStream; +import org.apache.commons.vfs2.util.MonitorInputStream; public class S3CommonFileInputStream extends MonitorInputStream { diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileObject.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileObject.java index 9d65310080b..ecad08de571 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileObject.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileObject.java @@ -27,19 +27,18 @@ import com.amazonaws.services.s3.model.S3Object; import com.amazonaws.services.s3.model.S3ObjectSummary; import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileType; -import org.apache.commons.vfs2.provider.AbstractFileName; -import org.apache.commons.vfs2.provider.AbstractFileObject; -import org.apache.hop.core.logging.LogChannel; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; +import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileSystemException; +import org.apache.commons.vfs2.FileType; +import org.apache.commons.vfs2.provider.AbstractFileName; +import org.apache.commons.vfs2.provider.AbstractFileObject; +import org.apache.hop.core.logging.LogChannel; public abstract class S3CommonFileObject extends AbstractFileObject { diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileProvider.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileProvider.java index e0f59fe7a97..4f0e8a67824 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileProvider.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileProvider.java @@ -17,6 +17,9 @@ package org.apache.hop.vfs.s3.s3common; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystem; @@ -25,10 +28,6 @@ import org.apache.commons.vfs2.UserAuthenticationData; import org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - public abstract class S3CommonFileProvider extends AbstractOriginatingFileProvider { /** Authentication types. */ diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileSystem.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileSystem.java index a6f2939a97a..12d1d732d51 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileSystem.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonFileSystem.java @@ -29,6 +29,8 @@ import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import java.io.File; +import java.util.Collection; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemOptions; @@ -37,9 +39,6 @@ import org.apache.hop.core.logging.LogChannel; import org.apache.hop.vfs.s3.amazon.s3.S3Util; -import java.io.File; -import java.util.Collection; - public abstract class S3CommonFileSystem extends AbstractFileSystem { private String awsAccessKeyCache; diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonPipedOutputStream.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonPipedOutputStream.java index 6e1d792af7e..638639f2569 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonPipedOutputStream.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3CommonPipedOutputStream.java @@ -23,10 +23,6 @@ import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; import com.amazonaws.services.s3.model.PartETag; import com.amazonaws.services.s3.model.UploadPartRequest; -import org.apache.hop.core.logging.LogChannel; -import org.apache.hop.core.util.StorageUnitConverter; -import org.apache.hop.i18n.BaseMessages; - import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -38,6 +34,9 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; +import org.apache.hop.core.logging.LogChannel; +import org.apache.hop.core.util.StorageUnitConverter; +import org.apache.hop.i18n.BaseMessages; /** Custom OutputStream that enables chunked uploads into S3 */ public class S3CommonPipedOutputStream extends PipedOutputStream { @@ -56,6 +55,7 @@ public class S3CommonPipedOutputStream extends PipedOutputStream { private Future result = null; private final String bucketId; private final String key; + /** AWS Multipart part size. */ private final int partSize; diff --git a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3HopProperty.java b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3HopProperty.java index bccfe3441ce..e9dbb8885a5 100644 --- a/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3HopProperty.java +++ b/plugins/tech/aws/src/main/java/org/apache/hop/vfs/s3/s3common/S3HopProperty.java @@ -22,9 +22,9 @@ /** Class that handles operations dealing with hop property file. */ public class S3HopProperty { - + // TODO: Provide variable description - @Variable(description="") + @Variable(description = "") public static final String HOP_S3_VFS_PART_SIZE = "HOP_S3_VFS_PART_SIZE"; public String getPartSize() { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserIT.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserIT.java index c0fdd89f702..efd345b7c6f 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserIT.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserIT.java @@ -17,13 +17,13 @@ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertEquals; + import org.apache.commons.vfs2.provider.FileNameParser; import org.apache.hop.vfs.s3.s3.vfs.S3FileName; import org.apache.hop.vfs.s3.s3.vfs.S3FileNameParser; import org.junit.Test; -import static org.junit.Assert.assertEquals; - /** created by: rfellows date: 5/25/12 */ public class S3FileNameParserIT { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserTest.java index c27fe17131e..769ee318f32 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameParserTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.provider.FileNameParser; import org.apache.commons.vfs2.provider.VfsComponentContext; @@ -24,10 +28,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; - /** Unit tests for S3FileNameParser */ public class S3FileNameParserTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameTest.java index 7f9f4873b9f..2fdc4a72852 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileNameTest.java @@ -17,13 +17,13 @@ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertEquals; + import org.apache.commons.vfs2.FileType; import org.apache.hop.vfs.s3.s3.vfs.S3FileName; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; - /** created by: rfellows date: 05/17/2012 */ public class S3FileNameTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileObjectTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileObjectTest.java index 4ef665e65aa..39b429812e6 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileObjectTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileObjectTest.java @@ -16,6 +16,21 @@ */ package org.apache.hop.vfs.s3.vfs; +import static java.util.AbstractMap.SimpleEntry; +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 static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.atMost; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.AmazonS3Exception; import com.amazonaws.services.s3.model.Bucket; @@ -30,6 +45,12 @@ import com.amazonaws.services.s3.model.S3ObjectInputStream; import com.amazonaws.services.s3.model.S3ObjectSummary; import com.amazonaws.services.s3.model.UploadPartResult; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; import org.apache.commons.vfs2.CacheStrategy; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; @@ -50,28 +71,6 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - -import static java.util.AbstractMap.SimpleEntry; -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 static org.junit.Assert.fail; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyString; -import static org.mockito.Mockito.atMost; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** created by: dzmitry_bahdanovich date: 10/18/13 */ public class S3FileObjectTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileProviderTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileProviderTest.java index efce0e0e53c..495f9bf2cc2 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileProviderTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileProviderTest.java @@ -16,15 +16,15 @@ */ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystemOptions; import org.apache.hop.vfs.s3.s3.vfs.S3FileProvider; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; - /** Unit tests for S3FileProvider */ public class S3FileProviderTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileSystemTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileSystemTest.java index 6cc139c8381..bd7eeec5a88 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileSystemTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3FileSystemTest.java @@ -16,6 +16,11 @@ */ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.FileType; @@ -32,11 +37,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** Unit tests for S3FileSystem */ public class S3FileSystemTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameParserTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameParserTest.java index 7f1b37bfda4..51352cef7c2 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameParserTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameParserTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.provider.FileNameParser; import org.apache.commons.vfs2.provider.VfsComponentContext; @@ -24,10 +28,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; - /** Unit tests for S3FileNameParser */ public class S3NFileNameParserTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameTest.java index d42b732dbe8..a9623a378e4 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileNameTest.java @@ -17,14 +17,14 @@ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertEquals; + import org.apache.commons.vfs2.FileType; import org.apache.hop.vfs.s3.s3n.vfs.S3NFileName; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.assertEquals; - /** created by: rfellows date: 05/17/2012 */ public class S3NFileNameTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileObjectTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileObjectTest.java index 84643d80ec1..4f2d71a5def 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileObjectTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileObjectTest.java @@ -16,6 +16,18 @@ */ package org.apache.hop.vfs.s3.vfs; +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 static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.AmazonS3Exception; import com.amazonaws.services.s3.model.Bucket; @@ -27,6 +39,11 @@ import com.amazonaws.services.s3.model.S3Object; import com.amazonaws.services.s3.model.S3ObjectInputStream; import com.amazonaws.services.s3.model.S3ObjectSummary; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; import org.apache.commons.vfs2.CacheStrategy; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; @@ -43,24 +60,6 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - -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 static org.junit.Assert.fail; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** created by: dzmitry_bahdanovich date: 10/18/13 */ public class S3NFileObjectTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileProviderTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileProviderTest.java index 449a282ef83..8df5ab1ad37 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileProviderTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileProviderTest.java @@ -16,15 +16,15 @@ */ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystemOptions; import org.apache.hop.vfs.s3.s3n.vfs.S3NFileProvider; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; - /** Unit tests for S3FileProvider */ public class S3NFileProviderTest { diff --git a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileSystemTest.java b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileSystemTest.java index 3361f4c546d..d9d0e3bd7b7 100644 --- a/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileSystemTest.java +++ b/plugins/tech/aws/src/test/java/org/apache/hop/vfs/s3/vfs/S3NFileSystemTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.vfs.s3.vfs; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.UserAuthenticationData; @@ -28,10 +32,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** Unit tests for S3FileSystem */ public class S3NFileSystemTest { diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java index 671ae8298c1..6c71c4f939f 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java @@ -22,6 +22,10 @@ import com.microsoft.azure.eventhubs.EventHubClient; import com.microsoft.azure.eventprocessorhost.EventProcessorHost; import com.microsoft.azure.eventprocessorhost.EventProcessorOptions; +import java.util.LinkedList; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.Executors; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -37,11 +41,6 @@ import org.apache.hop.pipeline.transform.RowAdapter; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.LinkedList; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.Executors; - public class AzureListener extends BaseTransform { public AzureListener( diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerData.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerData.java index 05ded64765a..65ccfc0f91a 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerData.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerData.java @@ -21,6 +21,8 @@ import com.microsoft.azure.eventhubs.ConnectionStringBuilder; import com.microsoft.azure.eventhubs.EventData; import com.microsoft.azure.eventhubs.EventHubClient; +import java.util.LinkedList; +import java.util.concurrent.ScheduledExecutorService; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.LinkedList; -import java.util.concurrent.ScheduledExecutorService; - public class AzureListenerData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerErrorNotificationHandler.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerErrorNotificationHandler.java index 9ff779a43b8..4ee0b741886 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerErrorNotificationHandler.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerErrorNotificationHandler.java @@ -19,7 +19,6 @@ package org.apache.hop.pipeline.transforms.eventhubs.listen; import com.microsoft.azure.eventprocessorhost.ExceptionReceivedEventArgs; - import java.util.function.Consumer; // The general notification handler is an object that derives from Consumer<> and takes an diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerEventProcessor.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerEventProcessor.java index f1e7e0c4e65..b55b039bdb4 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerEventProcessor.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerEventProcessor.java @@ -22,13 +22,12 @@ import com.microsoft.azure.eventprocessorhost.CloseReason; import com.microsoft.azure.eventprocessorhost.IEventProcessor; import com.microsoft.azure.eventprocessorhost.PartitionContext; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.RowDataUtil; - import java.sql.Timestamp; import java.time.Instant; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.RowDataUtil; public class AzureListenerEventProcessor implements IEventProcessor { diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWrite.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWrite.java index 2f18b60104f..b9ce639debb 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWrite.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWrite.java @@ -22,6 +22,9 @@ import com.microsoft.azure.eventhubs.EventData; import com.microsoft.azure.eventhubs.EventHubClient; import com.microsoft.azure.eventhubs.EventHubException; +import java.nio.charset.StandardCharsets; +import java.util.LinkedList; +import java.util.concurrent.Executors; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -30,10 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.nio.charset.StandardCharsets; -import java.util.LinkedList; -import java.util.concurrent.Executors; - public class AzureWrite extends BaseTransform { public AzureWrite( diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterData.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterData.java index 78401bdc8b8..abcde80f58c 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterData.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterData.java @@ -21,13 +21,12 @@ import com.microsoft.azure.eventhubs.ConnectionStringBuilder; import com.microsoft.azure.eventhubs.EventData; import com.microsoft.azure.eventhubs.EventHubClient; +import java.util.LinkedList; +import java.util.concurrent.ScheduledExecutorService; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.LinkedList; -import java.util.concurrent.ScheduledExecutorService; - public class AzureWriterData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterDialog.java b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterDialog.java index ebf71cf7348..1f4ed3f44fc 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterDialog.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterDialog.java @@ -43,7 +43,8 @@ public class AzureWriterDialog extends BaseTransformDialog implements ITransformDialog { - private static final Class PKG = AzureWriterMeta.class; // for i18n purposes, needed by Translator2!! + private static final Class PKG = + AzureWriterMeta.class; // for i18n purposes, needed by Translator2!! private Text wTransformName; private TextVar wNamespace; diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AppendBlobInputStream.java b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AppendBlobInputStream.java index 8641b202a2f..bf895f8f83f 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AppendBlobInputStream.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AppendBlobInputStream.java @@ -19,7 +19,6 @@ package org.apache.hop.vfs.azure; import com.microsoft.azure.storage.blob.BlobInputStream; - import java.io.IOException; import java.io.InputStream; diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileObject.java b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileObject.java index c577e83fe9b..9b3a6a0c368 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileObject.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileObject.java @@ -289,11 +289,12 @@ protected void doAttach() throws URISyntaxException, StorageException { } } - private boolean pathsMatch(String path, String currentPath) { - return path.replace("/" + ((AzureFileSystem) getFileSystem()).getAccount(), "").equals(currentPath); - } + private boolean pathsMatch(String path, String currentPath) { + return path.replace("/" + ((AzureFileSystem) getFileSystem()).getAccount(), "") + .equals(currentPath); + } - @Override + @Override protected void doDetach() throws Exception { if (this.attached) { this.attached = false; @@ -395,15 +396,14 @@ protected long doGetLastModifiedTime() throws Exception { protected OutputStream doGetOutputStream(boolean bAppend) throws Exception { if (container != null && !containerPath.equals("")) { if (bAppend) throw new UnsupportedOperationException(); - final CloudAppendBlob cab = container.getAppendBlobReference(removeLeadingSlash(containerPath)); + final CloudAppendBlob cab = + container.getAppendBlobReference(removeLeadingSlash(containerPath)); if (type == FileType.IMAGINARY) { type = FileType.FILE; - return new AppendBlobOutputStream( - cab, cab.openWriteNew()); + return new AppendBlobOutputStream(cab, cab.openWriteNew()); } else { - return new AppendBlobOutputStream( - cab, cab.openWriteExisting()); + return new AppendBlobOutputStream(cab, cab.openWriteExisting()); } } else { throw new UnsupportedOperationException(); diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileProvider.java b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileProvider.java index 609ec820dae..00362c39680 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileProvider.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileProvider.java @@ -20,6 +20,11 @@ import com.microsoft.azure.storage.CloudStorageAccount; import com.microsoft.azure.storage.blob.CloudBlobClient; +import java.net.URISyntaxException; +import java.security.InvalidKeyException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,12 +41,6 @@ import org.apache.hop.vfs.azure.config.AzureConfig; import org.apache.hop.vfs.azure.config.AzureConfigSingleton; -import java.net.URISyntaxException; -import java.security.InvalidKeyException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - public class AzureFileProvider extends AbstractOriginatingFileProvider { public static final Collection capabilities = diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileSystem.java b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileSystem.java index 56201fdcc80..2631ade0c29 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileSystem.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/AzureFileSystem.java @@ -19,6 +19,7 @@ package org.apache.hop.vfs.azure; import com.microsoft.azure.storage.blob.CloudBlobClient; +import java.util.Collection; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -26,8 +27,6 @@ import org.apache.commons.vfs2.provider.AbstractFileName; import org.apache.commons.vfs2.provider.AbstractFileSystem; -import java.util.Collection; - public class AzureFileSystem extends AbstractFileSystem { private CloudBlobClient client; @@ -35,7 +34,10 @@ public class AzureFileSystem extends AbstractFileSystem { private String account; public AzureFileSystem( - AzureFileName fileName, CloudBlobClient service, FileSystemOptions fileSystemOptions, String account) + AzureFileName fileName, + CloudBlobClient service, + FileSystemOptions fileSystemOptions, + String account) throws FileSystemException { super(fileName, null, fileSystemOptions); this.client = service; @@ -52,7 +54,7 @@ protected FileObject createFile(AbstractFileName name) throws Exception { return new AzureFileObject(name, this, client); } - public String getAccount() { - return account; - } + public String getAccount() { + return account; + } } diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfig.java b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfig.java index 03c81ae5e16..bd6fe354196 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfig.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfig.java @@ -26,8 +26,7 @@ public class AzureConfig { private String key; private String emulatorUrl; - public AzureConfig() { - } + public AzureConfig() {} public AzureConfig(AzureConfig config) { this(); @@ -45,7 +44,9 @@ public String getAccount() { return account; } - /** @param account The account to set */ + /** + * @param account The account to set + */ public void setAccount(String account) { this.account = account; } @@ -59,26 +60,26 @@ public String getKey() { return key; } - /** @param key The key to set */ + /** + * @param key The key to set + */ public void setKey(String key) { this.key = key; } + /** + * Gets emulatorUrl + * + * @return the url of the Azure Emulator + */ + public String getEmulatorUrl() { + return emulatorUrl; + } -/** -* Gets emulatorUrl - * - * @return the url of the Azure Emulator -*/ - public String getEmulatorUrl() { - return emulatorUrl; - } - -/** -* - * @param emulatorUrl The emulatorUrl to set -*/ - public void setEmulatorUrl(String emulatorUrl) { - this.emulatorUrl = emulatorUrl; - } + /** + * @param emulatorUrl The emulatorUrl to set + */ + public void setEmulatorUrl(String emulatorUrl) { + this.emulatorUrl = emulatorUrl; + } } diff --git a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfigPlugin.java b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfigPlugin.java index a171241a38a..0018c922285 100644 --- a/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfigPlugin.java +++ b/plugins/tech/azure/src/main/java/org/apache/hop/vfs/azure/config/AzureConfigPlugin.java @@ -74,19 +74,19 @@ public class AzureConfigPlugin implements IConfigOptions, IGuiPluginCompositeWid description = "The key to use for the Azure VFS") private String key; - @GuiWidgetElement( - id = WIDGET_ID_AZURE_LOCAL_EMULATOR_URL, - parentId = ConfigPluginOptionsTab.GUI_WIDGETS_PARENT_ID, - type = GuiElementType.TEXT, - variables = true, - password = false, - label = "i18n::AzureVFS.Url.Label", - toolTip = "i18n::AzureVFS.Url.Description") - @CommandLine.Option( - names = {"-aze", "--azure-emulator"}, - description = "The URL of an Azure emulator (Azurite) to be used for test and development goals instead of official Azure services") - private String localEmulatorUrl; - + @GuiWidgetElement( + id = WIDGET_ID_AZURE_LOCAL_EMULATOR_URL, + parentId = ConfigPluginOptionsTab.GUI_WIDGETS_PARENT_ID, + type = GuiElementType.TEXT, + variables = true, + password = false, + label = "i18n::AzureVFS.Url.Label", + toolTip = "i18n::AzureVFS.Url.Description") + @CommandLine.Option( + names = {"-aze", "--azure-emulator"}, + description = + "The URL of an Azure emulator (Azurite) to be used for test and development goals instead of official Azure services") + private String localEmulatorUrl; /** * Gets instance @@ -125,8 +125,8 @@ public boolean handleOption( } if (localEmulatorUrl != null) { - config.setEmulatorUrl(localEmulatorUrl); - log.logBasic("The Azure emulator URL is set to '" + localEmulatorUrl + "'"); + config.setEmulatorUrl(localEmulatorUrl); + log.logBasic("The Azure emulator URL is set to '" + localEmulatorUrl + "'"); } // Save to file if anything changed @@ -166,8 +166,8 @@ public void persistContents(GuiCompositeWidgets compositeWidgets) { AzureConfigSingleton.getConfig().setKey(key); break; case WIDGET_ID_AZURE_LOCAL_EMULATOR_URL: - localEmulatorUrl = ((TextVar) control).getText(); - AzureConfigSingleton.getConfig().setEmulatorUrl(localEmulatorUrl); + localEmulatorUrl = ((TextVar) control).getText(); + AzureConfigSingleton.getConfig().setEmulatorUrl(localEmulatorUrl); } } // Save the project... @@ -211,19 +211,17 @@ public void setKey(String key) { this.key = key; } -/** -* - * @return the local emulator url -*/ - public String getLocalEmulatorUrl() { - return localEmulatorUrl; - } + /** + * @return the local emulator url + */ + public String getLocalEmulatorUrl() { + return localEmulatorUrl; + } -/** -* - * @param localEmulatorUrl The URL of the Azure blob storage -*/ - public void setLocalEmulatorUrl(String localEmulatorUrl) { - this.localEmulatorUrl = localEmulatorUrl; - } + /** + * @param localEmulatorUrl The URL of the Azure blob storage + */ + public void setLocalEmulatorUrl(String localEmulatorUrl) { + this.localEmulatorUrl = localEmulatorUrl; + } } diff --git a/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerMetaTest.java b/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerMetaTest.java index 0a69d1a26a4..1e27846cc62 100644 --- a/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerMetaTest.java +++ b/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListenerMetaTest.java @@ -18,14 +18,13 @@ package org.apache.hop.pipeline.transforms.eventhubs.listen; +import java.util.List; import junit.framework.TestCase; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import org.junit.Test; -import java.util.List; - public class AzureListenerMetaTest extends TestCase { @Test diff --git a/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterMetaTest.java b/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterMetaTest.java index 4d66331c42f..1be786736c0 100644 --- a/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterMetaTest.java +++ b/plugins/tech/azure/src/test/java/org/apache/hop/pipeline/transforms/eventhubs/write/AzureWriterMetaTest.java @@ -18,16 +18,15 @@ package org.apache.hop.pipeline.transforms.eventhubs.write; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.List; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class AzureWriterMetaTest { @Test public void testSerialization() throws Exception { diff --git a/plugins/tech/azure/src/test/java/org/apache/hop/vfs/azure/AzureFileNameParserTest.java b/plugins/tech/azure/src/test/java/org/apache/hop/vfs/azure/AzureFileNameParserTest.java index 7c8f714686d..3b56b97b5dc 100644 --- a/plugins/tech/azure/src/test/java/org/apache/hop/vfs/azure/AzureFileNameParserTest.java +++ b/plugins/tech/azure/src/test/java/org/apache/hop/vfs/azure/AzureFileNameParserTest.java @@ -17,62 +17,88 @@ package org.apache.hop.vfs.azure; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; import java.util.Collection; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.provider.VfsComponentContext; -import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.mockito.Mockito; + @RunWith(Parameterized.class) public class AzureFileNameParserTest { - private AzureFileNameParser parser; + private AzureFileNameParser parser; - private final String inputUri; - private final String expectedScheme; - private final String expectedContainer; - private final String expectedPathAfterContainer; + private final String inputUri; + private final String expectedScheme; + private final String expectedContainer; + private final String expectedPathAfterContainer; - private final FileType expectedType; + private final FileType expectedType; - @Before - public void setup(){ - parser = new AzureFileNameParser(); - } + @Before + public void setup() { + parser = new AzureFileNameParser(); + } - public AzureFileNameParserTest(String inputUri, String expectedScheme, String expectedContainer, String expectedPathAfterContainer, FileType expectedType) { - this.inputUri = inputUri; - this.expectedScheme = expectedScheme; - this.expectedContainer = expectedContainer; - this.expectedPathAfterContainer = expectedPathAfterContainer; - this.expectedType = expectedType; - } + public AzureFileNameParserTest( + String inputUri, + String expectedScheme, + String expectedContainer, + String expectedPathAfterContainer, + FileType expectedType) { + this.inputUri = inputUri; + this.expectedScheme = expectedScheme; + this.expectedContainer = expectedContainer; + this.expectedPathAfterContainer = expectedPathAfterContainer; + this.expectedType = expectedType; + } - @Parameterized.Parameters - public static Collection azureUris() { - return Arrays.asList(new Object[][] { - { "azfs://hopsa/container/folder1/parquet-test-delo2-azfs-00-0001.parquet","azfs", "container","/folder1/parquet-test-delo2-azfs-00-0001.parquet", FileType.FILE }, - { "azfs:/hopsa/container/folder1/", "azfs", "container","/folder1", FileType.FOLDER }, - { "azure://test/folder1/", "azure", "test", "/folder1", FileType.FOLDER }, - { "azure://mycontainer/folder1/parquet-test-delo2-azfs-00-0001.parquet","azure", "mycontainer","/folder1/parquet-test-delo2-azfs-00-0001.parquet", FileType.FILE }, - { "azfs://devstoreaccount1/delo/delo3-azfs-00-0001.parquet", "azfs", "delo", "/delo3-azfs-00-0001.parquet", FileType.FILE} + @Parameterized.Parameters + public static Collection azureUris() { + return Arrays.asList( + new Object[][] { + { + "azfs://hopsa/container/folder1/parquet-test-delo2-azfs-00-0001.parquet", + "azfs", + "container", + "/folder1/parquet-test-delo2-azfs-00-0001.parquet", + FileType.FILE + }, + {"azfs:/hopsa/container/folder1/", "azfs", "container", "/folder1", FileType.FOLDER}, + {"azure://test/folder1/", "azure", "test", "/folder1", FileType.FOLDER}, + { + "azure://mycontainer/folder1/parquet-test-delo2-azfs-00-0001.parquet", + "azure", + "mycontainer", + "/folder1/parquet-test-delo2-azfs-00-0001.parquet", + FileType.FILE + }, + { + "azfs://devstoreaccount1/delo/delo3-azfs-00-0001.parquet", + "azfs", + "delo", + "/delo3-azfs-00-0001.parquet", + FileType.FILE + } }); - } + } - @Test - public void parseUri() throws FileSystemException { - VfsComponentContext context = Mockito.mock(VfsComponentContext.class); + @Test + public void parseUri() throws FileSystemException { + VfsComponentContext context = Mockito.mock(VfsComponentContext.class); - AzureFileName actual = (AzureFileName) parser.parseUri(context, null, inputUri); + AzureFileName actual = (AzureFileName) parser.parseUri(context, null, inputUri); - assertEquals(expectedScheme, actual.getScheme()); - assertEquals(expectedContainer, actual.getContainer()); - assertEquals(expectedPathAfterContainer, actual.getPathAfterContainer()); - assertEquals(expectedType, actual.getType()); - } + assertEquals(expectedScheme, actual.getScheme()); + assertEquals(expectedContainer, actual.getContainer()); + assertEquals(expectedPathAfterContainer, actual.getPathAfterContainer()); + assertEquals(expectedType, actual.getType()); + } } diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverConnection.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverConnection.java index 11cfaf385c5..3e142dbafa7 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverConnection.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverConnection.java @@ -34,10 +34,6 @@ import com.datastax.oss.driver.api.querybuilder.schema.CreateKeyspaceStart; import com.datastax.oss.driver.internal.core.type.codec.registry.DefaultCodecRegistry; import edu.umd.cs.findbugs.annotations.Nullable; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.databases.cassandra.spi.Keyspace; -import org.apache.hop.databases.cassandra.util.CassandraUtils; - import java.net.InetSocketAddress; import java.sql.Timestamp; import java.time.Duration; @@ -47,6 +43,9 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.databases.cassandra.spi.Keyspace; +import org.apache.hop.databases.cassandra.util.CassandraUtils; /** * connection using standard datastax driver
diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverCqlRowHandler.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverCqlRowHandler.java index 7446e57c9c0..bba22a78974 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverCqlRowHandler.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverCqlRowHandler.java @@ -31,6 +31,11 @@ import com.datastax.oss.driver.api.querybuilder.QueryBuilder; import com.datastax.oss.driver.api.querybuilder.insert.InsertInto; import com.datastax.oss.driver.api.querybuilder.insert.RegularInsert; +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; @@ -43,12 +48,6 @@ import org.apache.hop.databases.cassandra.spi.Keyspace; import org.apache.hop.pipeline.transform.ITransform; -import java.sql.Timestamp; -import java.util.Date; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - public class DriverCqlRowHandler implements CqlRowHandler { private final CqlSession session; diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverKeyspace.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverKeyspace.java index 96c02081278..b2dea2a673f 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverKeyspace.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/DriverKeyspace.java @@ -25,6 +25,10 @@ import com.datastax.oss.driver.api.querybuilder.SchemaBuilder; import com.datastax.oss.driver.api.querybuilder.schema.CreateTable; import com.datastax.oss.driver.api.querybuilder.schema.CreateTableStart; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.row.IRowMeta; @@ -35,11 +39,6 @@ import org.apache.hop.databases.cassandra.spi.Keyspace; import org.apache.hop.databases.cassandra.util.CassandraUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; - public class DriverKeyspace implements Keyspace { protected DriverConnection conn; diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/TableMetaData.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/TableMetaData.java index d8218bee055..e3b5b70f22f 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/TableMetaData.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/datastax/TableMetaData.java @@ -20,6 +20,10 @@ import com.datastax.oss.driver.api.core.metadata.schema.ColumnMetadata; import com.datastax.oss.driver.api.core.metadata.schema.TableMetadata; import com.datastax.oss.driver.api.core.type.DataType; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Optional; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaBigNumber; @@ -33,13 +37,6 @@ import org.apache.hop.databases.cassandra.spi.Keyspace; import org.apache.hop.databases.cassandra.util.Selector; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Optional; - public class TableMetaData implements ITableMetaData { private TableMetadata meta; @@ -94,7 +91,7 @@ public IValueMeta getValueMetaForKey() { @Override public List getKeyColumnNames() { List names = new ArrayList<>(); - meta.getPartitionKey().forEach(cm->names.add(cm.getName().asCql(false))); + meta.getPartitionKey().forEach(cm -> names.add(cm.getName().asCql(false))); return names; } @@ -102,7 +99,7 @@ public List getKeyColumnNames() { public IValueMeta getValueMetaForColumn(String colName) throws HopException { Optional optionalColumn = meta.getColumn(colName); if (optionalColumn.isEmpty()) { - throw new HopException("Column "+colName+" is not present"); + throw new HopException("Column " + colName + " is not present"); } return getValueMetaForColumn(optionalColumn.get()); } @@ -114,7 +111,7 @@ protected IValueMeta getValueMetaForColumn(ColumnMetadata column) { name = name.substring(1); } if (name.endsWith("\"")) { - name = name.substring(0, name.length()-1); + name = name.substring(0, name.length() - 1); } return toValueMeta(name, column.getType()); } diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnection.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnection.java index 18fcc62b5f7..ccf45ccfdbb 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnection.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnection.java @@ -18,6 +18,8 @@ package org.apache.hop.databases.cassandra.metadata; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.gui.plugin.GuiElementType; @@ -33,9 +35,6 @@ import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadata; -import java.util.HashMap; -import java.util.Map; - @GuiPlugin @HopMetadata( key = "cassandra-connection", diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/CqlRowHandler.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/CqlRowHandler.java index c788540e971..e574202db02 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/CqlRowHandler.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/CqlRowHandler.java @@ -17,12 +17,11 @@ */ package org.apache.hop.databases.cassandra.spi; +import java.util.Map; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.ITransform; -import java.util.Map; - /** Interface to something that can process rows (read and write) via CQL. */ public interface CqlRowHandler { /** diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/ITableMetaData.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/ITableMetaData.java index 66c7bdab0c5..35b64045ab6 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/ITableMetaData.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/ITableMetaData.java @@ -18,12 +18,11 @@ package org.apache.hop.databases.cassandra.spi; import com.datastax.oss.driver.api.core.type.DataType; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.databases.cassandra.util.Selector; -import java.util.List; - /** Interface to something that can fetch and represent meta data on a Cassandra table. */ public interface ITableMetaData { diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/Keyspace.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/Keyspace.java index 5fd7f88b3cd..d2a2c6509f3 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/Keyspace.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/spi/Keyspace.java @@ -17,13 +17,12 @@ */ package org.apache.hop.databases.cassandra.spi; +import java.util.List; +import java.util.Map; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.databases.cassandra.datastax.DriverConnection; -import java.util.List; -import java.util.Map; - /** Interface to something that can represent a keyspace in Cassandra. */ public interface Keyspace { diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/CassandraUtils.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/CassandraUtils.java index 65e3f3fcbd6..f2c5ffa8eed 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/CassandraUtils.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/CassandraUtils.java @@ -19,6 +19,17 @@ import com.datastax.oss.driver.api.core.type.DataType; import com.datastax.oss.driver.api.core.type.DataTypes; import com.google.common.base.Joiner; +import java.io.ByteArrayOutputStream; +import java.math.BigDecimal; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.Deflater; import org.apache.cassandra.cql3.functions.types.LocalDate; import org.apache.cassandra.db.marshal.BooleanType; import org.apache.cassandra.db.marshal.DecimalType; @@ -41,18 +52,6 @@ import org.apache.hop.databases.cassandra.spi.ITableMetaData; import org.apache.hop.i18n.BaseMessages; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.Deflater; - /** Static utility routines for various stuff. */ public class CassandraUtils { @@ -124,6 +123,7 @@ public static DataType getCassandraDataTypeFromValueMeta(IValueMeta vm) { return DataTypes.BLOB; } } + /** * Split a script containing one or more CQL statements (terminated by ;'s) into a list of * individual statements. diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Partitioners.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Partitioners.java index 9ceac790a50..936a947f944 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Partitioners.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Partitioners.java @@ -35,12 +35,16 @@ private Partitioners(String name, String type) { this.type = type; } - /** @return the name */ + /** + * @return the name + */ public String getName() { return name; } - /** @return the type */ + /** + * @return the type + */ public String getType() { return type; } diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Selector.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Selector.java index b211fae3b17..8ed7be5a488 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Selector.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/util/Selector.java @@ -30,7 +30,9 @@ public class Selector { private boolean isFunction; - /** @param columnName */ + /** + * @param columnName + */ public Selector(String columnName) { this(columnName, null); } diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInput.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInput.java index 4c341f760c4..c0b34780b0b 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInput.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInput.java @@ -17,6 +17,8 @@ */ package org.apache.hop.pipeline.transforms.cassandrainput; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.util.Utils; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashMap; -import java.util.Map; - /** * Class providing an input transform for reading data from a table in Cassandra. Accesses the * schema information stored in Cassandra for type information. diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInputMeta.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInputMeta.java index eabe04ab4cc..029067e6f82 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInputMeta.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrainput/CassandraInputMeta.java @@ -17,6 +17,8 @@ */ package org.apache.hop.pipeline.transforms.cassandrainput; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** Class providing an input transform for reading data from an Cassandra table */ @Transform( id = "CassandraInput", diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutput.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutput.java index a0c463fe9a1..23fe12b6d76 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutput.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutput.java @@ -18,6 +18,9 @@ package org.apache.hop.pipeline.transforms.cassandraoutput; import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -35,10 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** * Class providing an output transform for writing data to a cassandra table. Can create the * specified table (if it doesn't already exist) and can update table meta data. diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java index 68c3783bf6a..723d8c9f96e 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java @@ -16,6 +16,7 @@ */ package org.apache.hop.pipeline.transforms.cassandraoutput; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -56,8 +57,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.List; - /** Dialog class for the CassandraOutput transform. */ public class CassandraOutputDialog extends BaseTransformDialog implements ITransformDialog { diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputMeta.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputMeta.java index 5b60fccb9bf..df7e08f537e 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputMeta.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputMeta.java @@ -237,7 +237,7 @@ public static TtlUnits findWithDescription(String description) { public static String[] getDescriptions() { String[] descriptions = new String[values().length]; - for (int i=0;i { private static final SecurityManager sm = System.getSecurityManager(); + /** The number of rows seen so far for this batch */ protected int rowsSeen; + /** Writes the SSTable output */ protected AbstractSSTableWriter writer; + /** Used to determine input fields */ protected IRowMeta inputMetadata; + /** List of field names (optimization) */ private String[] fieldNames; + /** List of field indices (optimization) */ private int[] fieldValueIndices; diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMeta.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMeta.java index 056c3b87aab..04b7552e083 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMeta.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMeta.java @@ -17,6 +17,7 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** Provides metadata for the Cassandra SSTable output transform. */ @Transform( id = "SSTableOutput", @@ -44,27 +43,45 @@ public class SSTableOutputMeta extends BaseTransformMeta PKG = SSTableOutputMeta.class; /** The path to the yaml file */ - @HopMetadataProperty(key="yaml_path", injectionKey = "YAML_FILE_PATH", injectionKeyDescription = "SSTableOutput.Injection.YAML_FILE_PATH") + @HopMetadataProperty( + key = "yaml_path", + injectionKey = "YAML_FILE_PATH", + injectionKeyDescription = "SSTableOutput.Injection.YAML_FILE_PATH") protected String yamlPath; /** The directory to output to */ - @HopMetadataProperty(key="output_directory", injectionKey = "DIRECTORY", injectionKeyDescription = "SSTableOutput.Injection.DIRECTORY") + @HopMetadataProperty( + key = "output_directory", + injectionKey = "DIRECTORY", + injectionKeyDescription = "SSTableOutput.Injection.DIRECTORY") protected String directory; /** The keyspace (database) to use */ - @HopMetadataProperty(key="cassandra_keyspace", injectionKey = "CASSANDRA_KEYSPACE", injectionKeyDescription = "SSTableOutput.Injection.CASSANDRA_KEYSPACE") + @HopMetadataProperty( + key = "cassandra_keyspace", + injectionKey = "CASSANDRA_KEYSPACE", + injectionKeyDescription = "SSTableOutput.Injection.CASSANDRA_KEYSPACE") protected String cassandraKeyspace; /** The table to write to */ - @HopMetadataProperty(key="table", injectionKey = "TABLE", injectionKeyDescription = "SSTableOutput.Injection.TABLE") + @HopMetadataProperty( + key = "table", + injectionKey = "TABLE", + injectionKeyDescription = "SSTableOutput.Injection.TABLE") protected String table = ""; /** The field in the incoming data to use as the key for inserts */ - @HopMetadataProperty(key="key_field", injectionKey = "KEY_FIELD", injectionKeyDescription = "SSTableOutput.Injection.KEY_FIELD") + @HopMetadataProperty( + key = "key_field", + injectionKey = "KEY_FIELD", + injectionKeyDescription = "SSTableOutput.Injection.KEY_FIELD") protected String keyField = ""; /** Size (MB) of write buffer */ - @HopMetadataProperty(key="buffer_size_mb", injectionKey = "BUFFER_SIZE", injectionKeyDescription = "SSTableOutput.Injection.BUFFER_SIZE") + @HopMetadataProperty( + key = "buffer_size_mb", + injectionKey = "BUFFER_SIZE", + injectionKeyDescription = "SSTableOutput.Injection.BUFFER_SIZE") protected String bufferSize = "16"; public void check( diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriter.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriter.java index 9dbeeeb05e4..aee61535244 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriter.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriter.java @@ -17,9 +17,8 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput.writer; -import org.apache.hop.databases.cassandra.util.CassandraUtils; - import java.util.Map; +import org.apache.hop.databases.cassandra.util.CassandraUtils; public abstract class AbstractSSTableWriter { private static final int DEFAULT_BUFFER_SIZE_MB = 16; diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SSTableWriter.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SSTableWriter.java index 4b9c956d270..a1b1b18f1c6 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SSTableWriter.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SSTableWriter.java @@ -18,16 +18,13 @@ package org.apache.hop.pipeline.transforms.cassandrasstableoutput.writer; import com.google.common.base.Joiner; -import org.apache.cassandra.db.marshal.UTF8Type; +import java.util.Arrays; +import java.util.Map; import org.apache.cassandra.io.sstable.CQLSSTableWriter; -import org.apache.cassandra.schema.Schema; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.databases.cassandra.util.CassandraUtils; -import java.util.Arrays; -import java.util.Map; - class Cql3SSTableWriter extends AbstractSSTableWriter { private CQLSSTableWriter writer; private IRowMeta rowMeta; @@ -40,21 +37,21 @@ public void init() throws Exception { } /*void purgeSchemaInstance() { - // Since the unload function only cares about the keyspace and table name, - // the partition key and class don't matter (however, creating the CFMetaData - // will fail unless something is passed in - // - Schema.instance.truncateSchemaKeyspace(); + // Since the unload function only cares about the keyspace and table name, + // the partition key and class don't matter (however, creating the CFMetaData + // will fail unless something is passed in + // + Schema.instance.truncateSchemaKeyspace(); - CFMetaDataElements. - CFMetaData cfm = - CFMetaData.Builder.create() - .withPartitioner(CassandraUtils.getPartitionerClassInstance(getPartitionerClass())) - .addPartitionKey(getPartitionKey(), UTF8Type.instance) - .build(); - Schema.instance.unload(cfm); - } -*/ + CFMetaDataElements. + CFMetaData cfm = + CFMetaData.Builder.create() + .withPartitioner(CassandraUtils.getPartitionerClassInstance(getPartitionerClass())) + .addPartitionKey(getPartitionKey(), UTF8Type.instance) + .build(); + Schema.instance.unload(cfm); + } + */ CQLSSTableWriter getCQLSSTableWriter() { return CQLSSTableWriter.builder() .inDirectory(getDirectory()) diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/workflow/actions/execcql/ExecCql.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/workflow/actions/execcql/ExecCql.java index fc4d8ad8092..a0f2bd7bd52 100644 --- a/plugins/tech/cassandra/src/main/java/org/apache/hop/workflow/actions/execcql/ExecCql.java +++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/workflow/actions/execcql/ExecCql.java @@ -24,6 +24,7 @@ import com.datastax.oss.driver.api.core.cql.ResultSet; import com.datastax.oss.driver.api.core.cql.Row; import com.datastax.oss.driver.api.core.type.DataType; +import java.util.Iterator; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Result; import org.apache.hop.core.RowMetaAndData; @@ -46,8 +47,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.util.Iterator; - @Action( id = "CASSANDRA_EXEC_CQL", name = "Cassandra Execute CQL", diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CassandraUtilsTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CassandraUtilsTest.java index 2d545670128..d655d62febb 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CassandraUtilsTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CassandraUtilsTest.java @@ -17,6 +17,13 @@ */ package org.apache.hop.database.cassandra.util; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import com.datastax.oss.driver.api.core.type.DataTypes; import java.util.ArrayList; import java.util.Date; @@ -35,13 +42,6 @@ import org.apache.hop.databases.cassandra.util.CassandraUtils; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class CassandraUtilsTest { @Test diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlFunctionsTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlFunctionsTest.java index 546bbca053e..989cdeab3b9 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlFunctionsTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlFunctionsTest.java @@ -17,12 +17,12 @@ */ package org.apache.hop.database.cassandra.util; -import org.apache.hop.databases.cassandra.util.CqlFunctions; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.apache.hop.databases.cassandra.util.CqlFunctions; +import org.junit.Test; + public class CqlFunctionsTest { @Test diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlUtilsTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlUtilsTest.java index 1e6859e518a..31f65bdc9b3 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlUtilsTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/CqlUtilsTest.java @@ -17,19 +17,20 @@ */ package org.apache.hop.database.cassandra.util; -import org.apache.hop.databases.cassandra.util.CqlUtils; -import org.apache.hop.databases.cassandra.util.Selector; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import org.apache.hop.databases.cassandra.util.CqlUtils; +import org.apache.hop.databases.cassandra.util.Selector; +import org.junit.Test; + public class CqlUtilsTest { /** */ private static final String ALIAS_IS_INCORRECT = "Alias is incorrect:"; + /** */ private static final String COLUMN_NAME_IS_INCORRECT = "Column Name is incorrect:"; diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/PartitionersTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/PartitionersTest.java index bf002693101..c0662f34c02 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/PartitionersTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/PartitionersTest.java @@ -17,11 +17,11 @@ */ package org.apache.hop.database.cassandra.util; +import static org.junit.Assert.assertEquals; + import org.apache.hop.databases.cassandra.util.Partitioners; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class PartitionersTest { String pString; Partitioners expectedP; diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/SelectorTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/SelectorTest.java index bf7e3180d67..600cd6aa945 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/SelectorTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/database/cassandra/util/SelectorTest.java @@ -17,15 +17,15 @@ */ package org.apache.hop.database.cassandra.util; -import org.apache.hop.databases.cassandra.util.Selector; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import org.apache.hop.databases.cassandra.util.Selector; +import org.junit.Test; + public class SelectorTest { private static final String ARG_FUNCTION = "WRITETIME"; diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputTest.java index 84dc0d6beaa..8d0a7bcc070 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputTest.java @@ -17,13 +17,6 @@ */ package org.apache.hop.pipeline.transforms.cassandraoutput; -import java.util.Map; -import org.apache.hop.databases.cassandra.datastax.DriverCqlRowHandler; -import org.apache.hop.databases.cassandra.util.CassandraUtils; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; @@ -33,6 +26,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.util.Map; +import org.apache.hop.databases.cassandra.datastax.DriverCqlRowHandler; +import org.apache.hop.databases.cassandra.util.CassandraUtils; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + public class CassandraOutputTest { CassandraOutput co; diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMetaTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMetaTest.java index 23663813a10..2ebf8f560f6 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMetaTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputMetaTest.java @@ -17,10 +17,10 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput; -import org.junit.Test; - import static org.junit.Assert.assertTrue; +import org.junit.Test; + public class SSTableOutputMetaTest { @Test diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputTest.java index ccbd34cb960..2c736272114 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputTest.java @@ -17,6 +17,9 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -26,9 +29,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class SSTableOutputTest { private static TransformMockHelper helper; private static final SecurityManager sm = System.getSecurityManager(); diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriterTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriterTest.java index 44f4c6809b9..9184c97c62f 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriterTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/AbstractSSTableWriterTest.java @@ -17,11 +17,10 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput.writer; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.Map; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class AbstractSSTableWriterTest extends AbstractSSTableWriter { diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SsTableWriterTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SsTableWriterTest.java index 618109c1cbd..03d56773337 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SsTableWriterTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/Cql3SsTableWriterTest.java @@ -17,6 +17,21 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput.writer; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.anyMapOf; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.cassandra.io.sstable.CQLSSTableWriter; import org.apache.commons.lang.SystemUtils; import org.apache.hop.core.row.IRowMeta; @@ -27,22 +42,6 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.anyMapOf; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - public class Cql3SsTableWriterTest { @Before public void notOnWindows() { diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/SSTableWriterBuilderTest.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/SSTableWriterBuilderTest.java index 71df76902af..61709e517a3 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/SSTableWriterBuilderTest.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/writer/SSTableWriterBuilderTest.java @@ -17,13 +17,13 @@ */ package org.apache.hop.pipeline.transforms.cassandrasstableoutput.writer; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.hop.core.row.IRowMeta; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - public class SSTableWriterBuilderTest extends SSTableWriterBuilder { public static final String KEY_FIELD = "some_key"; diff --git a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java index 3d7ecec9593..6950ea09af3 100644 --- a/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java +++ b/plugins/tech/cassandra/src/test/java/org/apache/hop/pipeline/transforms/mock/TransformMockHelper.java @@ -17,6 +17,20 @@ */ package org.apache.hop.pipeline.transforms.mock; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.hop.core.IRowSet; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -33,21 +47,6 @@ import org.mockito.Mockito; import org.mockito.stubbing.Answer; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class TransformMockHelper { public final TransformMeta transformMeta; public final Data data; diff --git a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileNameParser.java b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileNameParser.java index 5c047a1868b..f4bec2fa70a 100644 --- a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileNameParser.java +++ b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileNameParser.java @@ -43,7 +43,7 @@ public FileName parseUri(VfsComponentContext context, FileName base, String uri) StringBuilder name = new StringBuilder(); String scheme = UriParser.extractScheme(context.getFileSystemManager().getSchemes(), uri, name); - + UriParser.canonicalizePath(name, 0, name.length(), this); // Normalize separators in the path diff --git a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileObject.java b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileObject.java index 99e92001888..b3d94f13bb5 100644 --- a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileObject.java +++ b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileObject.java @@ -24,6 +24,12 @@ import com.dropbox.core.v2.files.ListFolderResult; import com.dropbox.core.v2.files.Metadata; import com.dropbox.core.v2.files.UploadUploader; +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.io.output.NullOutputStream; import org.apache.commons.vfs2.FileNotFoundException; import org.apache.commons.vfs2.FileObject; @@ -32,13 +38,6 @@ import org.apache.commons.vfs2.provider.AbstractFileName; import org.apache.commons.vfs2.provider.AbstractFileObject; -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - /** An dropbox file object. */ public class DropboxFileObject extends AbstractFileObject { @@ -96,8 +95,7 @@ private List doGetChildren() throws IOException { String path = this.getName().getPath(); // Root path should be empty - if ("/".equals(path)) - path = ""; + if ("/".equals(path)) path = ""; ListFolderResult result = client.files().listFolder(path); while (true) { diff --git a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileProvider.java b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileProvider.java index 7d71f2a648b..34ac8fe2f83 100644 --- a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileProvider.java +++ b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileProvider.java @@ -20,6 +20,8 @@ import com.dropbox.core.DbxRequestConfig; import com.dropbox.core.v2.DbxClientV2; +import java.util.Collection; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; @@ -30,9 +32,6 @@ import org.apache.hop.vfs.dropbox.config.DropboxConfig; import org.apache.hop.vfs.dropbox.config.DropboxConfigSingleton; -import java.util.Collection; -import java.util.Set; - /** A provider for dropbox file systems. */ public class DropboxFileProvider extends AbstractOriginatingFileProvider { @@ -40,15 +39,15 @@ public class DropboxFileProvider extends AbstractOriginatingFileProvider { protected static final Collection capabilities = Set.of( - Capability.CREATE, - Capability.DELETE, - Capability.RENAME, - Capability.GET_TYPE, - Capability.LIST_CHILDREN, - Capability.READ_CONTENT, - Capability.GET_LAST_MODIFIED, - Capability.URI, - Capability.WRITE_CONTENT); + Capability.CREATE, + Capability.DELETE, + Capability.RENAME, + Capability.GET_TYPE, + Capability.LIST_CHILDREN, + Capability.READ_CONTENT, + Capability.GET_LAST_MODIFIED, + Capability.URI, + Capability.WRITE_CONTENT); private static FileSystemOptions defaultOptions = new FileSystemOptions(); @@ -58,7 +57,7 @@ public static FileSystemOptions getDefaultFileSystemOptions() { public DropboxFileProvider() { super(); - + setFileNameParser(DropboxFileNameParser.getInstance()); } diff --git a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileSystem.java b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileSystem.java index 1220465a2f6..2b6c583f6d7 100644 --- a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileSystem.java +++ b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/DropboxFileSystem.java @@ -19,6 +19,7 @@ package org.apache.hop.vfs.dropbox; import com.dropbox.core.v2.DbxClientV2; +import java.util.Collection; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; @@ -27,8 +28,6 @@ import org.apache.commons.vfs2.provider.AbstractFileName; import org.apache.commons.vfs2.provider.AbstractFileSystem; -import java.util.Collection; - public class DropboxFileSystem extends AbstractFileSystem { private final DbxClientV2 client; diff --git a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/config/DropboxConfigPlugin.java b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/config/DropboxConfigPlugin.java index 3d9d4bb5aa2..11285799b0e 100644 --- a/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/config/DropboxConfigPlugin.java +++ b/plugins/tech/dropbox/src/main/java/org/apache/hop/vfs/dropbox/config/DropboxConfigPlugin.java @@ -137,7 +137,9 @@ public String getAccessToken() { return accessToken; } - /** @param accessToken The access token to set */ + /** + * @param accessToken The access token to set + */ public void setAccessToken(String accessToken) { this.accessToken = accessToken; } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/BareBonesBrowserLaunch.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/BareBonesBrowserLaunch.java index 45cd50e271b..dfaaf01d011 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/BareBonesBrowserLaunch.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/BareBonesBrowserLaunch.java @@ -21,51 +21,59 @@ public class BareBonesBrowserLaunch { - static final String[] browsers = - { - "google-chrome", "firefox", "opera", "epiphany", "konqueror", "conkeror", "midori", "kazehakase", - "mozilla" }; - static final String errMsg = "Error attempting to launch web browser"; + static final String[] browsers = { + "google-chrome", + "firefox", + "opera", + "epiphany", + "konqueror", + "conkeror", + "midori", + "kazehakase", + "mozilla" + }; + static final String errMsg = "Error attempting to launch web browser"; - /** - * Opens the specified web page in the user's default browser - * - * @param url - * A web address (URL) of a web page (ex: "http://www.google.com/") - */ - public static void openURL( String url ) { - try { // attempt to use Desktop library from JDK 1.6+ - Class d = Class.forName( "java.awt.Desktop" ); - d.getDeclaredMethod( "browse", new Class[] { java.net.URI.class } ).invoke( - d.getDeclaredMethod( "getDesktop" ).invoke( null ), new Object[] { java.net.URI.create( url ) } ); - // above code mimicks: java.awt.Desktop.getDesktop().browse() - } catch ( Exception ignore ) { // library not available or failed - String osName = System.getProperty( "os.name" ); - try { - if ( osName.startsWith( "Mac OS" ) ) { - Class - .forName( "com.apple.eio.FileManager" ).getDeclaredMethod( "openURL", new Class[] { String.class } ) - .invoke( null, new Object[] { url } ); - } else if ( osName.startsWith( "Windows" ) ) { - Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + url ); - } else { // assume Unix or Linux - String browser = null; - for ( String b : browsers ) { - if ( browser == null - && Runtime.getRuntime().exec( new String[] { "which", b } ).getInputStream().read() != -1 ) { - Runtime.getRuntime().exec( new String[] { browser = b, url } ); - } - } - if ( browser == null ) { - throw new Exception( Arrays.toString( browsers ) ); - } - } - } catch ( Exception e ) { - // silently fail - // JOptionPane.showMessageDialog(null, errMsg + "\n" + e.toString()); - e.printStackTrace(); + /** + * Opens the specified web page in the user's default browser + * + * @param url A web address (URL) of a web page (ex: "http://www.google.com/") + */ + public static void openURL(String url) { + try { // attempt to use Desktop library from JDK 1.6+ + Class d = Class.forName("java.awt.Desktop"); + d.getDeclaredMethod("browse", new Class[] {java.net.URI.class}) + .invoke( + d.getDeclaredMethod("getDesktop").invoke(null), + new Object[] {java.net.URI.create(url)}); + // above code mimicks: java.awt.Desktop.getDesktop().browse() + } catch (Exception ignore) { // library not available or failed + String osName = System.getProperty("os.name"); + try { + if (osName.startsWith("Mac OS")) { + Class.forName("com.apple.eio.FileManager") + .getDeclaredMethod("openURL", new Class[] {String.class}) + .invoke(null, new Object[] {url}); + } else if (osName.startsWith("Windows")) { + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + } else { // assume Unix or Linux + String browser = null; + for (String b : browsers) { + if (browser == null + && Runtime.getRuntime().exec(new String[] {"which", b}).getInputStream().read() + != -1) { + Runtime.getRuntime().exec(new String[] {browser = b, url}); } + } + if (browser == null) { + throw new Exception(Arrays.toString(browsers)); + } } + } catch (Exception e) { + // silently fail + // JOptionPane.showMessageDialog(null, errMsg + "\n" + e.toString()); + e.printStackTrace(); + } } - + } } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalytics.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalytics.java index 2093ea0f31d..d244d8bc056 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalytics.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalytics.java @@ -31,6 +31,13 @@ import com.google.api.gax.core.FixedCredentialsProvider; import com.google.auth.Credentials; import com.google.auth.oauth2.ServiceAccountCredentials; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.RowDataUtil; @@ -43,190 +50,193 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.TransformStatus; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - public class GoogleAnalytics extends BaseTransform { - private BetaAnalyticsDataClient analyticsData; - private List dimensionHeaders; - private List metricHeaders; - private List dimensionList; - private List metricList; - private RunReportResponse response; - private InputStream inputStream; - private int requestOffset = 0; - private int REQUEST_ROW_SIZE = 100000; - private int rowsProcessed = 0; - - private int rowLimit; - - public GoogleAnalytics(TransformMeta transformMeta, GoogleAnalyticsMeta meta, GoogleAnalyticsData data, int copyNr, PipelineMeta pipelineMeta, Pipeline pipeline) { - super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); - } - - @Override - public boolean init(){ - - if(super.init()){ - try { - if(meta.getRowLimit() == 0) { - rowLimit = Integer.MAX_VALUE; - }else{ - rowLimit = meta.getRowLimit(); - } - inputStream = new FileInputStream(meta.getOAuthKeyFile()); - Credentials credentials = ServiceAccountCredentials.fromStream(inputStream); - - BetaAnalyticsDataSettings settings = BetaAnalyticsDataSettings.newHttpJsonBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build(); - analyticsData = BetaAnalyticsDataClient.create(settings); - - dimensionList = new ArrayList<>(); - String dimensionString = meta.getDimensions(); - for(String dimension : dimensionString.split(",")){ - dimensionList.add(Dimension.newBuilder().setName(dimension).build()); - } - metricList = new ArrayList<>(); - String metricsString = meta.getMetrics(); - for(String metric : metricsString.split(",")){ - metricList.add(Metric.newBuilder().setName(metric).build()); - } + private BetaAnalyticsDataClient analyticsData; + private List dimensionHeaders; + private List metricHeaders; + private List dimensionList; + private List metricList; + private RunReportResponse response; + private InputStream inputStream; + private int requestOffset = 0; + private int REQUEST_ROW_SIZE = 100000; + private int rowsProcessed = 0; + + private int rowLimit; + + public GoogleAnalytics( + TransformMeta transformMeta, + GoogleAnalyticsMeta meta, + GoogleAnalyticsData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { + super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); + } + + @Override + public boolean init() { + + if (super.init()) { + try { + if (meta.getRowLimit() == 0) { + rowLimit = Integer.MAX_VALUE; + } else { + rowLimit = meta.getRowLimit(); + } + inputStream = new FileInputStream(meta.getOAuthKeyFile()); + Credentials credentials = ServiceAccountCredentials.fromStream(inputStream); + + BetaAnalyticsDataSettings settings = + BetaAnalyticsDataSettings.newHttpJsonBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(credentials)) + .build(); + analyticsData = BetaAnalyticsDataClient.create(settings); + + dimensionList = new ArrayList<>(); + String dimensionString = meta.getDimensions(); + for (String dimension : dimensionString.split(",")) { + dimensionList.add(Dimension.newBuilder().setName(dimension).build()); + } + metricList = new ArrayList<>(); + String metricsString = meta.getMetrics(); + for (String metric : metricsString.split(",")) { + metricList.add(Metric.newBuilder().setName(metric).build()); + } - if(rowLimit < REQUEST_ROW_SIZE){ - REQUEST_ROW_SIZE = rowLimit; - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } catch (IOException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - return true; + if (rowLimit < REQUEST_ROW_SIZE) { + REQUEST_ROW_SIZE = rowLimit; } - return false; + } catch (FileNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + return true; } + return false; + } - private RunReportRequest getRequest(){ + private RunReportRequest getRequest() { - return RunReportRequest.newBuilder() - .setProperty("properties/" + meta.getGaProperty()) - .addAllDimensions(dimensionList) - .addAllMetrics(metricList) - .addDateRanges(DateRange.newBuilder().setStartDate(meta.getStartDate()).setEndDate(meta.getEndDate())) - .setLimit(REQUEST_ROW_SIZE) - .setOffset(requestOffset) - .build(); - } + return RunReportRequest.newBuilder() + .setProperty("properties/" + meta.getGaProperty()) + .addAllDimensions(dimensionList) + .addAllMetrics(metricList) + .addDateRanges( + DateRange.newBuilder().setStartDate(meta.getStartDate()).setEndDate(meta.getEndDate())) + .setLimit(REQUEST_ROW_SIZE) + .setOffset(requestOffset) + .build(); + } - @Override - public boolean processRow() throws HopException{ + @Override + public boolean processRow() throws HopException { - if(first) { - first = false; + if (first) { + first = false; - data.outputMeta = new RowMeta(); - meta.getFields(data.outputMeta, getTransformName(), null, null, this, metadataProvider); + data.outputMeta = new RowMeta(); + meta.getFields(data.outputMeta, getTransformName(), null, null, this, metadataProvider); - readResponse(); - } - logBasic("all rows processed. ready to shut down."); - setOutputDone(); - return false; + readResponse(); } - - private void readResponse(){ - response = analyticsData.runReport(getRequest()); - dimensionHeaders = response.getDimensionHeadersList(); - metricHeaders = response.getMetricHeadersList(); - - if(response.getRowsList().size() > 0){ - try{ - for(Row gaRow : response.getRowsList()){ - Object[] newRow = RowDataUtil.allocateRowData(meta.getGoogleAnalyticsFields().size()); - - for(int i=0; i < meta.getGoogleAnalyticsFields().size(); i++){ - GoogleAnalyticsField field = meta.getGoogleAnalyticsFields().get(i); - String fieldName = field.getFeedField(); - String type = field.getFeedFieldType(); - if(type.equals(meta.FIELD_TYPE_DIMENSION)){ - for(int j = 0; j < dimensionHeaders.size(); j++){ - if(dimensionHeaders.get(j).getName().equals(fieldName)){ - newRow[i] = gaRow.getDimensionValues(j).getValue(); - } - } - }else if (type.equals(meta.FIELD_TYPE_METRIC)){ - for(int j = 0; j < metricHeaders.size(); j++){ - if(metricHeaders.get(j).getName().equals(fieldName)){ - MetricType metricType = metricHeaders.get(j).getType(); - switch(metricType){ - case TYPE_INTEGER: - IValueMeta valueMetaInt = new ValueMetaInteger("int"); - IValueMeta gaValueMetaInt = data.outputMeta.getValueMeta(dimensionList.size()+j); - Long longValue = Long.valueOf(gaRow.getMetricValues(j).getValue()); - newRow[i] = gaValueMetaInt.convertData(valueMetaInt, longValue); - break; - case TYPE_FLOAT: - case TYPE_SECONDS: - case TYPE_MILLISECONDS: - case TYPE_MINUTES: - case TYPE_HOURS: - case TYPE_STANDARD: - case TYPE_CURRENCY: - case TYPE_FEET: - case TYPE_MILES: - case TYPE_METERS: - case TYPE_KILOMETERS: - IValueMeta valueMetaNumber = new ValueMetaNumber("num"); - IValueMeta gaValueMetaNumber = data.outputMeta.getValueMeta(dimensionList.size() + j); - Double doubleValue = Double.valueOf(gaRow.getMetricValues(j).getValue()); - newRow[i] = gaValueMetaNumber.convertData(valueMetaNumber, doubleValue); - break; - default: - newRow[i] = gaRow.getMetricValues(j).getValue(); - break; - } - } - } - } - } - putRow(data.outputMeta, newRow); + logBasic("all rows processed. ready to shut down."); + setOutputDone(); + return false; + } + + private void readResponse() { + response = analyticsData.runReport(getRequest()); + dimensionHeaders = response.getDimensionHeadersList(); + metricHeaders = response.getMetricHeadersList(); + + if (response.getRowsList().size() > 0) { + try { + for (Row gaRow : response.getRowsList()) { + Object[] newRow = RowDataUtil.allocateRowData(meta.getGoogleAnalyticsFields().size()); + + for (int i = 0; i < meta.getGoogleAnalyticsFields().size(); i++) { + GoogleAnalyticsField field = meta.getGoogleAnalyticsFields().get(i); + String fieldName = field.getFeedField(); + String type = field.getFeedFieldType(); + if (type.equals(meta.FIELD_TYPE_DIMENSION)) { + for (int j = 0; j < dimensionHeaders.size(); j++) { + if (dimensionHeaders.get(j).getName().equals(fieldName)) { + newRow[i] = gaRow.getDimensionValues(j).getValue(); } - }catch(Exception e){ - e.printStackTrace(); - } - // check if we're still below the row limit, adjust REQUEST_ROW_SIZE if we're getting close. - rowsProcessed = (int)getLinesWritten(); - if(getLinesWritten() + REQUEST_ROW_SIZE > rowLimit){ - REQUEST_ROW_SIZE = rowLimit - (int)getLinesWritten(); - } - requestOffset = (int)getLinesWritten(); - if(rowsProcessed < rowLimit){ - readResponse(); + } + } else if (type.equals(meta.FIELD_TYPE_METRIC)) { + for (int j = 0; j < metricHeaders.size(); j++) { + if (metricHeaders.get(j).getName().equals(fieldName)) { + MetricType metricType = metricHeaders.get(j).getType(); + switch (metricType) { + case TYPE_INTEGER: + IValueMeta valueMetaInt = new ValueMetaInteger("int"); + IValueMeta gaValueMetaInt = + data.outputMeta.getValueMeta(dimensionList.size() + j); + Long longValue = Long.valueOf(gaRow.getMetricValues(j).getValue()); + newRow[i] = gaValueMetaInt.convertData(valueMetaInt, longValue); + break; + case TYPE_FLOAT: + case TYPE_SECONDS: + case TYPE_MILLISECONDS: + case TYPE_MINUTES: + case TYPE_HOURS: + case TYPE_STANDARD: + case TYPE_CURRENCY: + case TYPE_FEET: + case TYPE_MILES: + case TYPE_METERS: + case TYPE_KILOMETERS: + IValueMeta valueMetaNumber = new ValueMetaNumber("num"); + IValueMeta gaValueMetaNumber = + data.outputMeta.getValueMeta(dimensionList.size() + j); + Double doubleValue = Double.valueOf(gaRow.getMetricValues(j).getValue()); + newRow[i] = gaValueMetaNumber.convertData(valueMetaNumber, doubleValue); + break; + default: + newRow[i] = gaRow.getMetricValues(j).getValue(); + break; + } + } + } } + } + putRow(data.outputMeta, newRow); } - + } catch (Exception e) { + e.printStackTrace(); + } + // check if we're still below the row limit, adjust REQUEST_ROW_SIZE if we're getting close. + rowsProcessed = (int) getLinesWritten(); + if (getLinesWritten() + REQUEST_ROW_SIZE > rowLimit) { + REQUEST_ROW_SIZE = rowLimit - (int) getLinesWritten(); + } + requestOffset = (int) getLinesWritten(); + if (rowsProcessed < rowLimit) { + readResponse(); + } } - - @Override - public Collection subStatuses() { - return super.subStatuses(); - } - - @Override - public void dispose(){ - try { - inputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - analyticsData.close(); - super.dispose(); + } + + @Override + public Collection subStatuses() { + return super.subStatuses(); + } + + @Override + public void dispose() { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); } + analyticsData.close(); + super.dispose(); + } } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsData.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsData.java index aa7194d46e1..bf6169ab195 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsData.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsData.java @@ -21,7 +21,7 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -public class GoogleAnalyticsData extends BaseTransformData implements ITransformData{ +public class GoogleAnalyticsData extends BaseTransformData implements ITransformData { - public IRowMeta outputMeta; + public IRowMeta outputMeta; } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsDialog.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsDialog.java index 2fde3e5f358..d4ba638e637 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsDialog.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsDialog.java @@ -30,6 +30,11 @@ import com.google.api.gax.core.FixedCredentialsProvider; import com.google.auth.Credentials; import com.google.auth.oauth2.ServiceAccountCredentials; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaBase; @@ -67,832 +72,830 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - public class GoogleAnalyticsDialog extends BaseTransformDialog implements ITransformDialog { - private static final Class PKG = GoogleAnalyticsMeta.class; // For Translator + private static final Class PKG = GoogleAnalyticsMeta.class; // For Translator - private GoogleAnalyticsMeta input; + private GoogleAnalyticsMeta input; - private TextVar wOauthAccount; + private TextVar wOauthAccount; - private Button fileChooser; - private TextVar keyFilename; + private Button fileChooser; + private TextVar keyFilename; - private TableView wFields; + private TableView wFields; - private TextVar wQuStartDate; + private TextVar wQuStartDate; - private TextVar wQuEndDate; + private TextVar wQuEndDate; - private TextVar wQuDimensions; + private TextVar wQuDimensions; - private TextVar wQuMetrics; + private TextVar wQuMetrics; - private TextVar wQuSort; + private TextVar wQuSort; - private Group gConnect; + private Group gConnect; + + private TextVar wGaAppName; - private TextVar wGaAppName; + private Text wLimit; + + private TextVar wGaPropertyId; + + private int middle; + private int margin; + + private ModifyListener lsMod; + + static final String REFERENCE_SORT_URI = + "https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy"; + static final String REFERENCE_METRICS_URI = + "https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics"; + static final String REFERENCE_DIMENSIONS_URI = + "https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions"; + static final String REFERENCE_DIMENSION_AND_METRIC_URI = + "https://support.google.com/analytics/answer/9143382?hl=en"; + static final String REFERENCE_METRICAGGS_URI = + "https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/MetricAggregation"; + + public GoogleAnalyticsDialog( + Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { + super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); + setInput((GoogleAnalyticsMeta) in); + } + + @Override + public String open() { + Shell parent = getParent(); + + shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); + props.setLook(shell); + setShellImage(shell, getInput()); + + lsMod = e -> getInput().setChanged(); + backupChanged = getInput().hasChanged(); + + FormLayout formLayout = new FormLayout(); + formLayout.marginWidth = Const.FORM_MARGIN; + formLayout.marginHeight = Const.FORM_MARGIN; + + shell.setLayout(formLayout); + shell.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Shell.Title")); + + middle = props.getMiddlePct(); + margin = Const.MARGIN; + + // Buttons at the very bottom + wOk = new Button(shell, SWT.PUSH); + wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); + wOk.addListener(SWT.Selection, e -> ok()); + wCancel = new Button(shell, SWT.PUSH); + wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); + wCancel.addListener(SWT.Selection, e -> cancel()); + wGet = new Button(shell, SWT.PUSH); + wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields")); + wGet.addListener(SWT.Selection, e -> getFields()); + wPreview = new Button(shell, SWT.PUSH); + wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview")); + wPreview.addListener(SWT.Selection, e -> preview()); + BaseTransformDialog.positionBottomButtons( + shell, new Button[] {wOk, wGet, wPreview, wCancel}, margin, null); + + /************************************************* + * // TRANSFORM NAME ENTRY + *************************************************/ + + // TransformName line + wlTransformName = new Label(shell, SWT.RIGHT); + wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName")); + props.setLook(wlTransformName); + fdlTransformName = new FormData(); + fdlTransformName.left = new FormAttachment(0, 0); + fdlTransformName.right = new FormAttachment(middle, -margin); + fdlTransformName.top = new FormAttachment(0, margin); + wlTransformName.setLayoutData(fdlTransformName); + + wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wTransformName.setText(transformName); + props.setLook(wTransformName); + wTransformName.addModifyListener(lsMod); + fdTransformName = new FormData(); + fdTransformName.left = new FormAttachment(middle, 0); + fdTransformName.top = new FormAttachment(0, margin); + fdTransformName.right = new FormAttachment(100, 0); + wTransformName.setLayoutData(fdTransformName); + + /************************************************* + * // GOOGLE ANALYTICS CONNECTION GROUP + *************************************************/ + + gConnect = new Group(shell, SWT.SHADOW_ETCHED_IN); + gConnect.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ConnectGroup.Label")); + FormLayout gConnectLayout = new FormLayout(); + gConnectLayout.marginWidth = 3; + gConnectLayout.marginHeight = 3; + gConnect.setLayout(gConnectLayout); + props.setLook(gConnect); + + FormData fdConnect = new FormData(); + fdConnect.left = new FormAttachment(0, 0); + fdConnect.right = new FormAttachment(100, 0); + fdConnect.top = new FormAttachment(wTransformName, margin); + gConnect.setLayoutData(fdConnect); + + // Google Analytics app name + Label wlGaAppName = new Label(gConnect, SWT.RIGHT); + wlGaAppName.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.AppName.Label")); + props.setLook(wlGaAppName); + FormData fdlGaAppName = new FormData(); + fdlGaAppName.top = new FormAttachment(0, margin); + fdlGaAppName.left = new FormAttachment(0, 0); + fdlGaAppName.right = new FormAttachment(middle, -margin); + wlGaAppName.setLayoutData(fdlGaAppName); + wGaAppName = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wGaAppName.addModifyListener(lsMod); + wGaAppName.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.AppName.Tooltip")); + props.setLook(wGaAppName); + FormData fdGaAppName = new FormData(); + fdGaAppName.top = new FormAttachment(wTransformName, margin); + fdGaAppName.left = new FormAttachment(middle, 0); + fdGaAppName.right = new FormAttachment(100, 0); + wGaAppName.setLayoutData(fdGaAppName); + + createOauthServiceCredentialsControls(); + + /************************************************* + * // GOOGLE ANALYTICS QUERY GROUP + *************************************************/ + + Group gQuery = new Group(shell, SWT.SHADOW_ETCHED_IN); + gQuery.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.QueryGroup.Label")); + FormLayout gQueryLayout = new FormLayout(); + gQueryLayout.marginWidth = 3; + gQueryLayout.marginHeight = 3; + gQuery.setLayout(gQueryLayout); + props.setLook(gQuery); + + // query start date + Label wlQuStartDate = new Label(gQuery, SWT.RIGHT); + wlQuStartDate.setText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.StartDate.Label")); + props.setLook(wlQuStartDate); + FormData fdlQuStartDate = new FormData(); + fdlQuStartDate.top = new FormAttachment(0, margin); + fdlQuStartDate.left = new FormAttachment(0, 0); + fdlQuStartDate.right = new FormAttachment(middle, -margin); + wlQuStartDate.setLayoutData(fdlQuStartDate); + wQuStartDate = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wQuStartDate.addModifyListener(lsMod); + wQuStartDate.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.StartDate.Tooltip")); + props.setLook(wQuStartDate); + FormData fdQuStartDate = new FormData(); + fdQuStartDate.top = new FormAttachment(0, margin); + fdQuStartDate.left = new FormAttachment(middle, 0); + fdQuStartDate.right = new FormAttachment(100, 0); + wQuStartDate.setLayoutData(fdQuStartDate); + + // query end date + Label wlQuEndDate = new Label(gQuery, SWT.RIGHT); + wlQuEndDate.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.EndDate.Label")); + props.setLook(wlQuEndDate); + FormData fdlQuEndDate = new FormData(); + fdlQuEndDate.top = new FormAttachment(wQuStartDate, margin); + fdlQuEndDate.left = new FormAttachment(0, 0); + fdlQuEndDate.right = new FormAttachment(middle, -margin); + wlQuEndDate.setLayoutData(fdlQuEndDate); + wQuEndDate = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wQuEndDate.addModifyListener(lsMod); + wQuEndDate.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.EndDate.Tooltip")); + props.setLook(wQuEndDate); + FormData fdQuEndDate = new FormData(); + fdQuEndDate.top = new FormAttachment(wQuStartDate, margin); + fdQuEndDate.left = new FormAttachment(middle, 0); + fdQuEndDate.right = new FormAttachment(100, 0); + wQuEndDate.setLayoutData(fdQuEndDate); + + // query dimensions + Label wlQuDimensions = new Label(gQuery, SWT.RIGHT); + wlQuDimensions.setText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Dimensions.Label")); + props.setLook(wlQuDimensions); + FormData fdlQuDimensions = new FormData(); + fdlQuDimensions.top = new FormAttachment(wQuEndDate, margin); + fdlQuDimensions.left = new FormAttachment(0, 0); + fdlQuDimensions.right = new FormAttachment(middle, -margin); + wlQuDimensions.setLayoutData(fdlQuDimensions); + wQuDimensions = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wQuDimensions.addModifyListener(lsMod); + wQuDimensions.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Dimensions.Tooltip")); + props.setLook(wQuDimensions); + + Link wQuDimensionsReference = new Link(gQuery, SWT.SINGLE); + + wQuDimensionsReference.setText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Reference.Label")); + props.setLook(wQuDimensionsReference); + wQuDimensionsReference.addListener( + SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_DIMENSIONS_URI)); + + wQuDimensionsReference.pack(true); + + FormData fdQuDimensions = new FormData(); + fdQuDimensions.top = new FormAttachment(wQuEndDate, margin); + fdQuDimensions.left = new FormAttachment(middle, 0); + fdQuDimensions.right = + new FormAttachment(100, -wQuDimensionsReference.getBounds().width - margin); + wQuDimensions.setLayoutData(fdQuDimensions); + + FormData fdQuDimensionsReference = new FormData(); + fdQuDimensionsReference.top = new FormAttachment(wQuEndDate, margin); + fdQuDimensionsReference.left = new FormAttachment(wQuDimensions, 0); + fdQuDimensionsReference.right = new FormAttachment(100, 0); + wQuDimensionsReference.setLayoutData(fdQuDimensionsReference); + + // query Metrics + Label wlQuMetrics = new Label(gQuery, SWT.RIGHT); + wlQuMetrics.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Metrics.Label")); + props.setLook(wlQuMetrics); + FormData fdlQuMetrics = new FormData(); + fdlQuMetrics.top = new FormAttachment(wQuDimensions, margin); + fdlQuMetrics.left = new FormAttachment(0, 0); + fdlQuMetrics.right = new FormAttachment(middle, -margin); + wlQuMetrics.setLayoutData(fdlQuMetrics); + wQuMetrics = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wQuMetrics.addModifyListener(lsMod); + wQuMetrics.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Metrics.Tooltip")); + props.setLook(wQuMetrics); + + Link wQuMetricsReference = new Link(gQuery, SWT.SINGLE); + wQuMetricsReference.setText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Reference.Label")); + props.setLook(wQuMetricsReference); + wQuMetricsReference.addListener( + SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_METRICS_URI)); + + wQuMetricsReference.pack(true); + + FormData fdQuMetrics = new FormData(); + fdQuMetrics.top = new FormAttachment(wQuDimensions, margin); + fdQuMetrics.left = new FormAttachment(middle, 0); + fdQuMetrics.right = new FormAttachment(100, -wQuMetricsReference.getBounds().width - margin); + wQuMetrics.setLayoutData(fdQuMetrics); + + FormData fdQuMetricsReference = new FormData(); + fdQuMetricsReference.top = new FormAttachment(wQuDimensions, margin); + fdQuMetricsReference.left = new FormAttachment(wQuMetrics, 0); + fdQuMetricsReference.right = new FormAttachment(100, 0); + wQuMetricsReference.setLayoutData(fdQuMetricsReference); + + // query Sort + Label wlQuSort = new Label(gQuery, SWT.RIGHT); + wlQuSort.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Sort.Label")); + props.setLook(wlQuSort); + FormData fdlQuSort = new FormData(); + fdlQuSort.top = new FormAttachment(wQuMetrics, margin); + fdlQuSort.left = new FormAttachment(0, 0); + fdlQuSort.right = new FormAttachment(middle, -margin); + wlQuSort.setLayoutData(fdlQuSort); + wQuSort = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wQuSort.addModifyListener(lsMod); + wQuSort.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Sort.Tooltip")); + props.setLook(wQuSort); + + Link wQuSortReference = new Link(gQuery, SWT.SINGLE); + wQuSortReference.setText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Reference.Label")); + props.setLook(wQuSortReference); + wQuSortReference.addListener( + SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_SORT_URI)); + + wQuSortReference.pack(true); + + FormData fdQuSort = new FormData(); + fdQuSort.top = new FormAttachment(wQuMetrics, margin); + fdQuSort.left = new FormAttachment(middle, 0); + fdQuSort.right = new FormAttachment(100, -wQuSortReference.getBounds().width - margin); + wQuSort.setLayoutData(fdQuSort); + + FormData fdQuSortReference = new FormData(); + fdQuSortReference.top = new FormAttachment(wQuMetrics, margin); + fdQuSortReference.left = new FormAttachment(wQuSort, 0); + fdQuSortReference.right = new FormAttachment(100, 0); + wQuSortReference.setLayoutData(fdQuSortReference); + + FormData fdQueryGroup = new FormData(); + fdQueryGroup.left = new FormAttachment(0, 0); + fdQueryGroup.right = new FormAttachment(100, 0); + fdQueryGroup.top = new FormAttachment(gConnect, margin); + gQuery.setLayoutData(fdQueryGroup); + + gQuery.setTabList(new Control[] {wQuStartDate, wQuEndDate, wQuDimensions, wQuMetrics, wQuSort}); + + // Limit input ... + Label wlLimit = new Label(shell, SWT.RIGHT); + wlLimit.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.LimitSize.Label")); + props.setLook(wlLimit); + FormData fdlLimit = new FormData(); + fdlLimit.left = new FormAttachment(0, 0); + fdlLimit.right = new FormAttachment(middle, -margin); + fdlLimit.bottom = new FormAttachment(wOk, -2 * margin); + wlLimit.setLayoutData(fdlLimit); + wLimit = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wLimit.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.LimitSize.Tooltip")); + props.setLook(wLimit); + wLimit.addModifyListener(lsMod); + FormData fdLimit = new FormData(); + fdLimit.left = new FormAttachment(middle, 0); + fdLimit.right = new FormAttachment(100, 0); + fdLimit.top = new FormAttachment(wlLimit, 0, SWT.CENTER); + + wLimit.setLayoutData(fdLimit); + + /************************************************* + * // KEY / LOOKUP TABLE + *************************************************/ + + // lookup fields settings widgets + Link wlFields = new Link(shell, SWT.NONE); + wlFields.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Return.Label")); + props.setLook(wlFields); + wlFields.addListener( + SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_DIMENSION_AND_METRIC_URI)); + + FormData fdlReturn = new FormData(); + fdlReturn.left = new FormAttachment(0, 0); + fdlReturn.top = new FormAttachment(gQuery, margin); + wlFields.setLayoutData(fdlReturn); + + int fieldWidgetCols = 5; + int fieldWidgetRows = + (getInput().getGoogleAnalyticsFields() != null + ? getInput().getGoogleAnalyticsFields().size() + : 1); + + ColumnInfo[] ciKeys = new ColumnInfo[fieldWidgetCols]; + ciKeys[0] = + new ColumnInfo( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.FeedFieldType"), + ColumnInfo.COLUMN_TYPE_CCOMBO, + new String[] { + GoogleAnalyticsMeta.FIELD_TYPE_DIMENSION, + GoogleAnalyticsMeta.FIELD_TYPE_METRIC, + GoogleAnalyticsMeta.FIELD_TYPE_DATA_SOURCE_PROPERTY, + GoogleAnalyticsMeta.FIELD_TYPE_DATA_SOURCE_FIELD + }, + true); + ciKeys[1] = + new ColumnInfo( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.FeedField"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false); + ciKeys[1].setUsingVariables(true); + ciKeys[2] = + new ColumnInfo( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.RenameTo"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false); + ciKeys[3] = + new ColumnInfo( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.Type"), + ColumnInfo.COLUMN_TYPE_CCOMBO, + ValueMetaBase.getTypes()); + ciKeys[4] = + new ColumnInfo( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.Format"), + ColumnInfo.COLUMN_TYPE_FORMAT, + 4); + + setTableView( + new TableView( + variables, + shell, + SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, + ciKeys, + fieldWidgetRows, + lsMod, + props)); + + FormData fdReturn = new FormData(); + fdReturn.left = new FormAttachment(0, 0); + fdReturn.top = new FormAttachment(wlFields, margin); + fdReturn.right = new FormAttachment(100, 0); + fdReturn.bottom = new FormAttachment(wLimit, -margin); + getTableView().setLayoutData(fdReturn); + + fileChooser.addListener(SWT.Selection, this::browseKeyFile); + + /************************************************* + * // POPULATE AND OPEN DIALOG + *************************************************/ + + getData(); + + getInput().setChanged(backupChanged); + wTransformName.setFocus(); + + shell.setTabList(new Control[] {wTransformName, gConnect, gQuery, getTableView()}); + + BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); + + return transformName; + } + + private void browseKeyFile(Event e) { + BaseDialog.presentFileDialog( + shell, + keyFilename, + variables, + new String[] {"*.properties", "*.*"}, + new String[] {"Properties files (*.properties)", "All Files (*.*)"}, + true); + } + + private RunReportResponse getReportResponse() { + BetaAnalyticsDataClient analyticsData = null; + try { + InputStream inputStream = new FileInputStream(keyFilename.getText()); + Credentials credentials = ServiceAccountCredentials.fromStream(inputStream); + + BetaAnalyticsDataSettings settings = + BetaAnalyticsDataSettings.newHttpJsonBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(credentials)) + .build(); + analyticsData = BetaAnalyticsDataClient.create(settings); + } catch (IOException e) { + new ErrorDialog( + shell, + "Error creating connection", + "Error reading key file or creating Google Analytics connection", + e); + } - private Text wLimit; + List dimensionList = new ArrayList<>(); + String dimensionString = wQuDimensions.getText(); + for (String dimension : dimensionString.split(",")) { + dimensionList.add(Dimension.newBuilder().setName(dimension).build()); + } + List metricList = new ArrayList<>(); + String metricsString = wQuMetrics.getText(); + for (String metric : metricsString.split(",")) { + metricList.add(Metric.newBuilder().setName(metric).build()); + } + RunReportRequest request = + RunReportRequest.newBuilder() + .setProperty("properties/" + wGaPropertyId.getText()) + .addAllDimensions(dimensionList) + .addAllMetrics(metricList) + .addDateRanges( + DateRange.newBuilder() + .setStartDate(wQuStartDate.getText()) + .setEndDate(wQuEndDate.getText())) + .build(); + RunReportResponse response = analyticsData.runReport(request); + return response; + } + + // Visible for testing + void getFields() { + + getTableView().removeAll(); + + RunReportResponse response = getReportResponse(); + List dimensionHeaders = response.getDimensionHeadersList(); + List metricHeaders = response.getMetricHeadersList(); + + if (response == null || dimensionHeaders.isEmpty() || metricHeaders.isEmpty()) { + MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); + mb.setText("Query yields empty feed"); + mb.setMessage("The feed did not give any results. Please specify a query that returns data."); + mb.open(); + + return; + } - private TextVar wGaPropertyId; + int i = 0; + getTableView().table.setItemCount(dimensionHeaders.size() + metricHeaders.size()); + for (DimensionHeader colHeader : dimensionHeaders) { + String name = colHeader.getName(); + ; + TableItem item = getTableView().table.getItem(i); + item.setText(1, GoogleAnalyticsMeta.FIELD_TYPE_DIMENSION); + item.setText(2, name); + item.setText(3, name); + item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_STRING)); + item.setText(5, ""); + i++; + } + for (MetricHeader metricHeader : metricHeaders) { + TableItem item = getTableView().table.getItem(i); + String name = metricHeader.getName(); + item.setText(1, GoogleAnalyticsMeta.FIELD_TYPE_METRIC); + item.setText(2, name); + item.setText(3, name); + MetricType metricType = metricHeader.getType(); + if (metricType.equals(MetricType.TYPE_INTEGER)) { + item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_INTEGER)); + item.setText(5, "#;-#"); + } else if (metricType.equals(MetricType.TYPE_FLOAT) + || metricType.equals(MetricType.TYPE_SECONDS) + || metricType.equals(MetricType.TYPE_MILLISECONDS) + || metricType.equals(MetricType.TYPE_MINUTES) + || metricType.equals(MetricType.TYPE_HOURS) + || metricType.equals(MetricType.TYPE_STANDARD) + || metricType.equals(MetricType.TYPE_CURRENCY) + || metricType.equals(MetricType.TYPE_FEET) + || metricType.equals(MetricType.TYPE_MILES) + || metricType.equals(MetricType.TYPE_METERS) + || metricType.equals(MetricType.TYPE_KILOMETERS)) { + item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_NUMBER)); + item.setText(5, "#.#;-#.#"); + } else { + item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_STRING)); + item.setText(5, ""); + } + i++; + } - private int middle; - private int margin; + getTableView().removeEmptyRows(); + getTableView().setRowNums(); + getTableView().optWidth(true); + getInput().setChanged(); + } - private ModifyListener lsMod; + private void getInfo(GoogleAnalyticsMeta meta) { - static final String REFERENCE_SORT_URI = - "https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy"; - static final String REFERENCE_METRICS_URI = - "https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics"; - static final String REFERENCE_DIMENSIONS_URI = - "https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions"; - static final String REFERENCE_DIMENSION_AND_METRIC_URI = - "https://support.google.com/analytics/answer/9143382?hl=en"; - static final String REFERENCE_METRICAGGS_URI = - "https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/MetricAggregation"; + transformName = wTransformName.getText(); // return value - public GoogleAnalyticsDialog( - Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { - super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); - setInput((GoogleAnalyticsMeta) in); - } - @Override - public String open() { - Shell parent = getParent(); - - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); - props.setLook(shell); - setShellImage(shell, getInput()); - - lsMod = e -> getInput().setChanged(); - backupChanged = getInput().hasChanged(); - - FormLayout formLayout = new FormLayout(); - formLayout.marginWidth = Const.FORM_MARGIN; - formLayout.marginHeight = Const.FORM_MARGIN; - - shell.setLayout(formLayout); - shell.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Shell.Title")); - - middle = props.getMiddlePct(); - margin = Const.MARGIN; - - // Buttons at the very bottom - wOk = new Button(shell, SWT.PUSH); - wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); - wOk.addListener(SWT.Selection, e -> ok()); - wCancel = new Button(shell, SWT.PUSH); - wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); - wCancel.addListener(SWT.Selection, e -> cancel()); - wGet = new Button(shell, SWT.PUSH); - wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields")); - wGet.addListener(SWT.Selection, e -> getFields()); - wPreview = new Button(shell, SWT.PUSH); - wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview")); - wPreview.addListener(SWT.Selection, e -> preview()); - BaseTransformDialog.positionBottomButtons( - shell, new Button[] {wOk, wGet, wPreview, wCancel}, margin, null); - - /************************************************* - * // TRANSFORM NAME ENTRY - *************************************************/ - - // TransformName line - wlTransformName = new Label(shell, SWT.RIGHT); - wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName")); - props.setLook(wlTransformName); - fdlTransformName = new FormData(); - fdlTransformName.left = new FormAttachment(0, 0); - fdlTransformName.right = new FormAttachment(middle, -margin); - fdlTransformName.top = new FormAttachment(0, margin); - wlTransformName.setLayoutData(fdlTransformName); - - wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wTransformName.setText(transformName); - props.setLook(wTransformName); - wTransformName.addModifyListener(lsMod); - fdTransformName = new FormData(); - fdTransformName.left = new FormAttachment(middle, 0); - fdTransformName.top = new FormAttachment(0, margin); - fdTransformName.right = new FormAttachment(100, 0); - wTransformName.setLayoutData(fdTransformName); - - /************************************************* - * // GOOGLE ANALYTICS CONNECTION GROUP - *************************************************/ - - gConnect = new Group(shell, SWT.SHADOW_ETCHED_IN); - gConnect.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ConnectGroup.Label")); - FormLayout gConnectLayout = new FormLayout(); - gConnectLayout.marginWidth = 3; - gConnectLayout.marginHeight = 3; - gConnect.setLayout(gConnectLayout); - props.setLook(gConnect); - - FormData fdConnect = new FormData(); - fdConnect.left = new FormAttachment(0, 0); - fdConnect.right = new FormAttachment(100, 0); - fdConnect.top = new FormAttachment(wTransformName, margin); - gConnect.setLayoutData(fdConnect); - - // Google Analytics app name - Label wlGaAppName = new Label(gConnect, SWT.RIGHT); - wlGaAppName.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.AppName.Label")); - props.setLook(wlGaAppName); - FormData fdlGaAppName = new FormData(); - fdlGaAppName.top = new FormAttachment(0, margin); - fdlGaAppName.left = new FormAttachment(0, 0); - fdlGaAppName.right = new FormAttachment(middle, -margin); - wlGaAppName.setLayoutData(fdlGaAppName); - wGaAppName = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wGaAppName.addModifyListener(lsMod); - wGaAppName.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.AppName.Tooltip")); - props.setLook(wGaAppName); - FormData fdGaAppName = new FormData(); - fdGaAppName.top = new FormAttachment(wTransformName, margin); - fdGaAppName.left = new FormAttachment(middle, 0); - fdGaAppName.right = new FormAttachment(100, 0); - wGaAppName.setLayoutData(fdGaAppName); - - createOauthServiceCredentialsControls(); - - - /************************************************* - * // GOOGLE ANALYTICS QUERY GROUP - *************************************************/ - - Group gQuery = new Group(shell, SWT.SHADOW_ETCHED_IN); - gQuery.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.QueryGroup.Label")); - FormLayout gQueryLayout = new FormLayout(); - gQueryLayout.marginWidth = 3; - gQueryLayout.marginHeight = 3; - gQuery.setLayout(gQueryLayout); - props.setLook(gQuery); - - // query start date - Label wlQuStartDate = new Label(gQuery, SWT.RIGHT); - wlQuStartDate.setText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.StartDate.Label")); - props.setLook(wlQuStartDate); - FormData fdlQuStartDate = new FormData(); - fdlQuStartDate.top = new FormAttachment(0, margin); - fdlQuStartDate.left = new FormAttachment(0, 0); - fdlQuStartDate.right = new FormAttachment(middle, -margin); - wlQuStartDate.setLayoutData(fdlQuStartDate); - wQuStartDate = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wQuStartDate.addModifyListener(lsMod); - wQuStartDate.setToolTipText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.StartDate.Tooltip")); - props.setLook(wQuStartDate); - FormData fdQuStartDate = new FormData(); - fdQuStartDate.top = new FormAttachment(0, margin); - fdQuStartDate.left = new FormAttachment(middle, 0); - fdQuStartDate.right = new FormAttachment(100, 0); - wQuStartDate.setLayoutData(fdQuStartDate); - - // query end date - Label wlQuEndDate = new Label(gQuery, SWT.RIGHT); - wlQuEndDate.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.EndDate.Label")); - props.setLook(wlQuEndDate); - FormData fdlQuEndDate = new FormData(); - fdlQuEndDate.top = new FormAttachment(wQuStartDate, margin); - fdlQuEndDate.left = new FormAttachment(0, 0); - fdlQuEndDate.right = new FormAttachment(middle, -margin); - wlQuEndDate.setLayoutData(fdlQuEndDate); - wQuEndDate = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wQuEndDate.addModifyListener(lsMod); - wQuEndDate.setToolTipText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.EndDate.Tooltip")); - props.setLook(wQuEndDate); - FormData fdQuEndDate = new FormData(); - fdQuEndDate.top = new FormAttachment(wQuStartDate, margin); - fdQuEndDate.left = new FormAttachment(middle, 0); - fdQuEndDate.right = new FormAttachment(100, 0); - wQuEndDate.setLayoutData(fdQuEndDate); - - // query dimensions - Label wlQuDimensions = new Label(gQuery, SWT.RIGHT); - wlQuDimensions.setText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Dimensions.Label")); - props.setLook(wlQuDimensions); - FormData fdlQuDimensions = new FormData(); - fdlQuDimensions.top = new FormAttachment(wQuEndDate, margin); - fdlQuDimensions.left = new FormAttachment(0, 0); - fdlQuDimensions.right = new FormAttachment(middle, -margin); - wlQuDimensions.setLayoutData(fdlQuDimensions); - wQuDimensions = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wQuDimensions.addModifyListener(lsMod); - wQuDimensions.setToolTipText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Dimensions.Tooltip")); - props.setLook(wQuDimensions); - - Link wQuDimensionsReference = new Link(gQuery, SWT.SINGLE); - - wQuDimensionsReference.setText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Reference.Label")); - props.setLook(wQuDimensionsReference); - wQuDimensionsReference.addListener( - SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_DIMENSIONS_URI)); - - wQuDimensionsReference.pack(true); - - FormData fdQuDimensions = new FormData(); - fdQuDimensions.top = new FormAttachment(wQuEndDate, margin); - fdQuDimensions.left = new FormAttachment(middle, 0); - fdQuDimensions.right = - new FormAttachment(100, -wQuDimensionsReference.getBounds().width - margin); - wQuDimensions.setLayoutData(fdQuDimensions); - - FormData fdQuDimensionsReference = new FormData(); - fdQuDimensionsReference.top = new FormAttachment(wQuEndDate, margin); - fdQuDimensionsReference.left = new FormAttachment(wQuDimensions, 0); - fdQuDimensionsReference.right = new FormAttachment(100, 0); - wQuDimensionsReference.setLayoutData(fdQuDimensionsReference); - - // query Metrics - Label wlQuMetrics = new Label(gQuery, SWT.RIGHT); - wlQuMetrics.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Metrics.Label")); - props.setLook(wlQuMetrics); - FormData fdlQuMetrics = new FormData(); - fdlQuMetrics.top = new FormAttachment(wQuDimensions, margin); - fdlQuMetrics.left = new FormAttachment(0, 0); - fdlQuMetrics.right = new FormAttachment(middle, -margin); - wlQuMetrics.setLayoutData(fdlQuMetrics); - wQuMetrics = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wQuMetrics.addModifyListener(lsMod); - wQuMetrics.setToolTipText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Metrics.Tooltip")); - props.setLook(wQuMetrics); - - Link wQuMetricsReference = new Link(gQuery, SWT.SINGLE); - wQuMetricsReference.setText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Reference.Label")); - props.setLook(wQuMetricsReference); - wQuMetricsReference.addListener( - SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_METRICS_URI)); - - wQuMetricsReference.pack(true); - - FormData fdQuMetrics = new FormData(); - fdQuMetrics.top = new FormAttachment(wQuDimensions, margin); - fdQuMetrics.left = new FormAttachment(middle, 0); - fdQuMetrics.right = new FormAttachment(100, -wQuMetricsReference.getBounds().width - margin); - wQuMetrics.setLayoutData(fdQuMetrics); - - FormData fdQuMetricsReference = new FormData(); - fdQuMetricsReference.top = new FormAttachment(wQuDimensions, margin); - fdQuMetricsReference.left = new FormAttachment(wQuMetrics, 0); - fdQuMetricsReference.right = new FormAttachment(100, 0); - wQuMetricsReference.setLayoutData(fdQuMetricsReference); - - // query Sort - Label wlQuSort = new Label(gQuery, SWT.RIGHT); - wlQuSort.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Sort.Label")); - props.setLook(wlQuSort); - FormData fdlQuSort = new FormData(); - fdlQuSort.top = new FormAttachment(wQuMetrics, margin); - fdlQuSort.left = new FormAttachment(0, 0); - fdlQuSort.right = new FormAttachment(middle, -margin); - wlQuSort.setLayoutData(fdlQuSort); - wQuSort = new TextVar(variables, gQuery, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wQuSort.addModifyListener(lsMod); - wQuSort.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Sort.Tooltip")); - props.setLook(wQuSort); - - Link wQuSortReference = new Link(gQuery, SWT.SINGLE); - wQuSortReference.setText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Query.Reference.Label")); - props.setLook(wQuSortReference); - wQuSortReference.addListener( - SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_SORT_URI)); - - wQuSortReference.pack(true); - - FormData fdQuSort = new FormData(); - fdQuSort.top = new FormAttachment(wQuMetrics, margin); - fdQuSort.left = new FormAttachment(middle, 0); - fdQuSort.right = new FormAttachment(100, -wQuSortReference.getBounds().width - margin); - wQuSort.setLayoutData(fdQuSort); - - FormData fdQuSortReference = new FormData(); - fdQuSortReference.top = new FormAttachment(wQuMetrics, margin); - fdQuSortReference.left = new FormAttachment(wQuSort, 0); - fdQuSortReference.right = new FormAttachment(100, 0); - wQuSortReference.setLayoutData(fdQuSortReference); - - FormData fdQueryGroup = new FormData(); - fdQueryGroup.left = new FormAttachment(0, 0); - fdQueryGroup.right = new FormAttachment(100, 0); - fdQueryGroup.top = new FormAttachment(gConnect, margin); - gQuery.setLayoutData(fdQueryGroup); - - gQuery.setTabList( - new Control[] { - wQuStartDate, - wQuEndDate, - wQuDimensions, - wQuMetrics, - wQuSort - }); - - // Limit input ... - Label wlLimit = new Label(shell, SWT.RIGHT); - wlLimit.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.LimitSize.Label")); - props.setLook(wlLimit); - FormData fdlLimit = new FormData(); - fdlLimit.left = new FormAttachment(0, 0); - fdlLimit.right = new FormAttachment(middle, -margin); - fdlLimit.bottom = new FormAttachment(wOk, -2 * margin); - wlLimit.setLayoutData(fdlLimit); - wLimit = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wLimit.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.LimitSize.Tooltip")); - props.setLook(wLimit); - wLimit.addModifyListener(lsMod); - FormData fdLimit = new FormData(); - fdLimit.left = new FormAttachment(middle, 0); - fdLimit.right = new FormAttachment(100, 0); - fdLimit.top = new FormAttachment(wlLimit, 0, SWT.CENTER); - - wLimit.setLayoutData(fdLimit); - - /************************************************* - * // KEY / LOOKUP TABLE - *************************************************/ - - // lookup fields settings widgets - Link wlFields = new Link(shell, SWT.NONE); - wlFields.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.Return.Label")); - props.setLook(wlFields); - wlFields.addListener( - SWT.Selection, ev -> BareBonesBrowserLaunch.openURL(REFERENCE_DIMENSION_AND_METRIC_URI)); - - FormData fdlReturn = new FormData(); - fdlReturn.left = new FormAttachment(0, 0); - fdlReturn.top = new FormAttachment(gQuery, margin); - wlFields.setLayoutData(fdlReturn); - - int fieldWidgetCols = 5; - int fieldWidgetRows = (getInput().getGoogleAnalyticsFields() != null ? getInput().getGoogleAnalyticsFields().size():1); - - ColumnInfo[] ciKeys = new ColumnInfo[fieldWidgetCols]; - ciKeys[0] = - new ColumnInfo( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.FeedFieldType"), - ColumnInfo.COLUMN_TYPE_CCOMBO, - new String[] { - GoogleAnalyticsMeta.FIELD_TYPE_DIMENSION, GoogleAnalyticsMeta.FIELD_TYPE_METRIC, - GoogleAnalyticsMeta.FIELD_TYPE_DATA_SOURCE_PROPERTY, - GoogleAnalyticsMeta.FIELD_TYPE_DATA_SOURCE_FIELD - }, - true); - ciKeys[1] = - new ColumnInfo( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.FeedField"), - ColumnInfo.COLUMN_TYPE_TEXT, - false, - false); - ciKeys[1].setUsingVariables(true); - ciKeys[2] = - new ColumnInfo( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.RenameTo"), - ColumnInfo.COLUMN_TYPE_TEXT, - false, - false); - ciKeys[3] = - new ColumnInfo( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.Type"), - ColumnInfo.COLUMN_TYPE_CCOMBO, - ValueMetaBase.getTypes()); - ciKeys[4] = - new ColumnInfo( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.ColumnInfo.Format"), - ColumnInfo.COLUMN_TYPE_FORMAT, - 4); - - setTableView( - new TableView( - variables, - shell, - SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, - ciKeys, - fieldWidgetRows, - lsMod, - props)); - - FormData fdReturn = new FormData(); - fdReturn.left = new FormAttachment(0, 0); - fdReturn.top = new FormAttachment(wlFields, margin); - fdReturn.right = new FormAttachment(100, 0); - fdReturn.bottom = new FormAttachment(wLimit, -margin); - getTableView().setLayoutData(fdReturn); - - fileChooser.addListener(SWT.Selection, this::browseKeyFile); - - /************************************************* - * // POPULATE AND OPEN DIALOG - *************************************************/ - - getData(); - - getInput().setChanged(backupChanged); - wTransformName.setFocus(); - - shell.setTabList(new Control[] {wTransformName, gConnect, gQuery, getTableView()}); - - BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); - - return transformName; - } + meta.setGaAppName(wGaAppName.getText()); + meta.setOAuthServiceAccount(wOauthAccount.getText()); + meta.setOAuthKeyFile(keyFilename.getText()); + meta.setGaProperty(wGaPropertyId.getText()); - private void browseKeyFile(Event e) { - BaseDialog.presentFileDialog( - shell, - keyFilename, - variables, - new String[] {"*.properties", "*.*"}, - new String[] {"Properties files (*.properties)", "All Files (*.*)"}, - true); - } + meta.setStartDate(wQuStartDate.getText()); + meta.setEndDate(wQuEndDate.getText()); - private RunReportResponse getReportResponse(){ - BetaAnalyticsDataClient analyticsData = null; - try{ - InputStream inputStream = new FileInputStream(keyFilename.getText()); - Credentials credentials = ServiceAccountCredentials.fromStream(inputStream); + meta.setDimensions(wQuDimensions.getText()); + meta.setMetrics(wQuMetrics.getText()); + meta.setSort(wQuSort.getText()); - BetaAnalyticsDataSettings settings = BetaAnalyticsDataSettings.newHttpJsonBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build(); - analyticsData = BetaAnalyticsDataClient.create(settings); - }catch(IOException e){ - new ErrorDialog(shell, "Error creating connection", "Error reading key file or creating Google Analytics connection", e); - } + int nrFields = getTableView().nrNonEmpty(); - List dimensionList = new ArrayList<>(); - String dimensionString = wQuDimensions.getText(); - for(String dimension : dimensionString.split(",")){ - dimensionList.add(Dimension.newBuilder().setName(dimension).build()); - } - List metricList = new ArrayList<>(); - String metricsString = wQuMetrics.getText(); - for(String metric : metricsString.split(",")){ - metricList.add(Metric.newBuilder().setName(metric).build()); + List googleAnalyticsFields = new ArrayList<>(); + for (int i = 0; i < nrFields; i++) { + TableItem item = getTableView().getNonEmpty(i); + GoogleAnalyticsField field = new GoogleAnalyticsField(); + field.setFeedFieldType(item.getText(1)); + field.setFeedField(item.getText(2)); + field.setOutputFieldName(item.getText(3)); + field.setType(item.getText(4)); + field.setInputFormat(item.getText(5)); + googleAnalyticsFields.add(field); + } + meta.setGoogleAnalyticsFields(googleAnalyticsFields); + meta.setRowLimit(Const.toInt(wLimit.getText(), 0)); + } + + // Preview the data + private void preview() { + // Create the XML input transform + GoogleAnalyticsMeta oneMeta = new GoogleAnalyticsMeta(); + getInfo(oneMeta); + PipelineMeta previewMeta = + PipelinePreviewFactory.generatePreviewPipeline( + metadataProvider, oneMeta, wTransformName.getText()); + + EnterNumberDialog numberDialog = + new EnterNumberDialog( + shell, + props.getDefaultPreviewSize(), + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PreviewSize.DialogTitle"), + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PreviewSize.DialogMessage")); + int previewSize = numberDialog.open(); + if (previewSize > 0) { + PipelinePreviewProgressDialog progressDialog = + new PipelinePreviewProgressDialog( + shell, + variables, + previewMeta, + new String[] {wTransformName.getText()}, + new int[] {previewSize}); + progressDialog.open(); + + Pipeline pipeline = progressDialog.getPipeline(); + String loggingText = progressDialog.getLoggingText(); + + if (!progressDialog.isCancelled()) { + if (pipeline.getResult() != null && pipeline.getResult().getNrErrors() > 0) { + EnterTextDialog etd = + new EnterTextDialog( + shell, + BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), + BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), + loggingText, + true); + etd.setReadOnly(); + etd.open(); } - RunReportRequest request = - RunReportRequest.newBuilder() - .setProperty("properties/" + wGaPropertyId.getText()) - .addAllDimensions(dimensionList) - .addAllMetrics(metricList) - .addDateRanges(DateRange.newBuilder().setStartDate(wQuStartDate.getText()).setEndDate(wQuEndDate.getText())) - .build(); - RunReportResponse response = analyticsData.runReport(request); - return response; + } + + PreviewRowsDialog prd = + new PreviewRowsDialog( + shell, + variables, + SWT.NONE, + wTransformName.getText(), + progressDialog.getPreviewRowsMeta(wTransformName.getText()), + progressDialog.getPreviewRows(wTransformName.getText()), + loggingText); + prd.open(); } + } - // Visible for testing - void getFields() { - - getTableView().removeAll(); - - RunReportResponse response = getReportResponse(); - List dimensionHeaders = response.getDimensionHeadersList(); - List metricHeaders = response.getMetricHeadersList(); - - if(response == null || dimensionHeaders.isEmpty() || metricHeaders.isEmpty()){ - MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); - mb.setText("Query yields empty feed"); - mb.setMessage( - "The feed did not give any results. Please specify a query that returns data."); - mb.open(); - - return; - } - - int i = 0; - getTableView().table.setItemCount(dimensionHeaders.size() + metricHeaders.size()); - for (DimensionHeader colHeader : dimensionHeaders) { - String name = colHeader.getName(); - ; - TableItem item = getTableView().table.getItem(i); - item.setText(1, GoogleAnalyticsMeta.FIELD_TYPE_DIMENSION); - item.setText(2, name); - item.setText(3, name); - item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_STRING)); - item.setText(5, ""); - i++; - } - for(MetricHeader metricHeader : metricHeaders) { - TableItem item = getTableView().table.getItem(i); - String name = metricHeader.getName(); - item.setText(1, GoogleAnalyticsMeta.FIELD_TYPE_METRIC); - item.setText(2, name); - item.setText(3, name); - MetricType metricType = metricHeader.getType(); - if(metricType.equals(MetricType.TYPE_INTEGER)) { - item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_INTEGER)); - item.setText(5, "#;-#"); - }else if(metricType.equals(MetricType.TYPE_FLOAT) || - metricType.equals(MetricType.TYPE_SECONDS) || - metricType.equals(MetricType.TYPE_MILLISECONDS) || - metricType.equals(MetricType.TYPE_MINUTES) || - metricType.equals(MetricType.TYPE_HOURS) || - metricType.equals(MetricType.TYPE_STANDARD) || - metricType.equals(MetricType.TYPE_CURRENCY) || - metricType.equals(MetricType.TYPE_FEET) || - metricType.equals(MetricType.TYPE_MILES) || - metricType.equals(MetricType.TYPE_METERS) || - metricType.equals(MetricType.TYPE_KILOMETERS)) { - item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_NUMBER)); - item.setText(5, "#.#;-#.#"); - }else { - item.setText(4, ValueMetaBase.getTypeDesc(IValueMeta.TYPE_STRING)); - item.setText(5, ""); - } - i++; - } - - getTableView().removeEmptyRows(); - getTableView().setRowNums(); - getTableView().optWidth(true); - getInput().setChanged(); + /** Collect data from the meta and place it in the dialog */ + public void getData() { + if (getInput().getGaAppName() != null) { + wGaAppName.setText(getInput().getGaAppName()); } - private void getInfo(GoogleAnalyticsMeta meta) { + wOauthAccount.setText(Const.NVL(getInput().getOAuthServiceAccount(), "")); + keyFilename.setText(Const.NVL(getInput().getOAuthKeyFile(), "")); + wGaPropertyId.setText(Const.NVL(getInput().getGaProperty(), "")); - transformName = wTransformName.getText(); // return value - - meta.setGaAppName(wGaAppName.getText()); - meta.setOAuthServiceAccount(wOauthAccount.getText()); - meta.setOAuthKeyFile(keyFilename.getText()); - meta.setGaProperty(wGaPropertyId.getText()); - - meta.setStartDate(wQuStartDate.getText()); - meta.setEndDate(wQuEndDate.getText()); - - meta.setDimensions(wQuDimensions.getText()); - meta.setMetrics(wQuMetrics.getText()); - meta.setSort(wQuSort.getText()); + if (getInput().getStartDate() != null) { + wQuStartDate.setText(getInput().getStartDate()); + } - int nrFields = getTableView().nrNonEmpty(); + if (getInput().getEndDate() != null) { + wQuEndDate.setText(getInput().getEndDate()); + } - List googleAnalyticsFields = new ArrayList<>(); - for (int i = 0; i < nrFields; i++) { - TableItem item = getTableView().getNonEmpty(i); - GoogleAnalyticsField field = new GoogleAnalyticsField(); - field.setFeedFieldType(item.getText(1)); - field.setFeedField(item.getText(2)); - field.setOutputFieldName(item.getText(3)); - field.setType(item.getText(4)); - field.setInputFormat(item.getText(5)); - googleAnalyticsFields.add(field); - } - meta.setGoogleAnalyticsFields(googleAnalyticsFields); - meta.setRowLimit(Const.toInt(wLimit.getText(), 0)); + if (getInput().getDimensions() != null) { + wQuDimensions.setText(getInput().getDimensions()); } - // Preview the data - private void preview() { - // Create the XML input transform - GoogleAnalyticsMeta oneMeta = new GoogleAnalyticsMeta(); - getInfo(oneMeta); - PipelineMeta previewMeta = - PipelinePreviewFactory.generatePreviewPipeline( - metadataProvider, oneMeta, wTransformName.getText()); - - EnterNumberDialog numberDialog = - new EnterNumberDialog( - shell, - props.getDefaultPreviewSize(), - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PreviewSize.DialogTitle"), - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PreviewSize.DialogMessage")); - int previewSize = numberDialog.open(); - if (previewSize > 0) { - PipelinePreviewProgressDialog progressDialog = - new PipelinePreviewProgressDialog( - shell, - variables, - previewMeta, - new String[] {wTransformName.getText()}, - new int[] {previewSize}); - progressDialog.open(); - - Pipeline pipeline = progressDialog.getPipeline(); - String loggingText = progressDialog.getLoggingText(); - - if (!progressDialog.isCancelled()) { - if (pipeline.getResult() != null && pipeline.getResult().getNrErrors() > 0) { - EnterTextDialog etd = - new EnterTextDialog( - shell, - BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), - BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), - loggingText, - true); - etd.setReadOnly(); - etd.open(); - } - } - - PreviewRowsDialog prd = - new PreviewRowsDialog( - shell, - variables, - SWT.NONE, - wTransformName.getText(), - progressDialog.getPreviewRowsMeta(wTransformName.getText()), - progressDialog.getPreviewRows(wTransformName.getText()), - loggingText); - prd.open(); - } + if (getInput().getMetrics() != null) { + wQuMetrics.setText(getInput().getMetrics()); } + if (getInput().getSort() != null) { + wQuSort.setText(getInput().getSort()); + } - /** Collect data from the meta and place it in the dialog */ - public void getData() { + wFields.removeAll(); + wFields.removeEmptyRows(); + if (input.getGoogleAnalyticsFields().size() > 0) { - if (getInput().getGaAppName() != null) { - wGaAppName.setText(getInput().getGaAppName()); - } + wFields.table.setItemCount(input.getGoogleAnalyticsFields().size()); + List googleAnalyticsFields = input.getGoogleAnalyticsFields(); - wOauthAccount.setText(Const.NVL(getInput().getOAuthServiceAccount(), "")); - keyFilename.setText(Const.NVL(getInput().getOAuthKeyFile(), "")); - wGaPropertyId.setText(Const.NVL(getInput().getGaProperty(), "")); + int i = 0; + for (GoogleAnalyticsField field : googleAnalyticsFields) { - if (getInput().getStartDate() != null) { - wQuStartDate.setText(getInput().getStartDate()); - } + TableItem item = wFields.table.getItem(i); - if (getInput().getEndDate() != null) { - wQuEndDate.setText(getInput().getEndDate()); + if (!Utils.isEmpty(field.getType())) { + item.setText(1, field.getFeedFieldType()); } - if (getInput().getDimensions() != null) { - wQuDimensions.setText(getInput().getDimensions()); + if (!Utils.isEmpty(field.getFeedField())) { + item.setText(2, field.getFeedField()); } - if (getInput().getMetrics() != null) { - wQuMetrics.setText(getInput().getMetrics()); + if (!Utils.isEmpty(field.getOutputFieldName())) { + item.setText(3, field.getOutputFieldName()); } - if (getInput().getSort() != null) { - wQuSort.setText(getInput().getSort()); + if (!Utils.isEmpty(field.getType())) { + item.setText(4, field.getType()); } - wFields.removeAll(); - wFields.removeEmptyRows(); - if (input.getGoogleAnalyticsFields().size() > 0) { - - wFields.table.setItemCount(input.getGoogleAnalyticsFields().size()); - List googleAnalyticsFields = input.getGoogleAnalyticsFields(); - - int i=0; - for (GoogleAnalyticsField field : googleAnalyticsFields) { - - TableItem item = wFields.table.getItem(i); - - if (!Utils.isEmpty(field.getType())) { - item.setText(1, field.getFeedFieldType()); - } - - if (!Utils.isEmpty(field.getFeedField())) { - item.setText(2, field.getFeedField()); - } - - if (!Utils.isEmpty(field.getOutputFieldName())) { - item.setText(3, field.getOutputFieldName()); - } - - if(!Utils.isEmpty(field.getType())){ - item.setText(4, field.getType()); - } - - if (!Utils.isEmpty(field.getInputFormat())) { - item.setText(5, field.getType()); - } - i++; - } + if (!Utils.isEmpty(field.getInputFormat())) { + item.setText(5, field.getType()); } - - wFields.removeEmptyRows(); - getTableView().setRowNums(); - getTableView().optWidth(true); - - wLimit.setText(getInput().getRowLimit() + ""); - - setActive(); - - wTransformName.selectAll(); - wTransformName.setFocus(); + i++; + } } - private void cancel() { - transformName = null; - getInput().setChanged(backupChanged); - dispose(); - } - - // let the meta know about the entered data - private void ok() { - getInfo(getInput()); - dispose(); - } - - private void createOauthServiceCredentialsControls() { - // OathAccount line - Label wlOauthAccount = new Label(gConnect, SWT.RIGHT); - wlOauthAccount.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.OauthAccount.Label")); - props.setLook(wlOauthAccount); - - FormData fdlOathAccount = new FormData(); - fdlOathAccount.left = new FormAttachment(0, 0); - fdlOathAccount.top = new FormAttachment(wGaAppName, margin); - fdlOathAccount.right = new FormAttachment(middle, -margin); - - wlOauthAccount.setLayoutData(fdlOathAccount); - wOauthAccount = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wOauthAccount.setToolTipText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.OauthAccount.Tooltip")); - props.setLook(wOauthAccount); - - wOauthAccount.addModifyListener(lsMod); - FormData fdOathAccount = new FormData(); - fdOathAccount.left = new FormAttachment(middle, 0); - fdOathAccount.top = new FormAttachment(wGaAppName, margin); - fdOathAccount.right = new FormAttachment(100, -margin); - wOauthAccount.setLayoutData(fdOathAccount); - - fileChooser = new Button(gConnect, SWT.PUSH | SWT.CENTER); - fileChooser.setText(BaseMessages.getString(PKG, ("System.Button.Browse"))); - props.setLook(fileChooser); - - FormData fdbFilename = new FormData(); - fdbFilename.right = new FormAttachment(100, 0); - fdbFilename.top = new FormAttachment(wOauthAccount, margin); - fileChooser.setLayoutData(fdbFilename); - - Label wlFilename = new Label(gConnect, SWT.RIGHT); - wlFilename.setText(BaseMessages.getString(PKG, ("GoogleAnalyticsDialog.KeyFile.Label"))); - props.setLook(wlFilename); - FormData fdlFilename = new FormData(); - fdlFilename.top = new FormAttachment(wOauthAccount, margin); - fdlFilename.left = new FormAttachment(0, 0); - fdlFilename.right = new FormAttachment(middle, -margin); - wlFilename.setLayoutData(fdlFilename); - - keyFilename = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - keyFilename.setToolTipText( - BaseMessages.getString(PKG, "GoogleAnalyticsDialog.KeyFilename.Tooltip")); - keyFilename.addModifyListener(lsMod); - props.setLook(keyFilename); - - FormData fdFilename = new FormData(); - fdFilename.top = new FormAttachment(wOauthAccount, margin); - fdFilename.left = new FormAttachment(middle, 0); - fdFilename.right = new FormAttachment(fileChooser, -margin); - keyFilename.setLayoutData(fdFilename); - - Label wlGaPropertyId = new Label(gConnect, SWT.RIGHT); - wlGaPropertyId.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PropertyId.Label")); - props.setLook(wlGaPropertyId); - FormData fdlGaPropertyId = new FormData(); - fdlGaPropertyId.top = new FormAttachment(keyFilename, margin); - fdlGaPropertyId.left = new FormAttachment(0,0); - fdlGaPropertyId.right = new FormAttachment(middle, -margin); - wlGaPropertyId.setLayoutData(fdlGaPropertyId); - - wGaPropertyId = new TextVar(variables, gConnect, SWT.SINGLE|SWT.LEFT|SWT.BORDER); - wGaPropertyId.setToolTipText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PropertyId.Tooltip")); - wGaPropertyId.addModifyListener(lsMod); - props.setLook(wGaPropertyId); - FormData fdGaPropertyId = new FormData(); - fdGaPropertyId.top = new FormAttachment(keyFilename, margin); - fdGaPropertyId.left = new FormAttachment(middle, 0); - fdGaPropertyId.right = new FormAttachment(100, -margin); - wGaPropertyId.setLayoutData(fdGaPropertyId); - - } - - TableView getTableView() { - return wFields; - } - - void setTableView(TableView wFields) { - this.wFields = wFields; - } - - GoogleAnalyticsMeta getInput() { - return input; - } - - void setInput(GoogleAnalyticsMeta input) { - this.input = input; - } + wFields.removeEmptyRows(); + getTableView().setRowNums(); + getTableView().optWidth(true); + + wLimit.setText(getInput().getRowLimit() + ""); + + setActive(); + + wTransformName.selectAll(); + wTransformName.setFocus(); + } + + private void cancel() { + transformName = null; + getInput().setChanged(backupChanged); + dispose(); + } + + // let the meta know about the entered data + private void ok() { + getInfo(getInput()); + dispose(); + } + + private void createOauthServiceCredentialsControls() { + // OathAccount line + Label wlOauthAccount = new Label(gConnect, SWT.RIGHT); + wlOauthAccount.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.OauthAccount.Label")); + props.setLook(wlOauthAccount); + + FormData fdlOathAccount = new FormData(); + fdlOathAccount.left = new FormAttachment(0, 0); + fdlOathAccount.top = new FormAttachment(wGaAppName, margin); + fdlOathAccount.right = new FormAttachment(middle, -margin); + + wlOauthAccount.setLayoutData(fdlOathAccount); + wOauthAccount = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wOauthAccount.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.OauthAccount.Tooltip")); + props.setLook(wOauthAccount); + + wOauthAccount.addModifyListener(lsMod); + FormData fdOathAccount = new FormData(); + fdOathAccount.left = new FormAttachment(middle, 0); + fdOathAccount.top = new FormAttachment(wGaAppName, margin); + fdOathAccount.right = new FormAttachment(100, -margin); + wOauthAccount.setLayoutData(fdOathAccount); + + fileChooser = new Button(gConnect, SWT.PUSH | SWT.CENTER); + fileChooser.setText(BaseMessages.getString(PKG, ("System.Button.Browse"))); + props.setLook(fileChooser); + + FormData fdbFilename = new FormData(); + fdbFilename.right = new FormAttachment(100, 0); + fdbFilename.top = new FormAttachment(wOauthAccount, margin); + fileChooser.setLayoutData(fdbFilename); + + Label wlFilename = new Label(gConnect, SWT.RIGHT); + wlFilename.setText(BaseMessages.getString(PKG, ("GoogleAnalyticsDialog.KeyFile.Label"))); + props.setLook(wlFilename); + FormData fdlFilename = new FormData(); + fdlFilename.top = new FormAttachment(wOauthAccount, margin); + fdlFilename.left = new FormAttachment(0, 0); + fdlFilename.right = new FormAttachment(middle, -margin); + wlFilename.setLayoutData(fdlFilename); + + keyFilename = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + keyFilename.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.KeyFilename.Tooltip")); + keyFilename.addModifyListener(lsMod); + props.setLook(keyFilename); + + FormData fdFilename = new FormData(); + fdFilename.top = new FormAttachment(wOauthAccount, margin); + fdFilename.left = new FormAttachment(middle, 0); + fdFilename.right = new FormAttachment(fileChooser, -margin); + keyFilename.setLayoutData(fdFilename); + + Label wlGaPropertyId = new Label(gConnect, SWT.RIGHT); + wlGaPropertyId.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PropertyId.Label")); + props.setLook(wlGaPropertyId); + FormData fdlGaPropertyId = new FormData(); + fdlGaPropertyId.top = new FormAttachment(keyFilename, margin); + fdlGaPropertyId.left = new FormAttachment(0, 0); + fdlGaPropertyId.right = new FormAttachment(middle, -margin); + wlGaPropertyId.setLayoutData(fdlGaPropertyId); + + wGaPropertyId = new TextVar(variables, gConnect, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wGaPropertyId.setToolTipText( + BaseMessages.getString(PKG, "GoogleAnalyticsDialog.PropertyId.Tooltip")); + wGaPropertyId.addModifyListener(lsMod); + props.setLook(wGaPropertyId); + FormData fdGaPropertyId = new FormData(); + fdGaPropertyId.top = new FormAttachment(keyFilename, margin); + fdGaPropertyId.left = new FormAttachment(middle, 0); + fdGaPropertyId.right = new FormAttachment(100, -margin); + wGaPropertyId.setLayoutData(fdGaPropertyId); + } + + TableView getTableView() { + return wFields; + } + + void setTableView(TableView wFields) { + this.wFields = wFields; + } + + GoogleAnalyticsMeta getInput() { + return input; + } + + void setInput(GoogleAnalyticsMeta input) { + this.input = input; + } } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsField.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsField.java index d938ce1e58d..599b45ec4e0 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsField.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsField.java @@ -24,77 +24,77 @@ public class GoogleAnalyticsField { - @HopMetadataProperty(key = "feed_field_type") - private String feedFieldType; + @HopMetadataProperty(key = "feed_field_type") + private String feedFieldType; - @HopMetadataProperty(key = "feed_field") - private String feedField; + @HopMetadataProperty(key = "feed_field") + private String feedField; - @HopMetadataProperty(key = "output_field") - private String outputFieldName; + @HopMetadataProperty(key = "output_field") + private String outputFieldName; - @HopMetadataProperty(key = "type") - private String type; + @HopMetadataProperty(key = "type") + private String type; - @HopMetadataProperty(key = "input_format") - private String inputFormat; + @HopMetadataProperty(key = "input_format") + private String inputFormat; - public GoogleAnalyticsField(){} + public GoogleAnalyticsField() {} - public GoogleAnalyticsField(GoogleAnalyticsField f){ - this.feedField = f.feedField; - this.type = f.type; - this.feedFieldType = f.feedFieldType; - this.outputFieldName = f.outputFieldName; - this.inputFormat = f.inputFormat; - } + public GoogleAnalyticsField(GoogleAnalyticsField f) { + this.feedField = f.feedField; + this.type = f.type; + this.feedFieldType = f.feedFieldType; + this.outputFieldName = f.outputFieldName; + this.inputFormat = f.inputFormat; + } - public int getHopType(){ - return ValueMetaFactory.getIdForValueMeta(type); - } + public int getHopType() { + return ValueMetaFactory.getIdForValueMeta(type); + } - public IValueMeta createValueMeta() throws HopPluginException{ - IValueMeta v = ValueMetaFactory.createValueMeta(outputFieldName, getHopType()); - return v; - } + public IValueMeta createValueMeta() throws HopPluginException { + IValueMeta v = ValueMetaFactory.createValueMeta(outputFieldName, getHopType()); + return v; + } - public String getFeedFieldType() { - return feedFieldType; - } + public String getFeedFieldType() { + return feedFieldType; + } - public void setFeedFieldType(String feedFieldType) { - this.feedFieldType = feedFieldType; - } + public void setFeedFieldType(String feedFieldType) { + this.feedFieldType = feedFieldType; + } - public String getFeedField() { - return feedField; - } + public String getFeedField() { + return feedField; + } - public void setFeedField(String feedField) { - this.feedField = feedField; - } + public void setFeedField(String feedField) { + this.feedField = feedField; + } - public String getOutputFieldName() { - return outputFieldName; - } + public String getOutputFieldName() { + return outputFieldName; + } - public void setOutputFieldName(String outputFieldName) { - this.outputFieldName = outputFieldName; - } + public void setOutputFieldName(String outputFieldName) { + this.outputFieldName = outputFieldName; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getInputFormat() { - return inputFormat; - } + public String getInputFormat() { + return inputFormat; + } - public void setInputFormat(String inputFormat) { - this.inputFormat = inputFormat; - } + public void setInputFormat(String inputFormat) { + this.inputFormat = inputFormat; + } } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsMeta.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsMeta.java index 8b7e43dfb24..4abd972cebc 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsMeta.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googleanalytics/GoogleAnalyticsMeta.java @@ -17,6 +17,8 @@ */ package org.apache.hop.pipeline.transforms.googleanalytics; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -29,210 +31,177 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( - id = "GoogleAnalytics", - image = "google-analytics.svg", - name = "i18n::BaseTransform.TypeLongDesc.GoogleAnalytics", - description = "i18n::BaseTransform.TypeTooltipDesc.GoogleAnalytics", - categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", - documentationUrl = - "https://hop.apache.org/manual/latest/pipeline/transforms/googleanalytics.html" -) + id = "GoogleAnalytics", + image = "google-analytics.svg", + name = "i18n::BaseTransform.TypeLongDesc.GoogleAnalytics", + description = "i18n::BaseTransform.TypeTooltipDesc.GoogleAnalytics", + categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", + documentationUrl = + "https://hop.apache.org/manual/latest/pipeline/transforms/googleanalytics.html") public class GoogleAnalyticsMeta extends BaseTransformMeta { - public static final String[] TYPE_SAMPLING_LEVEL_CODE = - new String[] {"DEFAULT", "FASTER", "HIGHER_PRECISION"}; - public static final String FIELD_TYPE_DIMENSION = "Dimension"; - public static final String FIELD_TYPE_METRIC = "Metric"; - public static final String FIELD_TYPE_DATA_SOURCE_PROPERTY = "Data Source Property"; - public static final String FIELD_TYPE_DATA_SOURCE_FIELD = "Data Source Field"; - - @HopMetadataProperty( - key = "oauth_service_account", - injectionKeyDescription = "" - ) - private String oAuthServiceAccount; - - @HopMetadataProperty( - key = "oauth_key_file", - injectionKeyDescription = "" - ) - private String oAuthKeyFile; - - @HopMetadataProperty( - key = "app_name", - injectionKeyDescription = "" - ) - private String gaAppName; - - @HopMetadataProperty( - key = "ga_property_id", - injectionKeyDescription = "" - ) - private String gaProperty; - - @HopMetadataProperty( - key = "start_date", - injectionKeyDescription = "" - ) - private String startDate; - - @HopMetadataProperty( - key = "end_date", - injectionKeyDescription = "" - ) - private String endDate; - - @HopMetadataProperty( - key = "dimensions", - injectionKeyDescription = "" - ) - private String dimensions; - - @HopMetadataProperty( - key = "metrics", - injectionKeyDescription = "" - ) - private String metrics; - - @HopMetadataProperty( - key = "order_by", - injectionKeyDescription = "" - ) - private String sort; - - @HopMetadataProperty( - key = "row_limit", - injectionKeyDescription = "" - ) - private int rowLimit; - - @HopMetadataProperty( - groupKey = "fields", - key = "field", - injectionGroupKey = "FIELDS", - injectionKeyDescription = "" - ) - private List googleAnalyticsFields; - - public GoogleAnalyticsMeta(){ - this.googleAnalyticsFields = new ArrayList<>(); - } - - public String getOAuthServiceAccount() { - return oAuthServiceAccount; - } - - public void setOAuthServiceAccount(String oAuthServiceAccount) { - this.oAuthServiceAccount = oAuthServiceAccount; - } - - public String getOAuthKeyFile() { - return oAuthKeyFile; - } - - public void setOAuthKeyFile(String oAuthKeyFile) { - this.oAuthKeyFile = oAuthKeyFile; - } - - public String getGaAppName() { - return gaAppName; - } - - public void setGaAppName(String gaAppName) { - this.gaAppName = gaAppName; - } - - public String getGaProperty() { - return gaProperty; - } - - public void setGaProperty(String gaProperty) { - this.gaProperty = gaProperty; - } - - public String getStartDate() { - return startDate; - } - - public void setStartDate(String startDate) { - this.startDate = startDate; - } + public static final String[] TYPE_SAMPLING_LEVEL_CODE = + new String[] {"DEFAULT", "FASTER", "HIGHER_PRECISION"}; + public static final String FIELD_TYPE_DIMENSION = "Dimension"; + public static final String FIELD_TYPE_METRIC = "Metric"; + public static final String FIELD_TYPE_DATA_SOURCE_PROPERTY = "Data Source Property"; + public static final String FIELD_TYPE_DATA_SOURCE_FIELD = "Data Source Field"; - public String getEndDate() { - return endDate; - } + @HopMetadataProperty(key = "oauth_service_account", injectionKeyDescription = "") + private String oAuthServiceAccount; - public void setEndDate(String endDate) { - this.endDate = endDate; - } - - public String getDimensions() { - return dimensions; - } + @HopMetadataProperty(key = "oauth_key_file", injectionKeyDescription = "") + private String oAuthKeyFile; - public void setDimensions(String dimensions) { - this.dimensions = dimensions; - } + @HopMetadataProperty(key = "app_name", injectionKeyDescription = "") + private String gaAppName; - public String getMetrics() { - return metrics; - } + @HopMetadataProperty(key = "ga_property_id", injectionKeyDescription = "") + private String gaProperty; - public void setMetrics(String metrics) { - this.metrics = metrics; - } + @HopMetadataProperty(key = "start_date", injectionKeyDescription = "") + private String startDate; - public String getSort() { - return sort; - } + @HopMetadataProperty(key = "end_date", injectionKeyDescription = "") + private String endDate; - public void setSort(String sort) { - this.sort = sort; - } + @HopMetadataProperty(key = "dimensions", injectionKeyDescription = "") + private String dimensions; - public int getRowLimit() { - return rowLimit; - } + @HopMetadataProperty(key = "metrics", injectionKeyDescription = "") + private String metrics; - public void setRowLimit(int rowLimit) { - this.rowLimit = rowLimit; - } + @HopMetadataProperty(key = "order_by", injectionKeyDescription = "") + private String sort; - public List getGoogleAnalyticsFields() { - return googleAnalyticsFields; - } + @HopMetadataProperty(key = "row_limit", injectionKeyDescription = "") + private int rowLimit; - public void setGoogleAnalyticsFields(List googleAnalyticsFields) { - this.googleAnalyticsFields = googleAnalyticsFields; - } + @HopMetadataProperty( + groupKey = "fields", + key = "field", + injectionGroupKey = "FIELDS", + injectionKeyDescription = "") + private List googleAnalyticsFields; - @Override - public void getFields( - IRowMeta inputRowMeta, - String name, - IRowMeta[] info, - TransformMeta nextTransform, - IVariables variables, - IHopMetadataProvider metadataProvider) throws HopTransformException { - for(int i=0; i < googleAnalyticsFields.size(); i++){ - try{ - if(!Utils.isEmpty(googleAnalyticsFields.get(i).getOutputFieldName())){ - int type = ValueMetaFactory.getIdForValueMeta(googleAnalyticsFields.get(i).getType()); - if(type == IValueMeta.TYPE_NONE){ - type = IValueMeta.TYPE_STRING; - } - IValueMeta v = ValueMetaFactory.createValueMeta(googleAnalyticsFields.get(i).getOutputFieldName(), type); - inputRowMeta.addValueMeta(v); - } - }catch(Exception e){ - throw new HopTransformException( - "Unable to create value of type " + googleAnalyticsFields.get(i).getType(), e); - } + public GoogleAnalyticsMeta() { + this.googleAnalyticsFields = new ArrayList<>(); + } + + public String getOAuthServiceAccount() { + return oAuthServiceAccount; + } + + public void setOAuthServiceAccount(String oAuthServiceAccount) { + this.oAuthServiceAccount = oAuthServiceAccount; + } + + public String getOAuthKeyFile() { + return oAuthKeyFile; + } + + public void setOAuthKeyFile(String oAuthKeyFile) { + this.oAuthKeyFile = oAuthKeyFile; + } + + public String getGaAppName() { + return gaAppName; + } + + public void setGaAppName(String gaAppName) { + this.gaAppName = gaAppName; + } + + public String getGaProperty() { + return gaProperty; + } + + public void setGaProperty(String gaProperty) { + this.gaProperty = gaProperty; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public String getDimensions() { + return dimensions; + } + + public void setDimensions(String dimensions) { + this.dimensions = dimensions; + } + + public String getMetrics() { + return metrics; + } + + public void setMetrics(String metrics) { + this.metrics = metrics; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public int getRowLimit() { + return rowLimit; + } + + public void setRowLimit(int rowLimit) { + this.rowLimit = rowLimit; + } + + public List getGoogleAnalyticsFields() { + return googleAnalyticsFields; + } + + public void setGoogleAnalyticsFields(List googleAnalyticsFields) { + this.googleAnalyticsFields = googleAnalyticsFields; + } + + @Override + public void getFields( + IRowMeta inputRowMeta, + String name, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables variables, + IHopMetadataProvider metadataProvider) + throws HopTransformException { + for (int i = 0; i < googleAnalyticsFields.size(); i++) { + try { + if (!Utils.isEmpty(googleAnalyticsFields.get(i).getOutputFieldName())) { + int type = ValueMetaFactory.getIdForValueMeta(googleAnalyticsFields.get(i).getType()); + if (type == IValueMeta.TYPE_NONE) { + type = IValueMeta.TYPE_STRING; + } + IValueMeta v = + ValueMetaFactory.createValueMeta( + googleAnalyticsFields.get(i).getOutputFieldName(), type); + inputRowMeta.addValueMeta(v); } + } catch (Exception e) { + throw new HopTransformException( + "Unable to create value of type " + googleAnalyticsFields.get(i).getType(), e); + } } - + } } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsCredentials.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsCredentials.java index 5d682977287..2c13b77a6a7 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsCredentials.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsCredentials.java @@ -35,8 +35,8 @@ public class GoogleSheetsCredentials { public static final String APPLICATION_NAME = "Apache-Hop-Google-Sheets"; - public static HttpCredentialsAdapter getCredentialsJson(String scope, String jsonCredentialPath, String impersonation) - throws IOException { + public static HttpCredentialsAdapter getCredentialsJson( + String scope, String jsonCredentialPath, String impersonation) throws IOException { GoogleCredentials credential; @@ -50,23 +50,27 @@ public static HttpCredentialsAdapter getCredentialsJson(String scope, String jso if (in == null) { throw new FileNotFoundException("Resource not found:" + jsonCredentialPath); } - if(StringUtils.isEmpty(impersonation)){ + if (StringUtils.isEmpty(impersonation)) { credential = GoogleCredentials.fromStream(in).createScoped(Collections.singleton(scope)); - }else{ - credential = GoogleCredentials.fromStream(in).createScoped(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN)).createDelegated(impersonation); + } else { + credential = + GoogleCredentials.fromStream(in) + .createScoped(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN)) + .createDelegated(impersonation); } return new HttpCredentialsAdapter(credential); } - public static HttpRequestInitializer setHttpTimeout(final HttpRequestInitializer requestInitializer, final String timeout) { + public static HttpRequestInitializer setHttpTimeout( + final HttpRequestInitializer requestInitializer, final String timeout) { return new HttpRequestInitializer() { @Override public void initialize(HttpRequest httpRequest) throws IOException { - Integer TO=Integer.parseInt(timeout); + Integer TO = Integer.parseInt(timeout); requestInitializer.initialize(httpRequest); - httpRequest.setConnectTimeout(TO * 60000); // 10 minutes connect timeout - httpRequest.setReadTimeout(TO * 60000); // 10 minutes read timeout + httpRequest.setConnectTimeout(TO * 60000); // 10 minutes connect timeout + httpRequest.setReadTimeout(TO * 60000); // 10 minutes read timeout } }; } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInput.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInput.java index 27d6a950308..80fafc0a4aa 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInput.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInput.java @@ -25,6 +25,11 @@ import com.google.api.services.sheets.v4.Sheets; import com.google.api.services.sheets.v4.SheetsScopes; import com.google.api.services.sheets.v4.model.ValueRange; +import java.math.BigDecimal; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.exception.HopValueException; @@ -35,13 +40,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import org.apache.hop.ui.util.EnvironmentUtils; - -import java.math.BigDecimal; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.List; /** Describe your transform plugin. */ public class GoogleSheetsInput extends BaseTransform { @@ -77,7 +75,9 @@ public boolean init() { if (super.init()) { try { - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, resolve(meta.getJsonCredentialPath()), resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, resolve(meta.getJsonCredentialPath()), resolve(meta.getImpersonation())); Sheets service = new Sheets.Builder( HTTP_TRANSPORT, diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputData.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputData.java index 4ed4b258411..e3b58a60bd2 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputData.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputData.java @@ -18,12 +18,11 @@ package org.apache.hop.pipeline.transforms.googlesheets; import com.google.api.services.sheets.v4.Sheets; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class GoogleSheetsInputData extends BaseTransformData implements ITransformData { public Sheets service; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java index 5de478098cf..b327f36887d 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java @@ -29,6 +29,8 @@ import com.google.api.services.sheets.v4.model.Sheet; import com.google.api.services.sheets.v4.model.Spreadsheet; import com.google.api.services.sheets.v4.model.ValueRange; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -59,9 +61,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class GoogleSheetsInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = GoogleSheetsInputMeta.class; // for Translator @@ -77,6 +76,7 @@ public class GoogleSheetsInputDialog extends BaseTransformDialog implements ITra private TextVar wWorksheetId; private TextVar wSampleFields; private TableView wFields; + public GoogleSheetsInputDialog( Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String name) { super(parent, variables, (BaseTransformMeta) in, pipelineMeta, name); @@ -181,14 +181,14 @@ public String open() { wPrivateKeyStore.setLayoutData(fdPrivateKeyStore); // Appname - Label - Label appNameLabel = new Label( serviceAccountComposite, SWT.RIGHT ); - appNameLabel.setText( "Google Application Name :" ); - props.setLook( appNameLabel ); + Label appNameLabel = new Label(serviceAccountComposite, SWT.RIGHT); + appNameLabel.setText("Google Application Name :"); + props.setLook(appNameLabel); FormData appNameLabelForm = new FormData(); - appNameLabelForm.top = new FormAttachment( wbPrivateKeyButton, margin ); - appNameLabelForm.left = new FormAttachment( 0, 0 ); - appNameLabelForm.right = new FormAttachment( middle, -margin ); - appNameLabel.setLayoutData( appNameLabelForm ); + appNameLabelForm.top = new FormAttachment(wbPrivateKeyButton, margin); + appNameLabelForm.left = new FormAttachment(0, 0); + appNameLabelForm.right = new FormAttachment(middle, -margin); + appNameLabel.setLayoutData(appNameLabelForm); // Appname - Text wAppname = new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); @@ -199,16 +199,15 @@ public String open() { appNameData.right = new FormAttachment(wbPrivateKeyButton, -margin); wAppname.setLayoutData(appNameData); - // Timeout - Label - Label timeoutLabel = new Label( serviceAccountComposite, SWT.RIGHT ); - timeoutLabel.setText( "Time out in minutes :" ); - props.setLook( timeoutLabel ); + Label timeoutLabel = new Label(serviceAccountComposite, SWT.RIGHT); + timeoutLabel.setText("Time out in minutes :"); + props.setLook(timeoutLabel); FormData timeoutLabelForm = new FormData(); - timeoutLabelForm.top = new FormAttachment( appNameLabel, margin ); - timeoutLabelForm.left = new FormAttachment( 0, 0 ); - timeoutLabelForm.right = new FormAttachment( middle, -margin ); - timeoutLabel.setLayoutData( timeoutLabelForm ); + timeoutLabelForm.top = new FormAttachment(appNameLabel, margin); + timeoutLabelForm.left = new FormAttachment(0, 0); + timeoutLabelForm.right = new FormAttachment(middle, -margin); + timeoutLabel.setLayoutData(timeoutLabelForm); // timeout - Text wTimeout = new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); @@ -220,17 +219,19 @@ public String open() { wTimeout.setLayoutData(timeoutData); // Impersonation - Label - Label impersonationLabel = new Label( serviceAccountComposite, SWT.RIGHT ); - impersonationLabel.setText(BaseMessages.getString(PKG, "GoogleSheetsOutputDialog.ImpersonationAccount")); - props.setLook( impersonationLabel ); + Label impersonationLabel = new Label(serviceAccountComposite, SWT.RIGHT); + impersonationLabel.setText( + BaseMessages.getString(PKG, "GoogleSheetsOutputDialog.ImpersonationAccount")); + props.setLook(impersonationLabel); FormData impersonationLabelForm = new FormData(); - impersonationLabelForm.top = new FormAttachment( wTimeout, margin ); - impersonationLabelForm.left = new FormAttachment( 0, 0 ); - impersonationLabelForm.right = new FormAttachment( middle, -margin ); - impersonationLabel.setLayoutData( impersonationLabelForm ); + impersonationLabelForm.top = new FormAttachment(wTimeout, margin); + impersonationLabelForm.left = new FormAttachment(0, 0); + impersonationLabelForm.right = new FormAttachment(middle, -margin); + impersonationLabel.setLayoutData(impersonationLabelForm); // impersonation - Text - wImpersonation = new TextVar(variables,serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wImpersonation = + new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wImpersonation); FormData impersonationData = new FormData(); impersonationData.top = new FormAttachment(wTimeout, margin); @@ -477,12 +478,17 @@ private void testServiceAccount() { String scope = SheetsScopes.SPREADSHEETS_READONLY; // Test by building a drive connection - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); // new Drive.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); wlTestServiceAccountInfo.setText("Google Drive API : Success!"); @@ -496,13 +502,18 @@ private void selectSpreadSheet() { NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); String scope = "https://www.googleapis.com/auth/drive.readonly"; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); // Drive service = - new Drive.Builder( - HTTP_TRANSPORT, - JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + new Drive.Builder( + HTTP_TRANSPORT, + JSON_FACTORY, + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); @@ -557,13 +568,18 @@ private void selectWorksheet() { JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); String scope = SheetsScopes.SPREADSHEETS_READONLY; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); // Sheets service = new Sheets.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); Spreadsheet response1 = @@ -610,22 +626,22 @@ private void selectWorksheet() { private void getData(GoogleSheetsInputMeta meta) { this.wTransformName.selectAll(); - if(!StringUtils.isEmpty(meta.getSpreadsheetKey())){ + if (!StringUtils.isEmpty(meta.getSpreadsheetKey())) { this.wSpreadSheetKey.setText(meta.getSpreadsheetKey()); } - if(!StringUtils.isEmpty(meta.getWorksheetId())){ + if (!StringUtils.isEmpty(meta.getWorksheetId())) { this.wWorksheetId.setText(meta.getWorksheetId()); } - if(!StringUtils.isEmpty(meta.getJsonCredentialPath())){ + if (!StringUtils.isEmpty(meta.getJsonCredentialPath())) { this.wPrivateKeyStore.setText(meta.getJsonCredentialPath()); } - if(!StringUtils.isEmpty(meta.getTimeout())){ + if (!StringUtils.isEmpty(meta.getTimeout())) { this.wTimeout.setText(meta.getTimeout()); } - if(!StringUtils.isEmpty(meta.getImpersonation())){ + if (!StringUtils.isEmpty(meta.getImpersonation())) { this.wImpersonation.setText(meta.getImpersonation()); } - if(!StringUtils.isEmpty(meta.getAppName())){ + if (!StringUtils.isEmpty(meta.getAppName())) { this.wAppname.setText(meta.getAppName()); } this.wSampleFields.setText(Integer.toString(meta.getSampleFields())); @@ -758,12 +774,17 @@ private void getSpreadsheetFields() { String scope = SheetsScopes.SPREADSHEETS_READONLY; wFields.table.removeAll(); - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); Sheets service = new Sheets.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); // Fill in sample in order to guess types @@ -824,25 +845,25 @@ private void getSpreadsheetFields() { System.arraycopy(tmpSampleColumnValues, 0, sampleColumnValues, 0, m); sampleInputFields.setSamples(sampleColumnValues); sampleInputFields.guess(); - if(!StringUtils.isEmpty(sampleInputFields.getTypeDesc())){ + if (!StringUtils.isEmpty(sampleInputFields.getTypeDesc())) { item.setText(2, sampleInputFields.getTypeDesc()); } - if(!StringUtils.isEmpty(sampleInputFields.getFormat())){ + if (!StringUtils.isEmpty(sampleInputFields.getFormat())) { item.setText(3, sampleInputFields.getFormat()); } - if(!StringUtils.isEmpty(Integer.toString(sampleInputFields.getPrecision()))){ + if (!StringUtils.isEmpty(Integer.toString(sampleInputFields.getPrecision()))) { item.setText(5, Integer.toString(sampleInputFields.getPrecision())); } - if(!StringUtils.isEmpty(sampleInputFields.getCurrencySymbol())){ + if (!StringUtils.isEmpty(sampleInputFields.getCurrencySymbol())) { item.setText(6, sampleInputFields.getCurrencySymbol()); } - if(!StringUtils.isEmpty(sampleInputFields.getDecimalSymbol())){ + if (!StringUtils.isEmpty(sampleInputFields.getDecimalSymbol())) { item.setText(7, sampleInputFields.getDecimalSymbol()); } - if(!StringUtils.isEmpty(sampleInputFields.getGroupSymbol())){ + if (!StringUtils.isEmpty(sampleInputFields.getGroupSymbol())) { item.setText(8, sampleInputFields.getGroupSymbol()); } - if(!StringUtils.isEmpty(sampleInputFields.getTrimTypeDesc())){ + if (!StringUtils.isEmpty(sampleInputFields.getTrimTypeDesc())) { item.setText(9, sampleInputFields.getTrimTypeDesc()); } } else { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputField.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputField.java index 2312d0a4148..7b0ccaf0f17 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputField.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputField.java @@ -18,18 +18,17 @@ package org.apache.hop.pipeline.transforms.googlesheets; -import org.apache.hop.core.Const; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import org.apache.hop.core.Const; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.metadata.api.HopMetadataProperty; /** Describes a single field in a text file */ public class GoogleSheetsInputField /*implements Cloneable, ITextFileInputField*/ { @@ -97,11 +96,9 @@ public class GoogleSheetsInputField /*implements Cloneable, ITextFileInputField* "#####.###############%", }; - public GoogleSheetsInputField(){ + public GoogleSheetsInputField() {} - } - - public GoogleSheetsInputField(GoogleSheetsInputField field){ + public GoogleSheetsInputField(GoogleSheetsInputField field) { this.name = field.getName(); this.position = field.getPosition(); this.length = field.getLength(); @@ -216,7 +213,7 @@ public void setTrimType(int trimtype) { this.trimType = trimtype; } - public int getTrimType(){ + public int getTrimType() { return trimType; } @@ -280,8 +277,6 @@ public void setIfNullValue(String ifNullValue) { this.ifNullValue = ifNullValue; } - - @Override public String toString() { return name + "@" + position + ":" + length; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java index ada1b80cbf0..76252130956 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java @@ -17,6 +17,8 @@ */ package org.apache.hop.pipeline.transforms.googlesheets; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "GoogleSheetsInput", image = "google-sheets-input.svg", @@ -48,19 +47,23 @@ public GoogleSheetsInputMeta() { super(); inputFields = new ArrayList<>(); } - @HopMetadataProperty(key="jsonCrendentialPath", injectionGroupKey = "SHEET" ,isExcludedFromInjection = true) + + @HopMetadataProperty( + key = "jsonCrendentialPath", + injectionGroupKey = "SHEET", + isExcludedFromInjection = true) private String oldJsonCredentialPath; - @HopMetadataProperty(key="jsonCredentialPath", injectionGroupKey = "SHEET") + @HopMetadataProperty(key = "jsonCredentialPath", injectionGroupKey = "SHEET") private String jsonCredentialPath; - @HopMetadataProperty(key="spreadsheetKey", injectionGroupKey = "SHEET") + @HopMetadataProperty(key = "spreadsheetKey", injectionGroupKey = "SHEET") private String spreadsheetKey; - @HopMetadataProperty(key="worksheetId", injectionGroupKey = "SHEET") + @HopMetadataProperty(key = "worksheetId", injectionGroupKey = "SHEET") private String worksheetId; - @HopMetadataProperty(key="sampleFields", injectionGroupKey = "INPUT_Fields") + @HopMetadataProperty(key = "sampleFields", injectionGroupKey = "INPUT_Fields") private Integer sampleFields; @HopMetadataProperty(key = "timeout", injectionGroupKey = "SHEET") @@ -72,11 +75,7 @@ public GoogleSheetsInputMeta() { @HopMetadataProperty(key = "appName", injectionGroupKey = "SHEET") private String appName; - @HopMetadataProperty( - groupKey = "fields", - key="field", - injectionGroupKey = "FIELDS" - ) + @HopMetadataProperty(groupKey = "fields", key = "field", injectionGroupKey = "FIELDS") private List inputFields; @Override @@ -90,7 +89,7 @@ public void setDefault() { } public String getJsonCredentialPath() { - if(getOldJsonCredentialPath() != null && this.jsonCredentialPath == null){ + if (getOldJsonCredentialPath() != null && this.jsonCredentialPath == null) { this.jsonCredentialPath = getOldJsonCredentialPath(); setOldJsonCredentialPath(null); } @@ -104,7 +103,8 @@ public void setJsonCredentialPath(String jsonCredentialPath) { public List getInputFields() { return inputFields; } - public void setInputFields(List inputFields){ + + public void setInputFields(List inputFields) { this.inputFields = inputFields; } @@ -156,7 +156,6 @@ public void setAppName(String appName) { this.appName = appName; } - public String getOldJsonCredentialPath() { return oldJsonCredentialPath; } @@ -246,5 +245,4 @@ public void check( transformMeta)); } } - } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutput.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutput.java index 88411c16c80..54e716cb902 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutput.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutput.java @@ -45,6 +45,9 @@ import com.google.api.services.sheets.v4.model.UpdateSheetPropertiesRequest; import com.google.api.services.sheets.v4.model.UpdateValuesResponse; import com.google.api.services.sheets.v4.model.ValueRange; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.Pipeline; @@ -52,11 +55,8 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -public class GoogleSheetsOutput extends BaseTransform { +public class GoogleSheetsOutput + extends BaseTransform { private String spreadsheetID; @@ -86,7 +86,9 @@ public boolean init() { JSON_FACTORY = JacksonFactory.getDefaultInstance(); scope = "https://www.googleapis.com/auth/drive"; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, resolve(meta.getJsonCredentialPath()), resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, resolve(meta.getJsonCredentialPath()), resolve(meta.getImpersonation())); Drive service = new Drive.Builder( HTTP_TRANSPORT, @@ -118,28 +120,39 @@ public boolean init() { } boolean worksheetExists = false; - if(exists){ + if (exists) { data.service = - new Sheets.Builder( - HTTP_TRANSPORT, - JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, resolve(meta.getTimeout()))) - .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) - .build(); - - Spreadsheet spreadSheet = data.service.spreadsheets().get(resolve(meta.getSpreadsheetKey())).execute(); + new Sheets.Builder( + HTTP_TRANSPORT, + JSON_FACTORY, + GoogleSheetsCredentials.setHttpTimeout( + credential, resolve(meta.getTimeout()))) + .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) + .build(); + + Spreadsheet spreadSheet = + data.service.spreadsheets().get(resolve(meta.getSpreadsheetKey())).execute(); List sheets = spreadSheet.getSheets(); - for(Sheet sheet : sheets){ - if(sheet.getProperties().getTitle().equals(resolve(meta.getWorksheetId()))){ + for (Sheet sheet : sheets) { + if (sheet.getProperties().getTitle().equals(resolve(meta.getWorksheetId()))) { worksheetExists = true; } } - if(!worksheetExists){ + if (!worksheetExists) { List requests = new ArrayList<>(); - requests.add(new Request().setAddSheet(new AddSheetRequest().setProperties(new SheetProperties().setTitle(resolve(meta.getWorksheetId()))))); - BatchUpdateSpreadsheetRequest body = new BatchUpdateSpreadsheetRequest().setRequests(requests); - data.service.spreadsheets().batchUpdate(resolve(meta.getSpreadsheetKey()), body).execute(); + requests.add( + new Request() + .setAddSheet( + new AddSheetRequest() + .setProperties( + new SheetProperties().setTitle(resolve(meta.getWorksheetId()))))); + BatchUpdateSpreadsheetRequest body = + new BatchUpdateSpreadsheetRequest().setRequests(requests); + data.service + .spreadsheets() + .batchUpdate(resolve(meta.getSpreadsheetKey()), body) + .execute(); } } @@ -154,14 +167,16 @@ public boolean init() { new Sheets.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); // If it does not exist create it. Spreadsheet spreadsheet = - new Spreadsheet().setProperties(new SpreadsheetProperties().setTitle(spreadsheetID)); - //new Spreadsheet().setProperties(new SpreadsheetProperties().setTitle(wsID)); + new Spreadsheet() + .setProperties(new SpreadsheetProperties().setTitle(spreadsheetID)); + // new Spreadsheet().setProperties(new SpreadsheetProperties().setTitle(wsID)); Sheets.Spreadsheets.Create request = data.service.spreadsheets().create(spreadsheet); Spreadsheet response = request.execute(); spreadsheetID = response.getSpreadsheetId(); @@ -185,7 +200,6 @@ public boolean init() { requestBody.setRequests(requests); // now you can execute batchUpdate with your sheetsService and SHEET_ID data.service.spreadsheets().batchUpdate(spreadsheetID, requestBody).execute(); - } } else { log.logError("Append and Create options cannot be activated altogether"); @@ -193,61 +207,57 @@ public boolean init() { } // now if share email is not null we share with R/W with the email given - if ((resolve(meta.getShareEmail()) != null - && !resolve(meta.getShareEmail()).isEmpty()) - || (resolve(meta.getShareDomain()) != null + if ((resolve(meta.getShareEmail()) != null && !resolve(meta.getShareEmail()).isEmpty()) + || (resolve(meta.getShareDomain()) != null && !resolve(meta.getShareDomain()).isEmpty())) { String fileId = spreadsheetID; JsonBatchCallback callback = - new JsonBatchCallback() { - @Override - public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) - throws IOException { - // Handle error - log.logError("Failed sharing file" + e.getMessage()); - } - - @Override - public void onSuccess(Permission permission, HttpHeaders responseHeaders) - throws IOException { - log.logBasic("Shared successfully : Permission ID: " + permission.getId()); - } - }; + new JsonBatchCallback() { + @Override + public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) + throws IOException { + // Handle error + log.logError("Failed sharing file" + e.getMessage()); + } + + @Override + public void onSuccess(Permission permission, HttpHeaders responseHeaders) + throws IOException { + log.logBasic("Shared successfully : Permission ID: " + permission.getId()); + } + }; BatchRequest batch = service.batch(); - if (resolve(meta.getShareEmail()) != null - && !resolve(meta.getShareEmail()).isEmpty()) { + if (resolve(meta.getShareEmail()) != null && !resolve(meta.getShareEmail()).isEmpty()) { log.logBasic("Sharing sheet with:" + resolve(meta.getShareEmail())); Permission userPermission = - new Permission() - .setType("user") - .setRole("writer") - .setEmailAddress(resolve(meta.getShareEmail())); + new Permission() + .setType("user") + .setRole("writer") + .setEmailAddress(resolve(meta.getShareEmail())); // Using Google drive service here not spreadsheet data.service service - .permissions() - .create(fileId, userPermission) - .setFields("id") - .queue(batch, callback); + .permissions() + .create(fileId, userPermission) + .setFields("id") + .queue(batch, callback); } if (resolve(meta.getShareDomain()) != null - && !resolve(meta.getShareDomain()).isEmpty()) { + && !resolve(meta.getShareDomain()).isEmpty()) { log.logBasic("Sharing sheet with domain:" + resolve(meta.getShareDomain())); Permission domainPermission = - new Permission() - .setType("domain") - .setRole("reader") - .setDomain(resolve(meta.getShareDomain())); + new Permission() + .setType("domain") + .setRole("reader") + .setDomain(resolve(meta.getShareDomain())); service - .permissions() - .create(fileId, domainPermission) - .setFields("id") - .queue(batch, callback); + .permissions() + .create(fileId, domainPermission) + .setFields("id") + .queue(batch, callback); } batch.execute(); } - - } if (!exists && !meta.isCreate()) { @@ -309,12 +319,15 @@ public boolean processRow() throws HopException { NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); String scope = SheetsScopes.SPREADSHEETS; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, resolve(meta.getJsonCredentialPath()), resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, resolve(meta.getJsonCredentialPath()), resolve(meta.getImpersonation())); data.service = new Sheets.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputData.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputData.java index 6337e89271a..dd47fd20349 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputData.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputData.java @@ -18,12 +18,11 @@ package org.apache.hop.pipeline.transforms.googlesheets; import com.google.api.services.sheets.v4.Sheets; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class GoogleSheetsOutputData extends BaseTransformData implements ITransformData { public Sheets service; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputDialog.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputDialog.java index 0bdb0fc2937..dbb1a5fdcb3 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputDialog.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputDialog.java @@ -16,8 +16,8 @@ */ package org.apache.hop.pipeline.transforms.googlesheets; -import com.google.api.client.http.HttpRequest; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; @@ -29,6 +29,8 @@ import com.google.api.services.sheets.v4.SheetsScopes; import com.google.api.services.sheets.v4.model.Sheet; import com.google.api.services.sheets.v4.model.Spreadsheet; +import java.io.IOException; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -54,9 +56,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.io.IOException; -import java.util.List; - public class GoogleSheetsOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = GoogleSheetsOutputMeta.class; // for Translator @@ -80,20 +79,21 @@ public GoogleSheetsOutputDialog( this.meta = (GoogleSheetsOutputMeta) in; } - private static HttpRequestInitializer setHttpTimeout(final HttpRequestInitializer requestInitializer, final String timeout) { + private static HttpRequestInitializer setHttpTimeout( + final HttpRequestInitializer requestInitializer, final String timeout) { return new HttpRequestInitializer() { @Override public void initialize(HttpRequest httpRequest) throws IOException { requestInitializer.initialize(httpRequest); Integer TO = 5; - if(!timeout.isEmpty()) { + if (!timeout.isEmpty()) { TO = Integer.parseInt(timeout); } - httpRequest.setConnectTimeout(TO * 60000); // 3 minutes connect timeout - httpRequest.setReadTimeout(TO * 60000); // 3 minutes read timeout - }}; - + httpRequest.setConnectTimeout(TO * 60000); // 3 minutes connect timeout + httpRequest.setReadTimeout(TO * 60000); // 3 minutes read timeout + } + }; } @Override @@ -194,19 +194,19 @@ public String open() { wPrivateKeyStore.setLayoutData(fdPrivateKey); // Appname - Label - Label appNameLabel = new Label( serviceAccountComposite, SWT.RIGHT ); - appNameLabel.setText( "Google Application Name :" ); - props.setLook( appNameLabel ); + Label appNameLabel = new Label(serviceAccountComposite, SWT.RIGHT); + appNameLabel.setText("Google Application Name :"); + props.setLook(appNameLabel); FormData appNameLabelForm = new FormData(); - appNameLabelForm.top = new FormAttachment( wbPrivateKey, margin ); - appNameLabelForm.left = new FormAttachment( 0, 0 ); - appNameLabelForm.right = new FormAttachment( middle, -margin ); - appNameLabel.setLayoutData( appNameLabelForm ); + appNameLabelForm.top = new FormAttachment(wbPrivateKey, margin); + appNameLabelForm.left = new FormAttachment(0, 0); + appNameLabelForm.right = new FormAttachment(middle, -margin); + appNameLabel.setLayoutData(appNameLabelForm); // Appname - Text wAppName = new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wAppName); -// wAppName.addModifyListener(modifiedListener); + // wAppName.addModifyListener(modifiedListener); FormData appNameData = new FormData(); appNameData.top = new FormAttachment(wbPrivateKey, margin); appNameData.left = new FormAttachment(middle, 0); @@ -214,17 +214,17 @@ public String open() { wAppName.setLayoutData(appNameData); // Timeout - Label - Label timeoutLabel = new Label( serviceAccountComposite, SWT.RIGHT ); - timeoutLabel.setText( "Time out in minutes :" ); - props.setLook( timeoutLabel ); + Label timeoutLabel = new Label(serviceAccountComposite, SWT.RIGHT); + timeoutLabel.setText("Time out in minutes :"); + props.setLook(timeoutLabel); FormData timeoutLabelForm = new FormData(); - timeoutLabelForm.top = new FormAttachment( appNameLabel, margin ); - timeoutLabelForm.left = new FormAttachment( 0, 0 ); - timeoutLabelForm.right = new FormAttachment( middle, -margin ); - timeoutLabel.setLayoutData( timeoutLabelForm ); + timeoutLabelForm.top = new FormAttachment(appNameLabel, margin); + timeoutLabelForm.left = new FormAttachment(0, 0); + timeoutLabelForm.right = new FormAttachment(middle, -margin); + timeoutLabel.setLayoutData(timeoutLabelForm); // timeout - Text - wTimeout = new TextVar(variables,serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wTimeout = new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wTimeout); FormData timeoutData = new FormData(); timeoutData.top = new FormAttachment(appNameLabel, margin); @@ -233,17 +233,19 @@ public String open() { wTimeout.setLayoutData(timeoutData); // Impersonation - Label - Label impersonationLabel = new Label( serviceAccountComposite, SWT.RIGHT ); - impersonationLabel.setText(BaseMessages.getString(PKG, "GoogleSheetsOutputDialog.ImpersonationAccount")); - props.setLook( impersonationLabel ); + Label impersonationLabel = new Label(serviceAccountComposite, SWT.RIGHT); + impersonationLabel.setText( + BaseMessages.getString(PKG, "GoogleSheetsOutputDialog.ImpersonationAccount")); + props.setLook(impersonationLabel); FormData impersonationLabelForm = new FormData(); - impersonationLabelForm.top = new FormAttachment( wTimeout, margin ); - impersonationLabelForm.left = new FormAttachment( 0, 0 ); - impersonationLabelForm.right = new FormAttachment( middle, -margin ); - impersonationLabel.setLayoutData( impersonationLabelForm ); + impersonationLabelForm.top = new FormAttachment(wTimeout, margin); + impersonationLabelForm.left = new FormAttachment(0, 0); + impersonationLabelForm.right = new FormAttachment(middle, -margin); + impersonationLabel.setLayoutData(impersonationLabelForm); // impersonation - Text - wImpersonation = new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wImpersonation = + new TextVar(variables, serviceAccountComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wImpersonation); FormData impersonationData = new FormData(); impersonationData.top = new FormAttachment(wTimeout, margin); @@ -469,12 +471,17 @@ private void selectWorksheet() { JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); String scope = SheetsScopes.SPREADSHEETS_READONLY; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); Sheets service = new Sheets.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); Spreadsheet response1 = @@ -519,12 +526,17 @@ private void selectSpreadSheetKey() { NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); String scope = "https://www.googleapis.com/auth/drive"; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); Drive service = new Drive.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); @@ -577,13 +589,18 @@ private void testServiceAccount() { JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); String scope = SheetsScopes.SPREADSHEETS_READONLY; - HttpRequestInitializer credential = GoogleSheetsCredentials.getCredentialsJson(scope, variables.resolve(meta.getJsonCredentialPath()), variables.resolve(meta.getImpersonation())); + HttpRequestInitializer credential = + GoogleSheetsCredentials.getCredentialsJson( + scope, + variables.resolve(meta.getJsonCredentialPath()), + variables.resolve(meta.getImpersonation())); // Build a Drive connection to test it // new Drive.Builder( HTTP_TRANSPORT, JSON_FACTORY, - GoogleSheetsCredentials.setHttpTimeout(credential, variables.resolve(meta.getTimeout()))) + GoogleSheetsCredentials.setHttpTimeout( + credential, variables.resolve(meta.getTimeout()))) .setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME) .build(); wlTestServiceAccountInfo.setText("Google Drive API : Success!"); @@ -608,34 +625,33 @@ private void selectPrivateKeyFile() { private void getData(GoogleSheetsOutputMeta meta) { this.wTransformName.selectAll(); - if(!StringUtils.isEmpty(meta.getSpreadsheetKey())){ + if (!StringUtils.isEmpty(meta.getSpreadsheetKey())) { this.wSpreadsheetKey.setText(meta.getSpreadsheetKey()); } - if(!StringUtils.isEmpty(meta.getWorksheetId())){ + if (!StringUtils.isEmpty(meta.getWorksheetId())) { this.wWorksheetId.setText(meta.getWorksheetId()); } - if(!StringUtils.isEmpty(meta.getShareEmail())){ + if (!StringUtils.isEmpty(meta.getShareEmail())) { this.wShareEmail.setText(meta.getShareEmail()); } - if(!StringUtils.isEmpty(meta.getTimeout())){ - this.wTimeout.setText( meta.getTimeout() ); + if (!StringUtils.isEmpty(meta.getTimeout())) { + this.wTimeout.setText(meta.getTimeout()); } - if(!StringUtils.isEmpty(meta.getImpersonation())){ + if (!StringUtils.isEmpty(meta.getImpersonation())) { this.wImpersonation.setText(meta.getImpersonation()); } - if(!StringUtils.isEmpty(meta.getAppName())){ - this.wAppName.setText( meta.getAppName()); + if (!StringUtils.isEmpty(meta.getAppName())) { + this.wAppName.setText(meta.getAppName()); } - if(!StringUtils.isEmpty(meta.getShareDomain())){ + if (!StringUtils.isEmpty(meta.getShareDomain())) { this.wShareDomainWise.setText(meta.getShareDomain()); } - if(!StringUtils.isEmpty(meta.getJsonCredentialPath())){ + if (!StringUtils.isEmpty(meta.getJsonCredentialPath())) { this.wPrivateKeyStore.setText(meta.getJsonCredentialPath()); } this.wbCreate.setSelection(meta.isCreate()); this.wbAppend.setSelection(meta.isAppend()); - } private void setData(GoogleSheetsOutputMeta meta) { @@ -650,7 +666,8 @@ private void setData(GoogleSheetsOutputMeta meta) { meta.setTimeout(this.wTimeout.getText()); meta.setAppName(this.wAppName.getText()); - meta.setImpersonation(this.wImpersonation.getText()); } + meta.setImpersonation(this.wImpersonation.getText()); + } private void cancel() { transformName = null; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java index 79ddb6b84cf..a08add7b3b8 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java @@ -17,6 +17,7 @@ */ package org.apache.hop.pipeline.transforms.googlesheets; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -28,8 +29,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "GoogleSheetsOutput", image = "google-sheets-output.svg", diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileObject.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileObject.java index f5f6b7faaed..ccdf844aa83 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileObject.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileObject.java @@ -32,13 +32,6 @@ import com.google.api.services.drive.DriveScopes; import com.google.api.services.drive.model.File; import com.google.api.services.drive.model.FileList; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileType; -import org.apache.commons.vfs2.provider.AbstractFileName; -import org.apache.commons.vfs2.provider.AbstractFileObject; -import org.apache.hop.vfs.googledrive.config.GoogleDriveConfigSingleton; -import org.apache.hop.vfs.googledrive.util.CustomDataStoreFactory; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; @@ -51,6 +44,12 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.commons.vfs2.FileSystemException; +import org.apache.commons.vfs2.FileType; +import org.apache.commons.vfs2.provider.AbstractFileName; +import org.apache.commons.vfs2.provider.AbstractFileObject; +import org.apache.hop.vfs.googledrive.config.GoogleDriveConfigSingleton; +import org.apache.hop.vfs.googledrive.util.CustomDataStoreFactory; public class GoogleDriveFileObject extends AbstractFileObject { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileProvider.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileProvider.java index 570ebefd69b..ba35cb8dcc9 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileProvider.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileProvider.java @@ -17,6 +17,8 @@ package org.apache.hop.vfs.googledrive; +import java.util.Collection; +import java.util.Set; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystem; @@ -24,26 +26,23 @@ import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider; -import java.util.Collection; -import java.util.Set; - public class GoogleDriveFileProvider extends AbstractOriginatingFileProvider { public static final String SCHEME = "googledrive"; public static final String DISPLAY_NAME = "Google Drive"; protected static final Collection capabilities = - Set.of( Capability.CREATE, - Capability.DELETE, - Capability.RENAME, - Capability.GET_TYPE, - Capability.LIST_CHILDREN, - Capability.READ_CONTENT, - Capability.URI, - Capability.WRITE_CONTENT, - Capability.GET_LAST_MODIFIED, - Capability.RANDOM_ACCESS_READ - ); + Set.of( + Capability.CREATE, + Capability.DELETE, + Capability.RENAME, + Capability.GET_TYPE, + Capability.LIST_CHILDREN, + Capability.READ_CONTENT, + Capability.URI, + Capability.WRITE_CONTENT, + Capability.GET_LAST_MODIFIED, + Capability.RANDOM_ACCESS_READ); @Override public FileSystem doCreateFileSystem(FileName fileName, FileSystemOptions fileSystemOptions) diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileSystem.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileSystem.java index b39e0a142b0..4b5b264e431 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileSystem.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/GoogleDriveFileSystem.java @@ -17,6 +17,7 @@ package org.apache.hop.vfs.googledrive; +import java.util.Collection; import org.apache.commons.vfs2.CacheStrategy; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; @@ -27,8 +28,6 @@ import org.apache.commons.vfs2.provider.AbstractFileName; import org.apache.commons.vfs2.provider.AbstractFileSystem; -import java.util.Collection; - public class GoogleDriveFileSystem extends AbstractFileSystem implements FileSystem { public GoogleDriveFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/config/GoogleDriveConfig.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/config/GoogleDriveConfig.java index b530fa48c24..1c35b996e30 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/config/GoogleDriveConfig.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/config/GoogleDriveConfig.java @@ -41,7 +41,9 @@ public String getCredentialsFile() { return credentialsFile; } - /** @param credentialsFile The credentialsFile to set */ + /** + * @param credentialsFile The credentialsFile to set + */ public void setCredentialsFile(String credentialsFile) { this.credentialsFile = credentialsFile; } @@ -55,7 +57,9 @@ public String getTokensFolder() { return tokensFolder; } - /** @param tokensFolder The tokensFolder to set */ + /** + * @param tokensFolder The tokensFolder to set + */ public void setTokensFolder(String tokensFolder) { this.tokensFolder = tokensFolder; } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomAuthorizationCodeInstalledApp.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomAuthorizationCodeInstalledApp.java index 2361c38aaef..d24a5c7c488 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomAuthorizationCodeInstalledApp.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomAuthorizationCodeInstalledApp.java @@ -21,12 +21,11 @@ import com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl; import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; import com.google.api.client.extensions.java6.auth.oauth2.VerificationCodeReceiver; +import java.io.IOException; import org.apache.hop.ui.hopgui.HopGui; import org.apache.hop.vfs.googledrive.ui.GoogleAuthorizationDialog; import org.eclipse.swt.widgets.Shell; -import java.io.IOException; - public class CustomAuthorizationCodeInstalledApp extends AuthorizationCodeInstalledApp { public CustomAuthorizationCodeInstalledApp( @@ -40,7 +39,8 @@ protected void onAuthorization(AuthorizationCodeRequestUrl authorizationUrl) thr HopGui hopGui = HopGui.getInstance(); if (hopGui != null) { - HopGui.getInstance().getDisplay() + HopGui.getInstance() + .getDisplay() .syncExec( () -> { Shell shell = hopGui.getShell(); diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomDataStoreFactory.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomDataStoreFactory.java index 4d135eae410..22f03222825 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomDataStoreFactory.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomDataStoreFactory.java @@ -25,7 +25,6 @@ import com.google.api.client.util.store.AbstractDataStoreFactory; import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.FileDataStoreFactory; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomLocalServerReceiver.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomLocalServerReceiver.java index 430598b8e3e..d3e47aaff2a 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomLocalServerReceiver.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/googledrive/util/CustomLocalServerReceiver.java @@ -19,18 +19,17 @@ import com.google.api.client.extensions.java6.auth.oauth2.VerificationCodeReceiver; import com.google.api.client.util.Throwables; -import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Request; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.webapp.WebAppContext; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.Socket; import java.net.SocketAddress; import java.net.URL; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.mortbay.jetty.Connector; +import org.mortbay.jetty.Request; +import org.mortbay.jetty.Server; +import org.mortbay.jetty.webapp.WebAppContext; public class CustomLocalServerReceiver implements VerificationCodeReceiver { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java index e1eadf382b7..2a49097903e 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java @@ -25,11 +25,6 @@ import com.google.cloud.storage.BucketInfo; import com.google.cloud.storage.Storage; import com.google.cloud.storage.Storage.BlobListOption; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileType; -import org.apache.commons.vfs2.provider.AbstractFileName; -import org.apache.commons.vfs2.provider.AbstractFileObject; - import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -37,6 +32,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileType; +import org.apache.commons.vfs2.provider.AbstractFileName; +import org.apache.commons.vfs2.provider.AbstractFileObject; public class GoogleStorageFileObject extends AbstractFileObject { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileProvider.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileProvider.java index 7a235e1da9e..8ce8d2d9a88 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileProvider.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileProvider.java @@ -18,6 +18,8 @@ package org.apache.hop.vfs.gs; +import java.util.Collection; +import java.util.Set; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystem; @@ -25,23 +27,20 @@ import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider; -import java.util.Collection; -import java.util.Set; - public class GoogleStorageFileProvider extends AbstractOriginatingFileProvider { public static final Collection capabilities = Set.of( - Capability.CREATE, - Capability.DELETE, - Capability.GET_TYPE, - Capability.GET_LAST_MODIFIED, - Capability.SET_LAST_MODIFIED_FILE, - Capability.SET_LAST_MODIFIED_FOLDER, - Capability.LIST_CHILDREN, - Capability.READ_CONTENT, - Capability.URI, - Capability.WRITE_CONTENT); + Capability.CREATE, + Capability.DELETE, + Capability.GET_TYPE, + Capability.GET_LAST_MODIFIED, + Capability.SET_LAST_MODIFIED_FILE, + Capability.SET_LAST_MODIFIED_FOLDER, + Capability.LIST_CHILDREN, + Capability.READ_CONTENT, + Capability.URI, + Capability.WRITE_CONTENT); @Override public Collection getCapabilities() { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileSystem.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileSystem.java index 13b9d96aec0..47547fe2629 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileSystem.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileSystem.java @@ -22,6 +22,9 @@ import com.google.auth.oauth2.ServiceAccountCredentials; import com.google.cloud.storage.Storage; import com.google.cloud.storage.StorageOptions; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Collection; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileName; @@ -33,10 +36,6 @@ import org.apache.hop.vfs.gs.config.GoogleCloudConfig; import org.apache.hop.vfs.gs.config.GoogleCloudConfigSingleton; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Collection; - public class GoogleStorageFileSystem extends AbstractFileSystem { Storage storage = null; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/ReadChannelInputStream.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/ReadChannelInputStream.java index bdf78d4637a..a782c81d00e 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/ReadChannelInputStream.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/ReadChannelInputStream.java @@ -19,7 +19,6 @@ package org.apache.hop.vfs.gs; import com.google.cloud.ReadChannel; - import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/WriteChannelOutputStream.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/WriteChannelOutputStream.java index c81a4c2aaf5..31362efc643 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/WriteChannelOutputStream.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/WriteChannelOutputStream.java @@ -19,7 +19,6 @@ package org.apache.hop.vfs.gs; import com.google.cloud.WriteChannel; - import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfig.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfig.java index 5359ff0e623..48be46d77be 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfig.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfig.java @@ -39,7 +39,9 @@ public String getServiceAccountKeyFile() { return serviceAccountKeyFile; } - /** @param serviceAccountKeyFile The serviceAccountKeyFile to set */ + /** + * @param serviceAccountKeyFile The serviceAccountKeyFile to set + */ public void setServiceAccountKeyFile(String serviceAccountKeyFile) { this.serviceAccountKeyFile = serviceAccountKeyFile; } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfigPlugin.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfigPlugin.java index 8565bdfd6b6..1de304ce32d 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfigPlugin.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/config/GoogleCloudConfigPlugin.java @@ -54,8 +54,7 @@ public class GoogleCloudConfigPlugin implements IConfigOptions, IGuiPluginCompos type = GuiElementType.FILENAME, variables = true, label = "i18n::GoogleCloudPlugin.AccountKeyFile.Label", - toolTip = - "i18n::GoogleCloudPlugin.AccountKeyFile.Description") + toolTip = "i18n::GoogleCloudPlugin.AccountKeyFile.Description") @CommandLine.Option( names = {"-gck", "--google-cloud-service-account-key-file"}, description = "Configure the path to a Google Cloud service account JSON key file") @@ -142,7 +141,9 @@ public String getServiceAccountKeyFile() { return serviceAccountKeyFile; } - /** @param serviceAccountKeyFile The serviceAccountKeyFile to set */ + /** + * @param serviceAccountKeyFile The serviceAccountKeyFile to set + */ public void setServiceAccountKeyFile(String serviceAccountKeyFile) { this.serviceAccountKeyFile = serviceAccountKeyFile; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnections.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnections.java index dcd5c876589..25c00534fee 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnections.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnections.java @@ -18,6 +18,8 @@ package org.apache.hop.neo4j.actions.check; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; import org.apache.hop.core.exception.HopException; @@ -31,9 +33,6 @@ import org.apache.hop.workflow.action.IAction; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - @Action( id = "NEO4J_CHECK_CONNECTIONS", name = "Check Neo4j Connections", @@ -149,7 +148,9 @@ public List getConnectionNames() { return connectionNames; } - /** @param connectionNames The connectionNames to set */ + /** + * @param connectionNames The connectionNames to set + */ public void setConnectionNames(List connectionNames) { this.connectionNames = connectionNames; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnectionsDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnectionsDialog.java index 6296d9aca13..f4339944f1c 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnectionsDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/check/CheckConnectionsDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.neo4j.actions.check; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.util.Utils; @@ -45,10 +48,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class CheckConnectionsDialog extends ActionDialog implements IActionDialog { private static final Class PKG = CheckConnectionsDialog.class; // For Translator diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/ConstraintUpdate.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/ConstraintUpdate.java index 974a5012972..bc03759ef24 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/ConstraintUpdate.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/ConstraintUpdate.java @@ -76,7 +76,9 @@ public ObjectType getObjectType() { return objectType; } - /** @param objectType The objectType to set */ + /** + * @param objectType The objectType to set + */ public void setObjectType(ObjectType objectType) { this.objectType = objectType; } @@ -90,7 +92,9 @@ public String getConstraintName() { return constraintName; } - /** @param constraintName The constraintName to set */ + /** + * @param constraintName The constraintName to set + */ public void setConstraintName(String constraintName) { this.constraintName = constraintName; } @@ -104,7 +108,9 @@ public String getObjectName() { return objectName; } - /** @param objectName The objectName to set */ + /** + * @param objectName The objectName to set + */ public void setObjectName(String objectName) { this.objectName = objectName; } @@ -118,7 +124,9 @@ public String getObjectProperties() { return objectProperties; } - /** @param objectProperties The objectProperties to set */ + /** + * @param objectProperties The objectProperties to set + */ public void setObjectProperties(String objectProperties) { this.objectProperties = objectProperties; } @@ -132,7 +140,9 @@ public UpdateType getUpdateType() { return updateType; } - /** @param updateType The type to set */ + /** + * @param updateType The type to set + */ public void setUpdateType(UpdateType updateType) { this.updateType = updateType; } @@ -146,7 +156,9 @@ public ConstraintType getConstraintType() { return constraintType; } - /** @param constraintType The constraintType to set */ + /** + * @param constraintType The constraintType to set + */ public void setConstraintType(ConstraintType constraintType) { this.constraintType = constraintType; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraint.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraint.java index dba3029d17a..b15bc999b8b 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraint.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraint.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.actions.constraint; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Result; import org.apache.hop.core.annotations.Action; @@ -28,9 +30,6 @@ import org.neo4j.driver.Driver; import org.neo4j.driver.Session; -import java.util.ArrayList; -import java.util.List; - @Action( id = "NEO4J_CONSTRAINT", name = "Neo4j Constraint", @@ -218,7 +217,9 @@ public NeoConnection getConnection() { return connection; } - /** @param connection The connection to set */ + /** + * @param connection The connection to set + */ public void setConnection(NeoConnection connection) { this.connection = connection; } @@ -232,7 +233,9 @@ public List getConstraintUpdates() { return constraintUpdates; } - /** @param constraintUpdates The constraintUpdates to set */ + /** + * @param constraintUpdates The constraintUpdates to set + */ public void setConstraintUpdates(List constraintUpdates) { this.constraintUpdates = constraintUpdates; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraintDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraintDialog.java index 937f625c35c..7d45f51866f 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraintDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/constraint/Neo4jConstraintDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.neo4j.actions.constraint; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; @@ -48,8 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class Neo4jConstraintDialog extends ActionDialog implements IActionDialog { private static final Class PKG = Neo4jConstraintDialog.class; // For Translator diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/cypherscript/CypherScriptDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/cypherscript/CypherScriptDialog.java index 53df556b96b..c1efdbfbc73 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/cypherscript/CypherScriptDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/cypherscript/CypherScriptDialog.java @@ -181,7 +181,7 @@ public IAction open() { BaseTransformDialog.positionBottomButtons( shell, new Button[] { - wOk, wCancel, + wOk, wCancel, }, margin, null); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/IndexUpdate.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/IndexUpdate.java index 6a21826fbf4..53478324feb 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/IndexUpdate.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/IndexUpdate.java @@ -67,7 +67,9 @@ public ObjectType getObjectType() { return objectType; } - /** @param objectType The objectType to set */ + /** + * @param objectType The objectType to set + */ public void setObjectType(ObjectType objectType) { this.objectType = objectType; } @@ -81,7 +83,9 @@ public String getIndexName() { return indexName; } - /** @param indexName The indexName to set */ + /** + * @param indexName The indexName to set + */ public void setIndexName(String indexName) { this.indexName = indexName; } @@ -95,7 +99,9 @@ public String getObjectName() { return objectName; } - /** @param objectName The nodeName to set */ + /** + * @param objectName The nodeName to set + */ public void setObjectName(String objectName) { this.objectName = objectName; } @@ -109,7 +115,9 @@ public String getObjectProperties() { return objectProperties; } - /** @param objectProperties The properties to set */ + /** + * @param objectProperties The properties to set + */ public void setObjectProperties(String objectProperties) { this.objectProperties = objectProperties; } @@ -123,7 +131,9 @@ public UpdateType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(UpdateType type) { this.type = type; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndex.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndex.java index ad5ddc63a8c..351b2a34ba4 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndex.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndex.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.actions.index; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Result; @@ -29,9 +31,6 @@ import org.neo4j.driver.Driver; import org.neo4j.driver.Session; -import java.util.ArrayList; -import java.util.List; - @Action( id = "NEO4J_INDEX", name = "Neo4j Index", @@ -216,7 +215,9 @@ public NeoConnection getConnection() { return connection; } - /** @param connection The connection to set */ + /** + * @param connection The connection to set + */ public void setConnection(NeoConnection connection) { this.connection = connection; } @@ -230,7 +231,9 @@ public List getIndexUpdates() { return indexUpdates; } - /** @param indexUpdates The indexUpdates to set */ + /** + * @param indexUpdates The indexUpdates to set + */ public void setIndexUpdates(List indexUpdates) { this.indexUpdates = indexUpdates; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndexDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndexDialog.java index d2d0a17b1c5..c352b0a2d15 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndexDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/actions/index/Neo4jIndexDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.neo4j.actions.index; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; @@ -48,8 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class Neo4jIndexDialog extends ActionDialog implements IActionDialog { private static final Class PKG = Neo4jIndexDialog.class; // For Translator diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphData.java index f2728609678..655538ea27d 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphData.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.core.data; +import java.util.ArrayList; +import java.util.List; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -28,9 +30,6 @@ import org.neo4j.driver.types.Path; import org.neo4j.driver.types.Relationship; -import java.util.ArrayList; -import java.util.List; - public class GraphData { protected List nodes; @@ -428,7 +427,9 @@ public List getNodes() { return nodes; } - /** @param nodes The nodes to set */ + /** + * @param nodes The nodes to set + */ public void setNodes(List nodes) { this.nodes = nodes; } @@ -442,7 +443,9 @@ public List getRelationships() { return relationships; } - /** @param relationships The relationships to set */ + /** + * @param relationships The relationships to set + */ public void setRelationships(List relationships) { this.relationships = relationships; } @@ -456,7 +459,9 @@ public String getSourcePipelineName() { return sourcePipelineName; } - /** @param sourcePipelineName The sourcePipelineName to set */ + /** + * @param sourcePipelineName The sourcePipelineName to set + */ public void setSourcePipelineName(String sourcePipelineName) { this.sourcePipelineName = sourcePipelineName; } @@ -470,7 +475,9 @@ public String getSourceTransformName() { return sourceTransformName; } - /** @param sourceTransformName The sourceTransformName to set */ + /** + * @param sourceTransformName The sourceTransformName to set + */ public void setSourceTransformName(String sourceTransformName) { this.sourceTransformName = sourceTransformName; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphNodeData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphNodeData.java index fd8670fbae0..d334a94c461 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphNodeData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphNodeData.java @@ -17,15 +17,14 @@ package org.apache.hop.neo4j.core.data; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.neo4j.driver.Value; import org.neo4j.driver.types.Node; -import java.util.ArrayList; -import java.util.List; - public class GraphNodeData { protected String id; @@ -200,7 +199,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -214,7 +215,9 @@ public List getLabels() { return labels; } - /** @param labels The labels to set */ + /** + * @param labels The labels to set + */ public void setLabels(List labels) { this.labels = labels; } @@ -228,7 +231,9 @@ public List getProperties() { return properties; } - /** @param properties The properties to set */ + /** + * @param properties The properties to set + */ public void setProperties(List properties) { this.properties = properties; } @@ -242,7 +247,9 @@ public String getPropertySetId() { return propertySetId; } - /** @param propertySetId The propertySetId to set */ + /** + * @param propertySetId The propertySetId to set + */ public void setPropertySetId(String propertySetId) { this.propertySetId = propertySetId; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyData.java index c3bb13b17ee..003922f06a7 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyData.java @@ -112,7 +112,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -126,7 +128,9 @@ public Object getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(Object value) { this.value = value; } @@ -140,7 +144,9 @@ public GraphPropertyDataType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(GraphPropertyDataType type) { this.type = type; } @@ -154,7 +160,9 @@ public boolean isPrimary() { return primary; } - /** @param primary The primary to set */ + /** + * @param primary The primary to set + */ public void setPrimary(boolean primary) { this.primary = primary; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyDataType.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyDataType.java index 2d116cb4b2d..0edb8515fde 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyDataType.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphPropertyDataType.java @@ -17,13 +17,12 @@ package org.apache.hop.neo4j.core.data; +import java.time.LocalDate; +import java.time.ZoneId; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.neo4j.core.value.ValueMetaGraph; -import java.time.LocalDate; -import java.time.ZoneId; - public enum GraphPropertyDataType { String("string"), Integer("long"), @@ -242,7 +241,9 @@ public java.lang.String getImportType() { return importType; } - /** @param importType The importType to set */ + /** + * @param importType The importType to set + */ public void setImportType(java.lang.String importType) { this.importType = importType; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphRelationshipData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphRelationshipData.java index 1f9c99ff4da..9de7c838143 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphRelationshipData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/core/data/GraphRelationshipData.java @@ -18,14 +18,13 @@ package org.apache.hop.neo4j.core.data; +import java.util.ArrayList; +import java.util.List; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.neo4j.driver.Value; import org.neo4j.driver.types.Relationship; -import java.util.ArrayList; -import java.util.List; - public class GraphRelationshipData { protected String id; @@ -160,7 +159,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -174,7 +175,9 @@ public String getLabel() { return label; } - /** @param label The label to set */ + /** + * @param label The label to set + */ public void setLabel(String label) { this.label = label; } @@ -188,7 +191,9 @@ public List getProperties() { return properties; } - /** @param properties The properties to set */ + /** + * @param properties The properties to set + */ public void setProperties(List properties) { this.properties = properties; } @@ -202,7 +207,9 @@ public String getSourceNodeId() { return sourceNodeId; } - /** @param sourceNodeId The sourceNodeId to set */ + /** + * @param sourceNodeId The sourceNodeId to set + */ public void setSourceNodeId(String sourceNodeId) { this.sourceNodeId = sourceNodeId; } @@ -216,7 +223,9 @@ public String getTargetNodeId() { return targetNodeId; } - /** @param targetNodeId The targetNodeId to set */ + /** + * @param targetNodeId The targetNodeId to set + */ public void setTargetNodeId(String targetNodeId) { this.targetNodeId = targetNodeId; } @@ -230,7 +239,9 @@ public String getPropertySetId() { return propertySetId; } - /** @param propertySetId The propertySetId to set */ + /** + * @param propertySetId The propertySetId to set + */ public void setPropertySetId(String propertySetId) { this.propertySetId = propertySetId; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMatchBuilder.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMatchBuilder.java index 69d1200dab8..4040300bd3e 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMatchBuilder.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMatchBuilder.java @@ -31,7 +31,7 @@ public static CypherMatchBuilder of() { } public CypherMatchBuilder withMatch(String label, String alias, String id1, Object value1) { - String key1=alias+"_"+id1; + String key1 = alias + "_" + id1; cypher .append("MATCH(") .append(alias) diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMergeBuilder.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMergeBuilder.java index 70e7b129efa..bb340871fd4 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMergeBuilder.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherMergeBuilder.java @@ -19,9 +19,8 @@ package org.apache.hop.neo4j.execution.builder; import com.fasterxml.jackson.core.JsonProcessingException; -import org.apache.hop.core.json.HopJson; - import java.util.Map; +import org.apache.hop.core.json.HopJson; public class CypherMergeBuilder extends BaseCypherBuilder { private CypherMergeBuilder() { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherQueryBuilder.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherQueryBuilder.java index c8e6e6581e7..3e6a678d485 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherQueryBuilder.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherQueryBuilder.java @@ -18,9 +18,8 @@ package org.apache.hop.neo4j.execution.builder; -import org.apache.commons.lang.StringUtils; - import java.util.Map; +import org.apache.commons.lang.StringUtils; public class CypherQueryBuilder extends BaseCypherBuilder { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherRelationshipBuilder.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherRelationshipBuilder.java index d27a22ea8ac..98073c6c7b7 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherRelationshipBuilder.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/builder/CypherRelationshipBuilder.java @@ -37,7 +37,7 @@ public CypherRelationshipBuilder withMatch(String label, String alias, String id @Override public CypherRelationshipBuilder withMatch( - String label, String alias, Map keyValueMap) { + String label, String alias, Map keyValueMap) { return (CypherRelationshipBuilder) super.withMatch(label, alias, keyValueMap); } @@ -56,16 +56,16 @@ public CypherRelationshipBuilder withMerge( } public CypherRelationshipBuilder withCreate( - String alias1, String alias2, String relationshipLabel) { + String alias1, String alias2, String relationshipLabel) { cypher - .append("CREATE(") - .append(alias1) - .append(")-[rel:") - .append(relationshipLabel) - .append("]->(") - .append(alias2) - .append(")"); + .append("CREATE(") + .append(alias1) + .append(")-[rel:") + .append(relationshipLabel) + .append("]->(") + .append(alias2) + .append(")"); return this; } } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResult.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResult.java index 336deb88c18..129004a230c 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResult.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResult.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.execution.path; -import org.apache.hop.core.Const; - import java.util.ArrayList; import java.util.Date; import java.util.List; +import org.apache.hop.core.Const; public class PathResult { @@ -49,7 +48,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -63,7 +64,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -77,7 +80,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -91,12 +96,13 @@ public Date getRegistrationDate() { return registrationDate; } - /** @param registrationDate The registrationDate to set */ + /** + * @param registrationDate The registrationDate to set + */ public void setRegistrationDate(Date registrationDate) { this.registrationDate = registrationDate; } - /** * Gets root * @@ -151,7 +157,9 @@ public List> getShortestPaths() { return shortestPaths; } - /** @param shortestPaths The shortestPaths to set */ + /** + * @param shortestPaths The shortestPaths to set + */ public void setShortestPaths(List> shortestPaths) { this.shortestPaths = shortestPaths; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResults.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResults.java index 7cdb0215695..1307d3be5a6 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResults.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/PathResults.java @@ -46,7 +46,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -60,7 +62,9 @@ public List getLastExecutions() { return lastExecutions; } - /** @param lastExecutions The lastExecutions to set */ + /** + * @param lastExecutions The lastExecutions to set + */ public void setLastExecutions(List lastExecutions) { this.lastExecutions = lastExecutions; } @@ -74,7 +78,9 @@ public String getSubjectName() { return subjectName; } - /** @param subjectName The subjectName to set */ + /** + * @param subjectName The subjectName to set + */ public void setSubjectName(String subjectName) { this.subjectName = subjectName; } @@ -88,7 +94,9 @@ public String getSubjectType() { return subjectType; } - /** @param subjectType The subjectType to set */ + /** + * @param subjectType The subjectType to set + */ public void setSubjectType(String subjectType) { this.subjectType = subjectType; } @@ -102,7 +110,9 @@ public String getSubjectCopy() { return subjectCopy; } - /** @param subjectCopy The subjectCopy to set */ + /** + * @param subjectCopy The subjectCopy to set + */ public void setSubjectCopy(String subjectCopy) { this.subjectCopy = subjectCopy; } @@ -116,7 +126,9 @@ public String getParentName() { return parentName; } - /** @param parentName The parentName to set */ + /** + * @param parentName The parentName to set + */ public void setParentName(String parentName) { this.parentName = parentName; } @@ -130,7 +142,9 @@ public String getParentType() { return parentType; } - /** @param parentType The parentType to set */ + /** + * @param parentType The parentType to set + */ public void setParentType(String parentType) { this.parentType = parentType; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerErrorTab.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerErrorTab.java index 8275adb2f49..ea8a380b6d9 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerErrorTab.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerErrorTab.java @@ -18,6 +18,12 @@ package org.apache.hop.neo4j.execution.path.base; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.i18n.BaseMessages; @@ -47,13 +53,6 @@ import org.neo4j.driver.types.Node; import org.neo4j.driver.types.Path; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @GuiPlugin public class NeoExecutionViewerErrorTab extends NeoExecutionViewerTabBase { private Tree wTree; @@ -79,9 +78,9 @@ public void addNeoErrorPathTab(CTabFolder tabFolder) { Button wGo = new Button(tabComposite, SWT.PUSH); wGo.setText(BaseMessages.getString("System.Button.Open")); PropsUi.setLook(wGo); - wGo.addListener(SWT.Selection, e->openItem(wTree)); + wGo.addListener(SWT.Selection, e -> openItem(wTree)); BaseTransformDialog.positionBottomButtons( - tabComposite, new Button[] {wGo}, PropsUi.getMargin(), null); + tabComposite, new Button[] {wGo}, PropsUi.getMargin(), null); wTree = new Tree(tabComposite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); PropsUi.setLook(wTree); @@ -91,7 +90,7 @@ public void addNeoErrorPathTab(CTabFolder tabFolder) { fdTree.bottom = new FormAttachment(wGo, -PropsUi.getMargin()); fdTree.right = new FormAttachment(100, 0); wTree.setLayoutData(fdTree); - wTree.addListener(SWT.DefaultSelection, e->openItem(wTree)); + wTree.addListener(SWT.DefaultSelection, e -> openItem(wTree)); wTree.setHeaderVisible(true); { TreeColumn column = new TreeColumn(wTree, SWT.LEFT); @@ -183,7 +182,7 @@ private void refresh() { } private String formatDate(Date registrationDate) { - if (registrationDate==null) { + if (registrationDate == null) { return ""; } return new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(registrationDate); @@ -207,31 +206,33 @@ private List> getLineageToError(String executionId) { pathParams.put("executionId", executionId); String pathCypher = getPathToFailedCypher(); - getSession().readTransaction( - tx -> { - Result pathResult = tx.run(pathCypher, pathParams); - - while (pathResult.hasNext()) { - Record pathRecord = pathResult.next(); - Value pathValue = pathRecord.get(0); - Path path = pathValue.asPath(); - List shortestPath = new ArrayList<>(); - for (Node node : path.nodes()) { - PathResult nodeResult = new PathResult(); - nodeResult.setId(LoggingCore.getStringValue(node, "id")); - nodeResult.setName(LoggingCore.getStringValue(node, "name")); - nodeResult.setType(LoggingCore.getStringValue(node, "executionType")); - nodeResult.setFailed(LoggingCore.getBooleanValue(node, "failed")); - nodeResult.setRegistrationDate(LoggingCore.getDateValue(node, "registrationDate")); - nodeResult.setCopy(LoggingCore.getStringValue(node, "copyNr")); - - shortestPath.add(0, nodeResult); - } - shortestPaths.add(shortestPath); - } - // - return null; - }); + getSession() + .readTransaction( + tx -> { + Result pathResult = tx.run(pathCypher, pathParams); + + while (pathResult.hasNext()) { + Record pathRecord = pathResult.next(); + Value pathValue = pathRecord.get(0); + Path path = pathValue.asPath(); + List shortestPath = new ArrayList<>(); + for (Node node : path.nodes()) { + PathResult nodeResult = new PathResult(); + nodeResult.setId(LoggingCore.getStringValue(node, "id")); + nodeResult.setName(LoggingCore.getStringValue(node, "name")); + nodeResult.setType(LoggingCore.getStringValue(node, "executionType")); + nodeResult.setFailed(LoggingCore.getBooleanValue(node, "failed")); + nodeResult.setRegistrationDate( + LoggingCore.getDateValue(node, "registrationDate")); + nodeResult.setCopy(LoggingCore.getStringValue(node, "copyNr")); + + shortestPath.add(0, nodeResult); + } + shortestPaths.add(shortestPath); + } + // + return null; + }); return shortestPaths; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerLineageTab.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerLineageTab.java index 87e98fd04a3..5c5b1ae27d8 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerLineageTab.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerLineageTab.java @@ -18,6 +18,13 @@ package org.apache.hop.neo4j.execution.path.base; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.gui.plugin.GuiPlugin; import org.apache.hop.i18n.BaseMessages; @@ -47,14 +54,6 @@ import org.neo4j.driver.types.Node; import org.neo4j.driver.types.Path; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @GuiPlugin public class NeoExecutionViewerLineageTab extends NeoExecutionViewerTabBase { private Tree wTree; @@ -80,7 +79,7 @@ public void addNeoExecutionPathTab(CTabFolder tabFolder) { Button wGo = new Button(tabComposite, SWT.PUSH); wGo.setText(BaseMessages.getString("System.Button.Open")); PropsUi.setLook(wGo); - wGo.addListener(SWT.Selection, e->openItem(wTree)); + wGo.addListener(SWT.Selection, e -> openItem(wTree)); BaseTransformDialog.positionBottomButtons( tabComposite, new Button[] {wGo}, PropsUi.getMargin(), null); @@ -92,7 +91,7 @@ public void addNeoExecutionPathTab(CTabFolder tabFolder) { fdTree.bottom = new FormAttachment(wGo, -PropsUi.getMargin()); fdTree.right = new FormAttachment(100, 0); wTree.setLayoutData(fdTree); - wTree.addListener(SWT.DefaultSelection, e->openItem(wTree)); + wTree.addListener(SWT.DefaultSelection, e -> openItem(wTree)); wTree.setHeaderVisible(true); { TreeColumn column = new TreeColumn(wTree, SWT.LEFT); @@ -201,7 +200,7 @@ private List> getLineageToRoot(String executionId) { treeItem.dispose(); } - if (viewer.getExecution().getParentId()==null) { + if (viewer.getExecution().getParentId() == null) { // There is no lineage since this is the parent return Collections.emptyList(); } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerTabBase.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerTabBase.java index 84ea276f601..d8950609e1a 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerTabBase.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/base/NeoExecutionViewerTabBase.java @@ -32,7 +32,6 @@ import org.apache.hop.ui.core.dialog.ErrorDialog; import org.apache.hop.ui.hopgui.perspective.execution.ExecutionPerspective; import org.apache.hop.ui.hopgui.shared.BaseExecutionViewer; -import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; import org.neo4j.driver.Session; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerCypherTab.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerCypherTab.java index 96eab3f2460..e21ce242b99 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerCypherTab.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerCypherTab.java @@ -37,9 +37,9 @@ public NeoWorkflowExecutionViewerCypherTab(WorkflowExecutionViewer viewer) { } @GuiTab( - id = "90010-workflow-execution-viewer-neo4j-cypher-tab", - parentId = WorkflowExecutionViewer.WORKFLOW_EXECUTION_VIEWER_TABS, - description = "Neo4j Cypher") + id = "90010-workflow-execution-viewer-neo4j-cypher-tab", + parentId = WorkflowExecutionViewer.WORKFLOW_EXECUTION_VIEWER_TABS, + description = "Neo4j Cypher") @Override public void addNeo4jCypherTab(CTabFolder tabFolder) { super.addNeo4jCypherTab(tabFolder); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerErrorTab.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerErrorTab.java index 99ebcaea1ec..629dca27409 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerErrorTab.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/execution/path/workflow/NeoWorkflowExecutionViewerErrorTab.java @@ -23,7 +23,6 @@ import org.apache.hop.execution.ExecutionInfoLocation; import org.apache.hop.neo4j.execution.NeoExecutionInfoLocation; import org.apache.hop.neo4j.execution.path.base.NeoExecutionViewerErrorTab; -import org.apache.hop.neo4j.execution.path.base.NeoExecutionViewerLineageTab; import org.apache.hop.ui.hopgui.perspective.execution.WorkflowExecutionViewer; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.graphics.Color; @@ -46,7 +45,7 @@ public NeoWorkflowExecutionViewerErrorTab(WorkflowExecutionViewer viewer) { parentId = WorkflowExecutionViewer.WORKFLOW_EXECUTION_VIEWER_TABS, description = "Workflow to error path") public void addNeoExecutionPathTab(CTabFolder tabFolder) { - super.addNeoErrorPathTab(tabFolder); + super.addNeoErrorPathTab(tabFolder); } /** @@ -61,6 +60,6 @@ public static boolean showTab(WorkflowExecutionViewer viewer) { if (!(executionInfoLocation.getExecutionInfoLocation() instanceof NeoExecutionInfoLocation)) { return false; } - return viewer.getExecutionState()!=null && viewer.getExecutionState().isFailed(); + return viewer.getExecutionState() != null && viewer.getExecutionState().isFailed(); } } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/Defaults.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/Defaults.java index 7c8dd7660be..231ca6775fe 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/Defaults.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/Defaults.java @@ -22,7 +22,9 @@ public class Defaults { - @Variable(description="Set this variable to the name of an existing Neo4j connection to enable execution logging to a Neo4j database.") + @Variable( + description = + "Set this variable to the name of an existing Neo4j connection to enable execution logging to a Neo4j database.") public static final String NEO4J_LOGGING_CONNECTION = "NEO4J_LOGGING_CONNECTION"; public static String TRANS_NODE_UPDATES_GROUP = "NODE_UPDATES"; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/util/LoggingCore.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/util/LoggingCore.java index 2ae683d3f32..693d16b716c 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/util/LoggingCore.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/util/LoggingCore.java @@ -17,6 +17,15 @@ package org.apache.hop.neo4j.logging.util; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; @@ -38,16 +47,6 @@ import org.neo4j.driver.Value; import org.neo4j.driver.types.Node; -import java.text.SimpleDateFormat; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - public class LoggingCore { public static final boolean isEnabled(IVariables space) { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/PipelineLoggingExtensionPoint.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/PipelineLoggingExtensionPoint.java index d42d93a2b0c..e1593299980 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/PipelineLoggingExtensionPoint.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/PipelineLoggingExtensionPoint.java @@ -17,6 +17,12 @@ package org.apache.hop.neo4j.logging.xp; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; @@ -37,16 +43,8 @@ import org.apache.hop.pipeline.transform.TransformMetaDataCombi; import org.neo4j.driver.Driver; import org.neo4j.driver.Session; -import org.neo4j.driver.Transaction; import org.neo4j.driver.TransactionWork; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - @ExtensionPoint( id = "PipelineLoggingExtensionPoint", extensionPointId = "PipelineStartThreads", @@ -227,7 +225,8 @@ private void logStartOfPipeline( synchronized (session) { session.writeTransaction( - (TransactionWork) transaction -> { + (TransactionWork) + transaction -> { try { // Create a new node for each log channel and its owner. // Start with the pipeline. @@ -281,7 +280,8 @@ private void logEndOfPipeline( synchronized (session) { session.writeTransaction( - (TransactionWork) transaction -> { + (TransactionWork) + transaction -> { try { // Create a new node for each log channel and it's owner @@ -301,7 +301,8 @@ private void logEndOfPipeline( pipelinePars.put("type", EXECUTION_TYPE_PIPELINE); pipelinePars.put("id", channel.getLogChannelId()); pipelinePars.put( - "executionEnd", new SimpleDateFormat("yyyy/MM/dd'T'HH:mm:ss").format(endDate)); + "executionEnd", + new SimpleDateFormat("yyyy/MM/dd'T'HH:mm:ss").format(endDate)); pipelinePars.put("durationMs", endDate.getTime() - startDate.getTime()); pipelinePars.put("errors", result.getNrErrors()); pipelinePars.put("linesInput", result.getNrLinesInput()); @@ -334,9 +335,12 @@ private void logEndOfPipeline( // List combis = ((Pipeline) pipeline).getTransforms(); for (TransformMetaDataCombi combi : combis) { - String transformLogChannelId = combi.transform.getLogChannel().getLogChannelId(); + String transformLogChannelId = + combi.transform.getLogChannel().getLogChannelId(); String transformLoggingText = - HopLogStore.getAppender().getBuffer(transformLogChannelId, false).toString(); + HopLogStore.getAppender() + .getBuffer(transformLogChannelId, false) + .toString(); Map transformPars = new HashMap<>(); transformPars.put("pipelineName", pipelineMeta.getName()); transformPars.put("name", combi.transformName); @@ -372,7 +376,8 @@ private void logEndOfPipeline( transaction.run(transformCypher, transformPars); // Log graph usage as well - // This Map is left by the Neo4j transform plugins : Neo4j Output and Neo4j Graph + // This Map is left by the Neo4j transform plugins : Neo4j Output and Neo4j + // Graph // Output // Map>> usageMap = diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/WorkflowLoggingExtensionPoint.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/WorkflowLoggingExtensionPoint.java index fac5d9c936f..316ff8162e7 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/WorkflowLoggingExtensionPoint.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/logging/xp/WorkflowLoggingExtensionPoint.java @@ -17,6 +17,11 @@ package org.apache.hop.neo4j.logging.xp; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; @@ -38,12 +43,6 @@ import org.neo4j.driver.Session; import org.neo4j.driver.TransactionWork; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @ExtensionPoint( id = "WorkflowLoggingExtensionPoint", extensionPointId = "WorkflowStart", diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/AreaOwner.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/AreaOwner.java index 6ea55c9cc84..5bc3c9abb1f 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/AreaOwner.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/AreaOwner.java @@ -73,7 +73,9 @@ public int getX() { return x; } - /** @param x The x to set */ + /** + * @param x The x to set + */ public void setX(int x) { this.x = x; } @@ -87,7 +89,9 @@ public int getY() { return y; } - /** @param y The y to set */ + /** + * @param y The y to set + */ public void setY(int y) { this.y = y; } @@ -101,7 +105,9 @@ public int getWidth() { return width; } - /** @param width The width to set */ + /** + * @param width The width to set + */ public void setWidth(int width) { this.width = width; } @@ -115,7 +121,9 @@ public int getHeight() { return height; } - /** @param height The height to set */ + /** + * @param height The height to set + */ public void setHeight(int height) { this.height = height; } @@ -129,7 +137,9 @@ public AreaType getAreaType() { return areaType; } - /** @param areaType The areaType to set */ + /** + * @param areaType The areaType to set + */ public void setAreaType(AreaType areaType) { this.areaType = areaType; } @@ -143,7 +153,9 @@ public Object getSubject() { return subject; } - /** @param subject The subject to set */ + /** + * @param subject The subject to set + */ public void setSubject(Object subject) { this.subject = subject; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModel.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModel.java index 929c1333505..43c6381be62 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModel.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModel.java @@ -21,6 +21,9 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonParser; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadata; @@ -31,10 +34,6 @@ import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - @HopMetadata( key = "neo4j-graph-model", name = "Neo4j Graph Model", @@ -309,7 +308,9 @@ public GraphNode findNode(String nodeName) { return null; } - /** @return a sorted list of node names */ + /** + * @return a sorted list of node names + */ public String[] getNodeNames() { String[] names = new String[nodes.size()]; for (int i = 0; i < names.length; i++) { @@ -334,7 +335,9 @@ public GraphRelationship findRelationship(String relationshipName) { return null; } - /** @return a sorted list of relationship names */ + /** + * @return a sorted list of relationship names + */ public String[] getRelationshipNames() { String[] names = new String[relationships.size()]; for (int i = 0; i < names.length; i++) { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelEditor.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelEditor.java index 74ba7b2d282..a7145d2a376 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelEditor.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelEditor.java @@ -17,6 +17,12 @@ package org.apache.hop.neo4j.model; +import java.awt.geom.Line2D; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -80,13 +86,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.awt.geom.Line2D; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - public class GraphModelEditor extends MetadataEditor { private static final Class PKG = @@ -852,7 +851,8 @@ private void importNodeProperties() { if (transformName == null) { return; } - IRowMeta inputRowMeta = pipelineMeta.getTransformFields(manager.getVariables(), transformName); + IRowMeta inputRowMeta = + pipelineMeta.getTransformFields(manager.getVariables(), transformName); String[] fieldNames = inputRowMeta.getFieldNames(); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelSearchableAnalyser.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelSearchableAnalyser.java index cb6e2ee044e..6ee7845c66a 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelSearchableAnalyser.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphModelSearchableAnalyser.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.model; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.search.BaseMetadataSearchableAnalyser; import org.apache.hop.core.search.ISearchQuery; import org.apache.hop.core.search.ISearchResult; @@ -24,9 +26,6 @@ import org.apache.hop.core.search.ISearchableAnalyser; import org.apache.hop.core.search.SearchableAnalyserPlugin; -import java.util.ArrayList; -import java.util.List; - @SearchableAnalyserPlugin( id = "GraphModelSearchableAnalyser", name = "Search in Neo4j Graph Model metadata") diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphNode.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphNode.java index f20a2de5d34..8953a98cc80 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphNode.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphNode.java @@ -17,13 +17,12 @@ package org.apache.hop.neo4j.model; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.ArrayList; -import java.util.List; - public class GraphNode { @HopMetadataProperty protected String name; @@ -138,7 +137,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -152,7 +153,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -166,7 +169,9 @@ public List getLabels() { return labels; } - /** @param labels The labels to set */ + /** + * @param labels The labels to set + */ public void setLabels(List labels) { this.labels = labels; } @@ -180,7 +185,9 @@ public List getProperties() { return properties; } - /** @param properties The properties to set */ + /** + * @param properties The properties to set + */ public void setProperties(List properties) { this.properties = properties; } @@ -194,7 +201,9 @@ public GraphPresentation getPresentation() { return presentation; } - /** @param presentation The presentation to set */ + /** + * @param presentation The presentation to set + */ public void setPresentation(GraphPresentation presentation) { this.presentation = presentation; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPresentation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPresentation.java index 9bb412601d6..d756cef0f59 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPresentation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPresentation.java @@ -48,7 +48,9 @@ public int getX() { return x; } - /** @param x The x to set */ + /** + * @param x The x to set + */ public void setX(int x) { this.x = x; } @@ -62,7 +64,9 @@ public int getY() { return y; } - /** @param y The y to set */ + /** + * @param y The y to set + */ public void setY(int y) { this.y = y; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphProperty.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphProperty.java index 9a39d099d37..adab868dc70 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphProperty.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphProperty.java @@ -18,9 +18,8 @@ package org.apache.hop.neo4j.model; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class GraphProperty { @@ -94,7 +93,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -108,7 +109,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } @@ -122,7 +125,9 @@ public GraphPropertyType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(GraphPropertyType type) { this.type = type; } @@ -136,7 +141,9 @@ public boolean isPrimary() { return primary; } - /** @param primary The primary to set */ + /** + * @param primary The primary to set + */ public void setPrimary(boolean primary) { this.primary = primary; } @@ -150,7 +157,9 @@ public boolean isMandatory() { return mandatory; } - /** @param mandatory The mandatory to set */ + /** + * @param mandatory The mandatory to set + */ public void setMandatory(boolean mandatory) { this.mandatory = mandatory; } @@ -164,7 +173,9 @@ public boolean isUnique() { return unique; } - /** @param unique The unique to set */ + /** + * @param unique The unique to set + */ public void setUnique(boolean unique) { this.unique = unique; } @@ -178,7 +189,9 @@ public boolean isIndexed() { return indexed; } - /** @param indexed The indexed to set */ + /** + * @param indexed The indexed to set + */ public void setIndexed(boolean indexed) { this.indexed = indexed; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPropertyType.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPropertyType.java index 3007940c09c..d1dbe8ddbd0 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPropertyType.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphPropertyType.java @@ -18,13 +18,12 @@ package org.apache.hop.neo4j.model; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.value.ValueMetaTimestamp; - import java.sql.Timestamp; import java.time.ZonedDateTime; import java.util.TimeZone; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.value.ValueMetaTimestamp; public enum GraphPropertyType { String, diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphRelationship.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphRelationship.java index fcb9cb8f263..f4041db7390 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphRelationship.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/GraphRelationship.java @@ -17,13 +17,12 @@ package org.apache.hop.neo4j.model; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.ArrayList; -import java.util.List; - public class GraphRelationship { @HopMetadataProperty protected String name; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/arrows/ArrowsAppImporter.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/arrows/ArrowsAppImporter.java index ba919b2395f..43886a722db 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/arrows/ArrowsAppImporter.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/arrows/ArrowsAppImporter.java @@ -17,6 +17,10 @@ package org.apache.hop.neo4j.model.arrows; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.model.GraphModel; @@ -28,11 +32,6 @@ import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ArrowsAppImporter { public static GraphModel importFromArrowsJson(String jsonString) throws HopException { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/sw/SolutionsWorkbenchImporter.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/sw/SolutionsWorkbenchImporter.java index 654b423cfdc..358ab257142 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/sw/SolutionsWorkbenchImporter.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/sw/SolutionsWorkbenchImporter.java @@ -17,6 +17,12 @@ package org.apache.hop.neo4j.model.sw; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.model.GraphModel; @@ -29,13 +35,6 @@ import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class SolutionsWorkbenchImporter { public static GraphModel importFromCwJson(String jsonString) throws HopException { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ConstraintDetails.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ConstraintDetails.java index 4fcee39aa40..5a3eef6e2ec 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ConstraintDetails.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ConstraintDetails.java @@ -47,7 +47,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -61,7 +63,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/IndexDetails.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/IndexDetails.java index 83717da826c..5c8da1b37a6 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/IndexDetails.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/IndexDetails.java @@ -18,9 +18,8 @@ package org.apache.hop.neo4j.model.validation; -import org.neo4j.driver.Record; - import java.util.List; +import org.neo4j.driver.Record; public class IndexDetails { private int id; @@ -58,7 +57,9 @@ public int getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(int id) { this.id = id; } @@ -72,7 +73,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -86,7 +89,9 @@ public String getState() { return state; } - /** @param state The state to set */ + /** + * @param state The state to set + */ public void setState(String state) { this.state = state; } @@ -100,7 +105,9 @@ public float getPopulationPercent() { return populationPercent; } - /** @param populationPercent The populationPercent to set */ + /** + * @param populationPercent The populationPercent to set + */ public void setPopulationPercent(float populationPercent) { this.populationPercent = populationPercent; } @@ -114,7 +121,9 @@ public String getUniqueness() { return uniqueness; } - /** @param uniqueness The uniqueness to set */ + /** + * @param uniqueness The uniqueness to set + */ public void setUniqueness(String uniqueness) { this.uniqueness = uniqueness; } @@ -128,7 +137,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -142,7 +153,9 @@ public String getEntityType() { return entityType; } - /** @param entityType The entityType to set */ + /** + * @param entityType The entityType to set + */ public void setEntityType(String entityType) { this.entityType = entityType; } @@ -156,7 +169,9 @@ public List getLabelsOrTypes() { return labelsOrTypes; } - /** @param labelsOrTypes The labelsOrTypes to set */ + /** + * @param labelsOrTypes The labelsOrTypes to set + */ public void setLabelsOrTypes(List labelsOrTypes) { this.labelsOrTypes = labelsOrTypes; } @@ -170,7 +185,9 @@ public List getProperties() { return properties; } - /** @param properties The properties to set */ + /** + * @param properties The properties to set + */ public void setProperties(List properties) { this.properties = properties; } @@ -184,7 +201,9 @@ public String getProvider() { return provider; } - /** @param provider The provider to set */ + /** + * @param provider The provider to set + */ public void setProvider(String provider) { this.provider = provider; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ModelValidator.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ModelValidator.java index deefb074dfe..c85a4f1683e 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ModelValidator.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/ModelValidator.java @@ -18,6 +18,10 @@ package org.apache.hop.neo4j.model.validation; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.neo4j.model.GraphModel; import org.apache.hop.neo4j.model.GraphNode; @@ -27,11 +31,6 @@ import org.neo4j.driver.Transaction; import org.neo4j.driver.TransactionWork; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** This class will help you validate data input and your Neo4j data against a Graph Model */ public class ModelValidator { @@ -230,7 +229,9 @@ public List getUsedNodeProperties() { return usedNodeProperties; } - /** @param usedNodeProperties The usedNodeProperties to set */ + /** + * @param usedNodeProperties The usedNodeProperties to set + */ public void setUsedNodeProperties(List usedNodeProperties) { this.usedNodeProperties = usedNodeProperties; } @@ -244,7 +245,9 @@ public GraphModel getGraphModel() { return graphModel; } - /** @param graphModel The graphModel to set */ + /** + * @param graphModel The graphModel to set + */ public void setGraphModel(GraphModel graphModel) { this.graphModel = graphModel; } @@ -258,7 +261,9 @@ public List getIndexesList() { return indexesList; } - /** @param indexesList The indexesList to set */ + /** + * @param indexesList The indexesList to set + */ public void setIndexesList(List indexesList) { this.indexesList = indexesList; } @@ -272,7 +277,9 @@ public List getConstraintsList() { return constraintsList; } - /** @param constraintsList The constraintsList to set */ + /** + * @param constraintsList The constraintsList to set + */ public void setConstraintsList(List constraintsList) { this.constraintsList = constraintsList; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/NodeProperty.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/NodeProperty.java index 2d29fe7c1b1..1e58adb783d 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/NodeProperty.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/model/validation/NodeProperty.java @@ -39,7 +39,9 @@ public String getNodeName() { return nodeName; } - /** @param nodeName The nodeName to set */ + /** + * @param nodeName The nodeName to set + */ public void setNodeName(String nodeName) { this.nodeName = nodeName; } @@ -53,7 +55,9 @@ public String getPropertyName() { return propertyName; } - /** @param propertyName The propertyName to set */ + /** + * @param propertyName The propertyName to set + */ public void setPropertyName(String propertyName) { this.propertyName = propertyName; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResult.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResult.java index c2f7343b43f..deaa03ae9b2 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResult.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResult.java @@ -18,10 +18,9 @@ package org.apache.hop.neo4j.perspective; -import org.apache.hop.core.Const; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.Const; public class HistoryResult { @@ -55,7 +54,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -69,7 +70,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -83,7 +86,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -97,7 +102,9 @@ public String getCopy() { return copy; } - /** @param copy The copy to set */ + /** + * @param copy The copy to set + */ public void setCopy(String copy) { this.copy = copy; } @@ -111,7 +118,9 @@ public Long getInput() { return input; } - /** @param input The input to set */ + /** + * @param input The input to set + */ public void setInput(Long input) { this.input = input; } @@ -125,7 +134,9 @@ public Long getOutput() { return output; } - /** @param output The output to set */ + /** + * @param output The output to set + */ public void setOutput(Long output) { this.output = output; } @@ -139,7 +150,9 @@ public Long getRead() { return read; } - /** @param read The read to set */ + /** + * @param read The read to set + */ public void setRead(Long read) { this.read = read; } @@ -153,7 +166,9 @@ public Long getWritten() { return written; } - /** @param written The written to set */ + /** + * @param written The written to set + */ public void setWritten(Long written) { this.written = written; } @@ -167,7 +182,9 @@ public Long getRejected() { return rejected; } - /** @param rejected The rejected to set */ + /** + * @param rejected The rejected to set + */ public void setRejected(Long rejected) { this.rejected = rejected; } @@ -181,7 +198,9 @@ public Long getErrors() { return errors; } - /** @param errors The errors to set */ + /** + * @param errors The errors to set + */ public void setErrors(Long errors) { this.errors = errors; } @@ -195,7 +214,9 @@ public String getLoggingText() { return loggingText; } - /** @param loggingText The loggingText to set */ + /** + * @param loggingText The loggingText to set + */ public void setLoggingText(String loggingText) { this.loggingText = loggingText; } @@ -209,7 +230,9 @@ public String getRegistrationDate() { return registrationDate; } - /** @param registrationDate The registrationDate to set */ + /** + * @param registrationDate The registrationDate to set + */ public void setRegistrationDate(String registrationDate) { this.registrationDate = registrationDate; } @@ -223,7 +246,9 @@ public List> getShortestPaths() { return shortestPaths; } - /** @param shortestPaths The shortestPaths to set */ + /** + * @param shortestPaths The shortestPaths to set + */ public void setShortestPaths(List> shortestPaths) { this.shortestPaths = shortestPaths; } @@ -237,7 +262,9 @@ public Long getDurationMs() { return durationMs; } - /** @param durationMs The durationMs to set */ + /** + * @param durationMs The durationMs to set + */ public void setDurationMs(Long durationMs) { this.durationMs = durationMs; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResults.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResults.java index 25b4c5811e8..09d9616bdac 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResults.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HistoryResults.java @@ -46,7 +46,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } @@ -60,7 +62,9 @@ public List getLastExecutions() { return lastExecutions; } - /** @param lastExecutions The lastExecutions to set */ + /** + * @param lastExecutions The lastExecutions to set + */ public void setLastExecutions(List lastExecutions) { this.lastExecutions = lastExecutions; } @@ -74,7 +78,9 @@ public String getSubjectName() { return subjectName; } - /** @param subjectName The subjectName to set */ + /** + * @param subjectName The subjectName to set + */ public void setSubjectName(String subjectName) { this.subjectName = subjectName; } @@ -88,7 +94,9 @@ public String getSubjectType() { return subjectType; } - /** @param subjectType The subjectType to set */ + /** + * @param subjectType The subjectType to set + */ public void setSubjectType(String subjectType) { this.subjectType = subjectType; } @@ -102,7 +110,9 @@ public String getSubjectCopy() { return subjectCopy; } - /** @param subjectCopy The subjectCopy to set */ + /** + * @param subjectCopy The subjectCopy to set + */ public void setSubjectCopy(String subjectCopy) { this.subjectCopy = subjectCopy; } @@ -116,7 +126,9 @@ public String getParentName() { return parentName; } - /** @param parentName The parentName to set */ + /** + * @param parentName The parentName to set + */ public void setParentName(String parentName) { this.parentName = parentName; } @@ -130,7 +142,9 @@ public String getParentType() { return parentType; } - /** @param parentType The parentType to set */ + /** + * @param parentType The parentType to set + */ public void setParentType(String parentType) { this.parentType = parentType; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HopNeo4jPerspective.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HopNeo4jPerspective.java index 5e34deba651..db04d689d1d 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HopNeo4jPerspective.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HopNeo4jPerspective.java @@ -17,6 +17,11 @@ package org.apache.hop.neo4j.perspective; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -83,12 +88,6 @@ import org.neo4j.driver.types.Node; import org.neo4j.driver.types.Path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @HopPerspectivePlugin( id = "HopNeo4jPerspective", name = "Neo4j", @@ -920,7 +919,8 @@ private void openItem(TreeItem item) { } } - private void openItem(NeoConnection connection, String id, String name, String type) throws HopConfigException { + private void openItem(NeoConnection connection, String id, String name, String type) + throws HopConfigException { try (Driver driver = connection.getDriver(hopGui.getLog(), hopGui.getVariables())) { try (Session session = @@ -1161,7 +1161,9 @@ public HopGui getHopGui() { return hopGui; } - /** @param hopGui The hopGui to set */ + /** + * @param hopGui The hopGui to set + */ public void setHopGui(HopGui hopGui) { this.hopGui = hopGui; } @@ -1175,7 +1177,9 @@ public Composite getParent() { return parent; } - /** @param parent The parent to set */ + /** + * @param parent The parent to set + */ public void setParent(Composite parent) { this.parent = parent; } @@ -1190,7 +1194,9 @@ public Composite getControl() { return composite; } - /** @param composite The composite to set */ + /** + * @param composite The composite to set + */ public void setComposite(Composite composite) { this.composite = composite; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/DriverSingleton.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/DriverSingleton.java index 42825cd00eb..99d96c746ee 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/DriverSingleton.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/DriverSingleton.java @@ -18,15 +18,14 @@ package org.apache.hop.neo4j.shared; -import org.apache.hop.core.exception.HopConfigException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.variables.IVariables; -import org.neo4j.driver.Driver; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.core.exception.HopConfigException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.variables.IVariables; +import org.neo4j.driver.Driver; public class DriverSingleton { @@ -45,7 +44,8 @@ public static DriverSingleton getInstance() { return singleton; } - public static Driver getDriver(ILogChannel log, IVariables variables, NeoConnection connection) throws HopConfigException { + public static Driver getDriver(ILogChannel log, IVariables variables, NeoConnection connection) + throws HopConfigException { DriverSingleton ds = getInstance(); String key = getDriverKey(connection, variables); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnection.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnection.java index f2dd909a2bc..ba0dadf8c3d 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnection.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnection.java @@ -17,6 +17,14 @@ package org.apache.hop.neo4j.shared; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; @@ -42,15 +50,6 @@ import org.neo4j.driver.SessionConfig; import org.neo4j.driver.Value; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; - @HopMetadata( key = "neo4j-connection", name = "Neo4j Connection", @@ -470,7 +469,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ @Override public void setName(String name) { this.name = name; @@ -485,7 +486,9 @@ public String getServer() { return server; } - /** @param server The server to set */ + /** + * @param server The server to set + */ public void setServer(String server) { this.server = server; } @@ -499,7 +502,9 @@ public String getDatabaseName() { return databaseName; } - /** @param databaseName The databaseName to set */ + /** + * @param databaseName The databaseName to set + */ public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } @@ -513,7 +518,9 @@ public String getBoltPort() { return boltPort; } - /** @param boltPort The boltPort to set */ + /** + * @param boltPort The boltPort to set + */ public void setBoltPort(String boltPort) { this.boltPort = boltPort; } @@ -527,7 +534,9 @@ public String getBrowserPort() { return browserPort; } - /** @param browserPort The browserPort to set */ + /** + * @param browserPort The browserPort to set + */ public void setBrowserPort(String browserPort) { this.browserPort = browserPort; } @@ -541,7 +550,9 @@ public boolean isRouting() { return routing; } - /** @param routing The routing to set */ + /** + * @param routing The routing to set + */ public void setRouting(boolean routing) { this.routing = routing; } @@ -555,7 +566,9 @@ public String getRoutingVariable() { return routingVariable; } - /** @param routingVariable The routingVariable to set */ + /** + * @param routingVariable The routingVariable to set + */ public void setRoutingVariable(String routingVariable) { this.routingVariable = routingVariable; } @@ -569,7 +582,9 @@ public String getRoutingPolicy() { return routingPolicy; } - /** @param routingPolicy The routingPolicy to set */ + /** + * @param routingPolicy The routingPolicy to set + */ public void setRoutingPolicy(String routingPolicy) { this.routingPolicy = routingPolicy; } @@ -583,7 +598,9 @@ public String getUsername() { return username; } - /** @param username The username to set */ + /** + * @param username The username to set + */ public void setUsername(String username) { this.username = username; } @@ -597,7 +614,9 @@ public String getPassword() { return password; } - /** @param password The password to set */ + /** + * @param password The password to set + */ public void setPassword(String password) { this.password = password; } @@ -611,7 +630,9 @@ public boolean isUsingEncryption() { return usingEncryption; } - /** @param usingEncryption The usingEncryption to set */ + /** + * @param usingEncryption The usingEncryption to set + */ public void setUsingEncryption(boolean usingEncryption) { this.usingEncryption = usingEncryption; } @@ -625,7 +646,9 @@ public boolean isTrustAllCertificates() { return trustAllCertificates; } - /** @param trustAllCertificates The trustAllCertificates to set */ + /** + * @param trustAllCertificates The trustAllCertificates to set + */ public void setTrustAllCertificates(boolean trustAllCertificates) { this.trustAllCertificates = trustAllCertificates; } @@ -639,7 +662,9 @@ public List getManualUrls() { return manualUrls; } - /** @param manualUrls The manualUrls to set */ + /** + * @param manualUrls The manualUrls to set + */ public void setManualUrls(List manualUrls) { this.manualUrls = manualUrls; } @@ -653,7 +678,9 @@ public String getConnectionLivenessCheckTimeout() { return connectionLivenessCheckTimeout; } - /** @param connectionLivenessCheckTimeout The connectionLivenessCheckTimeout to set */ + /** + * @param connectionLivenessCheckTimeout The connectionLivenessCheckTimeout to set + */ public void setConnectionLivenessCheckTimeout(String connectionLivenessCheckTimeout) { this.connectionLivenessCheckTimeout = connectionLivenessCheckTimeout; } @@ -667,7 +694,9 @@ public String getMaxConnectionLifetime() { return maxConnectionLifetime; } - /** @param maxConnectionLifetime The maxConnectionLifetime to set */ + /** + * @param maxConnectionLifetime The maxConnectionLifetime to set + */ public void setMaxConnectionLifetime(String maxConnectionLifetime) { this.maxConnectionLifetime = maxConnectionLifetime; } @@ -681,7 +710,9 @@ public String getMaxConnectionPoolSize() { return maxConnectionPoolSize; } - /** @param maxConnectionPoolSize The maxConnectionPoolSize to set */ + /** + * @param maxConnectionPoolSize The maxConnectionPoolSize to set + */ public void setMaxConnectionPoolSize(String maxConnectionPoolSize) { this.maxConnectionPoolSize = maxConnectionPoolSize; } @@ -695,7 +726,9 @@ public String getConnectionAcquisitionTimeout() { return connectionAcquisitionTimeout; } - /** @param connectionAcquisitionTimeout The connectionAcquisitionTimeout to set */ + /** + * @param connectionAcquisitionTimeout The connectionAcquisitionTimeout to set + */ public void setConnectionAcquisitionTimeout(String connectionAcquisitionTimeout) { this.connectionAcquisitionTimeout = connectionAcquisitionTimeout; } @@ -709,7 +742,9 @@ public String getConnectionTimeout() { return connectionTimeout; } - /** @param connectionTimeout The connectionTimeout to set */ + /** + * @param connectionTimeout The connectionTimeout to set + */ public void setConnectionTimeout(String connectionTimeout) { this.connectionTimeout = connectionTimeout; } @@ -723,7 +758,9 @@ public String getMaxTransactionRetryTime() { return maxTransactionRetryTime; } - /** @param maxTransactionRetryTime The maxTransactionRetryTime to set */ + /** + * @param maxTransactionRetryTime The maxTransactionRetryTime to set + */ public void setMaxTransactionRetryTime(String maxTransactionRetryTime) { this.maxTransactionRetryTime = maxTransactionRetryTime; } @@ -737,7 +774,9 @@ public boolean isVersion4() { return version4; } - /** @param version4 The version4 to set */ + /** + * @param version4 The version4 to set + */ public void setVersion4(boolean version4) { this.version4 = version4; } @@ -751,7 +790,9 @@ public String getUsingEncryptionVariable() { return usingEncryptionVariable; } - /** @param usingEncryptionVariable The usingEncryptionVariable to set */ + /** + * @param usingEncryptionVariable The usingEncryptionVariable to set + */ public void setUsingEncryptionVariable(String usingEncryptionVariable) { this.usingEncryptionVariable = usingEncryptionVariable; } @@ -765,7 +806,9 @@ public String getTrustAllCertificatesVariable() { return trustAllCertificatesVariable; } - /** @param trustAllCertificatesVariable The trustAllCertificatesVariable to set */ + /** + * @param trustAllCertificatesVariable The trustAllCertificatesVariable to set + */ public void setTrustAllCertificatesVariable(String trustAllCertificatesVariable) { this.trustAllCertificatesVariable = trustAllCertificatesVariable; } @@ -779,7 +822,9 @@ public String getVersion4Variable() { return version4Variable; } - /** @param version4Variable The version4Variable to set */ + /** + * @param version4Variable The version4Variable to set + */ public void setVersion4Variable(String version4Variable) { this.version4Variable = version4Variable; } @@ -794,12 +839,16 @@ public boolean isAutomatic() { return automatic; } - /** @param automatic The automatic flag to be set. */ + /** + * @param automatic The automatic flag to be set. + */ public void setAutomatic(boolean automatic) { this.automatic = automatic; } - /** @return A variable expression which allows you to enable or disable the automatic flag */ + /** + * @return A variable expression which allows you to enable or disable the automatic flag + */ public String getAutomaticVariable() { return automaticVariable; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionEditor.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionEditor.java index f8effebd6cb..c977e546905 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionEditor.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionEditor.java @@ -506,7 +506,10 @@ private void addUrlsTab(PropsUi props, IVariables variables) { ColumnInfo.COLUMN_TYPE_TEXT) }, getMetadata().getManualUrls().size(), - e -> { setChanged(); enableFields(); }, + e -> { + setChanged(); + enableFields(); + }, props); FormData fdUrls = new FormData(); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionSearchableAnalyser.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionSearchableAnalyser.java index f0ea558571b..c28f79d8f16 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionSearchableAnalyser.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionSearchableAnalyser.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.shared; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.search.BaseMetadataSearchableAnalyser; import org.apache.hop.core.search.ISearchQuery; import org.apache.hop.core.search.ISearchResult; @@ -24,9 +26,6 @@ import org.apache.hop.core.search.ISearchableAnalyser; import org.apache.hop.core.search.SearchableAnalyserPlugin; -import java.util.ArrayList; -import java.util.List; - @SearchableAnalyserPlugin( id = "NeoConnectionSearchableAnalyser", name = "Search in Neo4j Connection metadata") diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionUtils.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionUtils.java index 0e4c31ab082..19e469471f6 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionUtils.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoConnectionUtils.java @@ -17,11 +17,10 @@ package org.apache.hop.neo4j.shared; +import java.util.List; import org.apache.hop.core.logging.ILogChannel; import org.neo4j.driver.Session; -import java.util.List; - public class NeoConnectionUtils { private static final Class PKG = NeoConnectionUtils.class; // for i18n purposes, needed by Translator2!! @@ -76,7 +75,7 @@ public static final void createNodeIndex( } else { indexCypher += ", "; } - indexCypher += "n."+property; + indexCypher += "n." + property; } indexCypher += ")"; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoHopData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoHopData.java index d240281d99f..0c2e5bf892e 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoHopData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/shared/NeoHopData.java @@ -18,6 +18,11 @@ package org.apache.hop.neo4j.shared; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZonedDateTime; +import java.util.Date; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.neo4j.core.data.GraphData; @@ -26,12 +31,6 @@ import org.json.simple.JSONValue; import org.neo4j.driver.Value; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.util.Date; - public class NeoHopData { public static Object convertNeoToHopValue( diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransform.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransform.java index b906e6c0a96..74b2247116c 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransform.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransform.java @@ -18,6 +18,7 @@ package org.apache.hop.neo4j.transforms; +import java.util.HashMap; import org.apache.hop.neo4j.core.Neo4jDefaults; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -25,8 +26,6 @@ import org.apache.hop.pipeline.transform.ITransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashMap; - public abstract class BaseNeoTransform< Meta extends ITransformMeta, Data extends BaseNeoTransformData> extends BaseTransform { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransformData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransformData.java index cc34ceadbb1..98cd5536c16 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransformData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/BaseNeoTransformData.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.transforms; -import org.apache.hop.pipeline.transform.BaseTransformData; - import java.util.HashMap; import java.util.Map; import java.util.Set; +import org.apache.hop.pipeline.transform.BaseTransformData; public class BaseNeoTransformData extends BaseTransformData { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/Cypher.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/Cypher.java index 95140ee70cd..d76969852a8 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/Cypher.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/Cypher.java @@ -17,6 +17,10 @@ package org.apache.hop.neo4j.transforms.cypher; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopConfigException; @@ -43,11 +47,6 @@ import org.neo4j.driver.summary.Notification; import org.neo4j.driver.summary.ResultSummary; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class Cypher extends BaseTransform { public Cypher( diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherData.java index e13381f93e1..29e7d837738 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherData.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.transforms.cypher; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.neo4j.core.data.GraphPropertyDataType; import org.apache.hop.neo4j.shared.NeoConnection; @@ -26,9 +28,6 @@ import org.neo4j.driver.Session; import org.neo4j.driver.Transaction; -import java.util.List; -import java.util.Map; - public class CypherData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherDialog.java index c526b54c46c..01a8583789c 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.neo4j.transforms.cypher; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -75,11 +79,6 @@ import org.neo4j.driver.types.Type; import org.neo4j.driver.util.Pair; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class CypherDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherMeta.java index 6def828bc36..0930297fc26 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherMeta.java @@ -18,11 +18,12 @@ package org.apache.hop.neo4j.transforms.cypher; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.exception.HopTransformException; -import org.apache.hop.core.injection.InjectionSupported; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; @@ -33,9 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "Neo4jCypherOutput", name = "i18n::Cypher.Transform.Name", diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherStatement.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherStatement.java index 02eb5f68f64..ad6e153cdb6 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherStatement.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherStatement.java @@ -48,7 +48,9 @@ public Object[] getRow() { return row; } - /** @param row The row to set */ + /** + * @param row The row to set + */ public void setRow(Object[] row) { this.row = row; } @@ -62,7 +64,9 @@ public String getCypher() { return cypher; } - /** @param cypher The cypher to set */ + /** + * @param cypher The cypher to set + */ public void setCypher(String cypher) { this.cypher = cypher; } @@ -76,7 +80,9 @@ public Map getParameters() { return parameters; } - /** @param parameters The parameters to set */ + /** + * @param parameters The parameters to set + */ public void setParameters(Map parameters) { this.parameters = parameters; } @@ -90,7 +96,9 @@ public List getResultRows() { return resultRows; } - /** @param resultRows The resultRows to set */ + /** + * @param resultRows The resultRows to set + */ public void setResultRows(List resultRows) { this.resultRows = resultRows; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherTransactionWork.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherTransactionWork.java index 9d6dfc3bb89..c6c60b35e3e 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherTransactionWork.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypher/CypherTransactionWork.java @@ -18,13 +18,12 @@ package org.apache.hop.neo4j.transforms.cypher; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.neo4j.driver.Result; import org.neo4j.driver.Transaction; import org.neo4j.driver.TransactionWork; -import java.util.Map; - public class CypherTransactionWork implements TransactionWork { private final Cypher transform; private final Object[] currentRow; @@ -65,7 +64,9 @@ public String getCypher() { return cypher; } - /** @param cypher The cypher to set */ + /** + * @param cypher The cypher to set + */ public void setCypher(String cypher) { this.cypher = cypher; } @@ -79,7 +80,9 @@ public Map getUnwindMap() { return unwindMap; } - /** @param unwindMap The unwindMap to set */ + /** + * @param unwindMap The unwindMap to set + */ public void setUnwindMap(Map unwindMap) { this.unwindMap = unwindMap; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilder.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilder.java index cfe38a8986f..e42c90f91d9 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilder.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilder.java @@ -18,6 +18,9 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -36,10 +39,6 @@ import org.neo4j.driver.TransactionWork; import org.neo4j.driver.Value; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - public class CypherBuilder extends BaseTransform { public CypherBuilder( diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderData.java index 1cd91fc8fcd..3cdad283330 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderData.java @@ -18,6 +18,9 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.neo4j.core.data.GraphPropertyDataType; @@ -27,10 +30,6 @@ import org.neo4j.driver.Driver; import org.neo4j.driver.Session; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - public class CypherBuilderData extends BaseTransformData { public List> rowParametersList; public List inputRowsList; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderDialog.java index 7259aa61388..07160241f20 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -79,10 +82,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Function; - public class CypherBuilderDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = CypherBuilderMeta.class; // for i18n purposes, needed by Translator2!! diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMeta.java index 095ad24f5b5..3dfec7e1b9a 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMeta.java @@ -18,6 +18,9 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; @@ -33,10 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - @Transform( id = "Neo4jCypherBuilder", name = "i18n::CypherBuilderMeta.name", diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Parameter.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Parameter.java index 6e124e5de45..f5a9bc38b14 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Parameter.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Parameter.java @@ -18,9 +18,8 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; /** A parameter is set using an input field */ public class Parameter implements Cloneable { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Property.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Property.java index ead53309f1e..234b7285cdd 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Property.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/Property.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import java.util.Objects; import org.apache.commons.lang.StringUtils; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class Property implements Cloneable { @HopMetadataProperty private String alias; @@ -115,19 +114,18 @@ public String getOrderByCypherClause() { } /** - * alias.property={parameter} or alias.property=expression - * or alias.property=unwindAlias.parameter + * alias.property={parameter} or alias.property=expression or alias.property=unwindAlias.parameter * * @param unwindAlias unwind alias if there's any * @return The Cypher set clause for this property */ public String getSetCypherClause(String unwindAlias) { - String cypher = alias + "." + name+"="; + String cypher = alias + "." + name + "="; if (StringUtils.isEmpty(expression)) { if (StringUtils.isEmpty(unwindAlias)) { cypher += "{" + parameter + "}"; } else { - cypher += unwindAlias+"."+parameter; + cypher += unwindAlias + "." + parameter; } } else { cypher += expression; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/ReturnValue.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/ReturnValue.java index 7022c1f46bb..a47c7570a0e 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/ReturnValue.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/ReturnValue.java @@ -18,14 +18,13 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import java.util.Objects; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class ReturnValue implements Cloneable { /** The node or relationship alias */ @@ -117,7 +116,7 @@ public String getPropertyOrExpression() { } else if (StringUtils.isEmpty(parameter)) { return expression; } else { - return "{"+parameter+"}"; + return "{" + parameter + "}"; } } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/BaseOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/BaseOperation.java index 1cb208a6e69..170e6887d40 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/BaseOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/BaseOperation.java @@ -18,15 +18,14 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; import org.apache.hop.neo4j.transforms.cypherbuilder.Property; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - public class BaseOperation implements IOperation { /** The name of the operation makes it uniquely identifiable. */ diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/CreateOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/CreateOperation.java index edeac365982..eec86a1cafe 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/CreateOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/CreateOperation.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; -import java.util.List; - public class CreateOperation extends BaseOperation { public CreateOperation() { super(OperationType.CREATE); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/DeleteOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/DeleteOperation.java index 40c6084db57..fcd9f402ad8 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/DeleteOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/DeleteOperation.java @@ -18,12 +18,11 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; -import java.util.List; - public class DeleteOperation extends BaseOperation { public DeleteOperation() { super(OperationType.DELETE); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/EdgeMatchOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/EdgeMatchOperation.java index 75c575e51ef..371809ecae2 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/EdgeMatchOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/EdgeMatchOperation.java @@ -18,12 +18,11 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; -import java.util.List; - public class EdgeMatchOperation extends BaseOperation { @HopMetadataProperty protected String sourceAlias; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/IOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/IOperation.java index 7beaeace686..b77052c5b4d 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/IOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/IOperation.java @@ -18,12 +18,11 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataObject; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; -import java.util.List; - @HopMetadataObject(objectFactory = OperationFactory.class, xmlKey = "operationType") public interface IOperation extends Cloneable { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MatchOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MatchOperation.java index 2509384bbcc..1b90d1871a5 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MatchOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MatchOperation.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; -import java.util.List; - public class MatchOperation extends BaseOperation { public MatchOperation() { super(OperationType.MATCH); @@ -38,7 +37,8 @@ public MatchOperation clone() { } @Override - public String getCypherClause(String unwindAlias, List parameters) throws HopException { + public String getCypherClause(String unwindAlias, List parameters) + throws HopException { // MATCH StringBuilder cypher = new StringBuilder(operationType.keyWord()); // (m:Movie diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MergeOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MergeOperation.java index 0c357afc4b9..2ba88fbba28 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MergeOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/MergeOperation.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; -import java.util.List; - public class MergeOperation extends BaseOperation { public MergeOperation() { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OperationFactory.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OperationFactory.java index a219754b4c7..d2310f56392 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OperationFactory.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OperationFactory.java @@ -50,7 +50,7 @@ public static IOperation createOperation(OperationType operationType) { } } - @Override + @Override public Object createObject(String id, Object parentObject) throws HopException { try { OperationType operationType = OperationType.valueOf(id); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OrderByOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OrderByOperation.java index efc32d48c94..2aeb44442ba 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OrderByOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/OrderByOperation.java @@ -18,12 +18,11 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; import org.apache.hop.neo4j.transforms.cypherbuilder.Property; -import java.util.List; - public class OrderByOperation extends BaseOperation { public OrderByOperation() { @@ -35,7 +34,8 @@ public OrderByOperation(OrderByOperation o) { } @Override - public String getCypherClause(String unwindAlias, List parameters) throws HopException { + public String getCypherClause(String unwindAlias, List parameters) + throws HopException { // ORDER BY // StringBuilder cypher = new StringBuilder(operationType.keyWord()); @@ -43,9 +43,9 @@ public String getCypherClause(String unwindAlias, List parameters) th // n.name DESC, upper(n.lastName), ... // - for (int i=0;i0) { + if (i > 0) { cypher.append(", "); } cypher.append(property.getOrderByCypherClause()); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/ReturnOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/ReturnOperation.java index d0d91fa6d72..c986737c1c8 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/ReturnOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/ReturnOperation.java @@ -18,15 +18,14 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; import org.apache.hop.neo4j.transforms.cypherbuilder.ReturnValue; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - public class ReturnOperation implements IOperation { @HopMetadataProperty private String name; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/SetOperation.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/SetOperation.java index 43035c68551..364aa874b2b 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/SetOperation.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/cypherbuilder/operation/SetOperation.java @@ -18,12 +18,11 @@ package org.apache.hop.neo4j.transforms.cypherbuilder.operation; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.neo4j.transforms.cypherbuilder.Parameter; import org.apache.hop.neo4j.transforms.cypherbuilder.Property; -import java.util.List; - public class SetOperation extends BaseOperation { public SetOperation() { super(OperationType.SET); diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/CsvFile.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/CsvFile.java index 0383b2b19cd..676c7a3f779 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/CsvFile.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/CsvFile.java @@ -79,7 +79,9 @@ public FileOutputStream getOutputStream() { return outputStream; } - /** @param outputStream The outputStream to set */ + /** + * @param outputStream The outputStream to set + */ public void setOutputStream(FileOutputStream outputStream) { this.outputStream = outputStream; } @@ -110,7 +112,9 @@ public String getFilename() { return filename; } - /** @param filename The filename to set */ + /** + * @param filename The filename to set + */ public void setFilename(String filename) { this.filename = filename; } @@ -124,7 +128,9 @@ public String getFileType() { return fileType; } - /** @param fileType The fileType to set */ + /** + * @param fileType The fileType to set + */ public void setFileType(String fileType) { this.fileType = fileType; } @@ -138,7 +144,9 @@ public String getShortFilename() { return shortFilename; } - /** @param shortFilename The shortFilename to set */ + /** + * @param shortFilename The shortFilename to set + */ public void setShortFilename(String shortFilename) { this.shortFilename = shortFilename; } @@ -152,7 +160,9 @@ public List getPropsList() { return propsList; } - /** @param propsList The propsList to set */ + /** + * @param propsList The propsList to set + */ public void setPropsList(List propsList) { this.propsList = propsList; } @@ -166,7 +176,9 @@ public Map getPropsIndexes() { return propsIndexes; } - /** @param propsIndexes The propsIndexes to set */ + /** + * @param propsIndexes The propsIndexes to set + */ public void setPropsIndexes(Map propsIndexes) { this.propsIndexes = propsIndexes; } @@ -180,7 +192,9 @@ public String getIdFieldName() { return idFieldName; } - /** @param idFieldName The idFieldName to set */ + /** + * @param idFieldName The idFieldName to set + */ public void setIdFieldName(String idFieldName) { this.idFieldName = idFieldName; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsv.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsv.java index 6aa94a1d245..9861a4f1a4b 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsv.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsv.java @@ -18,6 +18,13 @@ package org.apache.hop.neo4j.transforms.gencsv; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -33,14 +40,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class GenerateCsv extends BaseTransform { /** diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvData.java index bd5dbdd377c..06fc1aef623 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvData.java @@ -18,13 +18,12 @@ package org.apache.hop.neo4j.transforms.gencsv; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Map; - public class GenerateCsvData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvMeta.java index 6a11e4569eb..399a801764f 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/GenerateCsvMeta.java @@ -120,7 +120,9 @@ public String getGraphFieldName() { return graphFieldName; } - /** @param graphFieldName The graphFieldName to set */ + /** + * @param graphFieldName The graphFieldName to set + */ public void setGraphFieldName(String graphFieldName) { this.graphFieldName = graphFieldName; } @@ -134,7 +136,9 @@ public String getBaseFolder() { return baseFolder; } - /** @param baseFolder The baseFolder to set */ + /** + * @param baseFolder The baseFolder to set + */ public void setBaseFolder(String baseFolder) { this.baseFolder = baseFolder; } @@ -148,7 +152,9 @@ public UniquenessStrategy getUniquenessStrategy() { return uniquenessStrategy; } - /** @param uniquenessStrategy The nodeUniquenessStrategy to set */ + /** + * @param uniquenessStrategy The nodeUniquenessStrategy to set + */ public void setUniquenessStrategy(UniquenessStrategy uniquenessStrategy) { this.uniquenessStrategy = uniquenessStrategy; } @@ -162,7 +168,9 @@ public String getFilesPrefix() { return filesPrefix; } - /** @param filesPrefix The filesPrefix to set */ + /** + * @param filesPrefix The filesPrefix to set + */ public void setFilesPrefix(String filesPrefix) { this.filesPrefix = filesPrefix; } @@ -176,7 +184,9 @@ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set */ + /** + * @param filenameField The filenameField to set + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } @@ -190,7 +200,9 @@ public String getFileTypeField() { return fileTypeField; } - /** @param fileTypeField The fileTypeField to set */ + /** + * @param fileTypeField The fileTypeField to set + */ public void setFileTypeField(String fileTypeField) { this.fileTypeField = fileTypeField; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IdType.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IdType.java index 5bd135b183f..24a500eb039 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IdType.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IdType.java @@ -18,9 +18,8 @@ package org.apache.hop.neo4j.transforms.gencsv; -import org.apache.hop.neo4j.core.data.GraphPropertyDataType; - import java.util.Objects; +import org.apache.hop.neo4j.core.data.GraphPropertyDataType; public class IdType { @@ -60,7 +59,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -74,7 +75,9 @@ public GraphPropertyDataType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(GraphPropertyDataType type) { this.type = type; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IndexedGraphData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IndexedGraphData.java index ef6b1f13139..698d1d1c8bb 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IndexedGraphData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/IndexedGraphData.java @@ -18,11 +18,7 @@ package org.apache.hop.neo4j.transforms.gencsv; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.neo4j.core.data.GraphData; -import org.apache.hop.neo4j.core.data.GraphNodeData; -import org.apache.hop.neo4j.core.data.GraphPropertyData; -import org.apache.hop.neo4j.core.data.GraphRelationshipData; +import static org.apache.hop.neo4j.transforms.gencsv.UniquenessStrategy.None; import java.util.ArrayList; import java.util.HashMap; @@ -30,8 +26,11 @@ import java.util.List; import java.util.Map; import java.util.Set; - -import static org.apache.hop.neo4j.transforms.gencsv.UniquenessStrategy.None; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.neo4j.core.data.GraphData; +import org.apache.hop.neo4j.core.data.GraphNodeData; +import org.apache.hop.neo4j.core.data.GraphPropertyData; +import org.apache.hop.neo4j.core.data.GraphRelationshipData; /** Adds an index to graph data. This allows us to quickly lookup nodes and relationships */ public class IndexedGraphData extends GraphData { @@ -151,7 +150,9 @@ public Map getNodeIdMap() { return nodeIdMap; } - /** @param nodeIdMap The nodeIdMap to set */ + /** + * @param nodeIdMap The nodeIdMap to set + */ public void setNodeIdMap(Map nodeIdMap) { this.nodeIdMap = nodeIdMap; } @@ -165,7 +166,9 @@ public Map getRelIdMap() { return relIdMap; } - /** @param relIdMap The relIdMap to set */ + /** + * @param relIdMap The relIdMap to set + */ public void setRelIdMap(Map relIdMap) { this.relIdMap = relIdMap; } @@ -179,7 +182,9 @@ public List getNodeCollisionListeners() { return nodeCollisionListeners; } - /** @param nodeCollisionListeners The nodeCollisionListeners to set */ + /** + * @param nodeCollisionListeners The nodeCollisionListeners to set + */ public void setNodeCollisionListeners(List nodeCollisionListeners) { this.nodeCollisionListeners = nodeCollisionListeners; } @@ -193,7 +198,9 @@ public List getRelCollisionListeners() { return relCollisionListeners; } - /** @param relCollisionListeners The relCollisionListeners to set */ + /** + * @param relCollisionListeners The relCollisionListeners to set + */ public void setRelCollisionListeners(List relCollisionListeners) { this.relCollisionListeners = relCollisionListeners; } @@ -207,7 +214,9 @@ public Set getNodePropertiesSet() { return nodePropertiesSet; } - /** @param nodePropertiesSet The nodePropertiesSet to set */ + /** + * @param nodePropertiesSet The nodePropertiesSet to set + */ public void setNodePropertiesSet(Set nodePropertiesSet) { this.nodePropertiesSet = nodePropertiesSet; } @@ -221,7 +230,9 @@ public Set getRelPropertiesSet() { return relPropertiesSet; } - /** @param relPropertiesSet The relPropertiesSet to set */ + /** + * @param relPropertiesSet The relPropertiesSet to set + */ public void setRelPropertiesSet(Set relPropertiesSet) { this.relPropertiesSet = relPropertiesSet; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/StreamConsumer.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/StreamConsumer.java index 9d02b5b9846..580351495bd 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/StreamConsumer.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/gencsv/StreamConsumer.java @@ -18,13 +18,12 @@ package org.apache.hop.neo4j.transforms.gencsv; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.logging.LogLevel; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.logging.LogLevel; public class StreamConsumer extends Thread { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/CypherParameters.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/CypherParameters.java index 0b56e479f96..617c2fe582f 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/CypherParameters.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/CypherParameters.java @@ -47,7 +47,9 @@ public String getCypher() { return cypher; } - /** @param cypher The cypher to set */ + /** + * @param cypher The cypher to set + */ public void setCypher(String cypher) { this.cypher = cypher; } @@ -61,7 +63,9 @@ public List getTargetParameters() { return targetParameters; } - /** @param targetParameters The targetParameters to set */ + /** + * @param targetParameters The targetParameters to set + */ public void setTargetParameters(List targetParameters) { this.targetParameters = targetParameters; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/FieldModelMapping.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/FieldModelMapping.java index ca1b6a2071e..a7de732fb1a 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/FieldModelMapping.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/FieldModelMapping.java @@ -17,9 +17,8 @@ package org.apache.hop.neo4j.transforms.graph; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class FieldModelMapping { @@ -106,7 +105,9 @@ public String getField() { return field; } - /** @param field The field to set */ + /** + * @param field The field to set + */ public void setField(String field) { this.field = field; } @@ -120,7 +121,9 @@ public ModelTargetType getTargetType() { return targetType; } - /** @param targetType The targetType to set */ + /** + * @param targetType The targetType to set + */ public void setTargetType(ModelTargetType targetType) { this.targetType = targetType; } @@ -134,7 +137,9 @@ public String getTargetName() { return targetName; } - /** @param targetName The targetName to set */ + /** + * @param targetName The targetName to set + */ public void setTargetName(String targetName) { this.targetName = targetName; } @@ -148,7 +153,9 @@ public String getTargetProperty() { return targetProperty; } - /** @param targetProperty The targetProperty to set */ + /** + * @param targetProperty The targetProperty to set + */ public void setTargetProperty(String targetProperty) { this.targetProperty = targetProperty; } @@ -162,7 +169,9 @@ public ModelTargetHint getTargetHint() { return targetHint; } - /** @param targetHint The targetHint to set */ + /** + * @param targetHint The targetHint to set + */ public void setTargetHint(ModelTargetHint targetHint) { this.targetHint = targetHint; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutput.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutput.java index 3a01e43c463..21337c9e2f0 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutput.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutput.java @@ -17,6 +17,17 @@ package org.apache.hop.neo4j.transforms.graph; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -48,18 +59,6 @@ import org.neo4j.driver.summary.Notification; import org.neo4j.driver.summary.ResultSummary; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class GraphOutput extends BaseNeoTransform { public GraphOutput( @@ -1150,8 +1149,7 @@ private Set getInvolvedNodes( // With this value we can now look up the target label // - Map valueLabelMap = - data.nodeValueLabelMergeMap.get(node.getName()); + Map valueLabelMap = data.nodeValueLabelMergeMap.get(node.getName()); if (valueLabelMap == null) { throw new HopException( "No field-to-label mapping was specified for node " + node.getName()); @@ -1182,7 +1180,9 @@ private Set getInvolvedNodes( throw new HopException("No node labels could be found for node: " + node.getName()); } - SelectedNode selectedNode = new SelectedNode(node, targetHint, new ArrayList<>(labels), new ArrayList<>(labelsToSet)); + SelectedNode selectedNode = + new SelectedNode( + node, targetHint, new ArrayList<>(labels), new ArrayList<>(labelsToSet)); nodesSet.add(selectedNode); nodeProperties.add( @@ -1649,15 +1649,15 @@ public String getGraphNodeDataId(SelectedNode node, List no return id.toString(); } - public void checkGraphProperty(GraphProperty graphProperty){ - // check if the graph property contains any special characters. Escape with a backtick if it does. + public void checkGraphProperty(GraphProperty graphProperty) { + // check if the graph property contains any special characters. Escape with a backtick if it + // does. String graphPropertyValue = graphProperty.getName(); Pattern p = Pattern.compile("[^A-Za-z0-9]"); Matcher m = p.matcher(graphPropertyValue); - if(m.find()){ + if (m.find()) { graphPropertyValue = "`" + graphPropertyValue + "`"; graphProperty.setName(graphPropertyValue); } } - } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputData.java index d700d95a52b..9b71981dfe7 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputData.java @@ -17,6 +17,9 @@ package org.apache.hop.neo4j.transforms.graph; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.neo4j.model.GraphModel; import org.apache.hop.neo4j.model.GraphProperty; @@ -29,10 +32,6 @@ import org.neo4j.driver.Session; import org.neo4j.driver.Transaction; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class GraphOutputData extends BaseNeoTransformData implements ITransformData { public IRowMeta outputRowMeta; @@ -71,7 +70,8 @@ public static class RelationshipMappingIndexes { // For a merge on a specific node name, map a field value to the specified node label public Map> nodeValueLabelMergeMap; - // To set a label on a node after merge, for a specific node name, map a field value to the specified node label + // To set a label on a node after merge, for a specific node name, map a field value to the + // specified node label public Map> nodeValueLabelSetMap; public GraphOutputData() { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputDialog.java index 163024f53be..077c857573d 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputDialog.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputDialog.java @@ -17,6 +17,12 @@ package org.apache.hop.neo4j.transforms.graph; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -62,13 +68,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - public class GraphOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMeta.java index aaa347fc833..e66090df3c8 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.transforms.graph; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.row.IRowMeta; @@ -28,9 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "Neo4jGraphOutput", name = "i18n::GraphOutput.Name", @@ -129,7 +128,7 @@ public String getDialogClassName() { } @Override - public void setDefault(){ + public void setDefault() { batchSize = "1000"; } @@ -158,7 +157,9 @@ public String getConnectionName() { return connectionName; } - /** @param connectionName The connectionName to set */ + /** + * @param connectionName The connectionName to set + */ public void setConnectionName(String connectionName) { this.connectionName = connectionName; } @@ -172,7 +173,9 @@ public String getModel() { return model; } - /** @param model The model to set */ + /** + * @param model The model to set + */ public void setModel(String model) { this.model = model; } @@ -186,7 +189,9 @@ public String getBatchSize() { return batchSize; } - /** @param batchSize The batchSize to set */ + /** + * @param batchSize The batchSize to set + */ public void setBatchSize(String batchSize) { this.batchSize = batchSize; } @@ -200,7 +205,9 @@ public boolean isCreatingIndexes() { return creatingIndexes; } - /** @param creatingIndexes The creatingIndexes to set */ + /** + * @param creatingIndexes The creatingIndexes to set + */ public void setCreatingIndexes(boolean creatingIndexes) { this.creatingIndexes = creatingIndexes; } @@ -214,7 +221,9 @@ public List getFieldModelMappings() { return fieldModelMappings; } - /** @param fieldModelMappings The fieldModelMappings to set */ + /** + * @param fieldModelMappings The fieldModelMappings to set + */ public void setFieldModelMappings(List fieldModelMappings) { this.fieldModelMappings = fieldModelMappings; } @@ -228,7 +237,9 @@ public boolean isReturningGraph() { return returningGraph; } - /** @param returningGraph The returningGraph to set */ + /** + * @param returningGraph The returningGraph to set + */ public void setReturningGraph(boolean returningGraph) { this.returningGraph = returningGraph; } @@ -242,7 +253,9 @@ public String getReturnGraphField() { return returnGraphField; } - /** @param returnGraphField The returnGraphField to set */ + /** + * @param returnGraphField The returnGraphField to set + */ public void setReturnGraphField(String returnGraphField) { this.returnGraphField = returnGraphField; } @@ -256,7 +269,9 @@ public boolean isValidatingAgainstModel() { return validatingAgainstModel; } - /** @param validatingAgainstModel The validatingAgainstModel to set */ + /** + * @param validatingAgainstModel The validatingAgainstModel to set + */ public void setValidatingAgainstModel(boolean validatingAgainstModel) { this.validatingAgainstModel = validatingAgainstModel; } @@ -270,7 +285,9 @@ public boolean isOutOfOrderAllowed() { return outOfOrderAllowed; } - /** @param outOfOrderAllowed The outOfOrderAllowed to set */ + /** + * @param outOfOrderAllowed The outOfOrderAllowed to set + */ public void setOutOfOrderAllowed(boolean outOfOrderAllowed) { this.outOfOrderAllowed = outOfOrderAllowed; } @@ -284,7 +301,9 @@ public List getRelationshipMappings() { return relationshipMappings; } - /** @param relationshipMappings The relationshipMappings to set */ + /** + * @param relationshipMappings The relationshipMappings to set + */ public void setRelationshipMappings(List relationshipMappings) { this.relationshipMappings = relationshipMappings; } @@ -298,7 +317,9 @@ public List getNodeMappings() { return nodeMappings; } - /** @param nodeMappings The nodeMappings to set */ + /** + * @param nodeMappings The nodeMappings to set + */ public void setNodeMappings(List nodeMappings) { this.nodeMappings = nodeMappings; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/ModelTargetHint.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/ModelTargetHint.java index cd387ab407e..174b3e28dc2 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/ModelTargetHint.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/ModelTargetHint.java @@ -59,7 +59,9 @@ public String getCode() { return code; } - /** @param code The code to set */ + /** + * @param code The code to set + */ public void setCode(String code) { this.code = code; } @@ -73,7 +75,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMapping.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMapping.java index 7fdaeeaf85a..1cdbd031118 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMapping.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMapping.java @@ -17,9 +17,8 @@ package org.apache.hop.neo4j.transforms.graph; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class NodeMapping { @@ -126,7 +125,9 @@ public NodeMappingType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(NodeMappingType type) { this.type = type; } @@ -140,7 +141,9 @@ public String getTargetNode() { return targetNode; } - /** @param targetNode The targetNode to set */ + /** + * @param targetNode The targetNode to set + */ public void setTargetNode(String targetNode) { this.targetNode = targetNode; } @@ -154,7 +157,9 @@ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set */ + /** + * @param fieldName The fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } @@ -168,7 +173,9 @@ public String getFieldValue() { return fieldValue; } - /** @param fieldValue The fieldValue to set */ + /** + * @param fieldValue The fieldValue to set + */ public void setFieldValue(String fieldValue) { this.fieldValue = fieldValue; } @@ -182,7 +189,9 @@ public String getTargetLabel() { return targetLabel; } - /** @param targetLabel The targetLabel to set */ + /** + * @param targetLabel The targetLabel to set + */ public void setTargetLabel(String targetLabel) { this.targetLabel = targetLabel; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMappingType.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMappingType.java index a84c0417bdd..65ca3745a38 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMappingType.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/NodeMappingType.java @@ -61,7 +61,9 @@ public String getCode() { return code; } - /** @param code The code to set */ + /** + * @param code The code to set + */ public void setCode(String code) { this.code = code; } @@ -75,7 +77,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMapping.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMapping.java index 87ff9a45a63..a5ae4bc77df 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMapping.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMapping.java @@ -17,9 +17,8 @@ package org.apache.hop.neo4j.transforms.graph; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class RelationshipMapping { @@ -139,7 +138,9 @@ public RelationshipMappingType getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(RelationshipMappingType type) { this.type = type; } @@ -153,7 +154,9 @@ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set */ + /** + * @param fieldName The fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } @@ -167,7 +170,9 @@ public String getFieldValue() { return fieldValue; } - /** @param fieldValue The fieldValue to set */ + /** + * @param fieldValue The fieldValue to set + */ public void setFieldValue(String fieldValue) { this.fieldValue = fieldValue; } @@ -181,7 +186,9 @@ public String getTargetRelationship() { return targetRelationship; } - /** @param targetRelationship The targetRelationship to set */ + /** + * @param targetRelationship The targetRelationship to set + */ public void setTargetRelationship(String targetRelationship) { this.targetRelationship = targetRelationship; } @@ -195,7 +202,9 @@ public String getSourceNode() { return sourceNode; } - /** @param sourceNode The sourceNode to set */ + /** + * @param sourceNode The sourceNode to set + */ public void setSourceNode(String sourceNode) { this.sourceNode = sourceNode; } @@ -209,7 +218,9 @@ public String getTargetNode() { return targetNode; } - /** @param targetNode The targetNode to set */ + /** + * @param targetNode The targetNode to set + */ public void setTargetNode(String targetNode) { this.targetNode = targetNode; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMappingType.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMappingType.java index 319b2cbfc64..8ccc2c8cfa9 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMappingType.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/RelationshipMappingType.java @@ -61,7 +61,9 @@ public String getCode() { return code; } - /** @param code The code to set */ + /** + * @param code The code to set + */ public void setCode(String code) { this.code = code; } @@ -75,7 +77,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedNode.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedNode.java index 5a38da64b73..2f620e0eba0 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedNode.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedNode.java @@ -17,11 +17,10 @@ package org.apache.hop.neo4j.transforms.graph; -import org.apache.hop.neo4j.model.GraphNode; - import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.apache.hop.neo4j.model.GraphNode; public class SelectedNode { private GraphNode node; @@ -33,7 +32,8 @@ public SelectedNode() { this.labels = new ArrayList<>(); } - public SelectedNode(GraphNode node, ModelTargetHint hint, List labels, List labelsToSet) { + public SelectedNode( + GraphNode node, ModelTargetHint hint, List labels, List labelsToSet) { this.node = node; this.hint = hint; this.labels = labels; @@ -73,7 +73,9 @@ public GraphNode getNode() { return node; } - /** @param node The node to set */ + /** + * @param node The node to set + */ public void setNode(GraphNode node) { this.node = node; } @@ -87,7 +89,9 @@ public ModelTargetHint getHint() { return hint; } - /** @param hint The hint to set */ + /** + * @param hint The hint to set + */ public void setHint(ModelTargetHint hint) { this.hint = hint; } @@ -101,7 +105,9 @@ public List getLabels() { return labels; } - /** @param labels The labels to set */ + /** + * @param labels The labels to set + */ public void setLabels(List labels) { this.labels = labels; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedRelationship.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedRelationship.java index cffdc455b4d..c375dcbf891 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedRelationship.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/SelectedRelationship.java @@ -17,9 +17,8 @@ package org.apache.hop.neo4j.transforms.graph; -import org.apache.hop.neo4j.model.GraphRelationship; - import java.util.Objects; +import org.apache.hop.neo4j.model.GraphRelationship; public class SelectedRelationship { private SelectedNode sourceNode; @@ -71,7 +70,9 @@ public SelectedNode getSourceNode() { return sourceNode; } - /** @param sourceNode The sourceNode to set */ + /** + * @param sourceNode The sourceNode to set + */ public void setSourceNode(SelectedNode sourceNode) { this.sourceNode = sourceNode; } @@ -85,7 +86,9 @@ public SelectedNode getTargetNode() { return targetNode; } - /** @param targetNode The targetNode to set */ + /** + * @param targetNode The targetNode to set + */ public void setTargetNode(SelectedNode targetNode) { this.targetNode = targetNode; } @@ -99,7 +102,9 @@ public GraphRelationship getRelationship() { return relationship; } - /** @param relationship The relationship to set */ + /** + * @param relationship The relationship to set + */ public void setRelationship(GraphRelationship relationship) { this.relationship = relationship; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/TargetParameter.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/TargetParameter.java index c781dbfb55c..8e972b9d7c2 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/TargetParameter.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/graph/TargetParameter.java @@ -49,7 +49,9 @@ public String getInputField() { return inputField; } - /** @param inputField The inputField to set */ + /** + * @param inputField The inputField to set + */ public void setInputField(String inputField) { this.inputField = inputField; } @@ -63,7 +65,9 @@ public int getInputFieldIndex() { return inputFieldIndex; } - /** @param inputFieldIndex The inputFieldIndex to set */ + /** + * @param inputFieldIndex The inputFieldIndex to set + */ public void setInputFieldIndex(int inputFieldIndex) { this.inputFieldIndex = inputFieldIndex; } @@ -77,7 +81,9 @@ public String getParameterName() { return parameterName; } - /** @param parameterName The parameterName to set */ + /** + * @param parameterName The parameterName to set + */ public void setParameterName(String parameterName) { this.parameterName = parameterName; } @@ -91,7 +97,9 @@ public GraphPropertyType getParameterType() { return parameterType; } - /** @param parameterType The parameterType to set */ + /** + * @param parameterType The parameterType to set + */ public void setParameterType(GraphPropertyType parameterType) { this.parameterType = parameterType; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/Importer.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/Importer.java index 817d374eecd..9f027faa098 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/Importer.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/Importer.java @@ -18,6 +18,10 @@ package org.apache.hop.neo4j.transforms.importer; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; @@ -28,11 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - public class Importer extends BaseTransform { public Importer( diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterData.java index 31a5ebe78b4..0e666c08a2c 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterData.java @@ -18,11 +18,10 @@ package org.apache.hop.neo4j.transforms.importer; +import java.util.List; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class ImporterData extends BaseTransformData implements ITransformData { public List nodesFiles; diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterMeta.java index 3b5c2cc10cd..336d0339397 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/importer/ImporterMeta.java @@ -142,7 +142,9 @@ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set */ + /** + * @param filenameField The filenameField to set + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } @@ -156,7 +158,9 @@ public String getFileTypeField() { return fileTypeField; } - /** @param fileTypeField The fileTypeField to set */ + /** + * @param fileTypeField The fileTypeField to set + */ public void setFileTypeField(String fileTypeField) { this.fileTypeField = fileTypeField; } @@ -170,7 +174,9 @@ public String getBaseFolder() { return baseFolder; } - /** @param baseFolder The baseFolder to set */ + /** + * @param baseFolder The baseFolder to set + */ public void setBaseFolder(String baseFolder) { this.baseFolder = baseFolder; } @@ -184,7 +190,9 @@ public String getAdminCommand() { return adminCommand; } - /** @param adminCommand The adminCommand to set */ + /** + * @param adminCommand The adminCommand to set + */ public void setAdminCommand(String adminCommand) { this.adminCommand = adminCommand; } @@ -198,7 +206,9 @@ public String getReportFile() { return reportFile; } - /** @param reportFile The reportFile to set */ + /** + * @param reportFile The reportFile to set + */ public void setReportFile(String reportFile) { this.reportFile = reportFile; } @@ -212,7 +222,9 @@ public String getMaxMemory() { return maxMemory; } - /** @param maxMemory The maxMemory to set */ + /** + * @param maxMemory The maxMemory to set + */ public void setMaxMemory(String maxMemory) { this.maxMemory = maxMemory; } @@ -226,7 +238,9 @@ public boolean isSkippingDuplicateNodes() { return skippingDuplicateNodes; } - /** @param skippingDuplicateNodes The ignoringDuplicateNodes to set */ + /** + * @param skippingDuplicateNodes The ignoringDuplicateNodes to set + */ public void setSkippingDuplicateNodes(boolean skippingDuplicateNodes) { this.skippingDuplicateNodes = skippingDuplicateNodes; } @@ -240,7 +254,9 @@ public boolean isIgnoringExtraColumns() { return ignoringExtraColumns; } - /** @param ignoringExtraColumns The ignoringExtraColumns to set */ + /** + * @param ignoringExtraColumns The ignoringExtraColumns to set + */ public void setIgnoringExtraColumns(boolean ignoringExtraColumns) { this.ignoringExtraColumns = ignoringExtraColumns; } @@ -254,7 +270,9 @@ public boolean isHighIo() { return highIo; } - /** @param highIo The highIo to set */ + /** + * @param highIo The highIo to set + */ public void setHighIo(boolean highIo) { this.highIo = highIo; } @@ -268,7 +286,9 @@ public String getDatabaseName() { return databaseName; } - /** @param databaseName The databaseFilename to set */ + /** + * @param databaseName The databaseFilename to set + */ public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } @@ -282,7 +302,9 @@ public boolean isMultiLine() { return multiLine; } - /** @param multiLine The multiLine to set */ + /** + * @param multiLine The multiLine to set + */ public void setMultiLine(boolean multiLine) { this.multiLine = multiLine; } @@ -296,7 +318,9 @@ public boolean isSkippingBadRelationships() { return skippingBadRelationships; } - /** @param skippingBadRelationships The skippingBadRelationships to set */ + /** + * @param skippingBadRelationships The skippingBadRelationships to set + */ public void setSkippingBadRelationships(boolean skippingBadRelationships) { this.skippingBadRelationships = skippingBadRelationships; } @@ -310,7 +334,9 @@ public String getReadBufferSize() { return readBufferSize; } - /** @param readBufferSize The readBufferSize to set */ + /** + * @param readBufferSize The readBufferSize to set + */ public void setReadBufferSize(String readBufferSize) { this.readBufferSize = readBufferSize; } @@ -324,7 +350,9 @@ public boolean isCacheOnHeap() { return cacheOnHeap; } - /** @param cacheOnHeap The cacheOnHeap to set */ + /** + * @param cacheOnHeap The cacheOnHeap to set + */ public void setCacheOnHeap(boolean cacheOnHeap) { this.cacheOnHeap = cacheOnHeap; } @@ -338,7 +366,9 @@ public boolean isIgnoringEmptyStrings() { return ignoringEmptyStrings; } - /** @param ignoringEmptyStrings The ignoringEmptyStrings to set */ + /** + * @param ignoringEmptyStrings The ignoringEmptyStrings to set + */ public void setIgnoringEmptyStrings(boolean ignoringEmptyStrings) { this.ignoringEmptyStrings = ignoringEmptyStrings; } @@ -352,7 +382,9 @@ public boolean isQuotingLegacyStyle() { return quotingLegacyStyle; } - /** @param quotingLegacyStyle The quotingLegacyStyle to set */ + /** + * @param quotingLegacyStyle The quotingLegacyStyle to set + */ public void setQuotingLegacyStyle(boolean quotingLegacyStyle) { this.quotingLegacyStyle = quotingLegacyStyle; } @@ -366,7 +398,9 @@ public boolean isNormalizingTypes() { return normalizingTypes; } - /** @param normalizingTypes The normalizingTypes to set */ + /** + * @param normalizingTypes The normalizingTypes to set + */ public void setNormalizingTypes(boolean normalizingTypes) { this.normalizingTypes = normalizingTypes; } @@ -380,7 +414,9 @@ public boolean isSkippingBadEntriesLogging() { return skippingBadEntriesLogging; } - /** @param skippingBadEntriesLogging The skippingBadEntriesLogging to set */ + /** + * @param skippingBadEntriesLogging The skippingBadEntriesLogging to set + */ public void setSkippingBadEntriesLogging(boolean skippingBadEntriesLogging) { this.skippingBadEntriesLogging = skippingBadEntriesLogging; } @@ -394,7 +430,9 @@ public boolean isTrimmingStrings() { return trimmingStrings; } - /** @param trimmingStrings The trimmingStrings to set */ + /** + * @param trimmingStrings The trimmingStrings to set + */ public void setTrimmingStrings(boolean trimmingStrings) { this.trimmingStrings = trimmingStrings; } @@ -408,7 +446,9 @@ public String getBadTolerance() { return badTolerance; } - /** @param badTolerance The badTollerance to set */ + /** + * @param badTolerance The badTollerance to set + */ public void setBadTolerance(String badTolerance) { this.badTolerance = badTolerance; } @@ -422,7 +462,9 @@ public String getProcessors() { return processors; } - /** @param processors The processors to set */ + /** + * @param processors The processors to set + */ public void setProcessors(String processors) { this.processors = processors; } @@ -436,7 +478,9 @@ public boolean isVerbose() { return verbose; } - /** @param verbose The verbose to set */ + /** + * @param verbose The verbose to set + */ public void setVerbose(boolean verbose) { this.verbose = verbose; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfo.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfo.java index f0f94d85e49..dd4678955a2 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfo.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfo.java @@ -18,6 +18,13 @@ package org.apache.hop.neo4j.transforms.loginfo; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -34,14 +41,6 @@ import org.neo4j.driver.Record; import org.neo4j.driver.Result; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** Get information from the System or the supervising pipeline. */ public class GetLoggingInfo extends BaseTransform { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfoMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfoMeta.java index 4e24013898b..86f4dc938d7 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfoMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/GetLoggingInfoMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.neo4j.transforms.loginfo; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,9 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.List; - @Transform( id = "GetLoggingInfo", name = "i18n::GetLoggingInfoDialog.DialogTitle", @@ -51,7 +50,8 @@ documentationUrl = "/pipeline/transforms/neo4j-getloginfo.html") @InjectionSupported(localizationPrefix = "GetLoggingInfoMeta.Injection.") public class GetLoggingInfoMeta extends BaseTransformMeta { - private static final Class PKG = GetLoggingInfoMeta.class; // for i18n purposes, needed by Translator2!! + private static final Class PKG = + GetLoggingInfoMeta.class; // for i18n purposes, needed by Translator2!! @Injection(name = "FIELD_NAME") private String[] fieldName; @@ -66,22 +66,30 @@ public GetLoggingInfoMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String[] getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String[] fieldName) { this.fieldName = fieldName; } - /** @return Returns the fieldType. */ + /** + * @return Returns the fieldType. + */ public GetLoggingInfoTypes[] getFieldType() { return fieldType; } - /** @param fieldType The fieldType to set. */ + /** + * @param fieldType The fieldType to set. + */ public void setFieldType(GetLoggingInfoTypes[] fieldType) { this.fieldType = fieldType; } @@ -95,7 +103,9 @@ public String[] getFieldArgument() { return fieldArgument; } - /** @param fieldArgument The fieldArgument to set */ + /** + * @param fieldArgument The fieldArgument to set + */ public void setFieldArgument(String[] fieldArgument) { this.fieldArgument = fieldArgument; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/Management.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/Management.java index a0fba40bd66..f43c5b42de2 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/Management.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/loginfo/Management.java @@ -19,11 +19,10 @@ package org.apache.hop.neo4j.transforms.loginfo; import com.sun.management.OperatingSystemMXBean; -import org.apache.hop.core.Const; - import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.lang.management.ThreadMXBean; +import org.apache.hop.core.Const; public class Management { private static RuntimeMXBean mx = null; @@ -32,7 +31,9 @@ public class Management { /** Return infos like current PID, JVM memory, ... */ - /** @return Process CPU time in nanoseconds */ + /** + * @return Process CPU time in nanoseconds + */ public static long getPID() { String pid = null; if (mx == null) { @@ -47,31 +48,41 @@ public static long getPID() { return Const.toInt(pid, -1); } - /** @return JVM CPU time in nanoseconds */ + /** + * @return JVM CPU time in nanoseconds + */ public static long getJVMCpuTime() { setOperatingSystemMXBean(); return bean.getProcessCpuTime(); } - /** @return the amount of free physical memory in bytes */ + /** + * @return the amount of free physical memory in bytes + */ public static long getFreePhysicalMemorySize() { setOperatingSystemMXBean(); return bean.getFreePhysicalMemorySize(); } - /** @return the amount of free swap space in bytes */ + /** + * @return the amount of free swap space in bytes + */ public static long getFreeSwapSpaceSize() { setOperatingSystemMXBean(); return bean.getFreeSwapSpaceSize(); } - /** @return the total amount of physical memory in bytes */ + /** + * @return the total amount of physical memory in bytes + */ public static long getTotalPhysicalMemorySize() { setOperatingSystemMXBean(); return bean.getTotalPhysicalMemorySize(); } - /** @return the total amount of swap space in bytes. */ + /** + * @return the total amount of swap space in bytes. + */ public static long getTotalSwapSpaceSize() { setOperatingSystemMXBean(); return bean.getTotalSwapSpaceSize(); @@ -86,7 +97,9 @@ public static long getCommittedVirtualMemorySize() { return bean.getCommittedVirtualMemorySize(); } - /** @return CPU time in nanoseconds. */ + /** + * @return CPU time in nanoseconds. + */ public static long getCpuTime(long id) { setThreadMXBean(); if (!tbean.isThreadCpuTimeSupported()) { diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutput.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutput.java index 4d251a1db85..538a67edf19 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutput.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutput.java @@ -17,6 +17,15 @@ package org.apache.hop.neo4j.transforms.output; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -42,16 +51,6 @@ import org.neo4j.driver.summary.Notification; import org.neo4j.driver.summary.ResultSummary; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - public class Neo4JOutput extends BaseNeoTransform { public Neo4JOutput( @@ -278,7 +277,8 @@ private void validateConfiguration() throws HopException { } } if (noFromKey) { - throw new HopException("Please specify at least one or more primary key properties in the 'from' node"); + throw new HopException( + "Please specify at least one or more primary key properties in the 'from' node"); } boolean noToKey = true; for (boolean key : meta.getToNodePropPrimary()) { @@ -288,7 +288,8 @@ private void validateConfiguration() throws HopException { } } if (noToKey) { - throw new HopException("Please specify at least one or more primary key properties in the 'to' node"); + throw new HopException( + "Please specify at least one or more primary key properties in the 'to' node"); } } } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputData.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputData.java index f5418265201..1c78a4a806b 100755 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputData.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputData.java @@ -18,6 +18,8 @@ package org.apache.hop.neo4j.transforms.output; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.neo4j.model.GraphPropertyType; import org.apache.hop.neo4j.shared.NeoConnection; @@ -26,9 +28,6 @@ import org.neo4j.driver.Driver; import org.neo4j.driver.Session; -import java.util.List; -import java.util.Map; - public class Neo4JOutputData extends BaseNeoTransformData implements ITransformData { public IRowMeta outputRowMeta; @@ -81,7 +80,7 @@ public class Neo4JOutputData extends BaseNeoTransformData implements ITransformD public String cypher; public boolean version4; - + public Neo4JOutputData() { super(); } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputMeta.java index fb875be45b1..ff72b41ff90 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputMeta.java @@ -18,6 +18,7 @@ package org.apache.hop.neo4j.transforms.output; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -42,8 +43,6 @@ import org.eclipse.swt.widgets.Shell; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "Neo4JOutput", image = "neo4j_output.svg", @@ -493,7 +492,9 @@ public String getConnection() { return connection; } - /** @param connection The connection to set */ + /** + * @param connection The connection to set + */ public void setConnection(String connection) { this.connection = connection; } @@ -507,7 +508,9 @@ public String getBatchSize() { return batchSize; } - /** @param batchSize The batchSize to set */ + /** + * @param batchSize The batchSize to set + */ public void setBatchSize(String batchSize) { this.batchSize = batchSize; } @@ -521,7 +524,9 @@ public boolean isCreatingIndexes() { return creatingIndexes; } - /** @param creatingIndexes The creatingIndexes to set */ + /** + * @param creatingIndexes The creatingIndexes to set + */ public void setCreatingIndexes(boolean creatingIndexes) { this.creatingIndexes = creatingIndexes; } @@ -535,7 +540,9 @@ public boolean isUsingCreate() { return usingCreate; } - /** @param usingCreate The usingCreate to set */ + /** + * @param usingCreate The usingCreate to set + */ public void setUsingCreate(boolean usingCreate) { this.usingCreate = usingCreate; } @@ -549,7 +556,9 @@ public boolean isOnlyCreatingRelationships() { return onlyCreatingRelationships; } - /** @param onlyCreatingRelationships The onlyCreatingRelationships to set */ + /** + * @param onlyCreatingRelationships The onlyCreatingRelationships to set + */ public void setOnlyCreatingRelationships(boolean onlyCreatingRelationships) { this.onlyCreatingRelationships = onlyCreatingRelationships; } @@ -563,7 +572,9 @@ public String[] getFromNodeProps() { return fromNodeProps; } - /** @param fromNodeProps The fromNodeProps to set */ + /** + * @param fromNodeProps The fromNodeProps to set + */ public void setFromNodeProps(String[] fromNodeProps) { this.fromNodeProps = fromNodeProps; } @@ -577,7 +588,9 @@ public String[] getFromNodePropNames() { return fromNodePropNames; } - /** @param fromNodePropNames The fromNodePropNames to set */ + /** + * @param fromNodePropNames The fromNodePropNames to set + */ public void setFromNodePropNames(String[] fromNodePropNames) { this.fromNodePropNames = fromNodePropNames; } @@ -591,7 +604,9 @@ public String[] getFromNodePropTypes() { return fromNodePropTypes; } - /** @param fromNodePropTypes The fromNodePropTypes to set */ + /** + * @param fromNodePropTypes The fromNodePropTypes to set + */ public void setFromNodePropTypes(String[] fromNodePropTypes) { this.fromNodePropTypes = fromNodePropTypes; } @@ -605,7 +620,9 @@ public boolean[] getFromNodePropPrimary() { return fromNodePropPrimary; } - /** @param fromNodePropPrimary The fromNodePropPrimary to set */ + /** + * @param fromNodePropPrimary The fromNodePropPrimary to set + */ public void setFromNodePropPrimary(boolean[] fromNodePropPrimary) { this.fromNodePropPrimary = fromNodePropPrimary; } @@ -619,7 +636,9 @@ public String[] getToNodeProps() { return toNodeProps; } - /** @param toNodeProps The toNodeProps to set */ + /** + * @param toNodeProps The toNodeProps to set + */ public void setToNodeProps(String[] toNodeProps) { this.toNodeProps = toNodeProps; } @@ -633,7 +652,9 @@ public String[] getToNodePropNames() { return toNodePropNames; } - /** @param toNodePropNames The toNodePropNames to set */ + /** + * @param toNodePropNames The toNodePropNames to set + */ public void setToNodePropNames(String[] toNodePropNames) { this.toNodePropNames = toNodePropNames; } @@ -647,7 +668,9 @@ public String[] getToNodePropTypes() { return toNodePropTypes; } - /** @param toNodePropTypes The toNodePropTypes to set */ + /** + * @param toNodePropTypes The toNodePropTypes to set + */ public void setToNodePropTypes(String[] toNodePropTypes) { this.toNodePropTypes = toNodePropTypes; } @@ -661,7 +684,9 @@ public boolean[] getToNodePropPrimary() { return toNodePropPrimary; } - /** @param toNodePropPrimary The toNodePropPrimary to set */ + /** + * @param toNodePropPrimary The toNodePropPrimary to set + */ public void setToNodePropPrimary(boolean[] toNodePropPrimary) { this.toNodePropPrimary = toNodePropPrimary; } @@ -675,7 +700,9 @@ public String[] getFromNodeLabels() { return fromNodeLabels; } - /** @param fromNodeLabels The fromNodeLabels to set */ + /** + * @param fromNodeLabels The fromNodeLabels to set + */ public void setFromNodeLabels(String[] fromNodeLabels) { this.fromNodeLabels = fromNodeLabels; } @@ -689,7 +716,9 @@ public String[] getToNodeLabels() { return toNodeLabels; } - /** @param toNodeLabels The toNodeLabels to set */ + /** + * @param toNodeLabels The toNodeLabels to set + */ public void setToNodeLabels(String[] toNodeLabels) { this.toNodeLabels = toNodeLabels; } @@ -703,7 +732,9 @@ public String[] getRelProps() { return relProps; } - /** @param relProps The relProps to set */ + /** + * @param relProps The relProps to set + */ public void setRelProps(String[] relProps) { this.relProps = relProps; } @@ -717,7 +748,9 @@ public String[] getRelPropNames() { return relPropNames; } - /** @param relPropNames The relPropNames to set */ + /** + * @param relPropNames The relPropNames to set + */ public void setRelPropNames(String[] relPropNames) { this.relPropNames = relPropNames; } @@ -731,7 +764,9 @@ public String[] getRelPropTypes() { return relPropTypes; } - /** @param relPropTypes The relPropTypes to set */ + /** + * @param relPropTypes The relPropTypes to set + */ public void setRelPropTypes(String[] relPropTypes) { this.relPropTypes = relPropTypes; } @@ -745,7 +780,9 @@ public String getKey() { return key; } - /** @param key The key to set */ + /** + * @param key The key to set + */ public void setKey(String key) { this.key = key; } @@ -759,7 +796,9 @@ public String getRelationship() { return relationship; } - /** @param relationship The relationship to set */ + /** + * @param relationship The relationship to set + */ public void setRelationship(String relationship) { this.relationship = relationship; } @@ -773,7 +812,9 @@ public String[] getFromNodeLabelValues() { return fromNodeLabelValues; } - /** @param fromNodeLabelValues The fromNodeLabelValues to set */ + /** + * @param fromNodeLabelValues The fromNodeLabelValues to set + */ public void setFromNodeLabelValues(String[] fromNodeLabelValues) { this.fromNodeLabelValues = fromNodeLabelValues; } @@ -787,7 +828,9 @@ public String[] getToNodeLabelValues() { return toNodeLabelValues; } - /** @param toNodeLabelValues The toNodeLabelValues to set */ + /** + * @param toNodeLabelValues The toNodeLabelValues to set + */ public void setToNodeLabelValues(String[] toNodeLabelValues) { this.toNodeLabelValues = toNodeLabelValues; } @@ -801,7 +844,9 @@ public String getRelationshipValue() { return relationshipValue; } - /** @param relationshipValue The relationshipValue to set */ + /** + * @param relationshipValue The relationshipValue to set + */ public void setRelationshipValue(String relationshipValue) { this.relationshipValue = relationshipValue; } @@ -815,7 +860,9 @@ public boolean isReturningGraph() { return returningGraph; } - /** @param returningGraph The returningGraph to set */ + /** + * @param returningGraph The returningGraph to set + */ public void setReturningGraph(boolean returningGraph) { this.returningGraph = returningGraph; } @@ -829,7 +876,9 @@ public String getReturnGraphField() { return returnGraphField; } - /** @param returnGraphField The returnGraphField to set */ + /** + * @param returnGraphField The returnGraphField to set + */ public void setReturnGraphField(String returnGraphField) { this.returnGraphField = returnGraphField; } @@ -843,7 +892,9 @@ public boolean isReadOnlyFromNode() { return readOnlyFromNode; } - /** @param readOnlyFromNode The readOnlyFromNode to set */ + /** + * @param readOnlyFromNode The readOnlyFromNode to set + */ public void setReadOnlyFromNode(boolean readOnlyFromNode) { this.readOnlyFromNode = readOnlyFromNode; } @@ -857,7 +908,9 @@ public boolean isReadOnlyToNode() { return readOnlyToNode; } - /** @param readOnlyToNode The readOnlyToNode to set */ + /** + * @param readOnlyToNode The readOnlyToNode to set + */ public void setReadOnlyToNode(boolean readOnlyToNode) { this.readOnlyToNode = readOnlyToNode; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/split/SplitGraphMeta.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/split/SplitGraphMeta.java index 3c754250183..4db3b8d2cf4 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/split/SplitGraphMeta.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/split/SplitGraphMeta.java @@ -113,7 +113,9 @@ public String getGraphField() { return graphField; } - /** @param graphField The graphField to set */ + /** + * @param graphField The graphField to set + */ public void setGraphField(String graphField) { this.graphField = graphField; } @@ -127,7 +129,9 @@ public String getTypeField() { return typeField; } - /** @param typeField The typeField to set */ + /** + * @param typeField The typeField to set + */ public void setTypeField(String typeField) { this.typeField = typeField; } @@ -141,7 +145,9 @@ public String getIdField() { return idField; } - /** @param idField The idField to set */ + /** + * @param idField The idField to set + */ public void setIdField(String idField) { this.idField = idField; } @@ -155,7 +161,9 @@ public String getPropertySetField() { return propertySetField; } - /** @param propertySetField The propertySetField to set */ + /** + * @param propertySetField The propertySetField to set + */ public void setPropertySetField(String propertySetField) { this.propertySetField = propertySetField; } diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/xp/RegisterMetadataObjectsExtensionPoint.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/xp/RegisterMetadataObjectsExtensionPoint.java index 3e9231db7e1..1889a8e79ec 100644 --- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/xp/RegisterMetadataObjectsExtensionPoint.java +++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/xp/RegisterMetadataObjectsExtensionPoint.java @@ -18,6 +18,8 @@ package org.apache.hop.neo4j.xp; +import java.net.URL; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.extension.ExtensionPoint; import org.apache.hop.core.extension.ExtensionPointPluginType; @@ -31,9 +33,6 @@ import org.apache.hop.neo4j.model.GraphModel; import org.apache.hop.neo4j.shared.NeoConnection; -import java.net.URL; -import java.util.List; - @ExtensionPoint( id = "RegisterMetadataObjectsExtensionPoint", extensionPointId = "HopEnvironmentAfterInit", diff --git a/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMetaTest.java b/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMetaTest.java index d55474c129b..e721a265584 100644 --- a/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMetaTest.java +++ b/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/cypherbuilder/CypherBuilderMetaTest.java @@ -18,6 +18,9 @@ package org.apache.hop.neo4j.transforms.cypherbuilder; +import static org.junit.Assert.assertEquals; + +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.variables.IVariables; import org.apache.hop.core.variables.Variables; @@ -36,10 +39,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertEquals; - public class CypherBuilderMetaTest { private IVariables variables; @@ -63,7 +62,8 @@ public void testMergeNode1() throws Exception { meta.getOperations().add(merge); assertEquals( - "MERGE(n:Customer {id:{pId}} ) SET n.lastName={pLastName}, n.firstName={pFirstName} " + Const.CR, + "MERGE(n:Customer {id:{pId}} ) SET n.lastName={pLastName}, n.firstName={pFirstName} " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -81,8 +81,10 @@ public void testMergeNodeUnwind1() throws Exception { meta.getOperations().add(merge); assertEquals( - "UNWIND $rows AS row " + Const.CR - + "MERGE(n:Customer {id:row.pId} ) SET n.lastName=row.pLastName, n.firstName=row.pFirstName " + Const.CR, + "UNWIND $rows AS row " + + Const.CR + + "MERGE(n:Customer {id:row.pId} ) SET n.lastName=row.pLastName, n.firstName=row.pFirstName " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -118,8 +120,10 @@ public void testCreateNodeUnwind1() throws Exception { meta.getOperations().add(create); assertEquals( - "UNWIND $rows AS row " + Const.CR - + "CREATE(n:Customer {id:row.pId} ) SET n.firstName=row.pFirstName " + Const.CR, + "UNWIND $rows AS row " + + Const.CR + + "CREATE(n:Customer {id:row.pId} ) SET n.firstName=row.pFirstName " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -153,7 +157,7 @@ public void testMatchNodeUnwind1() throws Exception { assertEquals( "UNWIND $rows AS row " + Const.CR + "MATCH(c:Customer {id:row.pId} ) " + Const.CR, - meta.getCypher(variables)); + meta.getCypher(variables)); testSerialization(meta); } @@ -176,8 +180,10 @@ public void testMatchReturnNode1() throws Exception { meta.getOperations().add(ret); assertEquals( - "MATCH(c:Customer {id:{pId}} ) " + Const.CR - + "RETURN c.firstName AS first_name, c.lastName AS last_name " + Const.CR, + "MATCH(c:Customer {id:{pId}} ) " + + Const.CR + + "RETURN c.firstName AS first_name, c.lastName AS last_name " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -203,9 +209,12 @@ public void testMatchEdge1() throws Exception { meta.getOperations().add(edgeCreate); assertEquals( - "MATCH(c:Customer {id:{pId}} ) " + Const.CR - + "MATCH(o:Location {zipCode:{pZipCode}} ) " + Const.CR - + "MATCH(c)-[r:HAS_LOCATION]->(o) " + Const.CR, + "MATCH(c:Customer {id:{pId}} ) " + + Const.CR + + "MATCH(o:Location {zipCode:{pZipCode}} ) " + + Const.CR + + "MATCH(c)-[r:HAS_LOCATION]->(o) " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -231,9 +240,12 @@ public void testCreateEdge1() throws Exception { meta.getOperations().add(edgeCreate); assertEquals( - "MATCH(c:Customer {id:{pId}} ) " + Const.CR - + "MATCH(o:Location {zipCode:{pZipCode}} ) " + Const.CR - + "CREATE(c)-[r:HAS_LOCATION]->(o) " + Const.CR, + "MATCH(c:Customer {id:{pId}} ) " + + Const.CR + + "MATCH(o:Location {zipCode:{pZipCode}} ) " + + Const.CR + + "CREATE(c)-[r:HAS_LOCATION]->(o) " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -259,9 +271,12 @@ public void testMergeEdge1() throws Exception { meta.getOperations().add(edgeCreate); assertEquals( - "MATCH(c:Customer {id:{pId}} ) " + Const.CR - + "MATCH(o:Location {zipCode:{pZipCode}} ) " + Const.CR - + "MERGE(c)-[r:HAS_LOCATION]->(o) " + Const.CR, + "MATCH(c:Customer {id:{pId}} ) " + + Const.CR + + "MATCH(o:Location {zipCode:{pZipCode}} ) " + + Const.CR + + "MERGE(c)-[r:HAS_LOCATION]->(o) " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } @@ -295,10 +310,14 @@ public void testMatchEdgeReturn1() throws Exception { meta.getOperations().add(ret); assertEquals( - "MATCH(c:Customer {id:{pId}} ) " + Const.CR - + "MATCH(o:Location {zipCode:{pZipCode}} ) " + Const.CR - + "MATCH(c)-[r:HAS_LOCATION]->(o) " + Const.CR - + "RETURN c.firstName AS first_name, c.lastName AS last_name, o.city " + Const.CR, + "MATCH(c:Customer {id:{pId}} ) " + + Const.CR + + "MATCH(o:Location {zipCode:{pZipCode}} ) " + + Const.CR + + "MATCH(c)-[r:HAS_LOCATION]->(o) " + + Const.CR + + "RETURN c.firstName AS first_name, c.lastName AS last_name, o.city " + + Const.CR, meta.getCypher(variables)); testSerialization(meta); } diff --git a/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMetaTest.java b/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMetaTest.java index 94121baa73b..9e4e2ca2fe6 100644 --- a/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMetaTest.java +++ b/plugins/tech/neo4j/src/test/java/org/apache/hop/neo4j/transforms/graph/GraphOutputMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.neo4j.transforms.graph; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; -import org.apache.hop.pipeline.transform.TransformMeta; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - -import static org.junit.Assert.assertEquals; +import org.apache.hop.core.xml.XmlHandler; +import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; +import org.apache.hop.pipeline.transform.TransformMeta; +import org.junit.Test; public class GraphOutputMetaTest { @Test diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetField.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetField.java index 28154bee5d2..d90fe7884a5 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetField.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetField.java @@ -86,7 +86,9 @@ public String getSourceField() { return sourceField; } - /** @param sourceField The sourceField to set */ + /** + * @param sourceField The sourceField to set + */ public void setSourceField(String sourceField) { this.sourceField = sourceField; } @@ -100,7 +102,9 @@ public String getTargetField() { return targetField; } - /** @param targetField The targetField to set */ + /** + * @param targetField The targetField to set + */ public void setTargetField(String targetField) { this.targetField = targetField; } @@ -114,7 +118,9 @@ public String getTargetType() { return targetType; } - /** @param targetType The targetType to set */ + /** + * @param targetType The targetType to set + */ public void setTargetType(String targetType) { this.targetType = targetType; } @@ -128,7 +134,9 @@ public String getTargetFormat() { return targetFormat; } - /** @param targetFormat The targetFormat to set */ + /** + * @param targetFormat The targetFormat to set + */ public void setTargetFormat(String targetFormat) { this.targetFormat = targetFormat; } @@ -142,7 +150,9 @@ public String getTargetLength() { return targetLength; } - /** @param targetLength The targetLength to set */ + /** + * @param targetLength The targetLength to set + */ public void setTargetLength(String targetLength) { this.targetLength = targetLength; } @@ -156,7 +166,9 @@ public String getTargetPrecision() { return targetPrecision; } - /** @param targetPrecision The targetPrecision to set */ + /** + * @param targetPrecision The targetPrecision to set + */ public void setTargetPrecision(String targetPrecision) { this.targetPrecision = targetPrecision; } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInput.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInput.java index 6b55293f785..ba5d4fd60de 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInput.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInput.java @@ -17,6 +17,8 @@ package org.apache.hop.parquet.transforms.input; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.RowMetaAndData; @@ -29,11 +31,7 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.parquet.hadoop.ParquetReader; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - -public class ParquetInput extends BaseTransform -{ +public class ParquetInput extends BaseTransform { public ParquetInput( TransformMeta transformMeta, ParquetInputMeta meta, diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputData.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputData.java index c430765c352..ae9ccde57a9 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputData.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputData.java @@ -21,10 +21,10 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -public class ParquetInputData extends BaseTransformData implements ITransformData { +public class ParquetInputData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public int filenameFieldIndex; - + public ParquetInputData() { super(); } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputDialog.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputDialog.java index 5da45009e46..86660b4df95 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputDialog.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.parquet.transforms.input; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -54,11 +58,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - public class ParquetInputDialog extends BaseTransformDialog implements ITransformDialog { public static final Class PKG = ParquetInputMeta.class; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputMeta.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputMeta.java index 29b3644f937..1d2f1c092eb 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputMeta.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.parquet.transforms.input; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -28,9 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "ParquetFileInput", image = "parquet_input.svg", @@ -83,7 +82,9 @@ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set */ + /** + * @param filenameField The filenameField to set + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } @@ -97,7 +98,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputStream.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputStream.java index a6496b58ca9..9b9d5fdbd8b 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputStream.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetInputStream.java @@ -17,14 +17,13 @@ package org.apache.hop.parquet.transforms.input; -import org.apache.hop.core.exception.HopException; -import org.apache.parquet.io.SeekableInputStream; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import org.apache.hop.core.exception.HopException; +import org.apache.parquet.io.SeekableInputStream; public class ParquetInputStream extends SeekableInputStream { diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReadSupport.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReadSupport.java index 80471d41fd7..30374903ebc 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReadSupport.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReadSupport.java @@ -17,6 +17,9 @@ package org.apache.hop.parquet.transforms.input; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hadoop.conf.Configuration; import org.apache.hop.core.RowMetaAndData; import org.apache.parquet.hadoop.api.InitContext; @@ -24,10 +27,6 @@ import org.apache.parquet.io.api.RecordMaterializer; import org.apache.parquet.schema.MessageType; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ParquetReadSupport extends ReadSupport { private List fields; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReaderBuilder.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReaderBuilder.java index ada31a1804b..1349ea6bb1e 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReaderBuilder.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetReaderBuilder.java @@ -17,12 +17,11 @@ package org.apache.hop.parquet.transforms.input; +import java.util.Objects; import org.apache.parquet.hadoop.ParquetReader; import org.apache.parquet.hadoop.api.ReadSupport; import org.apache.parquet.io.InputFile; -import java.util.Objects; - public class ParquetReaderBuilder extends ParquetReader.Builder { private final ReadSupport readSupport; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRecordMaterializer.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRecordMaterializer.java index d903fe518c7..5026c8c07bd 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRecordMaterializer.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRecordMaterializer.java @@ -17,6 +17,8 @@ package org.apache.hop.parquet.transforms.input; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -25,9 +27,6 @@ import org.apache.parquet.io.api.RecordMaterializer; import org.apache.parquet.schema.MessageType; -import java.util.ArrayList; -import java.util.List; - public class ParquetRecordMaterializer extends RecordMaterializer { private final ParquetRowConverter root; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRowConverter.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRowConverter.java index f66526a3e3a..95bda470025 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRowConverter.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetRowConverter.java @@ -17,6 +17,7 @@ package org.apache.hop.parquet.transforms.input; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowDataUtil; @@ -24,8 +25,6 @@ import org.apache.parquet.io.api.GroupConverter; import org.apache.parquet.schema.MessageType; -import java.util.List; - public class ParquetRowConverter extends GroupConverter { private final MessageType messageType; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetStream.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetStream.java index b28bed55152..1719bd7676f 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetStream.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetStream.java @@ -17,13 +17,12 @@ package org.apache.hop.parquet.transforms.input; +import java.io.ByteArrayInputStream; +import java.io.IOException; import org.apache.parquet.io.DelegatingSeekableInputStream; import org.apache.parquet.io.InputFile; import org.apache.parquet.io.SeekableInputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; - public class ParquetStream implements InputFile { private final byte[] data; private final String filename; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetValueConverter.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetValueConverter.java index 2447b0bee23..72e3d9fbda8 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetValueConverter.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/input/ParquetValueConverter.java @@ -17,15 +17,14 @@ package org.apache.hop.parquet.transforms.input; -import org.apache.hop.core.RowMetaAndData; -import org.apache.hop.core.row.IValueMeta; -import org.apache.parquet.io.api.Binary; -import org.apache.parquet.io.api.PrimitiveConverter; - import java.math.BigDecimal; import java.math.BigInteger; import java.nio.ByteBuffer; import java.util.Date; +import org.apache.hop.core.RowMetaAndData; +import org.apache.hop.core.row.IValueMeta; +import org.apache.parquet.io.api.Binary; +import org.apache.parquet.io.api.PrimitiveConverter; public class ParquetValueConverter extends PrimitiveConverter { @@ -151,7 +150,7 @@ public void addInt(int value) { /** * Source code from: * - * apache/parquet-mr/parquet-pig/src/main/java/org/apache/parquet/pig/convert/DecimalUtils.java + *

apache/parquet-mr/parquet-pig/src/main/java/org/apache/parquet/pig/convert/DecimalUtils.java * * @param value * @param precision diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetField.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetField.java index 1d60c2eb742..5ff0b477c59 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetField.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetField.java @@ -46,7 +46,9 @@ public String getSourceFieldName() { return sourceFieldName; } - /** @param sourceFieldName The sourceFieldName to set */ + /** + * @param sourceFieldName The sourceFieldName to set + */ public void setSourceFieldName(String sourceFieldName) { this.sourceFieldName = sourceFieldName; } @@ -60,7 +62,9 @@ public String getTargetFieldName() { return targetFieldName; } - /** @param targetFieldName The targetFieldName to set */ + /** + * @param targetFieldName The targetFieldName to set + */ public void setTargetFieldName(String targetFieldName) { this.targetFieldName = targetFieldName; } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutput.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutput.java index e681ded16be..43d7c327d3f 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutput.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutput.java @@ -17,6 +17,10 @@ package org.apache.hop.parquet.transforms.output; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; import org.apache.avro.LogicalTypes; import org.apache.avro.Schema; import org.apache.avro.SchemaBuilder; @@ -37,11 +41,6 @@ import org.apache.parquet.hadoop.ParquetWriter; import org.apache.parquet.schema.MessageType; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; - public class ParquetOutput extends BaseTransform { public ParquetOutput( @@ -270,7 +269,7 @@ private String buildFilename(Date date) { filename += "-" + new DecimalFormat("0000").format(data.split); } if (data.isBeamContext()) { - filename+= "_"+log.getLogChannelId()+"_"+data.getBeamBundleNr(); + filename += "_" + log.getLogChannelId() + "_" + data.getBeamBundleNr(); } filename += "." + Const.NVL(resolve(meta.getFilenameExtension()), "parquet"); filename += meta.getCompressionCodec().getExtension(); diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputData.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputData.java index 428731ec463..aa89a95ebcb 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputData.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputData.java @@ -17,6 +17,8 @@ package org.apache.hop.parquet.transforms.output; +import java.io.OutputStream; +import java.util.ArrayList; import org.apache.avro.Schema; import org.apache.hadoop.conf.Configuration; import org.apache.hop.core.RowMetaAndData; @@ -25,9 +27,6 @@ import org.apache.parquet.column.ParquetProperties; import org.apache.parquet.hadoop.ParquetWriter; -import java.io.OutputStream; -import java.util.ArrayList; - public class ParquetOutputData extends BaseTransformData implements ITransformData { public ArrayList sourceFieldIndexes; public Configuration conf; @@ -43,8 +42,8 @@ public class ParquetOutputData extends BaseTransformData implements ITransformDa public int pageSize; public int dictionaryPageSize; public Schema avroSchema; - + public ParquetOutputData() { - super(); + super(); } } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputFile.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputFile.java index e2aa5a2a2df..4e6811f1ef0 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputFile.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputFile.java @@ -17,11 +17,10 @@ package org.apache.hop.parquet.transforms.output; +import java.io.OutputStream; import org.apache.parquet.io.OutputFile; import org.apache.parquet.io.PositionOutputStream; -import java.io.OutputStream; - public class ParquetOutputFile implements OutputFile { private final OutputStream outputStream; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputMeta.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputMeta.java index dc8a878aac9..2ee01019d6e 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputMeta.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputMeta.java @@ -17,15 +17,14 @@ package org.apache.hop.parquet.transforms.output; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.parquet.column.ParquetProperties; import org.apache.parquet.hadoop.metadata.CompressionCodecName; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "ParquetFileOutput", image = "parquet_output.svg", @@ -127,7 +126,9 @@ public String getFilenameBase() { return filenameBase; } - /** @param filenameBase The filenameBase to set */ + /** + * @param filenameBase The filenameBase to set + */ public void setFilenameBase(String filenameBase) { this.filenameBase = filenameBase; } @@ -141,7 +142,9 @@ public String getFilenameExtension() { return filenameExtension; } - /** @param filenameExtension The filenameExtension to set */ + /** + * @param filenameExtension The filenameExtension to set + */ public void setFilenameExtension(String filenameExtension) { this.filenameExtension = filenameExtension; } @@ -155,7 +158,9 @@ public boolean isFilenameIncludingDate() { return filenameIncludingDate; } - /** @param filenameIncludingDate The filenameIncludingDate to set */ + /** + * @param filenameIncludingDate The filenameIncludingDate to set + */ public void setFilenameIncludingDate(boolean filenameIncludingDate) { this.filenameIncludingDate = filenameIncludingDate; } @@ -169,7 +174,9 @@ public boolean isFilenameIncludingTime() { return filenameIncludingTime; } - /** @param filenameIncludingTime The filenameIncludingTime to set */ + /** + * @param filenameIncludingTime The filenameIncludingTime to set + */ public void setFilenameIncludingTime(boolean filenameIncludingTime) { this.filenameIncludingTime = filenameIncludingTime; } @@ -183,7 +190,9 @@ public boolean isFilenameIncludingDateTime() { return filenameIncludingDateTime; } - /** @param filenameIncludingDateTime The filenameIncludingDateTime to set */ + /** + * @param filenameIncludingDateTime The filenameIncludingDateTime to set + */ public void setFilenameIncludingDateTime(boolean filenameIncludingDateTime) { this.filenameIncludingDateTime = filenameIncludingDateTime; } @@ -197,7 +206,9 @@ public String getFilenameDateTimeFormat() { return filenameDateTimeFormat; } - /** @param filenameDateTimeFormat The filenameDateTimeFormat to set */ + /** + * @param filenameDateTimeFormat The filenameDateTimeFormat to set + */ public void setFilenameDateTimeFormat(String filenameDateTimeFormat) { this.filenameDateTimeFormat = filenameDateTimeFormat; } @@ -211,7 +222,9 @@ public boolean isFilenameIncludingCopyNr() { return filenameIncludingCopyNr; } - /** @param filenameIncludingCopyNr The filenameIncludingCopyNr to set */ + /** + * @param filenameIncludingCopyNr The filenameIncludingCopyNr to set + */ public void setFilenameIncludingCopyNr(boolean filenameIncludingCopyNr) { this.filenameIncludingCopyNr = filenameIncludingCopyNr; } @@ -225,7 +238,9 @@ public boolean isFilenameIncludingSplitNr() { return filenameIncludingSplitNr; } - /** @param filenameIncludingSplitNr The filenameIncludingSplitNr to set */ + /** + * @param filenameIncludingSplitNr The filenameIncludingSplitNr to set + */ public void setFilenameIncludingSplitNr(boolean filenameIncludingSplitNr) { this.filenameIncludingSplitNr = filenameIncludingSplitNr; } @@ -239,7 +254,9 @@ public String getFileSplitSize() { return fileSplitSize; } - /** @param fileSplitSize The filenameIncludingSplitSize to set */ + /** + * @param fileSplitSize The filenameIncludingSplitSize to set + */ public void setFileSplitSize(String fileSplitSize) { this.fileSplitSize = fileSplitSize; } @@ -253,7 +270,9 @@ public boolean isFilenameCreatingParentFolders() { return filenameCreatingParentFolders; } - /** @param filenameCreatingParentFolders The filenameCreatingParentFolders to set */ + /** + * @param filenameCreatingParentFolders The filenameCreatingParentFolders to set + */ public void setFilenameCreatingParentFolders(boolean filenameCreatingParentFolders) { this.filenameCreatingParentFolders = filenameCreatingParentFolders; } @@ -267,7 +286,9 @@ public CompressionCodecName getCompressionCodec() { return compressionCodec; } - /** @param compressionCodec The compressionCodec to set */ + /** + * @param compressionCodec The compressionCodec to set + */ public void setCompressionCodec(CompressionCodecName compressionCodec) { this.compressionCodec = compressionCodec; } @@ -281,7 +302,9 @@ public ParquetVersion getVersion() { return version; } - /** @param version The version to set */ + /** + * @param version The version to set + */ public void setVersion(ParquetVersion version) { this.version = version; } @@ -295,7 +318,9 @@ public String getRowGroupSize() { return rowGroupSize; } - /** @param rowGroupSize The rowGroupSize to set */ + /** + * @param rowGroupSize The rowGroupSize to set + */ public void setRowGroupSize(String rowGroupSize) { this.rowGroupSize = rowGroupSize; } @@ -309,7 +334,9 @@ public String getDataPageSize() { return dataPageSize; } - /** @param dataPageSize The dataPageSize to set */ + /** + * @param dataPageSize The dataPageSize to set + */ public void setDataPageSize(String dataPageSize) { this.dataPageSize = dataPageSize; } @@ -323,7 +350,9 @@ public String getDictionaryPageSize() { return dictionaryPageSize; } - /** @param dictionaryPageSize The dictionaryPageSize to set */ + /** + * @param dictionaryPageSize The dictionaryPageSize to set + */ public void setDictionaryPageSize(String dictionaryPageSize) { this.dictionaryPageSize = dictionaryPageSize; } @@ -337,7 +366,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputStream.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputStream.java index 9e672eb777f..8e9273785eb 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputStream.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetOutputStream.java @@ -17,10 +17,9 @@ package org.apache.hop.parquet.transforms.output; -import org.apache.parquet.io.PositionOutputStream; - import java.io.IOException; import java.io.OutputStream; +import org.apache.parquet.io.PositionOutputStream; public class ParquetOutputStream extends PositionOutputStream { private long position = 0; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetVersion.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetVersion.java index cdc7f3ccd42..ed9afcfc769 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetVersion.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetVersion.java @@ -58,7 +58,9 @@ public String getCode() { return code; } - /** @param code The code to set */ + /** + * @param code The code to set + */ public void setCode(String code) { this.code = code; } @@ -72,7 +74,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriteSupport.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriteSupport.java index fe096550a93..3d2f419f2b2 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriteSupport.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriteSupport.java @@ -17,6 +17,9 @@ package org.apache.hop.parquet.transforms.output; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.avro.LogicalType; import org.apache.avro.Schema; import org.apache.hadoop.conf.Configuration; @@ -28,10 +31,6 @@ import org.apache.parquet.io.api.RecordConsumer; import org.apache.parquet.schema.MessageType; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ParquetWriteSupport extends WriteSupport { private final MessageType messageType; diff --git a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriterBuilder.java b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriterBuilder.java index 943d10d96ac..97be5b209d9 100644 --- a/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriterBuilder.java +++ b/plugins/tech/parquet/src/main/java/org/apache/hop/parquet/transforms/output/ParquetWriterBuilder.java @@ -17,6 +17,7 @@ package org.apache.hop.parquet.transforms.output; +import java.util.List; import org.apache.avro.Schema; import org.apache.hadoop.conf.Configuration; import org.apache.hop.core.RowMetaAndData; @@ -25,8 +26,6 @@ import org.apache.parquet.io.OutputFile; import org.apache.parquet.schema.MessageType; -import java.util.List; - public class ParquetWriterBuilder extends ParquetWriter.Builder { diff --git a/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/Abort.java b/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/Abort.java index b8f3f9cd027..e3b152cc2bf 100644 --- a/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/Abort.java +++ b/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/Abort.java @@ -26,8 +26,7 @@ import org.apache.hop.pipeline.transform.TransformMeta; /** Transform that will abort after having seen 'x' number of rows on its input. */ -public class Abort extends BaseTransform -{ +public class Abort extends BaseTransform { private static final Class PKG = Abort.class; // For Translator private int nrInputRows; diff --git a/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/AbortMeta.java b/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/AbortMeta.java index a90cbff925b..080d06a19e3 100644 --- a/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/AbortMeta.java +++ b/plugins/transforms/abort/src/main/java/org/apache/hop/pipeline/transforms/abort/AbortMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.abort; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - /** Meta data for the abort transform. */ @Transform( id = "Abort", @@ -158,7 +157,9 @@ public String getRowThreshold() { return rowThreshold; } - /** @param rowThreshold The rowThreshold to set */ + /** + * @param rowThreshold The rowThreshold to set + */ public void setRowThreshold(String rowThreshold) { this.rowThreshold = rowThreshold; } @@ -172,7 +173,9 @@ public String getMessage() { return message; } - /** @param message The message to set */ + /** + * @param message The message to set + */ public void setMessage(String message) { this.message = message; } @@ -186,7 +189,9 @@ public boolean isAlwaysLogRows() { return alwaysLogRows; } - /** @param alwaysLogRows The alwaysLogRows to set */ + /** + * @param alwaysLogRows The alwaysLogRows to set + */ public void setAlwaysLogRows(boolean alwaysLogRows) { this.alwaysLogRows = alwaysLogRows; } @@ -200,7 +205,9 @@ public AbortOption getAbortOption() { return abortOption; } - /** @param abortOption The abortOption to set */ + /** + * @param abortOption The abortOption to set + */ public void setAbortOption(AbortOption abortOption) { this.abortOption = abortOption; } @@ -208,5 +215,5 @@ public void setAbortOption(AbortOption abortOption) { @Override public boolean supportsMultiCopyExecution() { return false; - } + } } diff --git a/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortMetaTest.java b/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortMetaTest.java index 2f826b13c59..4a9fe9fc7c8 100644 --- a/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortMetaTest.java +++ b/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.abort; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.xml.XmlHandler; @@ -27,15 +35,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - public class AbortMetaTest { @Test diff --git a/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortTest.java b/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortTest.java index cd5bb45b2b6..8f405fdf064 100644 --- a/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortTest.java +++ b/plugins/transforms/abort/src/test/java/org/apache/hop/pipeline/transforms/abort/AbortTest.java @@ -17,13 +17,6 @@ package org.apache.hop.pipeline.transforms.abort; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILoggingObject; -import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -33,6 +26,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILoggingObject; +import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + public class AbortTest { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequence.java b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequence.java index f6b4d02eee9..805b899f134 100644 --- a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequence.java +++ b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequence.java @@ -34,8 +34,7 @@ import org.apache.hop.pipeline.transform.TransformMeta; /** Adds a sequential number to a stream of rows. */ -public class AddSequence extends BaseTransform -{ +public class AddSequence extends BaseTransform { private static final Class PKG = AddSequence.class; // For Translator diff --git a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceData.java b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceData.java index 0fee68aa3af..c9d0a814ddc 100644 --- a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceData.java +++ b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceData.java @@ -46,22 +46,30 @@ public AddSequenceData() { realSequenceName = null; } - /** @return Returns the db. */ + /** + * @return Returns the db. + */ public Database getDb() { return db; } - /** @param db The db to set. */ + /** + * @param db The db to set. + */ public void setDb(Database db) { this.db = db; } - /** @return Returns the lookup string usually "@@"+the name of the sequence. */ + /** + * @return Returns the lookup string usually "@@"+the name of the sequence. + */ public String getLookup() { return lookup; } - /** @param lookup the lookup string usually "@@"+the name of the sequence. */ + /** + * @param lookup the lookup string usually "@@"+the name of the sequence. + */ public void setLookup(String lookup) { this.lookup = lookup; } diff --git a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceDialog.java b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceDialog.java index 53f82901719..ec1f8936a04 100644 --- a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceDialog.java +++ b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceDialog.java @@ -170,7 +170,8 @@ public String open() { wlUseDatabase.setLayoutData(fdlUseDatabase); wUseDatabase = new Button(gDatabase, SWT.CHECK); PropsUi.setLook(wUseDatabase); - wUseDatabase.setToolTipText(BaseMessages.getString(PKG, "AddSequenceDialog.UseDatabase.Tooltip")); + wUseDatabase.setToolTipText( + BaseMessages.getString(PKG, "AddSequenceDialog.UseDatabase.Tooltip")); FormData fdUseDatabase = new FormData(); fdUseDatabase.left = new FormAttachment(middle, 0); fdUseDatabase.top = new FormAttachment(wlUseDatabase, 0, SWT.CENTER); @@ -206,7 +207,7 @@ public void widgetSelected(SelectionEvent e) { fdbSchema.right = new FormAttachment(100, 0); wbSchema.setLayoutData(fdbSchema); wbSchema.addListener(SWT.Selection, e -> getSchemaNames()); - + wSchema = new TextVar(variables, gDatabase, SWT.SINGLE | SWT.LEFT | SWT.BORDER); PropsUi.setLook(wSchema); wSchema.addModifyListener(lsMod); @@ -234,7 +235,7 @@ public void widgetSelected(SelectionEvent e) { fdbSequence.top = new FormAttachment(wbSchema, margin); wbSequence.setLayoutData(fdbSequence); wbSequence.addListener(SWT.Selection, e -> getSequences()); - + wSeqname = new TextVar(variables, gDatabase, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wSeqname.setText(""); PropsUi.setLook(wSeqname); @@ -459,7 +460,8 @@ private void ok() { input.setIncrementBy(wIncrBy.getText()); input.setMaxValue(wMaxVal.getText()); - if (input.isDatabaseUsed() && pipelineMeta.findDatabase(wConnection.getText(), variables) == null) { + if (input.isDatabaseUsed() + && pipelineMeta.findDatabase(wConnection.getText(), variables) == null) { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage( BaseMessages.getString(PKG, "AddSequenceDialog.NoValidConnectionError.DialogMessage")); @@ -480,7 +482,7 @@ private void activeSequence() { private void getSequences() { DatabaseMeta databaseMeta = pipelineMeta.findDatabase(wConnection.getText(), variables); - if (databaseMeta != null) { + if (databaseMeta != null) { try (Database database = new Database(loggingObject, variables, databaseMeta)) { database.connect(); String[] sequences = database.getSequences(); @@ -551,7 +553,7 @@ private void getSchemaNames() { shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "AddSequenceDialog.ErrorGettingSchemas"), - e); + e); } } } diff --git a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMeta.java b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMeta.java index 5c889c9bdf9..e09cb6cd45a 100644 --- a/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMeta.java +++ b/plugins/transforms/addsequence/src/main/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.addsequence; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** Meta data for the Add Sequence transform. */ @Transform( id = "Sequence", @@ -109,87 +108,121 @@ public void setConnection(String connection) { this.connection = connection; } - /** @return Returns the incrementBy. */ + /** + * @return Returns the incrementBy. + */ public String getIncrementBy() { return incrementBy; } - /** @param incrementBy The incrementBy to set. */ + /** + * @param incrementBy The incrementBy to set. + */ public void setIncrementBy(String incrementBy) { this.incrementBy = incrementBy; } - /** @return Returns the maxValue. */ + /** + * @return Returns the maxValue. + */ public String getMaxValue() { return maxValue; } - /** @param maxValue The maxValue to set. */ + /** + * @param maxValue The maxValue to set. + */ public void setMaxValue(String maxValue) { this.maxValue = maxValue; } - /** @return Returns the sequenceName. */ + /** + * @return Returns the sequenceName. + */ public String getSequenceName() { return sequenceName; } - /** @param sequenceName The sequenceName to set. */ + /** + * @param sequenceName The sequenceName to set. + */ public void setSequenceName(String sequenceName) { this.sequenceName = sequenceName; } - /** @param maxValue The maxValue to set. */ + /** + * @param maxValue The maxValue to set. + */ public void setMaxValue(long maxValue) { this.maxValue = Long.toString(maxValue); } - /** @param startAt The starting point of the sequence to set. */ + /** + * @param startAt The starting point of the sequence to set. + */ public void setStartAt(long startAt) { this.startAt = Long.toString(startAt); } - /** @param incrementBy The incrementBy to set. */ + /** + * @param incrementBy The incrementBy to set. + */ public void setIncrementBy(long incrementBy) { this.incrementBy = Long.toString(incrementBy); } - /** @return Returns the start of the sequence. */ + /** + * @return Returns the start of the sequence. + */ public String getStartAt() { return startAt; } - /** @param startAt The starting point of the sequence to set. */ + /** + * @param startAt The starting point of the sequence to set. + */ public void setStartAt(String startAt) { this.startAt = startAt; } - /** @return Returns the useCounter. */ + /** + * @return Returns the useCounter. + */ public boolean isCounterUsed() { return counterUsed; } - /** @param counterUsed The useCounter to set. */ + /** + * @param counterUsed The useCounter to set. + */ public void setCounterUsed(boolean counterUsed) { this.counterUsed = counterUsed; } - /** @return Returns the useDatabase. */ + /** + * @return Returns the useDatabase. + */ public boolean isDatabaseUsed() { return databaseUsed; } - /** @param databaseUsed The useDatabase to set. */ + /** + * @param databaseUsed The useDatabase to set. + */ public void setDatabaseUsed(boolean databaseUsed) { this.databaseUsed = databaseUsed; } - /** @return Returns the valuename. */ + /** + * @return Returns the valuename. + */ public String getValueName() { return valueName; } - /** @param valueName The valuename to set. */ + /** + * @param valueName The valuename to set. + */ public void setValueName(String valueName) { this.valueName = valueName; } @@ -345,22 +378,30 @@ public SqlStatement getSqlStatements( return retval; } - /** @return the counterName */ + /** + * @return the counterName + */ public String getCounterName() { return counterName; } - /** @param counterName the counterName to set */ + /** + * @param counterName the counterName to set + */ public void setCounterName(String counterName) { this.counterName = counterName; } - /** @return the schemaName */ + /** + * @return the schemaName + */ public String getSchemaName() { return schemaName; } - /** @param schemaName the schemaName to set */ + /** + * @param schemaName the schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } diff --git a/plugins/transforms/addsequence/src/test/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMetaTest.java b/plugins/transforms/addsequence/src/test/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMetaTest.java index 1870ebf37a5..da86748ab79 100644 --- a/plugins/transforms/addsequence/src/test/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMetaTest.java +++ b/plugins/transforms/addsequence/src/test/java/org/apache/hop/pipeline/transforms/addsequence/AddSequenceMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.addsequence; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class AddSequenceMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQuery.java b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQuery.java index c0939a1a4fc..2b379060d51 100644 --- a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQuery.java +++ b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQuery.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.analyticquery; +import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.exception.HopValueException; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.concurrent.ConcurrentLinkedQueue; - /** Performs analytic queries (LEAD/LAG, etc) based on a group */ public class AnalyticQuery extends BaseTransform { diff --git a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryData.java b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryData.java index 6a0fe3d53c3..90933f03439 100644 --- a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryData.java +++ b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.analyticquery; +import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.concurrent.ConcurrentLinkedQueue; - public class AnalyticQueryData extends BaseTransformData implements ITransformData { // Grouped Field Indexes (faster than looking up by strings) public int[] groupnrs; diff --git a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryDialog.java b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryDialog.java index 53069c2378d..a462760146f 100644 --- a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryDialog.java +++ b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.analyticquery; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -46,9 +48,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class AnalyticQueryDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = AnalyticQueryDialog.class; // For Translator diff --git a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMeta.java b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMeta.java index ca499c10ce3..ded07c35e96 100644 --- a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMeta.java +++ b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.analyticquery; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "AnalyticQuery", image = "analyticquery.svg", @@ -160,7 +159,9 @@ public List getGroupFields() { return groupFields; } - /** @param groupFields The groupFields to set */ + /** + * @param groupFields The groupFields to set + */ public void setGroupFields(List groupFields) { this.groupFields = groupFields; } @@ -174,7 +175,9 @@ public List getQueryFields() { return queryFields; } - /** @param queryFields The queryFields to set */ + /** + * @param queryFields The queryFields to set + */ public void setQueryFields(List queryFields) { this.queryFields = queryFields; } diff --git a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/GroupField.java b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/GroupField.java index a83c60379f1..659115a40db 100644 --- a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/GroupField.java +++ b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/GroupField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.analyticquery; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class GroupField { @@ -59,7 +58,9 @@ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set */ + /** + * @param fieldName The fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } diff --git a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/QueryField.java b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/QueryField.java index e807f5ad8f4..09f1a88d47c 100644 --- a/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/QueryField.java +++ b/plugins/transforms/analyticquery/src/main/java/org/apache/hop/pipeline/transforms/analyticquery/QueryField.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.analyticquery; +import java.util.Objects; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class QueryField { private static final Class PKG = AnalyticQuery.class; // For Translator @@ -130,7 +129,9 @@ public String getAggregateField() { return aggregateField; } - /** @param aggregateField The aggregateField to set */ + /** + * @param aggregateField The aggregateField to set + */ public void setAggregateField(String aggregateField) { this.aggregateField = aggregateField; } @@ -144,7 +145,9 @@ public String getSubjectField() { return subjectField; } - /** @param subjectField The subjectField to set */ + /** + * @param subjectField The subjectField to set + */ public void setSubjectField(String subjectField) { this.subjectField = subjectField; } @@ -158,7 +161,9 @@ public AggregateType getAggregateType() { return aggregateType; } - /** @param aggregateType The aggregateType to set */ + /** + * @param aggregateType The aggregateType to set + */ public void setAggregateType(AggregateType aggregateType) { this.aggregateType = aggregateType; } @@ -172,7 +177,9 @@ public int getValueField() { return valueField; } - /** @param valueField The valueField to set */ + /** + * @param valueField The valueField to set + */ public void setValueField(int valueField) { this.valueField = valueField; } diff --git a/plugins/transforms/analyticquery/src/test/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMetaTest.java b/plugins/transforms/analyticquery/src/test/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMetaTest.java index 9c4d2aeaf85..45ecb2d0c46 100644 --- a/plugins/transforms/analyticquery/src/test/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMetaTest.java +++ b/plugins/transforms/analyticquery/src/test/java/org/apache/hop/pipeline/transforms/analyticquery/AnalyticQueryMetaTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.analyticquery; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.injection.bean.BeanInjectionInfo; import org.apache.hop.core.injection.bean.BeanInjector; @@ -29,16 +38,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.junit.Test; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class AnalyticQueryMetaTest { @Test diff --git a/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/Append.java b/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/Append.java index d90fd90d5c6..c461b04f430 100644 --- a/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/Append.java +++ b/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/Append.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.append; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopRowException; import org.apache.hop.core.row.IRowMeta; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.List; - /** Read all rows from a hop until the end, and then read the rows from another hop. */ public class Append extends BaseTransform { diff --git a/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/AppendMeta.java b/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/AppendMeta.java index c8c68af695b..0d81eab66e8 100644 --- a/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/AppendMeta.java +++ b/plugins/transforms/append/src/main/java/org/apache/hop/pipeline/transforms/append/AppendMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.append; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -37,8 +38,6 @@ import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; -import java.util.List; - @Transform( id = "Append", image = "append.svg", @@ -192,7 +191,9 @@ public String getHeadTransformName() { return headTransformName; } - /** @param headTransformName The headTransformName to set */ + /** + * @param headTransformName The headTransformName to set + */ public void setHeadTransformName(String headTransformName) { this.headTransformName = headTransformName; } @@ -206,7 +207,9 @@ public String getTailTransformName() { return tailTransformName; } - /** @param tailTransformName The tailTransformName to set */ + /** + * @param tailTransformName The tailTransformName to set + */ public void setTailTransformName(String tailTransformName) { this.tailTransformName = tailTransformName; } diff --git a/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransform.java b/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransform.java index dc80114e8f1..1129de18fa9 100644 --- a/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransform.java +++ b/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransform.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.blockingtransform; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.SocketTimeoutException; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.hop.core.Const; @@ -30,17 +40,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.SocketTimeoutException; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - /** * A transform that blocks throughput until the input ends, then it will either output the last row * or the complete input. diff --git a/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformData.java b/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformData.java index b0d33a88661..c3500066c1e 100644 --- a/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformData.java +++ b/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.blockingtransform; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.DataInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.zip.GZIPInputStream; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class BlockingTransformData extends BaseTransformData implements ITransformData { public List files; diff --git a/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformMeta.java b/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformMeta.java index 0ae315a0797..77ee922200f 100644 --- a/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformMeta.java +++ b/plugins/transforms/blockingtransform/src/main/java/org/apache/hop/pipeline/transforms/blockingtransform/BlockingTransformMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.blockingtransform; +import java.io.File; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.File; -import java.util.List; - @Transform( id = "BlockingTransform", image = "blockingtransform.svg", @@ -42,7 +41,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow", keywords = "i18n::BlockingTransformMeta.keyword", documentationUrl = "/pipeline/transforms/blockingtransform.html") -public class BlockingTransformMeta extends BaseTransformMeta { +public class BlockingTransformMeta + extends BaseTransformMeta { private static final Class PKG = BlockingTransformMeta.class; // For Translator @@ -164,37 +164,51 @@ public void getFields( // Default: no values are added to the row in the transform } - /** @return Returns the cacheSize. */ + /** + * @return Returns the cacheSize. + */ public int getCacheSize() { return cacheSize; } - /** @param cacheSize The cacheSize to set. */ + /** + * @param cacheSize The cacheSize to set. + */ public void setCacheSize(int cacheSize) { this.cacheSize = cacheSize; } - /** @return Returns the prefix. */ + /** + * @return Returns the prefix. + */ public String getPrefix() { return prefix; } - /** @param prefix The prefix to set. */ + /** + * @param prefix The prefix to set. + */ public void setPrefix(String prefix) { this.prefix = prefix; } - /** @return Returns whether temporary files should be compressed */ + /** + * @return Returns whether temporary files should be compressed + */ public boolean isCompressFiles() { return compressFiles; } - /** @param compressFiles Whether to compress temporary files created during sorting */ + /** + * @param compressFiles Whether to compress temporary files created during sorting + */ public void setCompressFiles(boolean compressFiles) { this.compressFiles = compressFiles; } - /** @return true when all rows are passed and false when only the last one is passed. */ + /** + * @return true when all rows are passed and false when only the last one is passed. + */ public boolean isPassAllRows() { return passAllRows; } @@ -207,7 +221,9 @@ public void setPassAllRows(boolean passAllRows) { this.passAllRows = passAllRows; } - /** @return The directory to store the temporary files in. */ + /** + * @return The directory to store the temporary files in. + */ public String getDirectory() { return directory; } diff --git a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishData.java b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishData.java index 40e7319a2ff..4fef4e28aeb 100644 --- a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishData.java +++ b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.blockuntiltransformsfinish; -import org.apache.hop.pipeline.engine.IEngineComponent; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.util.Collections; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.apache.hop.pipeline.engine.IEngineComponent; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class BlockUntilTransformsFinishData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishDialog.java b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishDialog.java index 32966307742..b6270911eba 100644 --- a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishDialog.java +++ b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.blockuntiltransformsfinish; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -41,9 +43,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class BlockUntilTransformsFinishDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = BlockUntilTransformsFinishMeta.class; // For Translator diff --git a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishMeta.java b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishMeta.java index c0af951359b..fe66c05dfd8 100644 --- a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishMeta.java +++ b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockUntilTransformsFinishMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.blockuntiltransformsfinish; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -30,9 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "BlockUntilTransformsFinish", image = "blockinguntiltransformsfinish.svg", @@ -41,7 +40,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow", keywords = "i18n::BlockUntilTransformsFinishMeta.keyword", documentationUrl = "/pipeline/transforms/blockuntiltransformsfinish.html") -public class BlockUntilTransformsFinishMeta extends BaseTransformMeta { +public class BlockUntilTransformsFinishMeta + extends BaseTransformMeta { private static final Class PKG = BlockUntilTransformsFinishMeta.class; // For Translator @@ -136,7 +136,9 @@ public List getBlockingTransforms() { return blockingTransforms; } - /** @param blockingTransforms The blockingTransforms to set */ + /** + * @param blockingTransforms The blockingTransforms to set + */ public void setBlockingTransforms(List blockingTransforms) { this.blockingTransforms = blockingTransforms; } diff --git a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockingTransform.java b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockingTransform.java index 5b41f2fe200..7401df33109 100644 --- a/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockingTransform.java +++ b/plugins/transforms/blockuntiltransformsfinish/src/main/java/org/apache/hop/pipeline/transforms/blockuntiltransformsfinish/BlockingTransform.java @@ -47,7 +47,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -61,7 +63,9 @@ public String getCopyNr() { return copyNr; } - /** @param copyNr The copyNr to set */ + /** + * @param copyNr The copyNr to set + */ public void setCopyNr(String copyNr) { this.copyNr = copyNr; } diff --git a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/Calculator.java b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/Calculator.java index 61dc7136dc9..cb79e69eda6 100644 --- a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/Calculator.java +++ b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/Calculator.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.calculator; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopFileNotFoundException; import org.apache.hop.core.exception.HopTransformException; @@ -33,10 +36,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.calculator.CalculatorMetaFunction.CalculationType; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; - /** Calculate new field values using pre-defined functions. */ public class Calculator extends BaseTransform { @@ -616,11 +615,15 @@ private Object[] calcFields(IRowMeta inputRowMeta, Object[] r) resultType = targetMeta.getType(); break; case BASE64_ENCODE: - if(dataA != null){ - if(metaA.getType() == IValueMeta.TYPE_BINARY) { - calcData[index] = Base64.getEncoder().withoutPadding().encodeToString(metaA.getBinary(dataA)); + if (dataA != null) { + if (metaA.getType() == IValueMeta.TYPE_BINARY) { + calcData[index] = + Base64.getEncoder().withoutPadding().encodeToString(metaA.getBinary(dataA)); } else { - calcData[index] = Base64.getEncoder().withoutPadding().encodeToString(metaA.getString(dataA).getBytes()); + calcData[index] = + Base64.getEncoder() + .withoutPadding() + .encodeToString(metaA.getString(dataA).getBytes()); } } else { calcData[index] = null; @@ -628,13 +631,13 @@ private Object[] calcFields(IRowMeta inputRowMeta, Object[] r) resultType = IValueMeta.TYPE_STRING; break; case BASE64_DECODE: - if(dataA != null){ + if (dataA != null) { byte[] tmpDecoded = Base64.getDecoder().decode(metaA.getString(dataA)); - if(targetMeta.getType() == IValueMeta.TYPE_BINARY) { + if (targetMeta.getType() == IValueMeta.TYPE_BINARY) { calcData[index] = tmpDecoded; } else { String tmpDecodedString = new String(tmpDecoded); - calcData[index] = targetMeta.convertData(metaA, tmpDecodedString); + calcData[index] = targetMeta.convertData(metaA, tmpDecodedString); } } else { calcData[index] = null; diff --git a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorData.java b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorData.java index e9eae3fa000..e94571ebf18 100644 --- a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorData.java +++ b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorData.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.calculator; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; @@ -24,9 +26,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashMap; -import java.util.Map; - public class CalculatorData extends BaseTransformData implements ITransformData { private IRowMeta outputRowMeta; private IRowMeta calcRowMeta; diff --git a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDialog.java b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDialog.java index be2c42f27b8..ae583ffe355 100644 --- a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDialog.java +++ b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.calculator; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -51,9 +53,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class CalculatorDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = CalculatorMeta.class; // For Translator @@ -314,7 +313,7 @@ protected void setComboBoxes() { final List fields = new ArrayList<>(); // Add the currentMeta fields... - for(String s : inputFields) { + for (String s : inputFields) { fields.add(s); } diff --git a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMeta.java b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMeta.java index 229f73490e1..4125bab69ee 100644 --- a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMeta.java +++ b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.calculator; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** Contains the meta-data for the Calculator transform: calculates predefined formula's */ @Transform( id = "Calculator", @@ -191,7 +190,9 @@ public List getFunctions() { return functions; } - /** @param functions The calculations to set */ + /** + * @param functions The calculations to set + */ public void setFunctions(List functions) { this.functions = functions; } @@ -205,7 +206,9 @@ public boolean isFailIfNoFile() { return failIfNoFile; } - /** @param failIfNoFile The failIfNoFile to set */ + /** + * @param failIfNoFile The failIfNoFile to set + */ public void setFailIfNoFile(boolean failIfNoFile) { this.failIfNoFile = failIfNoFile; } diff --git a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunction.java b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunction.java index 8e3198b739b..8f9e17ee31b 100644 --- a/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunction.java +++ b/plugins/transforms/calculator/src/main/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunction.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.calculator; +import java.util.Objects; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IEnumHasCode; -import java.util.Objects; - public class CalculatorMetaFunction implements Cloneable { private static final Class PKG = CalculatorMeta.class; // For Translator @@ -352,14 +351,13 @@ public enum CalculationType implements IEnumHasCode { BaseMessages.getString(PKG, "CalculatorMetaFunction.CalcFunctions.Remainder"), IValueMeta.TYPE_NUMBER), BASE64_ENCODE( - "BASE64_ENCODE", - BaseMessages.getString(PKG, "CalculatorMetaFunction.CalcFunctions.Base64Encode"), - IValueMeta.TYPE_STRING), + "BASE64_ENCODE", + BaseMessages.getString(PKG, "CalculatorMetaFunction.CalcFunctions.Base64Encode"), + IValueMeta.TYPE_STRING), BASE64_DECODE( - "BASE64_DECODE", - BaseMessages.getString(PKG, "CalculatorMetaFunction.CalcFunctions.Base64Decode"), - IValueMeta.TYPE_STRING) - ; + "BASE64_DECODE", + BaseMessages.getString(PKG, "CalculatorMetaFunction.CalcFunctions.Base64Decode"), + IValueMeta.TYPE_STRING); private String code; private String description; @@ -612,7 +610,9 @@ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set */ + /** + * @param fieldName The fieldName to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } @@ -626,7 +626,9 @@ public CalculationType getCalcType() { return calcType; } - /** @param calcType The calcType to set */ + /** + * @param calcType The calcType to set + */ public void setCalcType(CalculationType calcType) { this.calcType = calcType; } @@ -640,7 +642,9 @@ public String getFieldA() { return fieldA; } - /** @param fieldA The fieldA to set */ + /** + * @param fieldA The fieldA to set + */ public void setFieldA(String fieldA) { this.fieldA = fieldA; } @@ -654,7 +658,9 @@ public String getFieldB() { return fieldB; } - /** @param fieldB The fieldB to set */ + /** + * @param fieldB The fieldB to set + */ public void setFieldB(String fieldB) { this.fieldB = fieldB; } @@ -668,7 +674,9 @@ public String getFieldC() { return fieldC; } - /** @param fieldC The fieldC to set */ + /** + * @param fieldC The fieldC to set + */ public void setFieldC(String fieldC) { this.fieldC = fieldC; } @@ -682,7 +690,9 @@ public String getValueType() { return valueType; } - /** @param valueType The valueType to set */ + /** + * @param valueType The valueType to set + */ public void setValueType(String valueType) { this.valueType = valueType; } @@ -696,7 +706,9 @@ public int getValueLength() { return valueLength; } - /** @param valueLength The valueLength to set */ + /** + * @param valueLength The valueLength to set + */ public void setValueLength(int valueLength) { this.valueLength = valueLength; } @@ -710,7 +722,9 @@ public int getValuePrecision() { return valuePrecision; } - /** @param valuePrecision The valuePrecision to set */ + /** + * @param valuePrecision The valuePrecision to set + */ public void setValuePrecision(int valuePrecision) { this.valuePrecision = valuePrecision; } @@ -724,7 +738,9 @@ public String getConversionMask() { return conversionMask; } - /** @param conversionMask The conversionMask to set */ + /** + * @param conversionMask The conversionMask to set + */ public void setConversionMask(String conversionMask) { this.conversionMask = conversionMask; } @@ -738,7 +754,9 @@ public String getDecimalSymbol() { return decimalSymbol; } - /** @param decimalSymbol The decimalSymbol to set */ + /** + * @param decimalSymbol The decimalSymbol to set + */ public void setDecimalSymbol(String decimalSymbol) { this.decimalSymbol = decimalSymbol; } @@ -752,7 +770,9 @@ public String getGroupingSymbol() { return groupingSymbol; } - /** @param groupingSymbol The groupingSymbol to set */ + /** + * @param groupingSymbol The groupingSymbol to set + */ public void setGroupingSymbol(String groupingSymbol) { this.groupingSymbol = groupingSymbol; } @@ -766,7 +786,9 @@ public String getCurrencySymbol() { return currencySymbol; } - /** @param currencySymbol The currencySymbol to set */ + /** + * @param currencySymbol The currencySymbol to set + */ public void setCurrencySymbol(String currencySymbol) { this.currencySymbol = currencySymbol; } @@ -780,7 +802,9 @@ public boolean isRemovedFromResult() { return removedFromResult; } - /** @param removedFromResult The removedFromResult to set */ + /** + * @param removedFromResult The removedFromResult to set + */ public void setRemovedFromResult(boolean removedFromResult) { this.removedFromResult = removedFromResult; } diff --git a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDataTest.java b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDataTest.java index e4b2bac0d72..9acc0633918 100644 --- a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDataTest.java +++ b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorDataTest.java @@ -17,14 +17,14 @@ package org.apache.hop.pipeline.transforms.calculator; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertTrue; - public class CalculatorDataTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunctionTest.java b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunctionTest.java index 3fbba050c61..81a2ba8621a 100644 --- a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunctionTest.java +++ b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaFunctionTest.java @@ -17,14 +17,14 @@ package org.apache.hop.pipeline.transforms.calculator; -import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; +import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; +import org.junit.Test; + public class CalculatorMetaFunctionTest { @Test diff --git a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaTest.java b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaTest.java index c5e04714b2c..3a1e0e75a7f 100644 --- a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaTest.java +++ b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorMetaTest.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.calculator; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.pipeline.transform.TransformMeta; import org.junit.Assert; import org.junit.Test; -import java.util.Random; -import java.util.UUID; - public class CalculatorMetaTest { @Test diff --git a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorUnitTest.java b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorUnitTest.java index b38dc0f84c3..fe0b3434c41 100644 --- a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorUnitTest.java +++ b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorUnitTest.java @@ -17,6 +17,21 @@ package org.apache.hop.pipeline.transforms.calculator; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; import junit.framework.Assert; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; @@ -43,22 +58,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** * Unit tests for calculator transform * diff --git a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorValueDataUtilTest.java b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorValueDataUtilTest.java index 55613395bb8..f52f2744428 100644 --- a/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorValueDataUtilTest.java +++ b/plugins/transforms/calculator/src/test/java/org/apache/hop/pipeline/transforms/calculator/CalculatorValueDataUtilTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.calculator; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -38,21 +52,6 @@ import org.junit.Test; import org.mockito.stubbing.Answer; -import java.math.BigDecimal; -import java.math.MathContext; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class CalculatorValueDataUtilTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); private static String yyyy_MM_dd = "yyyy-MM-dd"; diff --git a/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncoding.java b/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncoding.java index def485a9218..fc170466b2d 100644 --- a/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncoding.java +++ b/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncoding.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.changefileencoding; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.ResultFile; import org.apache.hop.core.exception.HopException; @@ -28,13 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; - /** Change file encoding * */ public class ChangeFileEncoding extends BaseTransform { diff --git a/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingDialog.java b/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingDialog.java index 0d5045b0364..91ad30207f4 100644 --- a/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingDialog.java +++ b/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.changefileencoding; +import java.nio.charset.Charset; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -46,9 +48,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; - public class ChangeFileEncodingDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = ChangeFileEncodingDialog.class; // For Translator diff --git a/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMeta.java b/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMeta.java index 7504c73f5b6..cddab42a175 100644 --- a/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMeta.java +++ b/plugins/transforms/changefileencoding/src/main/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.changefileencoding; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -30,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "ChangeFileEncoding", image = "changefileencoding.svg", @@ -40,7 +39,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Utility", keywords = "i18n::ChangeFileEncodingMeta.keyword", documentationUrl = "/pipeline/transforms/changefileencoding.html") -public class ChangeFileEncodingMeta extends BaseTransformMeta { +public class ChangeFileEncodingMeta + extends BaseTransformMeta { private static final Class PKG = ChangeFileEncoding.class; // For Translator @@ -84,42 +84,58 @@ public ChangeFileEncodingMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the filenamefield. */ + /** + * @return Returns the filenamefield. + */ public String getFilenameField() { return filenameField; } - /** @param filenamefield The filenamefield to set. */ + /** + * @param filenamefield The filenamefield to set. + */ public void setFilenameField(String filenamefield) { this.filenameField = filenamefield; } - /** @return Returns the targetfilenamefield. */ + /** + * @return Returns the targetfilenamefield. + */ public String getTargetFilenameField() { return targetFilenameField; } - /** @param targetfilenamefield The targetfilenamefield to set. */ + /** + * @param targetfilenamefield The targetfilenamefield to set. + */ public void setTargetFilenameField(String targetfilenamefield) { this.targetFilenameField = targetfilenamefield; } - /** @return Returns the sourceencoding. */ + /** + * @return Returns the sourceencoding. + */ public String getSourceEncoding() { return sourceEncoding; } - /** @param encoding The sourceencoding to set. */ + /** + * @param encoding The sourceencoding to set. + */ public void setSourceEncoding(String encoding) { this.sourceEncoding = encoding; } - /** @return Returns the targetencoding. */ + /** + * @return Returns the targetencoding. + */ public String getTargetEncoding() { return targetEncoding; } - /** @param encoding The targetencoding to set. */ + /** + * @param encoding The targetencoding to set. + */ public void setTargetEncoding(String encoding) { this.targetEncoding = encoding; } diff --git a/plugins/transforms/changefileencoding/src/test/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMetaTest.java b/plugins/transforms/changefileencoding/src/test/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMetaTest.java index 92934cdf2dc..a5efb96d077 100644 --- a/plugins/transforms/changefileencoding/src/test/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMetaTest.java +++ b/plugins/transforms/changefileencoding/src/test/java/org/apache/hop/pipeline/transforms/changefileencoding/ChangeFileEncodingMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.changefileencoding; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ChangeFileEncodingMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSum.java b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSum.java index 3e77b05fc2f..af26cc466ea 100644 --- a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSum.java +++ b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSum.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.checksum; +import java.io.ByteArrayOutputStream; +import java.security.MessageDigest; +import java.util.zip.Adler32; +import java.util.zip.CRC32; import org.apache.commons.codec.binary.Hex; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; @@ -28,11 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.ByteArrayOutputStream; -import java.security.MessageDigest; -import java.util.zip.Adler32; -import java.util.zip.CRC32; - /** Caculate a checksum for each row. */ public class CheckSum extends BaseTransform { @@ -176,7 +175,7 @@ private byte[] createCheckSum(Object[] r) throws Exception { if (value != null) { valueAdded = true; baos.write(value.toString().getBytes()); - } + } } } @@ -184,7 +183,7 @@ private byte[] createCheckSum(Object[] r) throws Exception { if (!valueAdded) { return null; } - + // Updates the digest using the specified array of bytes data.digest.update(baos.toByteArray()); @@ -227,7 +226,7 @@ private Long calculCheckSum(Object[] r) throws Exception { } else { Object value = valueMeta.getNativeDataType(r[data.fieldnrs[i]]); if (value != null) { - valueAdded= true; + valueAdded = true; baos.write(value.toString().getBytes()); } } @@ -237,7 +236,7 @@ private Long calculCheckSum(Object[] r) throws Exception { if (!valueAdded) { return null; } - + byteArray = baos.toByteArray(); if (meta.getCheckSumType() == CheckSumMeta.CheckSumType.CRC32) { diff --git a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumData.java b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumData.java index bf812d0c3d8..ad2dff8116b 100644 --- a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumData.java +++ b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.checksum; +import java.security.MessageDigest; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.security.MessageDigest; - /** Data class for the Cheksum class */ public class CheckSumData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumDialog.java b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumDialog.java index 6b259139782..79fa9659bd1 100644 --- a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumDialog.java +++ b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.checksum; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -50,9 +52,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class CheckSumDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = CheckSumDialog.class; // For Translator diff --git a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMeta.java b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMeta.java index 2e66a6086a2..2b4de21632f 100644 --- a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMeta.java +++ b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.checksum; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -37,9 +39,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "CheckSum", image = "checksum.svg", @@ -345,7 +344,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } @@ -359,7 +360,9 @@ public String getResultFieldName() { return resultFieldName; } - /** @param resultFieldName The resultFieldName to set */ + /** + * @param resultFieldName The resultFieldName to set + */ public void setResultFieldName(String resultFieldName) { this.resultFieldName = resultFieldName; } @@ -373,7 +376,9 @@ public CheckSumType getCheckSumType() { return checkSumType; } - /** @param checkSumType The checkSumType to set */ + /** + * @param checkSumType The checkSumType to set + */ public void setCheckSumType(CheckSumType checkSumType) { this.checkSumType = checkSumType; } @@ -387,7 +392,9 @@ public ResultType getResultType() { return resultType; } - /** @param resultType The resultType to set */ + /** + * @param resultType The resultType to set + */ public void setResultType(ResultType resultType) { this.resultType = resultType; } diff --git a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/Field.java b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/Field.java index 5f4307fc18e..7c0ce7a87b8 100644 --- a/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/Field.java +++ b/plugins/transforms/checksum/src/main/java/org/apache/hop/pipeline/transforms/checksum/Field.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.checksum; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Field { @@ -65,7 +64,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } diff --git a/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMetaTest.java b/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMetaTest.java index f1f64973060..3b7d6c40762 100644 --- a/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMetaTest.java +++ b/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumMetaTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.checksum; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -27,14 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; - public class CheckSumMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumTest.java b/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumTest.java index ee108a2f7dc..6739904231a 100644 --- a/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumTest.java +++ b/plugins/transforms/checksum/src/test/java/org/apache/hop/pipeline/transforms/checksum/CheckSumTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.checksum; +import static org.junit.Assert.assertEquals; + +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.SystemUtils; import org.apache.commons.vfs2.FileObject; @@ -50,13 +56,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; - public class CheckSumTest { // calculations are different in Linux and Windows for files (due to CRLF vs LF) @Before diff --git a/plugins/transforms/clonerow/src/main/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMeta.java b/plugins/transforms/clonerow/src/main/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMeta.java index 5ad46cb8a87..2b807638dde 100644 --- a/plugins/transforms/clonerow/src/main/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMeta.java +++ b/plugins/transforms/clonerow/src/main/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.clonerow; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -34,8 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "CloneRow", name = "i18n::CloneRow.Name", diff --git a/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMetaTest.java b/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMetaTest.java index 877e264caff..d3e94965a59 100644 --- a/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMetaTest.java +++ b/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.clonerow; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class CloneRowMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowTest.java b/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowTest.java index 63935b42b6c..34b38331c52 100644 --- a/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowTest.java +++ b/plugins/transforms/clonerow/src/test/java/org/apache/hop/pipeline/transforms/clonerow/CloneRowTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.clonerow; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Collections; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -26,13 +32,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.Collections; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class CloneRowTest { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGenerator.java b/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGenerator.java index 0a5398a07d3..957039134df 100644 --- a/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGenerator.java +++ b/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGenerator.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.closure; +import java.util.HashMap; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; import org.apache.hop.i18n.BaseMessages; @@ -25,8 +26,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashMap; - /** Reads information from a database table by using freehand SQL */ public class ClosureGenerator extends BaseTransform { diff --git a/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorData.java b/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorData.java index 778da036fdb..e9a0b60dfee 100644 --- a/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorData.java +++ b/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.closure; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Map; - public class ClosureGeneratorData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public int parentIndex; diff --git a/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMeta.java b/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMeta.java index fc61a18baa1..54feac18900 100644 --- a/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMeta.java +++ b/plugins/transforms/closure/src/main/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMeta.java @@ -17,25 +17,21 @@ package org.apache.hop.pipeline.transforms.closure; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; -import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.row.value.ValueMetaInteger; import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import org.w3c.dom.Node; - -import java.util.List; @Transform( id = "ClosureGenerator", diff --git a/plugins/transforms/closure/src/test/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMetaTest.java b/plugins/transforms/closure/src/test/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMetaTest.java index c5c4354680a..16c5de69fdc 100644 --- a/plugins/transforms/closure/src/test/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMetaTest.java +++ b/plugins/transforms/closure/src/test/java/org/apache/hop/pipeline/transforms/closure/ClosureGeneratorMetaTest.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.closure; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -24,9 +26,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class ClosureGeneratorMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = ClosureGeneratorMeta.class; diff --git a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceDialog.java b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceDialog.java index 11a74130858..714e965e082 100644 --- a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceDialog.java +++ b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.coalesce; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -49,9 +51,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class CoalesceDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = CoalesceMeta.class; // For Translator @@ -112,7 +111,11 @@ public String open() { wTransformName.setText(transformName); wTransformName.addListener(SWT.Modify, e -> input.setChanged()); wTransformName.setLayoutData( - new FormDataBuilder().left(wlTransformName, 0).top(wlTransformName, 0, SWT.CENTER).right().result()); + new FormDataBuilder() + .left(wlTransformName, 0) + .top(wlTransformName, 0, SWT.CENTER) + .right() + .result()); PropsUi.setLook(wTransformName); // Treat empty strings as nulls @@ -228,8 +231,8 @@ public void run() { for (int i = 0; i < row.size(); i++) { fieldNames[i] = row.getValueMeta(i).getName(); } - - if ( PropsUi.getInstance().isSortFieldByName() ) { + + if (PropsUi.getInstance().isSortFieldByName()) { Const.sortStrings(fieldNames); } } catch (HopException e) { diff --git a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceField.java b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceField.java index eab6c45e1b6..8eccb83e643 100644 --- a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceField.java +++ b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceField.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.coalesce; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.ArrayList; -import java.util.List; - /** * Contains the properties of the inputs fields, target field name, target value type and options. */ @@ -61,7 +60,8 @@ public CoalesceField() { super(); } - public CoalesceField(String name, String type, boolean removeFields, String inputFields, List cache) { + public CoalesceField( + String name, String type, boolean removeFields, String inputFields, List cache) { this.name = name; this.type = type; this.removeFields = removeFields; diff --git a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMeta.java b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMeta.java index 8d9ffc75bc6..fc7cc5c8c82 100644 --- a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMeta.java +++ b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMeta.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.coalesce; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -33,12 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** Lets you combine multiple fields into one, selecting the first value that is non-null. */ @Transform( id = "Coalesce", diff --git a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTransform.java b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTransform.java index 03af168d1ee..355be7dd39c 100644 --- a/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTransform.java +++ b/plugins/transforms/coalesce/src/main/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTransform.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.coalesce; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** * The Coalesce Transformation selects the first non null value from a group of input fields and * passes it down the stream or returns null if all the fields are null. @@ -196,13 +195,16 @@ private int getFirstNonNullValueIndex( int index = inputRowMeta.indexOfValue(fieldName); if (index >= 0) { Object data = row[index]; - boolean isNotNull = data instanceof byte[] ?data != null && ((byte[]) data).length > 0 : row[index] != null; + boolean isNotNull = + data instanceof byte[] + ? data != null && ((byte[]) data).length > 0 + : row[index] != null; if (!isTreatEmptyStringsAsNulls && data != null && isNotNull) { return index; } else if (isTreatEmptyStringsAsNulls - && row[index] != null - && isNotNull - && !Utils.isEmpty(data.toString())) { + && row[index] != null + && isNotNull + && !Utils.isEmpty(data.toString())) { return index; } } diff --git a/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMetaTest.java b/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMetaTest.java index e06e819f0d6..99b1cfb9ea6 100644 --- a/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMetaTest.java +++ b/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceMetaTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.coalesce; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.injection.bean.BeanInjectionInfo; import org.apache.hop.core.injection.bean.BeanInjector; @@ -26,12 +31,6 @@ import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class CoalesceMetaTest { @Test diff --git a/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTest.java b/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTest.java index 692fe3fcd02..eef9631dc6d 100644 --- a/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTest.java +++ b/plugins/transforms/coalesce/src/test/java/org/apache/hop/pipeline/transforms/coalesce/CoalesceTest.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.coalesce; +import java.util.Collections; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -27,10 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Collections; -import java.util.Random; -import java.util.UUID; - public class CoalesceTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -42,27 +41,28 @@ public static void setUpBeforeClass() throws HopException { @Test public void testLoadSave() throws Exception { - LoadSaveTester loadSaveTester = - new LoadSaveTester<>(CoalesceMeta.class); + LoadSaveTester loadSaveTester = new LoadSaveTester<>(CoalesceMeta.class); - loadSaveTester.getFieldLoadSaveValidatorFactory().registerValidator( + loadSaveTester + .getFieldLoadSaveValidatorFactory() + .registerValidator( CoalesceMeta.class.getDeclaredField("fields").getGenericType().toString(), new ListLoadSaveValidator<>(new CoalesceFieldLoadSaveValidator())); loadSaveTester.testSerialization(); } - private final class CoalesceFieldLoadSaveValidator implements IFieldLoadSaveValidator { + private final class CoalesceFieldLoadSaveValidator + implements IFieldLoadSaveValidator { @Override public CoalesceField getTestObject() { return new CoalesceField( - UUID.randomUUID().toString(), - UUID.randomUUID().toString(), - new Random().nextBoolean(), - UUID.randomUUID().toString(), - Collections.emptyList() - ); + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + new Random().nextBoolean(), + UUID.randomUUID().toString(), + Collections.emptyList()); } @Override @@ -71,10 +71,10 @@ public boolean validateTestObject(CoalesceField testObject, Object actual) { return false; } CoalesceField actualObject = (CoalesceField) actual; - return testObject.getName().equals(actualObject.getName()) && - testObject.getType().equals(actualObject.getType()) && - testObject.isRemoveFields()==actualObject.isRemoveFields() && - testObject.getInputFields().equals(actualObject.getInputFields()); + return testObject.getName().equals(actualObject.getName()) + && testObject.getType().equals(actualObject.getType()) + && testObject.isRemoveFields() == actualObject.isRemoveFields() + && testObject.getInputFields().equals(actualObject.getInputFields()); } } } diff --git a/plugins/transforms/columnexists/src/main/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMeta.java b/plugins/transforms/columnexists/src/main/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMeta.java index 680c38a9e1c..8998a7c8fe8 100644 --- a/plugins/transforms/columnexists/src/main/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMeta.java +++ b/plugins/transforms/columnexists/src/main/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.columnexists; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "ColumnExists", image = "columnexists.svg", @@ -90,52 +89,72 @@ public ColumnExistsMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the tablenamefield. */ + /** + * @return Returns the tablenamefield. + */ public String getTablenamefield() { return tablenamefield; } - /** @return Returns the tablename. */ + /** + * @return Returns the tablename. + */ public String getTableName() { return tableName; } - /** @param tableName The tablename to set. */ + /** + * @param tableName The tablename to set. + */ public void setTableName(String tableName) { this.tableName = tableName; } - /** @return Returns the schemaname. */ + /** + * @return Returns the schemaname. + */ public String getSchemaname() { return schemaname; } - /** @param schemaname The schemaname to set. */ + /** + * @param schemaname The schemaname to set. + */ public void setSchemaname(String schemaname) { this.schemaname = schemaname; } - /** @param tablenamefield The tablenamefield to set. */ + /** + * @param tablenamefield The tablenamefield to set. + */ public void setTablenamefield(String tablenamefield) { this.tablenamefield = tablenamefield; } - /** @return Returns the columnnamefield. */ + /** + * @return Returns the columnnamefield. + */ public String getColumnnamefield() { return columnnamefield; } - /** @param columnnamefield The columnnamefield to set. */ + /** + * @param columnnamefield The columnnamefield to set. + */ public void setColumnnamefield(String columnnamefield) { this.columnnamefield = columnnamefield; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getResultfieldname() { return resultfieldname; } - /** @param resultfieldname The resultfieldname to set. */ + /** + * @param resultfieldname The resultfieldname to set. + */ public void setResultfieldname(String resultfieldname) { this.resultfieldname = resultfieldname; } @@ -144,7 +163,9 @@ public boolean isTablenameInfield() { return tablenameInfield; } - /** @param tablenameInfield the isTablenameInField to set */ + /** + * @param tablenameInfield the isTablenameInField to set + */ public void setTablenameInfield(boolean tablenameInfield) { this.tablenameInfield = tablenameInfield; } diff --git a/plugins/transforms/columnexists/src/test/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMetaTest.java b/plugins/transforms/columnexists/src/test/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMetaTest.java index 9525bec8347..03e241caa44 100644 --- a/plugins/transforms/columnexists/src/test/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMetaTest.java +++ b/plugins/transforms/columnexists/src/test/java/org/apache/hop/pipeline/transforms/columnexists/ColumnExistsMetaTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.columnexists; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -25,9 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class ColumnExistsMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CFields.java b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CFields.java index 56faff5b502..be2a927eeee 100644 --- a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CFields.java +++ b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CFields.java @@ -18,10 +18,9 @@ package org.apache.hop.pipeline.transforms.combinationlookup; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; public class CFields { /** which fields do we use to look up a value? */ diff --git a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookup.java b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookup.java index b6c9bf1cba4..831b4017a58 100644 --- a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookup.java +++ b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookup.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.combinationlookup; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.database.Database; @@ -38,15 +46,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; - /** * Manages or looks up information in a Type 1 or junk dimension. * diff --git a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupData.java b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupData.java index cc91700be6f..6bde2115c3a 100644 --- a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupData.java +++ b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.combinationlookup; +import java.sql.PreparedStatement; +import java.util.Map; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.sql.PreparedStatement; -import java.util.Map; - public class CombinationLookupData extends BaseTransformData implements ITransformData { public Database db; public int[] keynrs; // nrs in row of the keys diff --git a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupDialog.java b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupDialog.java index a96f2567c3e..cf7207146bc 100644 --- a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupDialog.java +++ b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.combinationlookup; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -64,9 +66,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class CombinationLookupDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = CombinationLookupDialog.class; // For Translator @@ -112,7 +111,7 @@ public class CombinationLookupDialog extends BaseTransformDialog implements ITra private DatabaseMeta databaseMeta; private final List inputFields = new ArrayList<>(); - + /** List of ColumnInfo that should have the field names of the selected database table */ private final List tableFieldColumns = new ArrayList<>(); @@ -887,7 +886,8 @@ private void getTableName() { PKG, "CombinationLookupDialog.Log.LookingAtConnection", dbMeta.toString())); DatabaseExplorerDialog std = - new DatabaseExplorerDialog(shell, SWT.NONE, variables, dbMeta, pipelineMeta.getDatabases()); + new DatabaseExplorerDialog( + shell, SWT.NONE, variables, dbMeta, pipelineMeta.getDatabases()); std.setSelectedSchemaAndTable(wSchema.getText(), wTable.getText()); if (std.open()) { wSchema.setText(Const.NVL(std.getSchemaName(), "")); diff --git a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMeta.java b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMeta.java index 23bc000deaf..85e3f64bc48 100644 --- a/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMeta.java +++ b/plugins/transforms/combinationlookup/src/main/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.combinationlookup; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -44,9 +46,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "CombinationLookup", image = "combinationlookup.svg", @@ -129,8 +128,7 @@ public class CombinationLookupMeta injectionKeyDescription = "CombinationLookup.Injection.CACHE_SIZE") private int cacheSize; - @HopMetadataProperty - private CFields fields; + @HopMetadataProperty private CFields fields; public static final String CREATION_METHOD_AUTOINC = "autoinc"; public static final String CREATION_METHOD_SEQUENCE = "sequence"; @@ -149,7 +147,6 @@ public CombinationLookupMeta clone() { return new CombinationLookupMeta(this); } - @Override public void setDefault() { schemaName = ""; diff --git a/plugins/transforms/combinationlookup/src/test/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMetaTest.java b/plugins/transforms/combinationlookup/src/test/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMetaTest.java index be16bbd2b98..6a94f6653d7 100644 --- a/plugins/transforms/combinationlookup/src/test/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMetaTest.java +++ b/plugins/transforms/combinationlookup/src/test/java/org/apache/hop/pipeline/transforms/combinationlookup/CombinationLookupMetaTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.combinationlookup; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.database.Database; import org.apache.hop.core.exception.HopDatabaseException; @@ -30,8 +32,6 @@ import org.junit.Test; import org.mockito.Mockito; -import static org.junit.Assert.assertEquals; - public class CombinationLookupMetaTest { @Before public void setUpLoadSave() throws Exception { diff --git a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFields.java b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFields.java index 8bc9357bf9b..9f6627556ee 100644 --- a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFields.java +++ b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFields.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.concatfields; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -30,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; - public class ConcatFields extends BaseTransform { private static final Class PKG = ConcatFields.class; // For Translator diff --git a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsData.java b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsData.java index caa494ab9f9..39b851ada95 100644 --- a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsData.java +++ b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsData.java @@ -17,13 +17,11 @@ package org.apache.hop.pipeline.transforms.concatfields; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.List; - /* * ConcatFieldsData * diff --git a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsDialog.java b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsDialog.java index f7d2bf98e83..3b20a65b91c 100644 --- a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsDialog.java +++ b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.concatfields; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -55,9 +57,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - /* * ConcatFieldsDialog * @@ -191,7 +190,7 @@ public String open() { fdlSeparator.top = new FormAttachment(lastControl, margin); fdlSeparator.right = new FormAttachment(middle, -margin); wlSeparator.setLayoutData(fdlSeparator); - + Button wbSeparator = new Button(shell, SWT.PUSH | SWT.CENTER); PropsUi.setLook(wbSeparator); wbSeparator.setText(BaseMessages.getString(PKG, "ConcatFieldsDialog.Separator.Button")); diff --git a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMeta.java b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMeta.java index d0890139c08..0ab8ea67bf6 100644 --- a/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMeta.java +++ b/plugins/transforms/concatfields/src/main/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.concatfields; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,9 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /* * ConcatFieldsMeta */ diff --git a/plugins/transforms/concatfields/src/test/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMetaTest.java b/plugins/transforms/concatfields/src/test/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMetaTest.java index b43ba4c06e3..21f54c67e60 100644 --- a/plugins/transforms/concatfields/src/test/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMetaTest.java +++ b/plugins/transforms/concatfields/src/test/java/org/apache/hop/pipeline/transforms/concatfields/ConcatFieldsMetaTest.java @@ -18,11 +18,11 @@ package org.apache.hop.pipeline.transforms.concatfields; +import static org.junit.Assert.assertEquals; + import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class ConcatFieldsMetaTest { @Test diff --git a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/Constant.java b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/Constant.java index 99303e47b99..cfcbf20dab3 100644 --- a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/Constant.java +++ b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/Constant.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.constant; +import java.math.BigDecimal; +import java.net.InetAddress; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -34,12 +39,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.math.BigDecimal; -import java.net.InetAddress; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; - /** Generates a number of (empty or the same) rows */ public class Constant extends BaseTransform { private static final Class PKG = ConstantMeta.class; // For Translator @@ -82,7 +81,7 @@ public static final RowMetaAndData buildRow( String stringValue = field.getValue(); // If the value is empty: consider it to be NULL. - if (stringValue == null || stringValue.isEmpty() ) { + if (stringValue == null || stringValue.isEmpty()) { rowData[i] = null; if (value.getType() == IValueMeta.TYPE_NONE) { @@ -206,18 +205,22 @@ public static final RowMetaAndData buildRow( remarks.add(new CheckResult(ICheckResult.TYPE_RESULT_ERROR, message, null)); } break; - + case IValueMeta.TYPE_INET: try { rowData[i] = InetAddress.getByName(stringValue); } catch (Exception e) { String message = - BaseMessages.getString(PKG, "Constant.BuildRow.Error.Parsing.InternetAddress", - value.getName(), stringValue, e.toString()); + BaseMessages.getString( + PKG, + "Constant.BuildRow.Error.Parsing.InternetAddress", + value.getName(), + stringValue, + e.toString()); remarks.add(new CheckResult(ICheckResult.TYPE_RESULT_ERROR, message, null)); } break; - + default: String message = BaseMessages.getString( diff --git a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantData.java b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantData.java index 65610d55529..bdf1092f180 100644 --- a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantData.java +++ b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.constant; -import org.apache.hop.core.RowMetaAndData; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.text.DateFormatSymbols; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; +import org.apache.hop.core.RowMetaAndData; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class ConstantData extends BaseTransformData implements ITransformData { public NumberFormat nf; diff --git a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantDialog.java b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantDialog.java index 6a3d3c583ef..f90a2aa7221 100644 --- a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantDialog.java +++ b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.constant; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.row.value.ValueMetaFactory; @@ -43,8 +44,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class ConstantDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = ConstantMeta.class; // For Translator diff --git a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantField.java b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantField.java index 895175e0ddf..f97d58bd4e7 100644 --- a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantField.java +++ b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.constant; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class ConstantField { @@ -61,6 +60,7 @@ public class ConstantField { key = "precision", injectionKeyDescription = "ConstantMeta.Injection.FieldPrecision.Field") private int fieldPrecision; + /** Flag : set empty string */ @HopMetadataProperty( key = "set_empty_string", @@ -83,102 +83,142 @@ public ConstantField(String fieldName, String fieldType, boolean setEmptyString) this.value = ""; } - /** @return Returns the currency. */ + /** + * @return Returns the currency. + */ public String getCurrency() { return currency; } - /** @param currency The currency to set. */ + /** + * @param currency The currency to set. + */ public void setCurrency(String currency) { this.currency = currency; } - /** @return Returns the decimal. */ + /** + * @return Returns the decimal. + */ public String getDecimal() { return decimal; } - /** @param decimal The decimal to set. */ + /** + * @param decimal The decimal to set. + */ public void setDecimal(String decimal) { this.decimal = decimal; } - /** @return Returns the fieldFormat. */ + /** + * @return Returns the fieldFormat. + */ public String getFieldFormat() { return fieldFormat; } - /** @param fieldFormat The fieldFormat to set. */ + /** + * @param fieldFormat The fieldFormat to set. + */ public void setFieldFormat(String fieldFormat) { this.fieldFormat = fieldFormat; } - /** @return Returns the fieldLength. */ + /** + * @return Returns the fieldLength. + */ public int getFieldLength() { return fieldLength; } - /** @param fieldLength The fieldLength to set. */ + /** + * @param fieldLength The fieldLength to set. + */ public void setFieldLength(int fieldLength) { this.fieldLength = fieldLength; } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } - /** @return Returns the fieldPrecision. */ + /** + * @return Returns the fieldPrecision. + */ public int getFieldPrecision() { return fieldPrecision; } - /** @param fieldPrecision The fieldPrecision to set. */ + /** + * @param fieldPrecision The fieldPrecision to set. + */ public void setFieldPrecision(int fieldPrecision) { this.fieldPrecision = fieldPrecision; } - /** @return Returns the fieldType. */ + /** + * @return Returns the fieldType. + */ public String getFieldType() { return fieldType; } - /** @param fieldType The fieldType to set. */ + /** + * @param fieldType The fieldType to set. + */ public void setFieldType(String fieldType) { this.fieldType = fieldType; } - /** @return the setEmptyString */ + /** + * @return the setEmptyString + */ public boolean isEmptyString() { return emptyString; } - /** @param setEmptyString the setEmptyString to set */ + /** + * @param setEmptyString the setEmptyString to set + */ public void setEmptyString(boolean setEmptyString) { this.emptyString = setEmptyString; } - /** @return Returns the group. */ + /** + * @return Returns the group. + */ public String getGroup() { return group; } - /** @param group The group to set. */ + /** + * @param group The group to set. + */ public void setGroup(String group) { this.group = group; } - /** @return Returns the value. */ + /** + * @return Returns the value. + */ public String getValue() { return value; } - /** @param value The value to set. */ + /** + * @param value The value to set. + */ public void setValue(String value) { this.value = value; } diff --git a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantMeta.java b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantMeta.java index f7edb82228c..80ce93168a5 100644 --- a/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantMeta.java +++ b/plugins/transforms/constant/src/main/java/org/apache/hop/pipeline/transforms/constant/ConstantMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.constant; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "Constant", image = "constant.svg", diff --git a/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantMetaTest.java b/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantMetaTest.java index c290ea10279..05f3c1d571c 100644 --- a/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantMetaTest.java +++ b/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantMetaTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.constant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -33,14 +40,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class ConstantMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = ConstantMeta.class; diff --git a/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantTest.java b/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantTest.java index 4f292072af0..e372aa98177 100644 --- a/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantTest.java +++ b/plugins/transforms/constant/src/test/java/org/apache/hop/pipeline/transforms/constant/ConstantTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.constant; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.logging.ILoggingObject; @@ -31,13 +38,6 @@ import org.junit.Test; import org.mockito.Mockito; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class ConstantTest { private TransformMockHelper mockHelper; diff --git a/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMeta.java b/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMeta.java index c0ee0f6f5e9..4e67a847fa0 100644 --- a/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMeta.java +++ b/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMeta.java @@ -17,27 +17,23 @@ package org.apache.hop.pipeline.transforms.creditcardvalidator; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; -import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaBoolean; import org.apache.hop.core.row.value.ValueMetaString; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import org.w3c.dom.Node; - -import java.util.List; @Transform( id = "CreditCardValidator", @@ -47,24 +43,25 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Utility", keywords = "i18n::CreditCardValidatorMeta.keyword", documentationUrl = "/pipeline/transforms/creditcardvalidator.html") -public class CreditCardValidatorMeta extends BaseTransformMeta { +public class CreditCardValidatorMeta + extends BaseTransformMeta { private static final Class PKG = CreditCardValidatorMeta.class; // For Translator /** dynamic field */ - @HopMetadataProperty(key="fieldname") + @HopMetadataProperty(key = "fieldname") private String fieldName; - @HopMetadataProperty(key="cardtype") + @HopMetadataProperty(key = "cardtype") private String cardType; - @HopMetadataProperty(key="notvalidmsg") + @HopMetadataProperty(key = "notvalidmsg") private String notValidMessage; /** function result: new value name */ - @HopMetadataProperty(key="resultfieldname") + @HopMetadataProperty(key = "resultfieldname") private String resultFieldName; - @HopMetadataProperty(key="onlydigits") + @HopMetadataProperty(key = "onlydigits") private boolean onlyDigits; public CreditCardValidatorMeta() { diff --git a/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifier.java b/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifier.java index d860bf70e36..503972a8636 100644 --- a/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifier.java +++ b/plugins/transforms/creditcardvalidator/src/main/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifier.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.creditcardvalidator; -import org.apache.hop.core.util.Utils; -import org.apache.hop.i18n.BaseMessages; - import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.hop.core.util.Utils; +import org.apache.hop.i18n.BaseMessages; public class CreditCardVerifier { private static final Class PKG = CreditCardValidatorMeta.class; // For Translator diff --git a/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMetaTest.java b/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMetaTest.java index 32c77aa5540..8c64f3679c7 100644 --- a/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMetaTest.java +++ b/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardValidatorMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.creditcardvalidator; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.RowMeta; @@ -25,10 +29,6 @@ import org.junit.Assert; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class CreditCardValidatorMetaTest { @Test public void testLoadSave() throws Exception { diff --git a/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifierTest.java b/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifierTest.java index 6ca684983b9..52fec92ac57 100644 --- a/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifierTest.java +++ b/plugins/transforms/creditcardvalidator/src/test/java/org/apache/hop/pipeline/transforms/creditcardvalidator/CreditCardVerifierTest.java @@ -17,13 +17,13 @@ package org.apache.hop.pipeline.transforms.creditcardvalidator; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; +import org.junit.Test; + public class CreditCardVerifierTest { @Test diff --git a/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInput.java b/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInput.java index 249f4b8421d..17e64307102 100644 --- a/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInput.java +++ b/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInput.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.cubeinput; +import java.io.DataInputStream; +import java.io.IOException; +import java.net.SocketTimeoutException; +import java.util.zip.GZIPInputStream; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; import org.apache.hop.core.exception.HopEofException; @@ -30,11 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.DataInputStream; -import java.io.IOException; -import java.net.SocketTimeoutException; -import java.util.zip.GZIPInputStream; - public class CubeInput extends BaseTransform { private static final Class PKG = CubeInputMeta.class; // For Translator diff --git a/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputData.java b/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputData.java index 11c78b25907..666aeefff76 100644 --- a/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputData.java +++ b/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.cubeinput; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.DataInputStream; import java.io.InputStream; import java.util.zip.GZIPInputStream; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class CubeInputData extends BaseTransformData implements ITransformData { public InputStream fis; diff --git a/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMeta.java b/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMeta.java index 5198475ff42..dedf539c051 100644 --- a/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMeta.java +++ b/plugins/transforms/cubeinput/src/main/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMeta.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.cubeinput; +import java.io.DataInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import java.util.zip.GZIPInputStream; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -37,13 +43,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Map; -import java.util.zip.GZIPInputStream; - @Transform( id = "CubeInput", image = "cubeinput.svg", diff --git a/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/BaseParsingTest.java b/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/BaseParsingTest.java index 279a580de8f..5b88ff6e2aa 100644 --- a/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/BaseParsingTest.java +++ b/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/BaseParsingTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.cubeinput; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -39,15 +47,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** Base class for all tests for BaseFileInput transforms. */ @Ignore("No tests in abstract base class") public abstract class BaseParsingTest< diff --git a/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMetaTest.java b/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMetaTest.java index e38bb8bd9c9..aae2c9ee740 100644 --- a/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMetaTest.java +++ b/plugins/transforms/cubeinput/src/test/java/org/apache/hop/pipeline/transforms/cubeinput/CubeInputMetaTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.cubeinput; +import static org.apache.hop.core.util.Assert.assertNotNull; + import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import org.junit.Test; -import static org.apache.hop.core.util.Assert.assertNotNull; - public class CubeInputMetaTest { @Test diff --git a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java index 97735da901c..17a49731756 100644 --- a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java +++ b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.cubeoutput; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.zip.GZIPOutputStream; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ResultFile; import org.apache.hop.core.exception.HopException; @@ -29,10 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.zip.GZIPOutputStream; - /** * Outputs a stream/series of rows to a file, effectively building a sort of (compressed) microcube. */ @@ -172,15 +171,15 @@ public boolean init() { private void prepareFile() throws HopFileException { try { String filename = resolve(meta.getFilename()); - + FileObject fileObject = HopVfs.getFileObject(filename); - + // See if we need to create the parent folder(s)... // if (meta.isFilenameCreatingParentFolders()) { createParentFolder(fileObject.getParent()); } - + if (meta.isAddToResultFilenames()) { // Add this to the result file names... ResultFile resultFile = @@ -200,26 +199,28 @@ private void prepareFile() throws HopFileException { throw new HopFileException(e); } } - + private void createParentFolder(FileObject parentFolder) throws HopTransformException { - if ( parentFolder==null ) - return; - + if (parentFolder == null) return; + try { // See if we need to create the parent folder(s)... if (!parentFolder.exists()) { - + createParentFolder(parentFolder.getParent()); // Try to create the parent folder... parentFolder.createFolder(); if (log.isDebug()) { - logDebug(BaseMessages.getString(PKG, "CubeOutput.Log.ParentFolderCreated", parentFolder.getName())); + logDebug( + BaseMessages.getString( + PKG, "CubeOutput.Log.ParentFolderCreated", parentFolder.getName())); } } } catch (Exception e) { - throw new HopTransformException(BaseMessages.getString(PKG, - "CubeOutput.Error.ErrorCreatingParentFolder", parentFolder.getName())); + throw new HopTransformException( + BaseMessages.getString( + PKG, "CubeOutput.Error.ErrorCreatingParentFolder", parentFolder.getName())); } finally { if (parentFolder != null) { try { @@ -230,7 +231,7 @@ private void createParentFolder(FileObject parentFolder) throws HopTransformExce } } } - + @Override public void dispose() { if (data.oneFileOpened) { diff --git a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputData.java b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputData.java index 009bcd4e30c..680dc14bba8 100644 --- a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputData.java +++ b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.cubeoutput; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.DataOutputStream; import java.io.OutputStream; import java.util.zip.GZIPOutputStream; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class CubeOutputData extends BaseTransformData implements ITransformData { public OutputStream fos; diff --git a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputDialog.java b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputDialog.java index af25843f6f5..fdd51ddd344 100644 --- a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputDialog.java +++ b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputDialog.java @@ -146,8 +146,8 @@ public String open() { fdCreatingParentFolders.top = new FormAttachment(wlCreatingParentFolders, 0, SWT.CENTER); fdCreatingParentFolders.right = new FormAttachment(100, 0); wCreatingParentFolders.setLayoutData(fdCreatingParentFolders); - wCreatingParentFolders.addListener(SWT.Selection, e -> input.setChanged()); - + wCreatingParentFolders.addListener(SWT.Selection, e -> input.setChanged()); + // Open new File at Init // Label wlDoNotOpenNewFileInit = new Label(shell, SWT.RIGHT); @@ -168,7 +168,7 @@ public String open() { fdDoNotOpenNewFileInit.top = new FormAttachment(wlDoNotOpenNewFileInit, 0, SWT.CENTER); fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0); wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit); - wDoNotOpenNewFileInit.addListener(SWT.Selection, e -> input.setChanged()); + wDoNotOpenNewFileInit.addListener(SWT.Selection, e -> input.setChanged()); // Add File to the result files name // @@ -189,7 +189,7 @@ public String open() { fdAddToResult.top = new FormAttachment(wlAddToResult, 0, SWT.CENTER); fdAddToResult.right = new FormAttachment(100, 0); wAddToResult.setLayoutData(fdAddToResult); - wAddToResult.addListener(SWT.Selection, e -> input.setChanged()); + wAddToResult.addListener(SWT.Selection, e -> input.setChanged()); wOk = new Button(shell, SWT.PUSH); wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); diff --git a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java index a360568bd62..b318a31e68b 100644 --- a/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java +++ b/plugins/transforms/cubeoutput/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.cubeoutput; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -35,9 +37,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.util.List; -import java.util.Map; - @Transform( id = "CubeOutput", image = "cubeoutput.svg", @@ -55,7 +54,7 @@ public class CubeOutputMeta extends BaseTransformMeta PKG = DatabaseJoinMeta.class; // For Translator @@ -363,7 +362,7 @@ public void widgetSelected(SelectionEvent e) { protected void setComboBoxes() { // Something was changed in the row. - // + // String[] fieldNames = ConstUi.sortFieldNames(inputFields); ciKey[0].setComboValues(fieldNames); } diff --git a/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMeta.java b/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMeta.java index 812b227b25a..793521a9150 100644 --- a/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMeta.java +++ b/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.databasejoin; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -41,9 +43,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "DBJoin", image = "dbjoin.svg", @@ -119,42 +118,58 @@ public void setConnection(String connection) { this.connection = connection; } - /** @return Returns the outerJoin. */ + /** + * @return Returns the outerJoin. + */ public boolean isOuterJoin() { return outerJoin; } - /** @param outerJoin The outerJoin to set. */ + /** + * @param outerJoin The outerJoin to set. + */ public void setOuterJoin(boolean outerJoin) { this.outerJoin = outerJoin; } - /** @return Returns the replacevars. */ + /** + * @return Returns the replacevars. + */ public boolean isReplaceVariables() { return replaceVariables; } - /** @param enabled The replacevars to set. */ + /** + * @param enabled The replacevars to set. + */ public void setReplaceVariables(boolean enabled) { this.replaceVariables = enabled; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public int getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(int rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the sql. */ + /** + * @return Returns the sql. + */ public String getSql() { return sql; } - /** @param sql The sql to set. */ + /** + * @param sql The sql to set. + */ public void setSql(String sql) { this.sql = sql; } diff --git a/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/ParameterField.java b/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/ParameterField.java index 1ed6abe396b..6872679ce85 100644 --- a/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/ParameterField.java +++ b/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/ParameterField.java @@ -21,6 +21,7 @@ import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.metadata.api.HopMetadataProperty; + /** The parameters field. */ public class ParameterField implements Cloneable { diff --git a/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMetaTest.java b/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMetaTest.java index 24c63fabd18..3afdd4923a6 100644 --- a/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMetaTest.java +++ b/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinMetaTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.databasejoin; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -31,13 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class DatabaseJoinMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = DatabaseJoinMeta.class; diff --git a/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinTest.java b/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinTest.java index c23cabc7cd1..2c50f1a924d 100644 --- a/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinTest.java +++ b/plugins/transforms/databasejoin/src/test/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinTest.java @@ -17,20 +17,6 @@ package org.apache.hop.pipeline.transforms.databasejoin; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.pipeline.Pipeline; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; -import org.apache.hop.pipeline.transform.ITransformMeta; -import org.apache.hop.pipeline.transform.TransformMeta; -import org.apache.hop.pipeline.transform.TransformPartitioningMeta; -import org.junit.Before; -import org.junit.Test; - -import java.sql.Connection; -import java.sql.PreparedStatement; - import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertTrue; import static org.mockito.Matchers.any; @@ -43,6 +29,19 @@ import static org.mockito.Mockito.withSettings; import static org.powermock.api.mockito.PowerMockito.spy; +import java.sql.Connection; +import java.sql.PreparedStatement; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.pipeline.Pipeline; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; +import org.apache.hop.pipeline.transform.ITransformMeta; +import org.apache.hop.pipeline.transform.TransformMeta; +import org.apache.hop.pipeline.transform.TransformPartitioningMeta; +import org.junit.Before; +import org.junit.Test; + public class DatabaseJoinTest { DatabaseJoinMeta mockTransformMetaInterface; diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookup.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookup.java index 61ae2805c0f..018c3803a62 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookup.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookup.java @@ -18,6 +18,9 @@ package org.apache.hop.pipeline.transforms.databaselookup; import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; @@ -40,10 +43,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.databaselookup.readallcache.ReadAllCache; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - /** Looks up values in a database using keys from input streams. */ public class DatabaseLookup extends BaseTransform { @@ -170,8 +169,12 @@ synchronized Object[] lookupValues(IRowMeta inputRowMeta, Object[] row) throws H for (int i : data.trimIndexes) { IValueMeta expected = data.returnMeta.getValueMeta(i); add[i] = - expected.convertDataFromString( - (String) add[i], expected, "", "", ValueMetaBase.getTrimTypeByCode(data.returnTrimTypes[i])); + expected.convertDataFromString( + (String) add[i], + expected, + "", + "", + ValueMetaBase.getTrimTypeByCode(data.returnTrimTypes[i])); } // Only verify the data types if the data comes from the DB, NOT when we have a cache hit diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupData.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupData.java index 8bc4c7e9d71..153e5e3fd8e 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupData.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.databaselookup; +import java.util.List; import org.apache.hop.core.database.Database; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class DatabaseLookupData extends BaseTransformData implements ITransformData { public ICache cache; public Database db; diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupDialog.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupDialog.java index 79fe9ba5191..0be62d749c3 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupDialog.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupDialog.java @@ -532,40 +532,44 @@ private void setInputFieldCombo() { } private void setTableFieldCombo() { - shell.getDisplay().asyncExec(() -> { - if (!wTable.isDisposed() && !wConnection.isDisposed() && !wSchema.isDisposed()) { - final String tableName = wTable.getText(); - final String connectionName = wConnection.getText(); - final String schemaName = wSchema.getText(); - if (!Utils.isEmpty(tableName)) { - DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); - if (databaseMeta != null) { - try (Database database = new Database(loggingObject, variables, databaseMeta)) { - database.connect(); - - String schemaTable = - databaseMeta.getQuotedSchemaTableCombination(variables, schemaName, tableName); - IRowMeta rowMeta = database.getTableFields(schemaTable); - - if (null != rowMeta) { - String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); - if (null != fieldNames) { - for (ColumnInfo colInfo : tableFieldColumns) { - colInfo.setComboValues(fieldNames); + shell + .getDisplay() + .asyncExec( + () -> { + if (!wTable.isDisposed() && !wConnection.isDisposed() && !wSchema.isDisposed()) { + final String tableName = wTable.getText(); + final String connectionName = wConnection.getText(); + final String schemaName = wSchema.getText(); + if (!Utils.isEmpty(tableName)) { + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); + if (databaseMeta != null) { + try (Database database = new Database(loggingObject, variables, databaseMeta)) { + database.connect(); + + String schemaTable = + databaseMeta.getQuotedSchemaTableCombination( + variables, schemaName, tableName); + IRowMeta rowMeta = database.getTableFields(schemaTable); + + if (null != rowMeta) { + String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); + if (null != fieldNames) { + for (ColumnInfo colInfo : tableFieldColumns) { + colInfo.setComboValues(fieldNames); + } + } + } + } catch (Exception e) { + for (ColumnInfo colInfo : tableFieldColumns) { + colInfo.setComboValues(new String[] {}); + } + // ignore any errors here. drop downs will not be + // filled, but no problem for the user + } } } } - } catch (Exception e) { - for (ColumnInfo colInfo : tableFieldColumns) { - colInfo.setComboValues(new String[] {}); - } - // ignore any errors here. drop downs will not be - // filled, but no problem for the user - } - } - } - } - }); + }); } private void enableFields() { @@ -751,7 +755,8 @@ private void getlookup() { if (!Utils.isEmpty(wTable.getText())) { String schemaTable = - databaseMeta.getQuotedSchemaTableCombination(variables, wSchema.getText(), wTable.getText()); + databaseMeta.getQuotedSchemaTableCombination( + variables, wSchema.getText(), wTable.getText()); IRowMeta r = database.getTableFields(schemaTable); if (r != null && !r.isEmpty()) { diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMeta.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMeta.java index 303724c15e7..2642f750ba9 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMeta.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.databaselookup; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -43,11 +47,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - @Transform( id = "DBLookup", image = "dblookup.svg", diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DefaultCache.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DefaultCache.java index bf71a40ce54..6adffd2c50f 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DefaultCache.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/DefaultCache.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.databaselookup; -import org.apache.hop.core.RowMetaAndData; -import org.apache.hop.core.TimedRow; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; - import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; +import org.apache.hop.core.RowMetaAndData; +import org.apache.hop.core.TimedRow; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.IValueMeta; /** Old code, copied from {@linkplain DatabaseLookup} */ public class DefaultCache implements DatabaseLookupData.ICache { diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/KeyField.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/KeyField.java index 4b465ac5caf..956ee8249ae 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/KeyField.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/KeyField.java @@ -69,7 +69,9 @@ public String getStreamField1() { return streamField1; } - /** @param streamField1 The streamField1 to set */ + /** + * @param streamField1 The streamField1 to set + */ public void setStreamField1(String streamField1) { this.streamField1 = streamField1; } @@ -83,7 +85,9 @@ public String getStreamField2() { return streamField2; } - /** @param streamField2 The streamField2 to set */ + /** + * @param streamField2 The streamField2 to set + */ public void setStreamField2(String streamField2) { this.streamField2 = streamField2; } @@ -97,7 +101,9 @@ public String getCondition() { return condition; } - /** @param condition The condition to set */ + /** + * @param condition The condition to set + */ public void setCondition(String condition) { this.condition = condition; } @@ -111,7 +117,9 @@ public String getTableField() { return tableField; } - /** @param tableField The tableField to set */ + /** + * @param tableField The tableField to set + */ public void setTableField(String tableField) { this.tableField = tableField; } diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/Lookup.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/Lookup.java index 3f1a0e28d92..4fc22e91acf 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/Lookup.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/Lookup.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.databaselookup; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Lookup { /** what's the lookup schema name? */ @@ -98,7 +97,9 @@ public String getSchemaName() { return schemaName; } - /** @param schemaName The schemaName to set */ + /** + * @param schemaName The schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } @@ -112,7 +113,9 @@ public String getTableName() { return tableName; } - /** @param tableName The tableName to set */ + /** + * @param tableName The tableName to set + */ public void setTableName(String tableName) { this.tableName = tableName; } @@ -126,7 +129,9 @@ public List getKeyFields() { return keyFields; } - /** @param keyFields The keyFields to set */ + /** + * @param keyFields The keyFields to set + */ public void setKeyFields(List keyFields) { this.keyFields = keyFields; } @@ -140,7 +145,9 @@ public List getReturnValues() { return returnValues; } - /** @param returnValues The returnValues to set */ + /** + * @param returnValues The returnValues to set + */ public void setReturnValues(List returnValues) { this.returnValues = returnValues; } @@ -154,7 +161,9 @@ public String getOrderByClause() { return orderByClause; } - /** @param orderByClause The orderByClause to set */ + /** + * @param orderByClause The orderByClause to set + */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } @@ -168,7 +177,9 @@ public boolean isFailingOnMultipleResults() { return failingOnMultipleResults; } - /** @param failingOnMultipleResults The failingOnMultipleResults to set */ + /** + * @param failingOnMultipleResults The failingOnMultipleResults to set + */ public void setFailingOnMultipleResults(boolean failingOnMultipleResults) { this.failingOnMultipleResults = failingOnMultipleResults; } @@ -182,7 +193,9 @@ public boolean isEatingRowOnLookupFailure() { return eatingRowOnLookupFailure; } - /** @param eatingRowOnLookupFailure The eatingRowOnLookupFailure to set */ + /** + * @param eatingRowOnLookupFailure The eatingRowOnLookupFailure to set + */ public void setEatingRowOnLookupFailure(boolean eatingRowOnLookupFailure) { this.eatingRowOnLookupFailure = eatingRowOnLookupFailure; } diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/ReturnValue.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/ReturnValue.java index 1b251e3aeaf..5e34f412239 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/ReturnValue.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/ReturnValue.java @@ -79,7 +79,9 @@ public String getTableField() { return tableField; } - /** @param tableField The tableField to set */ + /** + * @param tableField The tableField to set + */ public void setTableField(String tableField) { this.tableField = tableField; } @@ -93,7 +95,9 @@ public String getNewName() { return newName; } - /** @param newName The newName to set */ + /** + * @param newName The newName to set + */ public void setNewName(String newName) { this.newName = newName; } @@ -107,7 +111,9 @@ public String getDefaultValue() { return defaultValue; } - /** @param defaultValue The defaultValue to set */ + /** + * @param defaultValue The defaultValue to set + */ public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } @@ -121,7 +127,9 @@ public String getDefaultType() { return defaultType; } - /** @param defaultType The defaultType to set */ + /** + * @param defaultType The defaultType to set + */ public void setDefaultType(String defaultType) { this.defaultType = defaultType; } diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndex.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndex.java index ad446231706..c985a242df3 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndex.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndex.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; +import java.util.BitSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; -import java.util.BitSet; - class EqIndex extends Index { static Index nonEqualityIndex(int column, IValueMeta valueMeta, int rowsAmount) { diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndex.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndex.java index 25d252e5755..c3ceb3a2750 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndex.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndex.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.apache.hop.core.row.IValueMeta; - import java.util.BitSet; +import org.apache.hop.core.row.IValueMeta; class GtIndex extends Index { diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/Index.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/Index.java index 23be00569bb..75bb712a089 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/Index.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/Index.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; +import java.util.Arrays; +import java.util.Comparator; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IValueMeta; -import java.util.Arrays; -import java.util.Comparator; - abstract class Index { final int column; diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndex.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndex.java index 26f590e6d8d..b3f210e8e7f 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndex.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndex.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.IValueMeta; - import java.util.BitSet; import java.util.Comparator; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.IValueMeta; class IsNullIndex extends Index implements Comparator { diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndex.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndex.java index 0ae6a505d1b..ccb52937c64 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndex.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndex.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.apache.hop.core.row.IValueMeta; - import java.util.BitSet; +import org.apache.hop.core.row.IValueMeta; class LtIndex extends Index { diff --git a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCache.java b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCache.java index bde3095a34a..e46aa5b3b4b 100644 --- a/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCache.java +++ b/plugins/transforms/databaselookup/src/main/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCache.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; +import java.util.PriorityQueue; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.transforms.databaselookup.DatabaseLookupData; import org.apache.hop.pipeline.transforms.databaselookup.DatabaseLookupMeta; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; -import java.util.PriorityQueue; - /** * This is a read-only array-based cache to be used in {@linkplain * org.apache.hop.pipeline.transforms.databaselookup.DatabaseLookup DatabaseLookup} when "Load All diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMetaTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMetaTest.java index d08a4313df8..7ee272db76e 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMetaTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupMetaTest.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.databaselookup; +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.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.database.DatabaseMeta; @@ -38,19 +50,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class DatabaseLookupMetaTest { private DatabaseLookupMeta databaseLookupMeta; diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupUTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupUTest.java index f44650ce0a5..40aa89bec2c 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupUTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/DatabaseLookupUTest.java @@ -17,6 +17,34 @@ package org.apache.hop.pipeline.transforms.databaselookup; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.nullable; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockingDetails; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.Arrays; +import java.util.Collections; +import java.util.concurrent.TimeUnit; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.IRowSet; import org.apache.hop.core.database.Database; @@ -48,35 +76,6 @@ import org.mockito.ArgumentMatchers; import org.mockito.Mockito; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.util.Arrays; -import java.util.Collections; -import java.util.concurrent.TimeUnit; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.nullable; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.mockingDetails; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class DatabaseLookupUTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndexTest.java index dfe96486987..d9ea7816339 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/EqIndexTest.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.fail; import java.util.BitSet; import java.util.List; - -import static org.junit.Assert.fail; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class EqIndexTest extends IndexTestBase { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GeIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GeIndexTest.java index 3f1495dbd84..4a2e95a9ea2 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GeIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GeIndexTest.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.apache.hop.core.row.IValueMeta; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.fail; import java.util.BitSet; import java.util.List; - -import static org.junit.Assert.fail; +import org.apache.hop.core.row.IValueMeta; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class GeIndexTest extends IndexTestBase { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndexTest.java index d0d1b685ae4..6c19bb83f7a 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/GtIndexTest.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.fail; import java.util.BitSet; import java.util.List; - -import static org.junit.Assert.fail; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class GtIndexTest extends IndexTestBase { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IndexTestBase.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IndexTestBase.java index a26660b6026..a43a0e13b9a 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IndexTestBase.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IndexTestBase.java @@ -17,20 +17,19 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Arrays; +import java.util.BitSet; +import java.util.List; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaInteger; import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.Arrays; -import java.util.BitSet; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - /** * This is a base class for several similar cases. All of them are checking how indexes work with * the same tuple of data: [0, 1, 2, 2, 3]. Since the data set is known, each subclass show diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndexTest.java index 26aae95dbb2..7cae8034fb8 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/IsNullIndexTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Arrays; +import java.util.BitSet; +import java.util.List; import org.apache.hop.core.row.value.ValueMetaInteger; import org.junit.After; import org.junit.Before; @@ -24,16 +33,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.util.Arrays; -import java.util.BitSet; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - @RunWith(Parameterized.class) public class IsNullIndexTest { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LeIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LeIndexTest.java index ded02530bca..27799f1d601 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LeIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LeIndexTest.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.apache.hop.core.row.IValueMeta; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.fail; import java.util.BitSet; import java.util.List; - -import static org.junit.Assert.fail; +import org.apache.hop.core.row.IValueMeta; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class LeIndexTest extends IndexTestBase { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndexTest.java index 2c7a1d48801..7058d2e029c 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/LtIndexTest.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.fail; import java.util.BitSet; import java.util.List; - -import static org.junit.Assert.fail; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class LtIndexTest extends IndexTestBase { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/NeIndexTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/NeIndexTest.java index 50f0b226a5b..6edf024213d 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/NeIndexTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/NeIndexTest.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.apache.hop.core.row.IValueMeta; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.fail; import java.util.BitSet; import java.util.List; - -import static org.junit.Assert.fail; +import org.apache.hop.core.row.IValueMeta; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class NeIndexTest extends IndexTestBase { diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCacheTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCacheTest.java index 340057f49cd..5ad800eef88 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCacheTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/ReadAllCacheTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertNull; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.StringTokenizer; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.row.value.ValueMetaDate; import org.apache.hop.core.row.value.ValueMetaInteger; @@ -27,14 +34,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.StringTokenizer; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertNull; - public class ReadAllCacheTest { private DatabaseLookupData transformData; diff --git a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/SearchingContextTest.java b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/SearchingContextTest.java index b9954cc6d03..6f62f42a6c4 100644 --- a/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/SearchingContextTest.java +++ b/plugins/transforms/databaselookup/src/test/java/org/apache/hop/pipeline/transforms/databaselookup/readallcache/SearchingContextTest.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.databaselookup.readallcache; -import org.junit.Test; - -import java.util.BitSet; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.BitSet; +import org.junit.Test; + public class SearchingContextTest { @Test diff --git a/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDataMeta.java b/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDataMeta.java index 3ab4acf61d6..0131a67df26 100644 --- a/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDataMeta.java +++ b/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDataMeta.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.datagrid; -import org.apache.hop.core.Const; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.apache.hop.core.Const; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DataGridDataMeta implements Cloneable { diff --git a/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDialog.java b/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDialog.java index 4b050cc4136..3af86bfd79c 100644 --- a/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDialog.java +++ b/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.datagrid; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; import org.apache.commons.collections4.CollectionUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -58,11 +62,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - public class DataGridDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = DataGridMeta.class; // For Translator diff --git a/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridMeta.java b/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridMeta.java index ccc7da64fab..29cb2e8ad07 100644 --- a/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridMeta.java +++ b/plugins/transforms/datagrid/src/main/java/org/apache/hop/pipeline/transforms/datagrid/DataGridMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.datagrid; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "DataGrid", image = "datagrid.svg", diff --git a/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProc.java b/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProc.java index 766b71fdf1d..748095862ae 100644 --- a/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProc.java +++ b/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProc.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.dbproc; +import java.sql.SQLException; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.RowMetaAndData; @@ -34,9 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.SQLException; -import java.util.List; - /** Retrieves values from a database by calling database stored procedures or functions */ public class DBProc extends BaseTransform { private static final Class PKG = DBProcMeta.class; // For Translator diff --git a/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcDialog.java b/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcDialog.java index abaa5e9b332..6c4b0008935 100644 --- a/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcDialog.java +++ b/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.dbproc; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -55,8 +57,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; public class DBProcDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = DBProcMeta.class; // For Translator @@ -311,7 +311,7 @@ public String open() { private void selectProcedure(Event event) { DatabaseMeta databaseMeta = pipelineMeta.findDatabase(wConnection.getText(), variables); - if (databaseMeta != null) { + if (databaseMeta != null) { try (Database db = new Database(loggingObject, variables, databaseMeta)) { db.connect(); String[] procs = db.getProcedures(); diff --git a/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcMeta.java b/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcMeta.java index 4ee1dc924fa..71494bebfed 100644 --- a/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcMeta.java +++ b/plugins/transforms/dbproc/src/main/java/org/apache/hop/pipeline/transforms/dbproc/DBProcMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.dbproc; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,9 +41,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "DBProc", image = "dbproc.svg", @@ -56,7 +55,7 @@ public class DBProcMeta extends BaseTransformMeta { /** database connection */ @HopMetadataProperty(key = "connection") private String connection; - + /** procedure name to be called */ @HopMetadataProperty private String procedure; @@ -162,9 +161,7 @@ public void check( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( - PKG, - "DBProcMeta.CheckResult.DatabaseMetaError", - variables.resolve(connection)), + PKG, "DBProcMeta.CheckResult.DatabaseMetaError", variables.resolve(connection)), transformMeta); remarks.add(cr); } @@ -224,13 +221,13 @@ public void check( BaseMessages.getString(PKG, "DBProcMeta.CheckResult.CouldNotReadFields") + Const.CR; cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); remarks.add(cr); - } + } } catch (HopException e) { errorMessage = BaseMessages.getString(PKG, "DBProcMeta.CheckResult.ErrorOccurred") + e.getMessage(); cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); remarks.add(cr); - } + } } else { errorMessage = BaseMessages.getString(PKG, "DBProcMeta.CheckResult.InvalidConnection"); cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); diff --git a/plugins/transforms/delay/src/main/java/org/apache/hop/pipeline/transforms/delay/DelayMeta.java b/plugins/transforms/delay/src/main/java/org/apache/hop/pipeline/transforms/delay/DelayMeta.java index 00e8ffa16ca..51f3777e8cb 100644 --- a/plugins/transforms/delay/src/main/java/org/apache/hop/pipeline/transforms/delay/DelayMeta.java +++ b/plugins/transforms/delay/src/main/java/org/apache/hop/pipeline/transforms/delay/DelayMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.delay; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,8 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "Delay", image = "delay.svg", diff --git a/plugins/transforms/delay/src/test/java/org/apache/hop/pipeline/transforms/delay/DelayMetaTest.java b/plugins/transforms/delay/src/test/java/org/apache/hop/pipeline/transforms/delay/DelayMetaTest.java index 11cc0f8b9af..48e5a7e21c4 100644 --- a/plugins/transforms/delay/src/test/java/org/apache/hop/pipeline/transforms/delay/DelayMetaTest.java +++ b/plugins/transforms/delay/src/test/java/org/apache/hop/pipeline/transforms/delay/DelayMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.delay; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class DelayMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/Delete.java b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/Delete.java index 347574380f5..a78a3322a6a 100644 --- a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/Delete.java +++ b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/Delete.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.delete; +import java.sql.SQLException; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -32,9 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.SQLException; -import java.util.List; - /** Delete data in a database table. */ public class Delete extends BaseTransform { diff --git a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteData.java b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteData.java index 6343b62f191..6b8e4220f0b 100644 --- a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteData.java +++ b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.delete; +import java.sql.PreparedStatement; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.sql.PreparedStatement; - public class DeleteData extends BaseTransformData implements ITransformData { public Database db; diff --git a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteDialog.java b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteDialog.java index cec6b615a90..98df4b03ea6 100644 --- a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteDialog.java +++ b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.delete; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; @@ -57,10 +60,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class DeleteDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = DeleteMeta.class; // For Translator @@ -413,7 +412,7 @@ private void setTableFieldCombo() { colInfo.setComboValues(new String[] {}); } if (!Utils.isEmpty(tableName)) { - DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName,variables); + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); if (databaseMeta != null) { Database database = new Database(loggingObject, variables, databaseMeta); try { @@ -497,7 +496,7 @@ private void ok() { } private void getSchemaNames() { - DatabaseMeta databaseMeta = pipelineMeta.findDatabase(wConnection.getText(),variables); + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(wConnection.getText(), variables); if (databaseMeta != null) { Database database = new Database(loggingObject, variables, databaseMeta); try { @@ -543,7 +542,7 @@ private void getTableName() { if (StringUtils.isEmpty(connectionName)) { return; } - DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName,variables); + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); if (databaseMeta != null) { logDebug( BaseMessages.getString(PKG, "DeleteDialog.Log.LookingAtConnection") diff --git a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteKeyField.java b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteKeyField.java index da936a6a9fa..f401853680c 100644 --- a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteKeyField.java +++ b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteKeyField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.delete; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DeleteKeyField { diff --git a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteLookupField.java b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteLookupField.java index c934d9cde37..2e6cfb7fb67 100644 --- a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteLookupField.java +++ b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteLookupField.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.delete; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DeleteLookupField { @@ -61,12 +60,16 @@ public DeleteLookupField(String schemaName, String tableName, List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteMeta.java b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteMeta.java index b3110b5b4db..76bcb645cf9 100644 --- a/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteMeta.java +++ b/plugins/transforms/delete/src/main/java/org/apache/hop/pipeline/transforms/delete/DeleteMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.delete; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -39,8 +40,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** * This class takes care of deleting values in a table using a certain condition and values for * input. @@ -84,7 +83,9 @@ public void setConnection(String connection) { this.connection = connection; } - /** @return Returns the commitSize. */ + /** + * @return Returns the commitSize. + */ public String getCommitSizeVar() { return commitSize; } @@ -112,7 +113,9 @@ public int getCommitSize(IVariables vs) { return Integer.parseInt(vs.resolve(commitSize)); } - /** @param commitSize The commitSize to set. */ + /** + * @param commitSize The commitSize to set. + */ public void setCommitSize(String commitSize) { this.commitSize = commitSize; } diff --git a/plugins/transforms/delete/src/test/java/org/apache/hop/pipeline/transforms/delete/DeleteMetaTest.java b/plugins/transforms/delete/src/test/java/org/apache/hop/pipeline/transforms/delete/DeleteMetaTest.java index 1215485cc2d..d94c60370d9 100644 --- a/plugins/transforms/delete/src/test/java/org/apache/hop/pipeline/transforms/delete/DeleteMetaTest.java +++ b/plugins/transforms/delete/src/test/java/org/apache/hop/pipeline/transforms/delete/DeleteMetaTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.delete; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -39,17 +49,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - public class DeleteMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = DeleteMeta.class; diff --git a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/Denormaliser.java b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/Denormaliser.java index b2592241c80..b36ba4fc77c 100644 --- a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/Denormaliser.java +++ b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/Denormaliser.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.denormaliser; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -35,15 +43,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Set; - /** Denormalises data based on key-value pairs */ public class Denormaliser extends BaseTransform { diff --git a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserData.java b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserData.java index 18ca8973e3b..d26d8a9a797 100644 --- a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserData.java +++ b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.denormaliser; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.util.Hashtable; import java.util.List; import java.util.Map; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; /** Data structure used by Denormaliser during processing */ public class DenormaliserData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserDialog.java b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserDialog.java index fe35f8f029c..1f542faccbc 100644 --- a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserDialog.java +++ b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserDialog.java @@ -277,31 +277,33 @@ public String open() { wCancel.addListener(SWT.Selection, e -> cancel()); getData(); - + // Search the fields in the background - shell.getDisplay().asyncExec(() -> { - String keyValue = wKeyField.getText(); - try { - IRowMeta rowMeta = pipelineMeta.getPrevTransformFields(variables, transformName); - - if (rowMeta != null) { - String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); - - for (String fieldName:fieldNames) { - wKeyField.add(fieldName); - } - ciKey[0].setComboValues(fieldNames); - ciTarget[1].setComboValues(fieldNames); - } - } catch (Exception e) { - logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); - } - finally { - if (keyValue != null) { - wKeyField.setText(keyValue); - } - } - }); + shell + .getDisplay() + .asyncExec( + () -> { + String keyValue = wKeyField.getText(); + try { + IRowMeta rowMeta = pipelineMeta.getPrevTransformFields(variables, transformName); + + if (rowMeta != null) { + String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); + + for (String fieldName : fieldNames) { + wKeyField.add(fieldName); + } + ciKey[0].setComboValues(fieldNames); + ciTarget[1].setComboValues(fieldNames); + } + } catch (Exception e) { + logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); + } finally { + if (keyValue != null) { + wKeyField.setText(keyValue); + } + } + }); BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); diff --git a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserMeta.java b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserMeta.java index 2e47571cdf4..798d46e5ffb 100644 --- a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserMeta.java +++ b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.denormaliser; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -32,9 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "Denormaliser", image = "denormaliser.svg", @@ -82,32 +81,44 @@ public DenormaliserMeta clone() { return meta; } - /** @return Returns the keyField. */ + /** + * @return Returns the keyField. + */ public String getKeyField() { return keyField; } - /** @param keyField The keyField to set. */ + /** + * @param keyField The keyField to set. + */ public void setKeyField(String keyField) { this.keyField = keyField; } - /** @return Returns the groupField. */ + /** + * @return Returns the groupField. + */ public List getGroupFields() { return groupFields; } - /** @param groupFields The groupField to set. */ + /** + * @param groupFields The groupField to set. + */ public void setGroupFields(List groupFields) { this.groupFields = groupFields; } - /** @return Return the Targetfields */ + /** + * @return Return the Targetfields + */ public List getDenormaliserTargetFields() { return denormaliserTargetFields; } - /** @param denormaliserTargetFields the denormaliserTargetField to set */ + /** + * @param denormaliserTargetFields the denormaliserTargetField to set + */ public void setDenormaliserTargetFields(List denormaliserTargetFields) { this.denormaliserTargetFields = denormaliserTargetFields; } diff --git a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTargetField.java b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTargetField.java index 8bb0e6dee7f..041ab86b78a 100644 --- a/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTargetField.java +++ b/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTargetField.java @@ -233,112 +233,156 @@ public DenormaliserTargetField clone() { return new DenormaliserTargetField(this); } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } - /** @return Returns the targetFormat. */ + /** + * @return Returns the targetFormat. + */ public String getTargetFormat() { return targetFormat; } - /** @param targetFormat The targetFormat to set. */ + /** + * @param targetFormat The targetFormat to set. + */ public void setTargetFormat(String targetFormat) { this.targetFormat = targetFormat; } - /** @return Returns the keyValue. */ + /** + * @return Returns the keyValue. + */ public String getKeyValue() { return keyValue; } - /** @param keyValue The keyValue to set. */ + /** + * @param keyValue The keyValue to set. + */ public void setKeyValue(String keyValue) { this.keyValue = keyValue; } - /** @return Returns the targetCurrencySymbol. */ + /** + * @return Returns the targetCurrencySymbol. + */ public String getTargetCurrencySymbol() { return targetCurrencySymbol; } - /** @param targetCurrencySymbol The targetCurrencySymbol to set. */ + /** + * @param targetCurrencySymbol The targetCurrencySymbol to set. + */ public void setTargetCurrencySymbol(String targetCurrencySymbol) { this.targetCurrencySymbol = targetCurrencySymbol; } - /** @return Returns the targetDecimalSymbol. */ + /** + * @return Returns the targetDecimalSymbol. + */ public String getTargetDecimalSymbol() { return targetDecimalSymbol; } - /** @param targetDecimalSymbol The targetDecimalSymbol to set. */ + /** + * @param targetDecimalSymbol The targetDecimalSymbol to set. + */ public void setTargetDecimalSymbol(String targetDecimalSymbol) { this.targetDecimalSymbol = targetDecimalSymbol; } - /** @return Returns the targetGroupingSymbol. */ + /** + * @return Returns the targetGroupingSymbol. + */ public String getTargetGroupingSymbol() { return targetGroupingSymbol; } - /** @param targetGroupingSymbol The targetGroupingSymbol to set. */ + /** + * @param targetGroupingSymbol The targetGroupingSymbol to set. + */ public void setTargetGroupingSymbol(String targetGroupingSymbol) { this.targetGroupingSymbol = targetGroupingSymbol; } - /** @return Returns the targetLength. */ + /** + * @return Returns the targetLength. + */ public int getTargetLength() { return targetLength; } - /** @param targetLength The targetLength to set. */ + /** + * @param targetLength The targetLength to set. + */ public void setTargetLength(int targetLength) { this.targetLength = targetLength; } - /** @return Returns the targetName. */ + /** + * @return Returns the targetName. + */ public String getTargetName() { return targetName; } - /** @param targetName The targetName to set. */ + /** + * @param targetName The targetName to set. + */ public void setTargetName(String targetName) { this.targetName = targetName; } - /** @return Returns the targetNullString. */ + /** + * @return Returns the targetNullString. + */ public String getTargetNullString() { return targetNullString; } - /** @param targetNullString The targetNullString to set. */ + /** + * @param targetNullString The targetNullString to set. + */ public void setTargetNullString(String targetNullString) { this.targetNullString = targetNullString; } - /** @return Returns the targetPrecision. */ + /** + * @return Returns the targetPrecision. + */ public int getTargetPrecision() { return targetPrecision; } - /** @param targetPrecision The targetPrecision to set. */ + /** + * @param targetPrecision The targetPrecision to set. + */ public void setTargetPrecision(int targetPrecision) { this.targetPrecision = targetPrecision; } - /** @return Returns the targetType. */ + /** + * @return Returns the targetType. + */ public String getTargetType() { return targetType; } - /** @param targetType The targetType to set. */ + /** + * @param targetType The targetType to set. + */ public void setTargetType(String targetType) { this.targetType = targetType; } diff --git a/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserAggregationsTest.java b/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserAggregationsTest.java index 2b90c4e76a3..fd214dab9c2 100644 --- a/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserAggregationsTest.java +++ b/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserAggregationsTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.denormaliser; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.logging.ILoggingObject; @@ -33,14 +40,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class DenormaliserAggregationsTest { static final String JUNIT = "JUNIT"; diff --git a/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTest.java b/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTest.java index 104ec7177a7..e41b7cebfa2 100644 --- a/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTest.java +++ b/plugins/transforms/denormaliser/src/test/java/org/apache/hop/pipeline/transforms/denormaliser/DenormaliserTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.denormaliser; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowMeta; @@ -29,14 +36,6 @@ import org.junit.Before; import org.junit.Test; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class DenormaliserTest { private TransformMockHelper mockHelper; diff --git a/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamData.java b/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamData.java index 977ecf36c5e..3dcbfe6c9a2 100644 --- a/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamData.java +++ b/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamData.java @@ -23,7 +23,7 @@ public class DetectEmptyStreamData extends BaseTransformData implements ITransformData { IRowMeta outputRowMeta; - + public DetectEmptyStreamData() { super(); } diff --git a/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamMeta.java b/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamMeta.java index 60cf087c1bf..8ba041f6b59 100644 --- a/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamMeta.java +++ b/plugins/transforms/detectemptystream/src/main/java/org/apache/hop/pipeline/transforms/detectemptystream/DetectEmptyStreamMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.detectemptystream; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,8 +32,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "DetectEmptyStream", image = "detectemptystream.svg", @@ -41,7 +40,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow", keywords = "i18n::DetectEmptyStreamMeta.keyword", documentationUrl = "/pipeline/transforms/detectemptystream.html") -public class DetectEmptyStreamMeta extends BaseTransformMeta { +public class DetectEmptyStreamMeta + extends BaseTransformMeta { private static final Class PKG = DetectEmptyStreamMeta.class; // For Translator public DetectEmptyStreamMeta() { diff --git a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java index a700cddb2c5..887b571ee90 100644 --- a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java +++ b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java @@ -35,7 +35,7 @@ public class DetectLastRowData extends BaseTransformData implements ITransformDa public DetectLastRowData() { super(); } - + /** Return a array with a constant True. */ public Object[] getTrueArray() { return trueArray; diff --git a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java index c561f8d00a7..725f2d9c22f 100644 --- a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java +++ b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.detectlastrow; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -34,8 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "DetectLastRow", image = "detectlastrow.svg", @@ -51,12 +50,16 @@ public class DetectLastRowMeta extends BaseTransformMeta getRowCache() { return rowCache; } - /** @param rowCache the rowCache to set */ + /** + * @param rowCache the rowCache to set + */ public void setRowCache(List rowCache) { this.rowCache = rowCache; } - /** @return the keyIndexes */ + /** + * @return the keyIndexes + */ public int[] getKeyIndexes() { return keyIndexes; } - /** @param keyIndexes the keyIndexes to set */ + /** + * @param keyIndexes the keyIndexes to set + */ public void setKeyIndexes(int[] keyIndexes) { this.keyIndexes = keyIndexes; } - /** @return the fromDateIndex */ + /** + * @return the fromDateIndex + */ public int getFromDateIndex() { return fromDateIndex; } - /** @param fromDateIndex the fromDateIndex to set */ + /** + * @param fromDateIndex the fromDateIndex to set + */ public void setFromDateIndex(int fromDateIndex) { this.fromDateIndex = fromDateIndex; } - /** @return the toDateIndex */ + /** + * @return the toDateIndex + */ public int getToDateIndex() { return toDateIndex; } - /** @param toDateIndex the toDateIndex to set */ + /** + * @param toDateIndex the toDateIndex to set + */ public void setToDateIndex(int toDateIndex) { this.toDateIndex = toDateIndex; } diff --git a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookup.java b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookup.java index 670b1e66bed..76604ff2798 100644 --- a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookup.java +++ b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookup.java @@ -148,8 +148,9 @@ public boolean processRow() throws HopException { if (isLookupOrUpdateTypeWithArgument(meta.isUpdate(), field)) { data.fieldnrs[i] = data.outputRowMeta.indexOfValue(field.getName()); if (data.fieldnrs[i] < 0) { - throw new HopTransformException(BaseMessages.getString(PKG, - "DimensionLookup.Exception.KeyFieldNotFound", field.getName())); + throw new HopTransformException( + BaseMessages.getString( + PKG, "DimensionLookup.Exception.KeyFieldNotFound", field.getName())); } } else { data.fieldnrs[i] = -1; @@ -234,7 +235,8 @@ public boolean processRow() throws HopException { return true; } - public boolean isLookupOrUpdateTypeWithArgument(final boolean update, final DLField field) throws HopTransformException { + public boolean isLookupOrUpdateTypeWithArgument(final boolean update, final DLField field) + throws HopTransformException { // Lookup if (!update) { return true; @@ -243,12 +245,13 @@ public boolean isLookupOrUpdateTypeWithArgument(final boolean update, final DLFi // Update type field DimensionUpdateType updateType = field.getUpdateType(); if (updateType == null) { - throw new HopTransformException(BaseMessages.getString( - PKG, "DimensionLookup.Exception.MissingUpdateTypeField ", field.getName())); - } + throw new HopTransformException( + BaseMessages.getString( + PKG, "DimensionLookup.Exception.MissingUpdateTypeField ", field.getName())); + } return updateType.isWithArgument(); } - + private Date determineDimensionUpdatedDate(Object[] row) throws HopException { if (data.datefieldnr < 0) { return getPipeline().getExecutionStartDate(); // start of pipeline... @@ -869,7 +872,8 @@ private void setDimLookup(IRowMeta rowMeta) throws HopException { for (DLField field : f.getFields()) { // Don't retrieve the fields without input - if (StringUtils.isNotEmpty(field.getLookup()) && isLookupOrUpdateTypeWithArgument(meta.isUpdate(), field)) { + if (StringUtils.isNotEmpty(field.getLookup()) + && isLookupOrUpdateTypeWithArgument(meta.isUpdate(), field)) { sql += ", " + databaseMeta.quoteField(field.getLookup()); if (StringUtils.isNotEmpty(field.getName()) && !field.getLookup().equals(field.getName())) { @@ -1446,7 +1450,7 @@ public void dimPunchThrough(IRowMeta rowMeta, Object[] row) throws HopDatabaseEx data.punchThroughRowMeta.addValueMeta(rowMeta.getValueMeta(data.fieldnrs[i])); } } - + // The special update fields... // for (DLField field : f.getFields()) { @@ -1463,8 +1467,8 @@ public void dimPunchThrough(IRowMeta rowMeta, Object[] row) throws HopDatabaseEx sqlUpdate += ", " + databaseMeta.quoteField(valueMeta.getName()) + " = ?" + Const.CR; data.punchThroughRowMeta.addValueMeta(valueMeta); } - } - + } + sqlUpdate += "WHERE "; for (int i = 0; i < f.getKeys().size(); i++) { DLKey key = f.getKeys().get(i); @@ -1500,7 +1504,7 @@ public void dimPunchThrough(IRowMeta rowMeta, Object[] row) throws HopDatabaseEx break; default: break; - } + } } for (int i = 0; i < data.keynrs.length; i++) { @@ -1692,16 +1696,16 @@ private Object[] getFromCache(Object[] keyValues, Date dateValue) throws HopValu long time = dateValue.getTime(); long from = 0L; long to = 0L; - + Date dateFrom = (Date) row[row.length - 2]; - if ( dateFrom!=null ) { + if (dateFrom != null) { from = dateFrom.getTime(); - } + } Date dateTo = (Date) row[row.length - 1]; - if ( dateTo!=null ) { + if (dateTo != null) { to = dateTo.getTime(); } - + if (time >= from && time < to) { // sanity check to see if we have the right version if (isRowLevel()) { logRowlevel( diff --git a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupData.java b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupData.java index 42748e8c244..e6d71c987c8 100644 --- a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupData.java +++ b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.dimensionlookup; +import java.sql.PreparedStatement; +import java.util.Date; +import java.util.List; import org.apache.hop.core.database.Database; import org.apache.hop.core.hash.ByteArrayHashMap; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.sql.PreparedStatement; -import java.util.Date; -import java.util.List; - public class DimensionLookupData extends BaseTransformData implements ITransformData { public Date valueDateNow; diff --git a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupDialog.java b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupDialog.java index 74ecc66c17a..094c23175d3 100644 --- a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupDialog.java +++ b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupDialog.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.dimensionlookup; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DLField; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DLFields; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DLKey; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DimensionUpdateType; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.StartDateAlternative; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod.AUTO_INCREMENT; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod.SEQUENCE; +import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod.TABLE_MAXIMUM; + import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils; @@ -68,16 +78,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DLField; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DLFields; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DLKey; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.DimensionUpdateType; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.StartDateAlternative; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod.AUTO_INCREMENT; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod.SEQUENCE; -import static org.apache.hop.pipeline.transforms.dimensionlookup.DimensionLookupMeta.TechnicalKeyCreationMethod.TABLE_MAXIMUM; - public class DimensionLookupDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = DimensionLookupMeta.class; // For Translator @@ -231,7 +231,9 @@ public String open() { // Connection line wConnection = addConnectionLine(mainComposite, wUpdate, input.getDatabaseMeta(), null); wConnection.addListener(SWT.FocusOut, e -> setTableFieldCombo()); - wConnection.addListener(SWT.Modify, e -> { + wConnection.addListener( + SWT.Modify, + e -> { // We have new content: change ci connection: databaseMeta = wConnection.loadSelectedElement(); setFlags(); @@ -264,7 +266,7 @@ public String open() { fdSchema.right = new FormAttachment(wbSchema, -margin); wSchema.setLayoutData(fdSchema); wSchema.addListener(SWT.Modify, e -> setTableFieldCombo()); - + // Table line... Label wlTable = new Label(mainComposite, SWT.RIGHT); wlTable.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.TargetTable.Label")); @@ -283,7 +285,7 @@ public String open() { fdbTable.top = new FormAttachment(wbSchema, margin); wbTable.setLayoutData(fdbTable); wbTable.addListener(SWT.Selection, e -> getTableName()); - + wTable = new TextVar(variables, mainComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); PropsUi.setLook(wTable); FormData fdTable = new FormData(); @@ -292,7 +294,7 @@ public String open() { fdTable.right = new FormAttachment(wbTable, -margin); wTable.setLayoutData(fdTable); wTable.addListener(SWT.Modify, e -> setTableFieldCombo()); - + // Commit size ... wlCommit = new Label(mainComposite, SWT.RIGHT); wlCommit.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Commit.Label")); @@ -465,7 +467,7 @@ public void addKeyTab(int margin) { null, props); tableFieldColumns.add(keyColumns[0]); - + FormData fdKey = new FormData(); fdKey.left = new FormAttachment(0, 0); fdKey.top = new FormAttachment(wlKey, margin); @@ -805,7 +807,7 @@ public void addVersioningTab(int margin, int middle) { shell.setCursor(null); busy.dispose(); }); - + // MinYear line wlMinYear = new Label(wVersioningComp, SWT.RIGHT); wlMinYear.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.MinYear.Label")); @@ -1098,7 +1100,7 @@ public void getData() { DimensionUpdateType updateType = field.getUpdateType(); item.setText(3, updateType == null ? "" : updateType.getDescription()); } else { - item.setText(3, Const.NVL(field.getReturnType(),"")); + item.setText(3, Const.NVL(field.getReturnType(), "")); } } @@ -1369,16 +1371,15 @@ private void setTableFieldCombo() { try (Database db = new Database(loggingObject, variables, dbMeta)) { db.connect(); - IRowMeta rowMeta = - db.getTableFieldsMeta(schemaName, tableName); + IRowMeta rowMeta = db.getTableFieldsMeta(schemaName, tableName); if (rowMeta == null) { return; } - String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); + String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); for (ColumnInfo colInfo : tableFieldColumns) { colInfo.setComboValues(fieldNames); } - + String tk = wTk.getText(); wTk.setItems(fieldNames); wTk.setText(Const.NVL(tk, "")); @@ -1402,7 +1403,7 @@ private void getLookup() { final String tableName = variables.resolve(wTable.getText()); final String schemaName = variables.resolve(wSchema.getText()); DatabaseMeta dbMeta = wConnection.loadSelectedElement(); - if (dbMeta != null && StringUtils.isNotEmpty(tableName)) { + if (dbMeta != null && StringUtils.isNotEmpty(tableName)) { try (Database db = new Database(loggingObject, variables, dbMeta)) { db.connect(); @@ -1467,7 +1468,7 @@ private void getFieldsFromTable() { final String schemaName = variables.resolve(wSchema.getText()); final String tableName = variables.resolve(wTable.getText()); final DatabaseMeta dbMeta = wConnection.loadSelectedElement(); - + // Without a database or a table name we can't do very much if (dbMeta == null || StringUtils.isEmpty(tableName)) { return; @@ -1478,7 +1479,7 @@ private void getFieldsFromTable() { IRowMeta rowMeta = db.getTableFieldsMeta(schemaName, tableName); if (null != rowMeta) { String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); - + // Version String version = wVersion.getText(); wVersion.setItems(fieldNames); diff --git a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java index 09418331c4c..8602ffa41f9 100644 --- a/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java +++ b/plugins/transforms/dimensionlookup/src/main/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.dimensionlookup; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -49,11 +53,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - @Transform( id = "DimensionLookup", image = "dimensionlookup.svg", @@ -174,7 +173,6 @@ public DimensionLookupMeta() { @Override public boolean supportsErrorHandling() { return true; - } @Override @@ -371,8 +369,7 @@ public void check( try (Database db = new Database(loggingObject, variables, databaseMeta)) { db.connect(); - IRowMeta tableRowMeta = - checkTableFields(transformMeta, db, realSchema, realTable, remarks); + IRowMeta tableRowMeta = checkTableFields(transformMeta, db, realSchema, realTable, remarks); if (tableRowMeta != null) { checkKeys( transformMeta, @@ -455,15 +452,18 @@ private void checkPreviousFields( boolean allOk = true; for (DLField field : fields.fields) { - DimensionUpdateType updateType = field.getUpdateType(); - if ( updateType!=null && updateType.isWithArgument() ) { + DimensionUpdateType updateType = field.getUpdateType(); + if (updateType != null && updateType.isWithArgument()) { IValueMeta valueMeta = previousFields.searchValueMeta(field.getName()); if (valueMeta == null) { allOk = false; - remarks.add(new CheckResult(ICheckResult.TYPE_RESULT_ERROR, - BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.MissingFields") + " " - + field.getName(), - transformMeta)); + remarks.add( + new CheckResult( + ICheckResult.TYPE_RESULT_ERROR, + BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.MissingFields") + + " " + + field.getName(), + transformMeta)); } } } @@ -1165,16 +1165,25 @@ public enum DimensionUpdateType implements IEnumHasCodeAndDescription { INSERT("Insert", BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.Insert"), true), UPDATE("Update", BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.Update"), true), PUNCH_THROUGH( - "Punch through", BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.PunchThrough"), true), + "Punch through", + BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.PunchThrough"), + true), DATE_INSERTED_UPDATED( "DateInsertedOrUpdated", - BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.DateInsertedOrUpdated"), false), + BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.DateInsertedOrUpdated"), + false), DATE_INSERTED( - "DateInserted", BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.DateInserted"), false), + "DateInserted", + BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.DateInserted"), + false), DATE_UPDATED( - "DateUpdated", BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.DateUpdated"), false), + "DateUpdated", + BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.DateUpdated"), + false), LAST_VERSION( - "LastVersion", BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.LastVersion"), false); + "LastVersion", + BaseMessages.getString(PKG, "DimensionLookupMeta.TypeDesc.LastVersion"), + false); private final String code; private final String description; private final boolean isWithArgument; @@ -1216,9 +1225,10 @@ public String getDescription() { public boolean isWithArgument() { return isWithArgument; } - + public static DimensionUpdateType lookupDescription(String description) { - return IEnumHasCodeAndDescription.lookupDescription(DimensionUpdateType.class, description, null); + return IEnumHasCodeAndDescription.lookupDescription( + DimensionUpdateType.class, description, null); } } @@ -1516,12 +1526,12 @@ public static class DLField { injectionKeyDescription = "DimensionLookup.Injection.UPDATE_TYPE") private String update; - @HopMetadataProperty( + @HopMetadataProperty( key = "type", injectionKey = "TYPE_OF_RETURN_FIELD", injectionKeyDescription = "DimensionLookup.Injection.TYPE_OF_RETURN_FIELD") private String returnType; - + /** Not serialized. This is used to cache the lookup of the dimension type */ private DimensionUpdateType updateType; @@ -1605,16 +1615,16 @@ public void setUpdate(String update) { this.update = update; this.updateType = null; } - + /** * Gets return type for read only lookup * - * @return type of + * @return type of */ public String getReturnType() { return returnType; } - + /** * Sets return type for read only lookup * @@ -1631,6 +1641,7 @@ public static class DLKey { injectionKey = "KEY_STREAM_FIELDNAME", injectionKeyDescription = "DimensionLookup.Injection.KEY_STREAM_FIELDNAME") private String name; + /** Fields in the dimension to use for lookup */ @HopMetadataProperty( injectionKey = "KEY_DATABASE_FIELDNAME", diff --git a/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionCacheTest.java b/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionCacheTest.java index 97b1d68f67a..d01180f78c8 100644 --- a/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionCacheTest.java +++ b/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionCacheTest.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.dimensionlookup; +import java.sql.Timestamp; +import java.util.Date; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.row.value.ValueMetaTimestamp; import org.apache.hop.core.util.Assert; import org.junit.Test; -import java.sql.Timestamp; -import java.util.Date; - public class DimensionCacheTest { @Test diff --git a/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMetaTest.java b/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMetaTest.java index 7adb82a7adb..0086f93d690 100644 --- a/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMetaTest.java +++ b/plugins/transforms/dimensionlookup/src/test/java/org/apache/hop/pipeline/transforms/dimensionlookup/DimensionLookupMetaTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.dimensionlookup; +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 org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; @@ -24,11 +29,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class DimensionLookupMetaTest { @Before @@ -59,13 +59,17 @@ public void testSerialization() throws Exception { assertEquals("value", meta.getFields().getFields().get(0).getName()); assertEquals("valueLookup", meta.getFields().getFields().get(0).getLookup()); assertEquals("Insert", meta.getFields().getFields().get(0).getUpdate()); - assertEquals(DimensionLookupMeta.DimensionUpdateType.INSERT, meta.getFields().getFields().get(0).getUpdateType()); + assertEquals( + DimensionLookupMeta.DimensionUpdateType.INSERT, + meta.getFields().getFields().get(0).getUpdateType()); assertEquals("lastVersion", meta.getFields().getFields().get(1).getName()); assertEquals("lastVersionLookup", meta.getFields().getFields().get(1).getLookup()); assertEquals("LastVersion", meta.getFields().getFields().get(1).getUpdate()); - assertEquals(DimensionLookupMeta.DimensionUpdateType.LAST_VERSION, meta.getFields().getFields().get(1).getUpdateType()); - + assertEquals( + DimensionLookupMeta.DimensionUpdateType.LAST_VERSION, + meta.getFields().getFields().get(1).getUpdateType()); + meta = TransformSerializationTestUtil.testSerialization( "/dimension-lookup-transform.xml", DimensionLookupMeta.class, metadataProvider); diff --git a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoader.java b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoader.java index f6a24dd9f13..369583037cc 100644 --- a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoader.java +++ b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoader.java @@ -18,6 +18,11 @@ package org.apache.hop.pipeline.transforms.dorisbulkloader; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.i18n.BaseMessages; @@ -27,12 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class DorisBulkLoader extends BaseTransform { private static final Class PKG = DorisBulkLoaderMeta.class; // For Translator diff --git a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderDialog.java b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderDialog.java index c1bc9ef01d5..3d274595898 100644 --- a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderDialog.java +++ b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderDialog.java @@ -18,6 +18,14 @@ package org.apache.hop.pipeline.transforms.dorisbulkloader; +import static org.apache.hop.pipeline.transforms.dorisbulkloader.LoadConstants.CSV; +import static org.apache.hop.pipeline.transforms.dorisbulkloader.LoadConstants.JSON; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -57,15 +65,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.apache.hop.pipeline.transforms.dorisbulkloader.LoadConstants.CSV; -import static org.apache.hop.pipeline.transforms.dorisbulkloader.LoadConstants.JSON; - public class DorisBulkLoaderDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = DorisBulkLoaderMeta.class; // For Translator diff --git a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderMeta.java b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderMeta.java index 1daeb5ad919..8e903c5aace 100644 --- a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderMeta.java +++ b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderMeta.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.dorisbulkloader; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -30,9 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "DorisBulkLoader", image = "dorisbulkloader.svg", diff --git a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisHeader.java b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisHeader.java index 8c74454ca24..43014d1ab6f 100644 --- a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisHeader.java +++ b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisHeader.java @@ -18,9 +18,8 @@ package org.apache.hop.pipeline.transforms.dorisbulkloader; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class DorisHeader { @HopMetadataProperty private String name; diff --git a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisStreamLoad.java b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisStreamLoad.java index 8f2d3783c39..130682be0a4 100644 --- a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisStreamLoad.java +++ b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisStreamLoad.java @@ -19,6 +19,10 @@ package org.apache.hop.pipeline.transforms.dorisbulkloader; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.UUID; import org.apache.commons.codec.binary.Base64; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.json.HopJson; @@ -31,16 +35,12 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.UUID; - public class DorisStreamLoad { private static final byte[] JSON_ARRAY_START = LoadConstants.JSON_ARRAY_START.getBytes(StandardCharsets.UTF_8); private static final byte[] JSON_ARRAY_END = LoadConstants.JSON_ARRAY_END.getBytes(StandardCharsets.UTF_8); + /** used to serialize or deserialize json string */ private static final ObjectMapper OBJECT_MAPPER = HopJson.newMapper(); diff --git a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/RecordBuffer.java b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/RecordBuffer.java index 36c7df6c917..489ebd7a3aa 100644 --- a/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/RecordBuffer.java +++ b/plugins/transforms/dorisbulkloader/src/main/java/org/apache/hop/pipeline/transforms/dorisbulkloader/RecordBuffer.java @@ -32,8 +32,10 @@ public class RecordBuffer { private ByteBuffer currentWriteBuffer; private ByteBuffer currentReadBuffer; private final int bufferSize; // A buffer's capacity, in bytes. + /** BufferSize * BufferCount is the max capacity to buffer data before doing real stream load */ private final int bufferCount; + /** write length in bytes to recordBuffer */ private long writeLength = 0; diff --git a/plugins/transforms/dorisbulkloader/src/test/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderTest.java b/plugins/transforms/dorisbulkloader/src/test/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderTest.java index 923380ae2d2..c6dc611d641 100644 --- a/plugins/transforms/dorisbulkloader/src/test/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderTest.java +++ b/plugins/transforms/dorisbulkloader/src/test/java/org/apache/hop/pipeline/transforms/dorisbulkloader/DorisBulkLoaderTest.java @@ -17,13 +17,6 @@ package org.apache.hop.pipeline.transforms.dorisbulkloader; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.util.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; - import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyBoolean; @@ -36,6 +29,13 @@ import static org.mockito.Mockito.when; import static org.powermock.reflect.Whitebox.setInternalState; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.util.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.modules.junit4.PowerMockRunner; + @RunWith(PowerMockRunner.class) public class DorisBulkLoaderTest { @@ -98,7 +98,12 @@ public void testCallProcessStreamLoadWithTwoBatch() throws Exception { Assert.assertTrue(data.dorisStreamLoad != null, "data.dorisStreamLoad initialization failure"); data.dorisStreamLoad = mock(DorisStreamLoad.class); - when(data.dorisStreamLoad.canWrite(anyLong())).thenAnswer(x -> {canWrite = !canWrite; return canWrite;}); + when(data.dorisStreamLoad.canWrite(anyLong())) + .thenAnswer( + x -> { + canWrite = !canWrite; + return canWrite; + }); dorisBulkLoader.processStreamLoad("{\"no\":2, \"name\":\"jack\", \"sex\":\"m\"}", false); @@ -107,5 +112,4 @@ public void testCallProcessStreamLoadWithTwoBatch() throws Exception { verify(data.dorisStreamLoad, times(2)).executeDorisStreamLoad(); } - } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleResultItem.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleResultItem.java index 1af9e85ea08..cfa04fdec17 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleResultItem.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleResultItem.java @@ -17,52 +17,50 @@ package org.apache.hop.pipeline.transforms.drools; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class RuleResultItem { - @HopMetadataProperty(key = "column-name") - private String name; + @HopMetadataProperty(key = "column-name") + private String name; - @HopMetadataProperty(key = "column-type") - private String type; + @HopMetadataProperty(key = "column-type") + private String type; - public RuleResultItem() { - } + public RuleResultItem() {} - public RuleResultItem(String name, String type) { - this.name = name; - this.type = type; - } + public RuleResultItem(String name, String type) { + this.name = name; + this.type = type; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - RuleResultItem that = (RuleResultItem) o; - return name.equals(that.name) && type.equals(that.type); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RuleResultItem that = (RuleResultItem) o; + return name.equals(that.name) && type.equals(that.type); + } - @Override - public int hashCode() { - return Objects.hash(name, type); - } + @Override + public int hashCode() { + return Objects.hash(name, type); + } } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleValidationException.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleValidationException.java index 7f65870d742..d0ae8480302 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleValidationException.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RuleValidationException.java @@ -17,32 +17,36 @@ package org.apache.hop.pipeline.transforms.drools; -import org.kie.api.builder.Message; - import java.util.ArrayList; import java.util.List; +import org.kie.api.builder.Message; public class RuleValidationException extends Exception { - List messages; - - /** - * Constructs a new throwable with the specified set of detail messages. - * - * @param messages the detailed messages (which is saved for later retrieval by the getMessages() - * method). - */ - public RuleValidationException(List messages) { - super(); - this.messages = new ArrayList(); - for (Message item : messages) { - - this.messages.add("Severity: " + item.getLevel().toString() + - " - Line: " + item.getLine() + " - Message: " + item.getText()); - } + List messages; + + /** + * Constructs a new throwable with the specified set of detail messages. + * + * @param messages the detailed messages (which is saved for later retrieval by the getMessages() + * method). + */ + public RuleValidationException(List messages) { + super(); + this.messages = new ArrayList(); + for (Message item : messages) { + + this.messages.add( + "Severity: " + + item.getLevel().toString() + + " - Line: " + + item.getLine() + + " - Message: " + + item.getText()); } + } - public List getMessages() { - return messages; - } + public List getMessages() { + return messages; + } } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/Rules.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/Rules.java index a7ff3ae08eb..efa3843ad3e 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/Rules.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/Rules.java @@ -28,18 +28,18 @@ public static class Row { private boolean external; public Row() { - this( new Hashtable(), false ); + this(new Hashtable(), false); } - public Row( Map row ) { - this( row, false ); + public Row(Map row) { + this(row, false); } - public Row( boolean external ) { - this( new Hashtable(), external ); + public Row(boolean external) { + this(new Hashtable(), external); } - public Row( Map row, boolean external ) { + public Row(Map row, boolean external) { this.row = row; this.external = external; } @@ -52,8 +52,8 @@ public boolean isExternalSource() { return external; } - public void addColumn( String columnName, Object value ) { - row.put( columnName, value ); + public void addColumn(String columnName, Object value) { + row.put(columnName, value); } } @@ -70,19 +70,19 @@ public Column() { this.external = false; } - public Column( Boolean external ) { + public Column(Boolean external) { this.external = external; } - public Column( String name, String type, Object payload ) { + public Column(String name, String type, Object payload) { this(); this.name = name; this.type = type; this.payload = payload; } - public Column( Boolean external, String name, String type, Object payload ) { - this( external ); + public Column(Boolean external, String name, String type, Object payload) { + this(external); this.name = name; this.type = type; this.payload = payload; @@ -92,7 +92,7 @@ public String getName() { return name; } - public void setName( String name ) { + public void setName(String name) { this.name = name; } @@ -100,7 +100,7 @@ public String getType() { return type; } - public void setType( String type ) { + public void setType(String type) { this.type = type; } @@ -108,11 +108,11 @@ public Object getPayload() { return payload; } - public void setPayload( Object payload ) { + public void setPayload(Object payload) { this.payload = payload; } - public void setExternalSource( boolean external ) { + public void setExternalSource(boolean external) { this.external = external; } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulator.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulator.java index 4b8e1198395..ec45489dfa9 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulator.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulator.java @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -26,23 +25,23 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -public class RulesAccumulator extends BaseTransform { +public class RulesAccumulator extends BaseTransform { private static final Class PKG = Rules.class; // for i18n purposes public RulesAccumulator( - TransformMeta transformMeta, - RulesAccumulatorMeta meta, - RulesAccumulatorData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline) { + TransformMeta transformMeta, + RulesAccumulatorMeta meta, + RulesAccumulatorData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); } @Override public boolean init() { - if ( super.init() ) { + if (super.init()) { return true; } return false; @@ -50,13 +49,12 @@ public boolean init() { public boolean runtimeInit() throws HopTransformException { try { - data.setOutputRowMeta( getInputRowMeta().clone() ); - meta.setKeepInputFields( false ); - meta.getFields( data.getOutputRowMeta(), getTransformName(), null, null, this, null ); - - data.setRuleFilePath( meta.getRuleFile() ); - data.setRuleString( meta.getRuleDefinition() ); + data.setOutputRowMeta(getInputRowMeta().clone()); + meta.setKeepInputFields(false); + meta.getFields(data.getOutputRowMeta(), getTransformName(), null, null, this, null); + data.setRuleFilePath(meta.getRuleFile()); + data.setRuleString(meta.getRuleDefinition()); try { data.initializeRules(); @@ -67,11 +65,11 @@ public boolean runtimeInit() throws HopTransformException { } throw new HopTransformException(BaseMessages.getString(PKG, "RulesData.Error.CompileDRL")); } - data.initializeInput( getInputRowMeta() ); + data.initializeInput(getInputRowMeta()); return true; - } catch ( Exception e ) { - throw new HopTransformException( e ); + } catch (Exception e) { + throw new HopTransformException(e); } } @@ -80,7 +78,7 @@ public boolean processRow() throws HopException { try { Object[] r = getRow(); // get row, set busy! - if ( r == null ) { // no more input to be expected... + if (r == null) { // no more input to be expected... data.execute(); @@ -88,12 +86,13 @@ public boolean processRow() throws HopException { String[] expectedResults = meta.getExpectedResultList(); - for ( Rules.Row resultRow : data.getResultRows() ) { + for (Rules.Row resultRow : data.getResultRows()) { outputRow = new Object[expectedResults.length]; - for ( String columnName : expectedResults ) { - outputRow[data.getOutputRowMeta().indexOfValue( columnName )] = resultRow.getColumn().get( columnName ); + for (String columnName : expectedResults) { + outputRow[data.getOutputRowMeta().indexOfValue(columnName)] = + resultRow.getColumn().get(columnName); } - putRow( data.getOutputRowMeta(), outputRow ); + putRow(data.getOutputRowMeta(), outputRow); } data.shutdown(); @@ -101,8 +100,8 @@ public boolean processRow() throws HopException { return false; } - if ( first ) { - if ( !runtimeInit() ) { + if (first) { + if (!runtimeInit()) { return false; } @@ -110,11 +109,11 @@ public boolean processRow() throws HopException { } // Store the row for processing - data.loadRow( r ); + data.loadRow(r); return true; - } catch ( Exception e ) { - throw new HopException( e ); + } catch (Exception e) { + throw new HopException(e); } } } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorData.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorData.java index f69fe7459f4..771610d7f04 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorData.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorData.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.drools; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.pipeline.transform.BaseTransformData; @@ -30,13 +36,6 @@ import org.kie.internal.io.ResourceFactory; import org.kie.internal.utils.KieHelper; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - public class RulesAccumulatorData extends BaseTransformData implements ITransformData { private static Class PKG = RulesAccumulator.class; // for i18n purposes @@ -101,7 +100,7 @@ public void initializeRules() throws RuleValidationException { throw new RuleValidationException(results1.getMessages()); } - // reset classloader back to original + // reset classloader back to original Thread.currentThread().setContextClassLoader(orig); } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorDialog.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorDialog.java index a4aa8bf6406..6b951e79b98 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorDialog.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesAccumulatorDialog.java @@ -57,383 +57,378 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -public class RulesAccumulatorDialog extends BaseTransformDialog implements ITransformDialog { - - private static final Class PKG = Rules.class; - - private RulesAccumulatorMeta input; - - private Label wlRuleFilePath; - private Button wbBrowse; - private Button wbRulesInEditor; - private TextVar wRuleFilePath; - private StyledTextComp wRulesEditor; - private Label wlPosition; - private TableView wResultColumnsFields; - - public RulesAccumulatorDialog( - Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { - super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); - input = (RulesAccumulatorMeta) in; +public class RulesAccumulatorDialog extends BaseTransformDialog implements ITransformDialog { + + private static final Class PKG = Rules.class; + + private RulesAccumulatorMeta input; + + private Label wlRuleFilePath; + private Button wbBrowse; + private Button wbRulesInEditor; + private TextVar wRuleFilePath; + private StyledTextComp wRulesEditor; + private Label wlPosition; + private TableView wResultColumnsFields; + + public RulesAccumulatorDialog( + Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { + super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); + input = (RulesAccumulatorMeta) in; + } + + @Override + public String open() { + Shell parent = getParent(); + + shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); + PropsUi.setLook(shell); + setShellImage(shell, input); + + FormLayout formLayout = new FormLayout(); + formLayout.marginWidth = PropsUi.getFormMargin(); + formLayout.marginHeight = PropsUi.getFormMargin(); + + shell.setLayout(formLayout); + shell.setText(BaseMessages.getString(PKG, "RulesAccumulator.Shell.Title")); + + int middle = props.getMiddlePct(); + int margin = props.getMargin(); + + // THE BUTTONS + wOk = new Button(shell, SWT.PUSH); + wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); + wCancel = new Button(shell, SWT.PUSH); + wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); + setButtonPositions(new Button[] {wOk, wCancel}, margin, null); + + // TransformName line + wlTransformName = new Label(shell, SWT.RIGHT); + wlTransformName.setText(BaseMessages.getString(PKG, "RulesDialog.TransformName.Label")); + PropsUi.setLook(wlTransformName); + fdlTransformName = new FormData(); + fdlTransformName.left = new FormAttachment(0, 0); + fdlTransformName.right = new FormAttachment(middle, -margin); + fdlTransformName.top = new FormAttachment(0, margin); + wlTransformName.setLayoutData(fdlTransformName); + wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + wTransformName.setText(transformName); + PropsUi.setLook(wTransformName); + fdTransformName = new FormData(); + fdTransformName.left = new FormAttachment(middle, 0); + fdTransformName.top = new FormAttachment(0, margin); + fdTransformName.right = new FormAttachment(100, 0); + wTransformName.setLayoutData(fdTransformName); + + CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER); + PropsUi.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); + wTabFolder.setUnselectedCloseVisible(true); + + FormData fdTabFolder = new FormData(); + fdTabFolder.left = new FormAttachment(0, 0); + fdTabFolder.top = new FormAttachment(wTransformName, 20); + fdTabFolder.right = new FormAttachment(100, 0); + fdTabFolder.bottom = new FormAttachment(100, 0); + wTabFolder.setLayoutData(fdTabFolder); + + addRulesTab(wTabFolder, margin); + addRulesResultsTab(wTabFolder, margin); + + FormData fdAgg = new FormData(); + fdAgg.left = new FormAttachment(0, 0); + fdAgg.bottom = new FormAttachment(wOk, -margin); + + // Add listeners + wOk.addListener(SWT.Selection, e -> ok()); + wCancel.addListener(SWT.Selection, e -> cancel()); + + wTabFolder.setSelection(0); + + getData(); + + activeRuleFilenameField(); + input.setChanged(changed); + + BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); + + return transformName; + } + + private void addRulesTab(CTabFolder wTabFolder, int margin) { + + ModifyListener lsMod = + e -> { + // changedInDialog = true; + input.setChanged(); + }; + + CTabItem wRulesTab = new CTabItem(wTabFolder, SWT.NONE); + wRulesTab.setFont(GuiResource.getInstance().getFontDefault()); + wRulesTab.setText(BaseMessages.getString(PKG, "RulesDialog.Tabs.RuleDefinition")); + + Composite wRulesComp = new Composite(wTabFolder, SWT.NONE); + PropsUi.setLook(wRulesComp); + + FormLayout rulesLayout = new FormLayout(); + rulesLayout.marginWidth = 3; + rulesLayout.marginHeight = 3; + wRulesComp.setLayout(rulesLayout); + + wlRuleFilePath = new Label(wRulesComp, SWT.LEFT); + PropsUi.setLook(wlRuleFilePath); + wlRuleFilePath.setText(BaseMessages.getString(PKG, "RulesDialog.RulesFile.Label")); + FormData fdlTransformation = new FormData(); + fdlTransformation.left = new FormAttachment(0, 0); + fdlTransformation.top = new FormAttachment(0, 20); + fdlTransformation.right = new FormAttachment(50, 0); + wlRuleFilePath.setLayoutData(fdlTransformation); + + wbBrowse = new Button(wRulesComp, SWT.PUSH); + PropsUi.setLook(wbBrowse); + wbBrowse.setText(BaseMessages.getString(PKG, "RulesDialog.Browse.Label")); + FormData fdBrowse = new FormData(); + fdBrowse.right = new FormAttachment(100, 0); + fdBrowse.top = new FormAttachment(wlRuleFilePath, Const.isOSX() ? 0 : 5); + wbBrowse.setLayoutData(fdBrowse); + wbBrowse.addListener( + SWT.Selection, + e -> + BaseDialog.presentFileDialog( + shell, + wRuleFilePath, + variables, + new String[] {"*"}, + new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")}, + true)); + + wRuleFilePath = new TextVar(variables, wRulesComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); + FormData fdRuleFilePath = new FormData(); + fdRuleFilePath.left = new FormAttachment(0, 0); + fdRuleFilePath.top = new FormAttachment(wlRuleFilePath, 5); + fdRuleFilePath.right = new FormAttachment(wbBrowse, -props.getMargin()); + wRuleFilePath.setLayoutData(fdRuleFilePath); + + wbRulesInEditor = new Button(wRulesComp, SWT.CHECK); + PropsUi.setLook(wbRulesInEditor); + wbRulesInEditor.setText( + BaseMessages.getString(PKG, "RulesDialog.RuleDefinition.EnableScriptEditor.Label")); + FormData fdPipelineNameInField = new FormData(); + fdPipelineNameInField.left = new FormAttachment(0, 0); + fdPipelineNameInField.top = new FormAttachment(wRuleFilePath, margin); + wbRulesInEditor.setLayoutData(fdPipelineNameInField); + wbRulesInEditor.addSelectionListener( + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + input.setChanged(); + activeRuleFilenameField(); + } + }); + + wRulesEditor = + new StyledTextComp( + variables, wRulesComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + PropsUi.setLook(wRulesEditor, Props.WIDGET_STYLE_FIXED); + + FormData fdRulesEditor = new FormData(); + fdRulesEditor.left = new FormAttachment(0, 0); + fdRulesEditor.top = new FormAttachment(wbRulesInEditor, 5); + fdRulesEditor.right = new FormAttachment(100, -2 * margin); + fdRulesEditor.bottom = new FormAttachment(100, -12 * margin); + wRulesEditor.setLayoutData(fdRulesEditor); + + wRulesEditor.addModifyListener(lsMod); + wRulesEditor.addModifyListener(arg0 -> setPosition()); + + wRulesEditor.addKeyListener( + new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + setPosition(); + } + + @Override + public void keyReleased(KeyEvent e) { + setPosition(); + } + }); + wRulesEditor.addFocusListener( + new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + setPosition(); + } + + @Override + public void focusLost(FocusEvent e) { + setPosition(); + } + }); + wRulesEditor.addMouseListener( + new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + setPosition(); + } + + @Override + public void mouseDown(MouseEvent e) { + setPosition(); + } + + @Override + public void mouseUp(MouseEvent e) { + setPosition(); + } + }); + + // Position label under the SQL editor + // + wlPosition = new Label(wRulesComp, SWT.NONE); + PropsUi.setLook(wlPosition); + FormData fdlPosition = new FormData(); + fdlPosition.left = new FormAttachment(0, 0); + fdlPosition.top = + new FormAttachment(wRulesEditor, margin); // 2 times since we deal with bottom instead of + fdlPosition.right = new FormAttachment(100, 0); + // top + wlPosition.setLayoutData(fdlPosition); + + FormData fdRulesComp = new FormData(); + fdRulesComp.left = new FormAttachment(0, 0); + fdRulesComp.top = new FormAttachment(0, 0); + fdRulesComp.right = new FormAttachment(100, 0); + fdRulesComp.bottom = new FormAttachment(100, 0); + wRulesComp.setLayoutData(fdRulesComp); + + wRulesComp.layout(); + wRulesTab.setControl(wRulesComp); + } + + private void activeRuleFilenameField() { + wlRuleFilePath.setEnabled(!wbRulesInEditor.getSelection()); + wRuleFilePath.setEnabled(!wbRulesInEditor.getSelection()); + + wRulesEditor.setEnabled(wbRulesInEditor.getSelection()); + } + + private void setPosition() { + int lineNumber = wRulesEditor.getLineNumber(); + int columnNumber = wRulesEditor.getColumnNumber(); + wlPosition.setText( + BaseMessages.getString( + PKG, "RulesDialog.Position.Label", "" + lineNumber, "" + columnNumber)); + } + + private void addRulesResultsTab(CTabFolder wTabFolder, int margin) { + + CTabItem wRulesResultsTab = new CTabItem(wTabFolder, SWT.NONE); + wRulesResultsTab.setFont(GuiResource.getInstance().getFontDefault()); + wRulesResultsTab.setText(BaseMessages.getString(PKG, "RulesDialog.Tabs.ColumnSelection")); + + Composite wRulesResultsComp = new Composite(wTabFolder, SWT.NONE); + PropsUi.setLook(wRulesResultsComp); + + FormLayout rulesResultsLayout = new FormLayout(); + rulesResultsLayout.marginWidth = 3; + rulesResultsLayout.marginHeight = 3; + wRulesResultsComp.setLayout(rulesResultsLayout); + + int nrRows = (input.getRuleResultColumns() != null ? input.getRuleResultColumns().size() : 1); + + ColumnInfo[] ciResultFields = + new ColumnInfo[] { + new ColumnInfo( + BaseMessages.getString(PKG, "RulesDialog.ColumnSelection.ColumnName"), + ColumnInfo.COLUMN_TYPE_TEXT, + false, + false), + new ColumnInfo( + BaseMessages.getString(PKG, "RulesDialog.ColumnSelection.ColumnType"), + ColumnInfo.COLUMN_TYPE_CCOMBO, + ValueMetaFactory.getValueMetaNames()), + }; + + wResultColumnsFields = + new TableView( + variables, + wRulesResultsComp, + SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, + ciResultFields, + nrRows, + false, + null, + props, + false); + + FormData fdResultFields = new FormData(); + fdResultFields.left = new FormAttachment(0, 0); + fdResultFields.top = new FormAttachment(0, 5); + fdResultFields.right = new FormAttachment(100, 0); + fdResultFields.bottom = new FormAttachment(100, -margin * 8); + wResultColumnsFields.setLayoutData(fdResultFields); + wResultColumnsFields.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 25, 25)); + + FormData fdRulesResultsComp = new FormData(); + fdRulesResultsComp.left = new FormAttachment(0, 0); + fdRulesResultsComp.top = new FormAttachment(0, 0); + fdRulesResultsComp.right = new FormAttachment(100, 0); + fdRulesResultsComp.bottom = new FormAttachment(100, 0); + wRulesResultsComp.setLayoutData(fdRulesResultsComp); + + wRulesResultsComp.layout(); + wRulesResultsTab.setControl(wRulesResultsComp); + } + + private void ok() { + if (Utils.isEmpty(wTransformName.getText())) { + return; } - @Override - public String open() { - Shell parent = getParent(); - - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); - PropsUi.setLook(shell); - setShellImage(shell, input); - - FormLayout formLayout = new FormLayout(); - formLayout.marginWidth = PropsUi.getFormMargin(); - formLayout.marginHeight = PropsUi.getFormMargin(); - - shell.setLayout(formLayout); - shell.setText(BaseMessages.getString(PKG, "RulesAccumulator.Shell.Title")); - - int middle = props.getMiddlePct(); - int margin = props.getMargin(); - - // THE BUTTONS - wOk = new Button(shell, SWT.PUSH); - wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); - wCancel = new Button(shell, SWT.PUSH); - wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); - setButtonPositions(new Button[] {wOk, wCancel}, margin, null); - - // TransformName line - wlTransformName = new Label(shell, SWT.RIGHT); - wlTransformName.setText(BaseMessages.getString(PKG, "RulesDialog.TransformName.Label")); - PropsUi.setLook(wlTransformName); - fdlTransformName = new FormData(); - fdlTransformName.left = new FormAttachment(0, 0); - fdlTransformName.right = new FormAttachment(middle, -margin); - fdlTransformName.top = new FormAttachment(0, margin); - wlTransformName.setLayoutData(fdlTransformName); - wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - wTransformName.setText(transformName); - PropsUi.setLook(wTransformName); - fdTransformName = new FormData(); - fdTransformName.left = new FormAttachment(middle, 0); - fdTransformName.top = new FormAttachment(0, margin); - fdTransformName.right = new FormAttachment(100, 0); - wTransformName.setLayoutData(fdTransformName); - - CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER); - PropsUi.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); - wTabFolder.setUnselectedCloseVisible(true); - - FormData fdTabFolder = new FormData(); - fdTabFolder.left = new FormAttachment(0, 0); - fdTabFolder.top = new FormAttachment(wTransformName, 20); - fdTabFolder.right = new FormAttachment(100, 0); - fdTabFolder.bottom = new FormAttachment(100, 0); - wTabFolder.setLayoutData(fdTabFolder); - - addRulesTab(wTabFolder, margin); - addRulesResultsTab(wTabFolder, margin); - - FormData fdAgg = new FormData(); - fdAgg.left = new FormAttachment(0, 0); - fdAgg.bottom = new FormAttachment(wOk, -margin); - - // Add listeners - wOk.addListener(SWT.Selection, e -> ok()); - wCancel.addListener(SWT.Selection, e -> cancel()); - - wTabFolder.setSelection(0); - - getData(); - - activeRuleFilenameField(); - input.setChanged(changed); - - BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); - - return transformName; - } + input.setRuleFile(wRuleFilePath.getText()); + input.setRuleDefinition(wRulesEditor.getText()); - private void addRulesTab(CTabFolder wTabFolder, int margin) { - - ModifyListener lsMod = - e -> { - // changedInDialog = true; - input.setChanged(); - }; - - CTabItem wRulesTab = new CTabItem(wTabFolder, SWT.NONE); - wRulesTab.setFont(GuiResource.getInstance().getFontDefault()); - wRulesTab.setText(BaseMessages.getString(PKG, "RulesDialog.Tabs.RuleDefinition")); - - Composite wRulesComp = new Composite(wTabFolder, SWT.NONE); - PropsUi.setLook(wRulesComp); - - FormLayout rulesLayout = new FormLayout(); - rulesLayout.marginWidth = 3; - rulesLayout.marginHeight = 3; - wRulesComp.setLayout(rulesLayout); - - wlRuleFilePath = new Label(wRulesComp, SWT.LEFT); - PropsUi.setLook(wlRuleFilePath); - wlRuleFilePath.setText(BaseMessages.getString(PKG, "RulesDialog.RulesFile.Label")); - FormData fdlTransformation = new FormData(); - fdlTransformation.left = new FormAttachment(0, 0); - fdlTransformation.top = new FormAttachment(0, 20); - fdlTransformation.right = new FormAttachment(50, 0); - wlRuleFilePath.setLayoutData(fdlTransformation); - - wbBrowse = new Button(wRulesComp, SWT.PUSH); - PropsUi.setLook(wbBrowse); - wbBrowse.setText(BaseMessages.getString(PKG, "RulesDialog.Browse.Label")); - FormData fdBrowse = new FormData(); - fdBrowse.right = new FormAttachment(100, 0); - fdBrowse.top = new FormAttachment(wlRuleFilePath, Const.isOSX() ? 0 : 5); - wbBrowse.setLayoutData(fdBrowse); - wbBrowse.addListener( - SWT.Selection, - e -> - BaseDialog.presentFileDialog( - shell, - wRuleFilePath, - variables, - new String[] {"*"}, - new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")}, - true)); - - wRuleFilePath = new TextVar(variables, wRulesComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); - FormData fdRuleFilePath = new FormData(); - fdRuleFilePath.left = new FormAttachment(0, 0); - fdRuleFilePath.top = new FormAttachment(wlRuleFilePath, 5); - fdRuleFilePath.right = new FormAttachment(wbBrowse, -props.getMargin()); - wRuleFilePath.setLayoutData(fdRuleFilePath); - - wbRulesInEditor = new Button(wRulesComp, SWT.CHECK); - PropsUi.setLook(wbRulesInEditor); - wbRulesInEditor.setText( - BaseMessages.getString(PKG, "RulesDialog.RuleDefinition.EnableScriptEditor.Label")); - FormData fdPipelineNameInField = new FormData(); - fdPipelineNameInField.left = new FormAttachment(0, 0); - fdPipelineNameInField.top = new FormAttachment(wRuleFilePath, margin); - wbRulesInEditor.setLayoutData(fdPipelineNameInField); - wbRulesInEditor.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - input.setChanged(); - activeRuleFilenameField(); - } - }); - - wRulesEditor = - new StyledTextComp( - variables, wRulesComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - PropsUi.setLook(wRulesEditor, Props.WIDGET_STYLE_FIXED); - - FormData fdRulesEditor = new FormData(); - fdRulesEditor.left = new FormAttachment(0, 0); - fdRulesEditor.top = new FormAttachment(wbRulesInEditor, 5); - fdRulesEditor.right = new FormAttachment(100, -2 * margin); - fdRulesEditor.bottom = new FormAttachment(100, -12 * margin); - wRulesEditor.setLayoutData(fdRulesEditor); - - wRulesEditor.addModifyListener(lsMod); - wRulesEditor.addModifyListener(arg0 -> setPosition()); - - wRulesEditor.addKeyListener( - new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - setPosition(); - } - - @Override - public void keyReleased(KeyEvent e) { - setPosition(); - } - }); - wRulesEditor.addFocusListener( - new FocusAdapter() { - @Override - public void focusGained(FocusEvent e) { - setPosition(); - } - - @Override - public void focusLost(FocusEvent e) { - setPosition(); - } - }); - wRulesEditor.addMouseListener( - new MouseAdapter() { - @Override - public void mouseDoubleClick(MouseEvent e) { - setPosition(); - } - - @Override - public void mouseDown(MouseEvent e) { - setPosition(); - } - - @Override - public void mouseUp(MouseEvent e) { - setPosition(); - } - }); - - // Position label under the SQL editor - // - wlPosition = new Label(wRulesComp, SWT.NONE); - PropsUi.setLook(wlPosition); - FormData fdlPosition = new FormData(); - fdlPosition.left = new FormAttachment(0, 0); - fdlPosition.top = - new FormAttachment(wRulesEditor, margin); // 2 times since we deal with bottom instead of - fdlPosition.right = new FormAttachment(100, 0); - // top - wlPosition.setLayoutData(fdlPosition); - - FormData fdRulesComp = new FormData(); - fdRulesComp.left = new FormAttachment(0, 0); - fdRulesComp.top = new FormAttachment(0, 0); - fdRulesComp.right = new FormAttachment(100, 0); - fdRulesComp.bottom = new FormAttachment(100, 0); - wRulesComp.setLayoutData(fdRulesComp); - - wRulesComp.layout(); - wRulesTab.setControl(wRulesComp); - } - - private void activeRuleFilenameField() { - wlRuleFilePath.setEnabled(!wbRulesInEditor.getSelection()); - wRuleFilePath.setEnabled(!wbRulesInEditor.getSelection()); - - wRulesEditor.setEnabled(wbRulesInEditor.getSelection()); - } + input.getRuleResultColumns().clear(); - private void setPosition() { - int lineNumber = wRulesEditor.getLineNumber(); - int columnNumber = wRulesEditor.getColumnNumber(); - wlPosition.setText( - BaseMessages.getString( - PKG, "RulesDialog.Position.Label", "" + lineNumber, "" + columnNumber)); - } + for (int i = 0; i < wResultColumnsFields.nrNonEmpty(); i++) { + TableItem item = wResultColumnsFields.getNonEmpty(i); - private void addRulesResultsTab(CTabFolder wTabFolder, int margin) { - - CTabItem wRulesResultsTab = new CTabItem(wTabFolder, SWT.NONE); - wRulesResultsTab.setFont(GuiResource.getInstance().getFontDefault()); - wRulesResultsTab.setText(BaseMessages.getString(PKG, "RulesDialog.Tabs.ColumnSelection")); - - Composite wRulesResultsComp = new Composite(wTabFolder, SWT.NONE); - PropsUi.setLook(wRulesResultsComp); - - FormLayout rulesResultsLayout = new FormLayout(); - rulesResultsLayout.marginWidth = 3; - rulesResultsLayout.marginHeight = 3; - wRulesResultsComp.setLayout(rulesResultsLayout); - - int nrRows = - (input.getRuleResultColumns() != null - ? input.getRuleResultColumns().size() - : 1); - - - ColumnInfo[] ciResultFields = - new ColumnInfo[] { - new ColumnInfo( - BaseMessages.getString(PKG, "RulesDialog.ColumnSelection.ColumnName"), - ColumnInfo.COLUMN_TYPE_TEXT, - false, - false), - new ColumnInfo( - BaseMessages.getString(PKG, "RulesDialog.ColumnSelection.ColumnType"), - ColumnInfo.COLUMN_TYPE_CCOMBO, - ValueMetaFactory.getValueMetaNames()), - }; - - wResultColumnsFields = - new TableView( - variables, - wRulesResultsComp, - SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, - ciResultFields, - nrRows, - false, - null, - props, - false); - - FormData fdResultFields = new FormData(); - fdResultFields.left = new FormAttachment(0, 0); - fdResultFields.top = new FormAttachment(0, 5); - fdResultFields.right = new FormAttachment(100, 0); - fdResultFields.bottom = new FormAttachment(100, -margin * 8); - wResultColumnsFields.setLayoutData(fdResultFields); - wResultColumnsFields.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 25, 25)); - - FormData fdRulesResultsComp = new FormData(); - fdRulesResultsComp.left = new FormAttachment(0, 0); - fdRulesResultsComp.top = new FormAttachment(0, 0); - fdRulesResultsComp.right = new FormAttachment(100, 0); - fdRulesResultsComp.bottom = new FormAttachment(100, 0); - wRulesResultsComp.setLayoutData(fdRulesResultsComp); - - wRulesResultsComp.layout(); - wRulesResultsTab.setControl(wRulesResultsComp); + if (!Utils.isEmpty(item.getText(1))) { + input.getRuleResultColumns().add(new RuleResultItem(item.getText(1), item.getText(2))); + } } - private void ok() { - if (Utils.isEmpty(wTransformName.getText())) { - return; - } - - input.setRuleFile(wRuleFilePath.getText()); - input.setRuleDefinition(wRulesEditor.getText()); - - input.getRuleResultColumns().clear(); + dispose(); + } - for (int i = 0; i < wResultColumnsFields.nrNonEmpty(); i++) { - TableItem item = wResultColumnsFields.getNonEmpty(i); + private void cancel() { + transformName = null; + input.setChanged(false); + dispose(); + } - if (!Utils.isEmpty(item.getText(1))) { - input.getRuleResultColumns().add(new RuleResultItem(item.getText(1), item.getText(2))); - } - } + public void getData() { - dispose(); + if (input.getRuleFile() != null) { + wlRuleFilePath.setText(input.getRuleFile()); } - private void cancel() { - transformName = null; - input.setChanged(false); - dispose(); + if (input.getRuleDefinition() != null) { + wRulesEditor.setText(input.getRuleDefinition()); } - public void getData() { - - if (input.getRuleFile() != null) { - wlRuleFilePath.setText(input.getRuleFile()); - } - - if (input.getRuleDefinition() != null) { - wRulesEditor.setText(input.getRuleDefinition()); - } + wbRulesInEditor.setSelection(input.getRuleDefinition() != null); - wbRulesInEditor.setSelection(input.getRuleDefinition() != null); - - for (int i = 0; i ruleResultColumns = new ArrayList<>(); - @HopMetadataProperty(key="rule-file") + @HopMetadataProperty(key = "rule-file") private String ruleFile; - @HopMetadataProperty(key="rule-definition") + @HopMetadataProperty(key = "rule-definition") private String ruleDefinition; private boolean keepInputFields = true; @@ -92,13 +91,13 @@ public void setDefault() {} @Override public void getFields( - IRowMeta inputRowMeta, - String name, - IRowMeta[] info, - TransformMeta nextTransform, - IVariables variables, - IHopMetadataProvider metadataProvider) - throws HopTransformException { + IRowMeta inputRowMeta, + String name, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables variables, + IHopMetadataProvider metadataProvider) + throws HopTransformException { if (!keepInputFields) { inputRowMeta.clear(); @@ -106,16 +105,16 @@ public void getFields( try { if (ruleResultColumns != null) { for (int i = 0; i < ruleResultColumns.size(); i++) { - int type = ValueMetaFactory.getIdForValueMeta( ruleResultColumns.get(i).getType() ) ; - IValueMeta vm = ValueMetaFactory.createValueMeta( ruleResultColumns.get(i).getName(), type ); + int type = ValueMetaFactory.getIdForValueMeta(ruleResultColumns.get(i).getType()); + IValueMeta vm = + ValueMetaFactory.createValueMeta(ruleResultColumns.get(i).getName(), type); vm.setOrigin(name); inputRowMeta.addValueMeta(vm); } } } catch (HopPluginException e) { - throw new HopTransformException( - "Unable to get rule result columns"); + throw new HopTransformException("Unable to get rule result columns"); } } diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutor.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutor.java index c42dcbfd26c..b1d2294d18c 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutor.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutor.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.drools; +import java.util.Arrays; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.i18n.BaseMessages; @@ -25,8 +26,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Arrays; - public class RulesExecutor extends BaseTransform { private static final Class PKG = Rules.class; // for i18n purposes diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorData.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorData.java index b6ae2d4961d..2fdc86851a9 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorData.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorData.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.drools; +import java.io.StringReader; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.i18n.BaseMessages; @@ -31,12 +36,6 @@ import org.kie.internal.io.ResourceFactory; import org.kie.internal.utils.KieHelper; -import java.io.StringReader; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class RulesExecutorData extends BaseTransformData implements ITransformData { private static Class PKG = RulesExecutor.class; // for i18n purposes @@ -76,7 +75,6 @@ public IRowMeta getOutputRowMeta() { return outputRowMeta; } - public void initializeRules() throws RuleValidationException { // To ensure the plugin classloader use for dependency resolution diff --git a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorDialog.java b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorDialog.java index 03e4a1ab80c..1d4ac1debbf 100644 --- a/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorDialog.java +++ b/plugins/transforms/drools/src/main/java/org/apache/hop/pipeline/transforms/drools/RulesExecutorDialog.java @@ -224,13 +224,13 @@ private void addRulesTab(CTabFolder wTabFolder, int margin) { fdPipelineNameInField.top = new FormAttachment(wRuleFilePath, margin); wbRulesInEditor.setLayoutData(fdPipelineNameInField); wbRulesInEditor.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - input.setChanged(); - activeRuleFilenameField(); - } - }); + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + input.setChanged(); + activeRuleFilenameField(); + } + }); wRulesEditor = new StyledTextComp( @@ -421,7 +421,7 @@ public void getData() { wbRulesInEditor.setSelection(input.getRuleDefinition() != null); - for (int i = 0; i { + id = "RuleExecutor", + image = "rules_exec.svg", + name = "i18n::RulesExecutor.Name", + description = "i18n::RulesExecutor.Description", + categoryDescription = "i18n::Rules.Category", + keywords = "i18n::RulesExecutor.keyword", + documentationUrl = "/pipeline/transforms/rulesexecutor.html") +public class RulesExecutorMeta extends BaseTransformMeta { private static Class PKG = Rules.class; // for i18n purposes // Contain storage keys in single location to cut down on save/load bugs @@ -51,10 +47,10 @@ public class RulesExecutorMeta @HopMetadataProperty(groupKey = "fields", key = "field") private List ruleResultColumns = new ArrayList<>(); - @HopMetadataProperty(key="rule-file") + @HopMetadataProperty(key = "rule-file") private String ruleFile; - @HopMetadataProperty(key="rule-definition") + @HopMetadataProperty(key = "rule-definition") private String ruleDefinition; private boolean keepInputFields = true; @@ -63,11 +59,11 @@ public List getRuleResultColumns() { return ruleResultColumns; } - public void setRuleResultColumns( List ruleResultColumns ) { + public void setRuleResultColumns(List ruleResultColumns) { this.ruleResultColumns = ruleResultColumns; } - public void setRuleFile( String ruleFile ) { + public void setRuleFile(String ruleFile) { this.ruleFile = ruleFile; } @@ -75,7 +71,7 @@ public String getRuleFile() { return ruleFile; } - public void setRuleDefinition( String ruleDefinition ) { + public void setRuleDefinition(String ruleDefinition) { this.ruleDefinition = ruleDefinition; } @@ -87,52 +83,49 @@ public boolean isKeepInputFields() { return keepInputFields; } - public void setKeepInputFields( boolean keepInputFields ) { + public void setKeepInputFields(boolean keepInputFields) { this.keepInputFields = keepInputFields; } - @Override - public void setDefault() { - } + public void setDefault() {} @Override public void getFields( - IRowMeta inputRowMeta, - String name, - IRowMeta[] info, - TransformMeta nextTransform, - IVariables variables, - IHopMetadataProvider metadataProvider) - throws HopTransformException { + IRowMeta inputRowMeta, + String name, + IRowMeta[] info, + TransformMeta nextTransform, + IVariables variables, + IHopMetadataProvider metadataProvider) + throws HopTransformException { if (!keepInputFields) { inputRowMeta.clear(); } try { - if (ruleResultColumns != null) { - for (int i = 0; i < ruleResultColumns.size(); i++) { - int type = ValueMetaFactory.getIdForValueMeta( ruleResultColumns.get(i).getType() ) ; - IValueMeta vm = ValueMetaFactory.createValueMeta( ruleResultColumns.get(i).getName(), type ); - - vm.setOrigin(name); - inputRowMeta.addValueMeta(vm); + if (ruleResultColumns != null) { + for (int i = 0; i < ruleResultColumns.size(); i++) { + int type = ValueMetaFactory.getIdForValueMeta(ruleResultColumns.get(i).getType()); + IValueMeta vm = + ValueMetaFactory.createValueMeta(ruleResultColumns.get(i).getName(), type); + + vm.setOrigin(name); + inputRowMeta.addValueMeta(vm); + } } - } } catch (HopPluginException e) { - throw new HopTransformException( - "Unable to get rule result columns"); + throw new HopTransformException("Unable to get rule result columns"); } } public String[] getExpectedResultList() { String[] result = new String[ruleResultColumns.size()]; - for ( int i = 0; i < ruleResultColumns.size(); i++ ) { - result[i] = ruleResultColumns.get( i ).getName(); + for (int i = 0; i < ruleResultColumns.size(); i++) { + result[i] = ruleResultColumns.get(i).getName(); } return result; } - } diff --git a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRow.java b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRow.java index b836d0de221..10b09909d56 100644 --- a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRow.java +++ b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRow.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.dynamicsqlrow; +import java.sql.ResultSet; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.exception.HopException; @@ -30,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.ResultSet; - /** Run dynamic SQL. SQL is defined in a field. */ public class DynamicSqlRow extends BaseTransform { diff --git a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowData.java b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowData.java index 45950ee9beb..f9e5781ff2e 100644 --- a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowData.java +++ b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.dynamicsqlrow; +import java.util.ArrayList; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; - public class DynamicSqlRowData extends BaseTransformData implements ITransformData { IRowMeta outputRowMeta; IRowMeta lookupRowMeta; diff --git a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMeta.java b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMeta.java index 214c4816fab..bef6fb977ff 100644 --- a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMeta.java +++ b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.dynamicsqlrow; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,8 +39,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "DynamicSqlRow", image = "dynamicsqlrow.svg", @@ -117,72 +116,100 @@ public void setConnection(String connection) { this.connection = connection; } - /** @return Returns the database. */ + /** + * @return Returns the database. + */ public DatabaseMeta getDatabaseMeta() { return databaseMeta; } - /** @param database The database to set. */ + /** + * @param database The database to set. + */ public void setDatabaseMeta(DatabaseMeta database) { this.databaseMeta = database; } - /** @return Returns the outerJoin. */ + /** + * @return Returns the outerJoin. + */ public boolean isOuterJoin() { return outerJoin; } - /** @param outerJoin The outerJoin to set. */ + /** + * @param outerJoin The outerJoin to set. + */ public void setOuterJoin(boolean outerJoin) { this.outerJoin = outerJoin; } - /** @return Returns the replacevars. */ + /** + * @return Returns the replacevars. + */ public boolean isReplaceVariables() { return replaceVariables; } - /** @param replacevars The replacevars to set. */ + /** + * @param replacevars The replacevars to set. + */ public void setReplaceVariables(boolean replaceVariables) { this.replaceVariables = replaceVariables; } - /** @return Returns the queryonlyonchange. */ + /** + * @return Returns the queryonlyonchange. + */ public boolean isQueryOnlyOnChange() { return queryOnlyOnChange; } - /** @param queryonlyonchange The queryonlyonchange to set. */ + /** + * @param queryonlyonchange The queryonlyonchange to set. + */ public void setQueryOnlyOnChange(boolean queryonlyonchange) { this.queryOnlyOnChange = queryonlyonchange; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public int getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(int rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the sql. */ + /** + * @return Returns the sql. + */ public String getSql() { return sql; } - /** @param sql The sql to set. */ + /** + * @param sql The sql to set. + */ public void setSql(String sql) { this.sql = sql; } - /** @return Returns the sqlfieldname. */ + /** + * @return Returns the sqlfieldname. + */ public String getSqlFieldName() { return sqlFieldName; } - /** @param sqlfieldname The sqlfieldname to set. */ + /** + * @param sqlfieldname The sqlfieldname to set. + */ public void setSqlFieldName(String sqlfieldname) { this.sqlFieldName = sqlfieldname; } diff --git a/plugins/transforms/dynamicsqlrow/src/test/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMetaTest.java b/plugins/transforms/dynamicsqlrow/src/test/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMetaTest.java index d977459c702..95e09ace8c9 100644 --- a/plugins/transforms/dynamicsqlrow/src/test/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMetaTest.java +++ b/plugins/transforms/dynamicsqlrow/src/test/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.dynamicsqlrow; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class DynamicSqlRowMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = DynamicSqlRowMeta.class; diff --git a/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2Xml.java b/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2Xml.java index ead883412f0..21a8637e70f 100644 --- a/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2Xml.java +++ b/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2Xml.java @@ -77,13 +77,14 @@ public boolean processRow() throws HopException { data.inputFieldIndex = getInputRowMeta().indexOfValue(realInputField); if (data.inputFieldIndex < 0) { - throw new HopException(BaseMessages.getString(PKG, "Edi2Xml.Log.CouldNotFindInputField", realInputField)); + throw new HopException( + BaseMessages.getString(PKG, "Edi2Xml.Log.CouldNotFindInputField", realInputField)); } if (!data.inputRowMeta.getValueMeta(data.inputFieldIndex).isString()) { - throw new HopException(BaseMessages.getString(PKG, "Edi2Xml.Log.InputFieldIsNotAString", realInputField)); + throw new HopException( + BaseMessages.getString(PKG, "Edi2Xml.Log.InputFieldIsNotAString", realInputField)); } - data.inputMeta = data.inputRowMeta.getValueMeta(data.inputFieldIndex); if (Utils.isEmpty(meta.getOutputField())) { diff --git a/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMeta.java b/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMeta.java index 0293f5147fd..7372b6481c9 100644 --- a/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMeta.java +++ b/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.edi2xml; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,8 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "TypeExitEdi2XmlTransform", image = "edi2xml.svg", diff --git a/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/grammar/FastSimpleGenericEdifactDirectXMLParser.java b/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/grammar/FastSimpleGenericEdifactDirectXMLParser.java index 5da8e957335..33e39ea5a4f 100644 --- a/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/grammar/FastSimpleGenericEdifactDirectXMLParser.java +++ b/plugins/transforms/edi2xml/src/main/java/org/apache/hop/pipeline/transforms/edi2xml/grammar/FastSimpleGenericEdifactDirectXMLParser.java @@ -21,6 +21,10 @@ package org.apache.hop.pipeline.transforms.edi2xml.grammar; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; import org.antlr.runtime.BitSet; import org.antlr.runtime.IntStream; import org.antlr.runtime.MismatchedSetException; @@ -37,11 +41,6 @@ import org.antlr.stringtemplate.language.AngleBracketTemplateLexer; import org.apache.commons.lang.StringEscapeUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; - public class FastSimpleGenericEdifactDirectXMLParser extends Parser { public static final String[] tokenNames = new String[] { diff --git a/plugins/transforms/edi2xml/src/test/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMetaTest.java b/plugins/transforms/edi2xml/src/test/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMetaTest.java index 8018db17af8..98fc4e8948a 100644 --- a/plugins/transforms/edi2xml/src/test/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMetaTest.java +++ b/plugins/transforms/edi2xml/src/test/java/org/apache/hop/pipeline/transforms/edi2xml/Edi2XmlMetaTest.java @@ -17,23 +17,15 @@ package org.apache.hop.pipeline.transforms.edi2xml; -import org.apache.hop.core.exception.HopException; import org.apache.hop.core.util.Assert; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; -import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; -import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class Edi2XmlMetaTest { @Test public void testSerialization() throws Exception { - Edi2XmlMeta meta = TransformSerializationTestUtil.testSerialization( + Edi2XmlMeta meta = + TransformSerializationTestUtil.testSerialization( "/edi-to-xml-transform.xml", Edi2XmlMeta.class); Assert.assertNotNull(meta.getInputField()); diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInput.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInput.java index 40c99619be6..55470924f42 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInput.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInput.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.excelinput; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.TimeZone; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -45,11 +49,6 @@ import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; import org.apache.poi.openxml4j.util.ZipSecureFile; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.TimeZone; - /** This class reads data from one or more Microsoft Excel files. */ public class ExcelInput extends BaseTransform { @@ -376,7 +375,6 @@ private void checkType(IKCell cell, IValueMeta v) throws HopException { } break; - default: throw new HopException( BaseMessages.getString( diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputData.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputData.java index 37e0340c67e..e28b0b50f0c 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputData.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputData.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.excelinput; +import java.util.Date; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.fileinput.FileInputList; import org.apache.hop.core.playlist.IFilePlayList; @@ -32,8 +33,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; -import java.util.Date; - public class ExcelInputData extends BaseTransformData implements ITransformData { /** The previous row in case we want to repeat values... */ public Object[] previousRow; diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputDialog.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputDialog.java index 904ce87f38b..f4a6be999e2 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputDialog.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.excelinput; +import static org.apache.hop.pipeline.transforms.excelinput.ExcelInputMeta.EIFile; +import static org.apache.hop.pipeline.transforms.excelinput.ExcelInputMeta.EISheet; +import static org.apache.hop.pipeline.transforms.excelinput.ExcelInputMeta.RequiredFilesCode; + import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; @@ -45,9 +49,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.ITransformDialog; import org.apache.hop.pipeline.transform.TransformMeta; -import static org.apache.hop.pipeline.transforms.excelinput.ExcelInputMeta.EIFile; -import static org.apache.hop.pipeline.transforms.excelinput.ExcelInputMeta.EISheet; -import static org.apache.hop.pipeline.transforms.excelinput.ExcelInputMeta.RequiredFilesCode; import org.apache.hop.pipeline.transforms.fileinput.text.DirectoryDialogButtonListenerFactory; import org.apache.hop.staticschema.metadata.SchemaDefinition; import org.apache.hop.staticschema.util.SchemaDefinitionUtil; @@ -847,13 +848,13 @@ public String open() { wFieldsTab.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FieldsTab.TabTitle")); SelectionListener lsSelection = - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - fillFieldsLayoutFromSchema(); - input.setChanged(); - } - }; + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + fillFieldsLayoutFromSchema(); + input.setChanged(); + } + }; FormLayout fieldsLayout = new FormLayout(); fieldsLayout.marginWidth = PropsUi.getFormMargin(); @@ -863,14 +864,14 @@ public void widgetSelected(SelectionEvent e) { wFieldsComp.setLayout(fieldsLayout); wSchemaDefinition = - new MetaSelectionLine<>( - variables, - metadataProvider, - SchemaDefinition.class, - wFieldsComp, - SWT.NONE, - BaseMessages.getString(PKG, "ExcelInputDialog.SchemaDefinition.Label"), - BaseMessages.getString(PKG, "ExcelInputDialog.SchemaDefinition.Tooltip")); + new MetaSelectionLine<>( + variables, + metadataProvider, + SchemaDefinition.class, + wFieldsComp, + SWT.NONE, + BaseMessages.getString(PKG, "ExcelInputDialog.SchemaDefinition.Label"), + BaseMessages.getString(PKG, "ExcelInputDialog.SchemaDefinition.Tooltip")); PropsUi.setLook(wSchemaDefinition); FormData fdSchemaDefinition = new FormData(); @@ -889,7 +890,8 @@ public void widgetSelected(SelectionEvent e) { Group wManualSchemaDefinition = new Group(wFieldsComp, SWT.SHADOW_NONE); PropsUi.setLook(wManualSchemaDefinition); - wManualSchemaDefinition.setText(BaseMessages.getString(PKG, "ExcelInputDialog.ManualSchemaDefinition.Label")); + wManualSchemaDefinition.setText( + BaseMessages.getString(PKG, "ExcelInputDialog.ManualSchemaDefinition.Label")); FormLayout manualSchemaDefinitionLayout = new FormLayout(); manualSchemaDefinitionLayout.marginWidth = 10; @@ -953,7 +955,7 @@ public void widgetSelected(SelectionEvent e) { wFields = new TableView( variables, - wManualSchemaDefinition, + wManualSchemaDefinition, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, @@ -1116,7 +1118,8 @@ private void fillFieldsLayoutFromSchema() { MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); mb.setMessage( - BaseMessages.getString(PKG, "ExcelInputDialog.Load.SchemaDefinition.Message", schemaName)); + BaseMessages.getString( + PKG, "ExcelInputDialog.Load.SchemaDefinition.Message", schemaName)); mb.setText(BaseMessages.getString(PKG, "ExcelInputDialog.Load.SchemaDefinition.Title")); int answer = mb.open(); @@ -1124,7 +1127,7 @@ private void fillFieldsLayoutFromSchema() { if (!Utils.isEmpty(schemaName)) { try { SchemaDefinition schemaDefinition = - (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); + (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); if (schemaDefinition != null) { IRowMeta r = schemaDefinition.getRowMeta(); if (r != null) { @@ -1138,14 +1141,15 @@ private void fillFieldsLayoutFromSchema() { item.setText(1, valueMeta.getName()); item.setText(2, ValueMetaFactory.getValueMetaName(valueMeta.getType())); item.setText( - 3, - valueMeta.getLength() >= 0 ? Integer.toString(valueMeta.getLength()) : ""); + 3, + valueMeta.getLength() >= 0 ? Integer.toString(valueMeta.getLength()) : ""); item.setText( - 4, - valueMeta.getPrecision() >= 0 - ? Integer.toString(valueMeta.getPrecision()) - : ""); - item.setText(5, Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); + 4, + valueMeta.getPrecision() >= 0 + ? Integer.toString(valueMeta.getPrecision()) + : ""); + item.setText( + 5, Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); item.setText(7, Const.NVL(valueMeta.getConversionMask(), "")); item.setText(8, Const.NVL(valueMeta.getCurrencySymbol(), "")); item.setText(9, Const.NVL(valueMeta.getDecimalSymbol(), "")); @@ -1167,7 +1171,6 @@ private void fillFieldsLayoutFromSchema() { } } - public void setFlags() { wbGetFields.setEnabled(wHeader.getSelection()); diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMeta.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMeta.java index 1317526941c..c93fbb7c095 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMeta.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMeta.java @@ -108,11 +108,10 @@ public class ExcelInputMeta extends BaseTransformMeta * Rows should only be accessed sequentially: random access will severely impact performance.
diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiWorkbook.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiWorkbook.java index fe49124a5e4..a51309c98bf 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiWorkbook.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiWorkbook.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.excelinput.staxpoi; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -27,16 +36,6 @@ import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.eventusermodel.XSSFReader; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - /** * Streaming reader for XLSX files.
* Does not open XLS. diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxUtil.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxUtil.java index d4891a19718..c340f109308 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxUtil.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxUtil.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.excelinput.staxpoi; -import org.apache.poi.ss.SpreadsheetVersion; - import javax.xml.stream.XMLInputFactory; +import org.apache.poi.ss.SpreadsheetVersion; public class StaxUtil { private static final SpreadsheetVersion DEFAULT_SPREADSHEET_VERSION = diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterFileField.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterFileField.java index 591ce41b63b..53c9ed0fdb9 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterFileField.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterFileField.java @@ -126,9 +126,9 @@ public class ExcelWriterFileField { injectionKeyDescription = "ExcelWriterMeta.Injection.DateInFilename.Field") private boolean dateInFilename; - /** Flag: create parent folder, default to true */ - @HopMetadataProperty(injectionKeyDescription = "ExcelWriterMeta.Injection.CreateParentFolder.Field") + @HopMetadataProperty( + injectionKeyDescription = "ExcelWriterMeta.Injection.CreateParentFolder.Field") private boolean createParentFolder; public boolean isCreateParentFolder() { @@ -155,62 +155,86 @@ public void setIfSheetExists(String ifSheetExists) { this.ifSheetExists = ifSheetExists; } - /** @param transformNrInFilename The transformNrInFilename to set. */ + /** + * @param transformNrInFilename The transformNrInFilename to set. + */ public void setTransformNrInFilename(boolean transformNrInFilename) { this.transformNrInFilename = transformNrInFilename; } - /** @return the streamingData */ + /** + * @return the streamingData + */ public boolean isStreamingData() { return streamingData; } - /** @param streamingData the streamingData to set */ + /** + * @param streamingData the streamingData to set + */ public void setStreamingData(boolean streamingData) { this.streamingData = streamingData; } - /** @return Returns the "do not open new file at init" flag. */ + /** + * @return Returns the "do not open new file at init" flag. + */ public boolean isDoNotOpenNewFileInit() { return doNotOpenNewFileInit; } - /** @param doNotOpenNewFileInit The "do not open new file at init" flag to set. */ + /** + * @param doNotOpenNewFileInit The "do not open new file at init" flag to set. + */ public void setDoNotOpenNewFileInit(boolean doNotOpenNewFileInit) { this.doNotOpenNewFileInit = doNotOpenNewFileInit; } - /** @return Returns the splitEvery. */ + /** + * @return Returns the splitEvery. + */ public int getSplitEvery() { return splitEvery; } - /** @param splitEvery The splitEvery to set. */ + /** + * @param splitEvery The splitEvery to set. + */ public void setSplitEvery(int splitEvery) { this.splitEvery = splitEvery >= 0 ? splitEvery : 0; } - /** @return Returns the transformNrInFilename. */ + /** + * @return Returns the transformNrInFilename. + */ public boolean isTransformNrInFilename() { return transformNrInFilename; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } - /** @param password teh passwoed to set. */ + /** + * @param password teh passwoed to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the sheet name. */ + /** + * @return Returns the sheet name. + */ public String getSheetname() { return sheetname; } - /** @param sheetname The sheet name. */ + /** + * @param sheetname The sheet name. + */ public void setSheetname(String sheetname) { this.sheetname = sheetname; } @@ -223,52 +247,72 @@ public void setProtectedBy(String protectedBy) { this.protectedBy = protectedBy; } - /** @return Returns the extension. */ + /** + * @return Returns the extension. + */ public String getExtension() { return extension; } - /** @param extension The extension to set. */ + /** + * @param extension The extension to set. + */ public void setExtension(String extension) { this.extension = extension; } - /** @return Returns the dateInFilename. */ + /** + * @return Returns the dateInFilename. + */ public boolean isDateInFilename() { return dateInFilename; } - /** @param dateInFilename The dateInFilename to set. */ + /** + * @param dateInFilename The dateInFilename to set. + */ public void setDateInFilename(boolean dateInFilename) { this.dateInFilename = dateInFilename; } - /** @return Returns the timeInFilename. */ + /** + * @return Returns the timeInFilename. + */ public boolean isTimeInFilename() { return timeInFilename; } - /** @return Returns the protectsheet. */ + /** + * @return Returns the protectsheet. + */ public boolean isProtectsheet() { return protectsheet; } - /** @param timeInFilename The timeInFilename to set. */ + /** + * @param timeInFilename The timeInFilename to set. + */ public void setTimeInFilename(boolean timeInFilename) { this.timeInFilename = timeInFilename; } - /** @param protectsheet the value to set. */ + /** + * @param protectsheet the value to set. + */ public void setProtectsheet(boolean protectsheet) { this.protectsheet = protectsheet; } - /** @return Returns the autosizecolums. */ + /** + * @return Returns the autosizecolums. + */ public boolean isAutosizecolums() { return autosizecolums; } - /** @param autosizecolums The autosizecolums to set. */ + /** + * @param autosizecolums The autosizecolums to set. + */ public void setAutosizecolums(boolean autosizecolums) { this.autosizecolums = autosizecolums; } @@ -289,32 +333,44 @@ public void setDateTimeFormat(String dateTimeFormat) { this.dateTimeFormat = dateTimeFormat; } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String getFileName() { return fileName; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String fileName) { this.fileName = fileName; } - /** @return Is the file name coded in a field? */ + /** + * @return Is the file name coded in a field? + */ public boolean isFileNameInField() { return fileNameInField; } - /** @param fileNameInField Is the file name coded in a field? */ + /** + * @param fileNameInField Is the file name coded in a field? + */ public void setFileNameInField(boolean fileNameInField) { this.fileNameInField = fileNameInField; } - /** @return The field name that contains the output file name. */ + /** + * @return The field name that contains the output file name. + */ public String getFileNameField() { return fileNameField; } - /** @param fileNameField Name of the field that contains the file name */ + /** + * @param fileNameField Name of the field that contains the file name + */ public void setFileNameField(String fileNameField) { this.fileNameField = fileNameField; } diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterOutputField.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterOutputField.java index 2256c052ea9..9fc9dff5c7a 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterOutputField.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterOutputField.java @@ -21,44 +21,54 @@ public class ExcelWriterOutputField implements Cloneable { - @HopMetadataProperty(injectionKey = "NAME", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.FieldName.Field") + @HopMetadataProperty( + injectionKey = "NAME", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.FieldName.Field") private String name; - @HopMetadataProperty(injectionKey = "TYPE", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Type.Field") + @HopMetadataProperty( + injectionKey = "TYPE", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Type.Field") private String type; - @HopMetadataProperty(injectionKey = "FORMAT", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Format.Field") + @HopMetadataProperty( + injectionKey = "FORMAT", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Format.Field") private String format; - @HopMetadataProperty(injectionKey = "FIELDTITLE", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Title.Field") + @HopMetadataProperty( + injectionKey = "FIELDTITLE", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Title.Field") private String title; - @HopMetadataProperty(injectionKey = "FORMULA", + @HopMetadataProperty( + injectionKey = "FORMULA", injectionKeyDescription = "ExcelWriterMeta.Injection.Output.FieldContainFormula.Field") private boolean formula; - @HopMetadataProperty(injectionKey = "HYPERLINKFIELD", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Hyperlink.Field") + @HopMetadataProperty( + injectionKey = "HYPERLINKFIELD", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Hyperlink.Field") private String hyperlinkField; - @HopMetadataProperty(injectionKey = "CELLCOMMENT", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Comment.Field") + @HopMetadataProperty( + injectionKey = "CELLCOMMENT", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.Comment.Field") private String commentField; - @HopMetadataProperty(injectionKey = "COMMENTAUTHOR", + @HopMetadataProperty( + injectionKey = "COMMENTAUTHOR", injectionKeyDescription = "ExcelWriterMeta.Injection.Output.CommentAuthor.Field") private String commentAuthorField; - @HopMetadataProperty(injectionKey = "TITLESTYLE", + @HopMetadataProperty( + injectionKey = "TITLESTYLE", injectionKeyDescription = "ExcelWriterMeta.Injection.Output.TitleStyleCell.Field") private String titleStyleCell; - @HopMetadataProperty(injectionKey = "STYLECELL", - injectionKeyDescription = "ExcelWriterMeta.Injection.Output.StyleCell.Field") + @HopMetadataProperty( + injectionKey = "STYLECELL", + injectionKeyDescription = "ExcelWriterMeta.Injection.Output.StyleCell.Field") private String styleCell; public String getCommentAuthorField() { @@ -75,7 +85,17 @@ public ExcelWriterOutputField(String name, String type, String format) { this.format = format; } - public ExcelWriterOutputField(String name, String type, String format, String title, boolean formula, String hyperlinkField, String commentField, String commentAuthorField, String titleStyleCell, String styleCell) { + public ExcelWriterOutputField( + String name, + String type, + String format, + String title, + boolean formula, + String hyperlinkField, + String commentField, + String commentAuthorField, + String titleStyleCell, + String styleCell) { this.name = name; this.type = type; this.format = format; @@ -107,7 +127,16 @@ public boolean equalsAll(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExcelWriterOutputField that = (ExcelWriterOutputField) o; - return formula == that.formula && name.equals(that.name) && type.equals(that.type) && format.equals(that.format) && title.equals(that.title) && hyperlinkField.equals(that.hyperlinkField) && commentField.equals(that.commentField) && commentAuthorField.equals(that.commentAuthorField) && titleStyleCell.equals(that.titleStyleCell) && styleCell.equals(that.styleCell); + return formula == that.formula + && name.equals(that.name) + && type.equals(that.type) + && format.equals(that.format) + && title.equals(that.title) + && hyperlinkField.equals(that.hyperlinkField) + && commentField.equals(that.commentField) + && commentAuthorField.equals(that.commentAuthorField) + && titleStyleCell.equals(that.titleStyleCell) + && styleCell.equals(that.styleCell); } @Override diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTemplateField.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTemplateField.java index 5c07e85cdda..6b297f1cacc 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTemplateField.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTemplateField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.excelwriter; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class ExcelWriterTemplateField { @@ -70,20 +69,33 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExcelWriterTemplateField that = (ExcelWriterTemplateField) o; - return templateEnabled == that.templateEnabled && templateSheetEnabled == that.templateSheetEnabled && templateSheetHidden == that.templateSheetHidden && Objects.equals(templateFileName, that.templateFileName) && Objects.equals(templateSheetName, that.templateSheetName); + return templateEnabled == that.templateEnabled + && templateSheetEnabled == that.templateSheetEnabled + && templateSheetHidden == that.templateSheetHidden + && Objects.equals(templateFileName, that.templateFileName) + && Objects.equals(templateSheetName, that.templateSheetName); } @Override public int hashCode() { - return Objects.hash(templateEnabled, templateSheetEnabled, templateSheetHidden, templateFileName, templateSheetName); + return Objects.hash( + templateEnabled, + templateSheetEnabled, + templateSheetHidden, + templateFileName, + templateSheetName); } - /** @return Returns the template. */ + /** + * @return Returns the template. + */ public boolean isTemplateEnabled() { return templateEnabled; } - /** @param template The template to set. */ + /** + * @param template The template to set. + */ public void setTemplateEnabled(boolean template) { this.templateEnabled = template; } @@ -104,12 +116,16 @@ public void setTemplateSheetHidden(boolean hide) { this.templateSheetHidden = hide; } - /** @return Returns the templateFileName. */ + /** + * @return Returns the templateFileName. + */ public String getTemplateFileName() { return templateFileName; } - /** @param templateFileName The templateFileName to set. */ + /** + * @param templateFileName The templateFileName to set. + */ public void setTemplateFileName(String templateFileName) { this.templateFileName = templateFileName; } diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform.java index 84f660c0605..b9f0fedb45c 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform.java @@ -65,22 +65,22 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelWriterTransform - extends BaseTransform { + extends BaseTransform { private static final Class PKG = ExcelWriterTransformMeta.class; // For Translator public static final String STREAMER_FORCE_RECALC_PROP_NAME = - "HOP_EXCEL_WRITER_STREAMER_FORCE_RECALCULATE"; + "HOP_EXCEL_WRITER_STREAMER_FORCE_RECALCULATE"; public static int BYTE_ARRAY_MAX_OVERRIDE = 250000000; public ExcelWriterTransform( - TransformMeta transformMeta, - ExcelWriterTransformMeta meta, - ExcelWriterTransformData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline) { + TransformMeta transformMeta, + ExcelWriterTransformMeta meta, + ExcelWriterTransformData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); IOUtils.setByteArrayMaxOverride(BYTE_ARRAY_MAX_OVERRIDE); } @@ -111,10 +111,10 @@ public boolean processRow() throws HopException { prepareNextOutputFile(r); } catch (HopException e) { logError( - BaseMessages.getString( - PKG, - "ExcelWriterTransform.Exception.CouldNotPrepareFile", - resolve(meta.getFile().getFileName()))); + BaseMessages.getString( + PKG, + "ExcelWriterTransform.Exception.CouldNotPrepareFile", + resolve(meta.getFile().getFileName()))); setErrors(1L); stopAll(); return false; @@ -162,9 +162,9 @@ public boolean processRow() throws HopException { data.commentauthorfieldnrs[i] = data.inputRowMeta.indexOfValue(commentAuthorField); if (data.commentauthorfieldnrs[i] < 0 && !Utils.isEmpty(commentAuthorField)) { logError( - "Comment Author Field [" - + commentAuthorField - + "] couldn't be found in the input stream!"); + "Comment Author Field [" + + commentAuthorField + + "] couldn't be found in the input stream!"); setErrors(1); stopAll(); return false; @@ -191,7 +191,7 @@ public boolean processRow() throws HopException { if (meta.getFile().isFileNameInField()) { if (data.isBeamContext()) { throw new HopException( - "Storing filenames in an input field is not supported in Beam pipelines"); + "Storing filenames in an input field is not supported in Beam pipelines"); } if (!data.currentWorkbookDefinition.getFile().equals(getFileLocation(r))) { @@ -212,10 +212,10 @@ public boolean processRow() throws HopException { // File Splitting Feature, is it time to create a new file? if (!meta.isAppendLines() - && !meta.getFile().isFileNameInField() - && meta.getFile().getSplitEvery() > 0 - && data.currentWorkbookDefinition.getDatalines() > 0 - && data.currentWorkbookDefinition.getDatalines() % meta.getFile().getSplitEvery() == 0) { + && !meta.getFile().isFileNameInField() + && meta.getFile().getSplitEvery() > 0 + && data.currentWorkbookDefinition.getDatalines() > 0 + && data.currentWorkbookDefinition.getDatalines() % meta.getFile().getSplitEvery() == 0) { prepareNextOutputFile(r); } @@ -223,7 +223,7 @@ public boolean processRow() throws HopException { incrementLinesOutput(); data.currentWorkbookDefinition.setDatalines( - data.currentWorkbookDefinition.getDatalines() + 1); + data.currentWorkbookDefinition.getDatalines() + 1); // pass on the row unchanged putRow(data.outputRowMeta, r); @@ -258,33 +258,33 @@ private void createParentFolder(FileObject filename) throws Exception { if (parentfolder.exists()) { if (isDetailed()) { logDetailed( - BaseMessages.getString( - PKG, "ExcelWriter.Log.ParentFolderExist", HopVfs.getFriendlyURI(parentfolder))); + BaseMessages.getString( + PKG, "ExcelWriter.Log.ParentFolderExist", HopVfs.getFriendlyURI(parentfolder))); } } else { if (isDetailed()) { logDetailed( - BaseMessages.getString( - PKG, - "ExcelWriter.Log.ParentFolderNotExist", - HopVfs.getFriendlyURI(parentfolder))); + BaseMessages.getString( + PKG, + "ExcelWriter.Log.ParentFolderNotExist", + HopVfs.getFriendlyURI(parentfolder))); } if (meta.getFile().isCreateParentFolder()) { parentfolder.createFolder(); if (isDetailed()) { logDetailed( - BaseMessages.getString( - PKG, - "ExcelWriter.Log.ParentFolderCreated", - HopVfs.getFriendlyURI(parentfolder))); + BaseMessages.getString( + PKG, + "ExcelWriter.Log.ParentFolderCreated", + HopVfs.getFriendlyURI(parentfolder))); } } else { throw new HopException( - BaseMessages.getString( - PKG, - "ExcelWriter.Log.ParentFolderNotExistCreateIt", - HopVfs.getFriendlyURI(parentfolder), - HopVfs.getFriendlyURI(filename))); + BaseMessages.getString( + PKG, + "ExcelWriter.Log.ParentFolderNotExistCreateIt", + HopVfs.getFriendlyURI(parentfolder), + HopVfs.getFriendlyURI(filename))); } } } finally { @@ -334,8 +334,8 @@ private void closeOutputFile(ExcelWriterWorkbookDefinition file) throws HopExcep file.getWorkbook().close(); // deleting the temporary files - if (file.getWorkbook() instanceof SXSSFWorkbook ) { - ((SXSSFWorkbook ) file.getWorkbook()).dispose(); + if (file.getWorkbook() instanceof SXSSFWorkbook) { + ((SXSSFWorkbook) file.getWorkbook()).dispose(); } } catch (IOException e) { @@ -358,10 +358,10 @@ void recalculateAllWorkbookFormulas(ExcelWriterWorkbookDefinition workbookDefini if (workbookDefinition.getWorkbook() instanceof XSSFWorkbook) { // XLSX needs full reevaluation FormulaEvaluator evaluator = - workbookDefinition.getWorkbook().getCreationHelper().createFormulaEvaluator(); + workbookDefinition.getWorkbook().getCreationHelper().createFormulaEvaluator(); for (int sheetNum = 0; - sheetNum < workbookDefinition.getWorkbook().getNumberOfSheets(); - sheetNum++) { + sheetNum < workbookDefinition.getWorkbook().getNumberOfSheets(); + sheetNum++) { Sheet sheet = workbookDefinition.getWorkbook().getSheetAt(sheetNum); for (Row r : sheet) { for (Cell c : r) { @@ -374,8 +374,8 @@ void recalculateAllWorkbookFormulas(ExcelWriterWorkbookDefinition workbookDefini } else if (workbookDefinition.getWorkbook() instanceof HSSFWorkbook) { // XLS supports a "dirty" flag to have excel recalculate everything when a sheet is opened for (int sheetNum = 0; - sheetNum < workbookDefinition.getWorkbook().getNumberOfSheets(); - sheetNum++) { + sheetNum < workbookDefinition.getWorkbook().getNumberOfSheets(); + sheetNum++) { HSSFSheet sheet = ((HSSFWorkbook) workbookDefinition.getWorkbook()).getSheetAt(sheetNum); sheet.setForceFormulaRecalculation(true); } @@ -388,7 +388,7 @@ void recalculateAllWorkbookFormulas(ExcelWriterWorkbookDefinition workbookDefini } public void writeNextLine(ExcelWriterWorkbookDefinition workbookDefinition, Object[] r) - throws HopException { + throws HopException { try { openLine(workbookDefinition.getSheet(), workbookDefinition.getPosY()); Row xlsRow = workbookDefinition.getSheet().getRow(workbookDefinition.getPosY()); @@ -407,15 +407,15 @@ public void writeNextLine(ExcelWriterWorkbookDefinition workbookDefinition, Obje for (int i = 0; i < nr; i++) { v = r[i]; writeField( - workbookDefinition, - v, - data.inputRowMeta.getValueMeta(i), - null, - xlsRow, - x++, - r, - i, - false); + workbookDefinition, + v, + data.inputRowMeta.getValueMeta(i), + null, + xlsRow, + x++, + r, + i, + false); } // go to the next line workbookDefinition.setPosX(data.startingCol); @@ -429,15 +429,15 @@ public void writeNextLine(ExcelWriterWorkbookDefinition workbookDefinition, Obje v = r[data.fieldnrs[i]]; ExcelWriterOutputField field = meta.getOutputFields().get(i); writeField( - workbookDefinition, - v, - data.inputRowMeta.getValueMeta(data.fieldnrs[i]), - field, - xlsRow, - x++, - r, - i, - false); + workbookDefinition, + v, + data.inputRowMeta.getValueMeta(data.fieldnrs[i]), + field, + xlsRow, + x++, + r, + i, + false); } // go to the next line workbookDefinition.setPosX(data.startingCol); @@ -450,7 +450,7 @@ public void writeNextLine(ExcelWriterWorkbookDefinition workbookDefinition, Obje } private Comment createCellComment( - ExcelWriterWorkbookDefinition workbookDefinition, String author, String comment) { + ExcelWriterWorkbookDefinition workbookDefinition, String author, String comment) { // comments only supported for XLSX if (workbookDefinition.getSheet() instanceof XSSFSheet) { CreationHelper factory = workbookDefinition.getWorkbook().getCreationHelper(); @@ -471,7 +471,7 @@ private Comment createCellComment( * @return the cell the reference points to */ private Cell getCellFromReference( - ExcelWriterWorkbookDefinition workbookDefinition, String reference) { + ExcelWriterWorkbookDefinition workbookDefinition, String reference) { CellReference cellRef = new CellReference(reference); String sheetName = cellRef.getSheetName(); @@ -493,16 +493,16 @@ private Cell getCellFromReference( // VisibleForTesting void writeField( - ExcelWriterWorkbookDefinition workbookDefinition, - Object v, - IValueMeta vMeta, - ExcelWriterOutputField excelField, - Row xlsRow, - int posX, - Object[] row, - int fieldNr, - boolean isTitle) - throws HopException { + ExcelWriterWorkbookDefinition workbookDefinition, + Object v, + IValueMeta vMeta, + ExcelWriterOutputField excelField, + Row xlsRow, + int posX, + Object[] row, + int fieldNr, + boolean isTitle) + throws HopException { try { boolean cellExisted = true; // get the cell @@ -540,17 +540,16 @@ void writeField( // set cell format as specified, specific format overrides cell specification if (!isTitle - && excelField != null - && !Utils.isEmpty(excelField.getFormat()) - && !excelField.getFormat().startsWith("Image")) { + && excelField != null + && !Utils.isEmpty(excelField.getFormat()) + && !excelField.getFormat().startsWith("Image")) { setDataFormat(workbookDefinition, excelField.getFormat(), cell); } - if (!isTitle - && excelField != null - && Utils.isEmpty(excelField.getFormat())) { + if (!isTitle && excelField != null && Utils.isEmpty(excelField.getFormat())) { - if (vMeta.getType() == IValueMeta.TYPE_DATE || vMeta.getType() == IValueMeta.TYPE_TIMESTAMP) { + if (vMeta.getType() == IValueMeta.TYPE_DATE + || vMeta.getType() == IValueMeta.TYPE_TIMESTAMP) { String format = vMeta.getFormatMask(); if (!Utils.isEmpty(format)) { @@ -568,9 +567,9 @@ void writeField( // create link on cell if requested if (!isTitle && excelField != null && data.linkfieldnrs[fieldNr] >= 0) { String link = - data.inputRowMeta - .getValueMeta(data.linkfieldnrs[fieldNr]) - .getString(row[data.linkfieldnrs[fieldNr]]); + data.inputRowMeta + .getValueMeta(data.linkfieldnrs[fieldNr]) + .getString(row[data.linkfieldnrs[fieldNr]]); if (!Utils.isEmpty(link)) { CreationHelper ch = workbookDefinition.getWorkbook().getCreationHelper(); // set the link on the cell depending on link type @@ -599,7 +598,7 @@ void writeField( cell.setCellStyle(workbookDefinition.getCachedLinkStyle(fieldNr)); } else { Font origFont = - workbookDefinition.getWorkbook().getFontAt(cell.getCellStyle().getFontIndex()); + workbookDefinition.getWorkbook().getFontAt(cell.getCellStyle().getFontIndex()); Font hlinkFont = workbookDefinition.getWorkbook().createFont(); // reproduce original font characteristics @@ -624,20 +623,20 @@ void writeField( // create comment on cell if requested if (!isTitle - && excelField != null - && data.commentfieldnrs[fieldNr] >= 0 - && workbookDefinition.getWorkbook() instanceof XSSFWorkbook) { + && excelField != null + && data.commentfieldnrs[fieldNr] >= 0 + && workbookDefinition.getWorkbook() instanceof XSSFWorkbook) { String comment = - data.inputRowMeta - .getValueMeta(data.commentfieldnrs[fieldNr]) - .getString(row[data.commentfieldnrs[fieldNr]]); + data.inputRowMeta + .getValueMeta(data.commentfieldnrs[fieldNr]) + .getString(row[data.commentfieldnrs[fieldNr]]); if (!Utils.isEmpty(comment)) { String author = - data.commentauthorfieldnrs[fieldNr] >= 0 - ? data.inputRowMeta - .getValueMeta(data.commentauthorfieldnrs[fieldNr]) - .getString(row[data.commentauthorfieldnrs[fieldNr]]) - : "Apache Hop"; + data.commentauthorfieldnrs[fieldNr] >= 0 + ? data.inputRowMeta + .getValueMeta(data.commentauthorfieldnrs[fieldNr]) + .getString(row[data.commentauthorfieldnrs[fieldNr]]) + : "Apache Hop"; cell.setCellComment(createCellComment(workbookDefinition, author, comment)); } } @@ -675,12 +674,12 @@ void writeField( } } catch (Exception e) { logError( - "Error writing field (" - + workbookDefinition.getPosX() - + "," - + workbookDefinition.getPosY() - + ") : " - + e.toString()); + "Error writing field (" + + workbookDefinition.getPosX() + + "," + + workbookDefinition.getPosY() + + ") : " + + e.toString()); logError(Const.getStackTracker(e)); throw new HopException(e); } @@ -693,15 +692,15 @@ void writeField( * @param cell the cell to set up format */ private void setDataFormat( - ExcelWriterWorkbookDefinition workbookDefinition, String excelFieldFormat, Cell cell) { + ExcelWriterWorkbookDefinition workbookDefinition, String excelFieldFormat, Cell cell) { if (log.isDebug()) { logDebug( - BaseMessages.getString( - PKG, - "ExcelWriterTransform.Log.SetDataFormat", - excelFieldFormat, - CellReference.convertNumToColString(cell.getColumnIndex()), - cell.getRowIndex())); + BaseMessages.getString( + PKG, + "ExcelWriterTransform.Log.SetDataFormat", + excelFieldFormat, + CellReference.convertNumToColString(cell.getColumnIndex()), + cell.getRowIndex())); } DataFormat format = workbookDefinition.getWorkbook().createDataFormat(); @@ -728,12 +727,12 @@ public String buildFilename(IRowMeta rowMeta, Object[] row) { */ public String buildFilename(int splitNr) { return meta.buildFilename( - this, - getCopy(), - splitNr, - data.isBeamContext(), - log.getLogChannelId(), - data.getBeamBundleNr()); + this, + getCopy(), + splitNr, + data.isBeamContext(), + log.getLogChannelId(), + data.getBeamBundleNr()); } /** @@ -745,7 +744,7 @@ public String buildFilename(int splitNr) { */ public static void copyFile(FileObject in, FileObject out) throws HopException { try (BufferedInputStream fis = new BufferedInputStream(HopVfs.getInputStream(in)); - BufferedOutputStream fos = new BufferedOutputStream(HopVfs.getOutputStream(out, false))) { + BufferedOutputStream fos = new BufferedOutputStream(HopVfs.getOutputStream(out, false))) { byte[] buf = new byte[1024 * 1024]; // copy in chunks of 1 MB int i = 0; while ((i = fis.read(buf)) != -1) { @@ -763,23 +762,23 @@ public void prepareNextOutputFile(Object[] row) throws HopException { // sheet name shouldn't exceed 31 character if (data.realSheetname != null && data.realSheetname.length() > 31) { throw new HopException( - BaseMessages.getString( - PKG, "ExcelWriterTransform.Exception.MaxSheetName", data.realSheetname)); + BaseMessages.getString( + PKG, "ExcelWriterTransform.Exception.MaxSheetName", data.realSheetname)); } // Getting field names from input is not supported in a Beam context // if (data.isBeamContext() && meta.getFile().isFileNameInField()) { throw new HopException( - BaseMessages.getString( - PKG, "ExcelWriterTransform.Exception.FilenameFromFieldNotSupportedInBeam")); + BaseMessages.getString( + PKG, "ExcelWriterTransform.Exception.FilenameFromFieldNotSupportedInBeam")); } // clear style cache int numOfFields = - meta.getOutputFields() != null && !meta.getOutputFields().isEmpty() - ? meta.getOutputFields().size() - : 0; + meta.getOutputFields() != null && !meta.getOutputFields().isEmpty() + ? meta.getOutputFields().size() + : 0; if (numOfFields == 0) { numOfFields = data.inputRowMeta != null ? data.inputRowMeta.size() : 0; } @@ -793,26 +792,26 @@ public void prepareNextOutputFile(Object[] row) throws HopException { if (!file.getParent().exists() && meta.getFile().isCreateParentFolder()) { logDebug( - "Create parent directory for " - + file.getName().toString() - + " because it does not exist."); + "Create parent directory for " + + file.getName().toString() + + " because it does not exist."); createParentFolder(file); } if (log.isDebug()) { logDebug( - BaseMessages.getString( - PKG, "ExcelWriterTransform.Log.OpeningFile", file.getName().toString())); + BaseMessages.getString( + PKG, "ExcelWriterTransform.Log.OpeningFile", file.getName().toString())); } // determine whether existing file must be deleted if (file.exists() && data.createNewFile && !file.delete()) { if (log.isBasic()) { logBasic( - BaseMessages.getString( - PKG, - "ExcelWriterTransform.Log.CouldNotDeleteStaleFile", - file.getName().toString())); + BaseMessages.getString( + PKG, + "ExcelWriterTransform.Log.CouldNotDeleteStaleFile", + file.getName().toString())); } setErrors(1); throw new HopException("Could not delete stale file " + file.getName().toString()); @@ -822,13 +821,13 @@ public void prepareNextOutputFile(Object[] row) throws HopException { if (meta.isAddToResultFilenames()) { // Add this to the result file names... ResultFile resultFile = - new ResultFile( - ResultFile.FILE_TYPE_GENERAL, - file, - getPipelineMeta().getName(), - getTransformName()); + new ResultFile( + ResultFile.FILE_TYPE_GENERAL, + file, + getPipelineMeta().getName(), + getTransformName()); resultFile.setComment( - "This file was created with an Excel writer transform by Hop : The Hop Orchestration Platform"); + "This file was created with an Excel writer transform by Hop : The Hop Orchestration Platform"); addResultFile(resultFile); } boolean appendingToSheet = true; @@ -839,14 +838,14 @@ public void prepareNextOutputFile(Object[] row) throws HopException { // handle template case (must have same format) // ensure extensions match String templateExt = - HopVfs.getFileObject(data.realTemplateFileName).getName().getExtension(); + HopVfs.getFileObject(data.realTemplateFileName).getName().getExtension(); if (!meta.getFile().getExtension().equalsIgnoreCase(templateExt)) { throw new HopException( - "Template Format Mismatch: Template has extension: " - + templateExt - + ", but output file has extension: " - + meta.getFile().getExtension() - + ". Template and output file must share the same format!"); + "Template Format Mismatch: Template has extension: " + + templateExt + + ", but output file has extension: " + + meta.getFile().getExtension() + + ". Template and output file must share the same format!"); } if (HopVfs.getFileObject(data.realTemplateFileName).exists()) { @@ -856,8 +855,8 @@ public void prepareNextOutputFile(Object[] row) throws HopException { // template is missing, log it and get out if (log.isBasic()) { logBasic( - BaseMessages.getString( - PKG, "ExcelWriterTransform.Log.TemplateMissing", data.realTemplateFileName)); + BaseMessages.getString( + PKG, "ExcelWriterTransform.Log.TemplateMissing", data.realTemplateFileName)); } setErrors(1); throw new HopException("Template file missing: " + data.realTemplateFileName); @@ -865,9 +864,9 @@ public void prepareNextOutputFile(Object[] row) throws HopException { } else { // handle fresh file case, just create a fresh workbook try (Workbook wb = - meta.getFile().getExtension().equalsIgnoreCase("xlsx") - ? new XSSFWorkbook() - : new HSSFWorkbook()) { + meta.getFile().getExtension().equalsIgnoreCase("xlsx") + ? new XSSFWorkbook() + : new HSSFWorkbook()) { wb.createSheet(data.realSheetname); try (OutputStream out = HopVfs.getOutputStream(file, false)) { wb.write(out); @@ -915,10 +914,10 @@ public void prepareNextOutputFile(Object[] row) throws HopException { // if template sheet is missing, break if (ts == null) { throw new HopException( - BaseMessages.getString( - PKG, - "ExcelWriterTransform.Exception.TemplateNotFound", - data.realTemplateSheetName)); + BaseMessages.getString( + PKG, + "ExcelWriterTransform.Exception.TemplateNotFound", + data.realTemplateSheetName)); } sheet = wb.cloneSheet(wb.getSheetIndex(ts)); wb.setSheetName(wb.getSheetIndex(sheet), data.realSheetname); @@ -1004,35 +1003,38 @@ public void prepareNextOutputFile(Object[] row) throws HopException { } // If starting cell provided, use the posY derived above, otherwise use default behaviour - int startY = !Utils.isEmpty(data.realStartingCell) ? posY : Math.max(posY, sheet.getLastRowNum()); + int startY = + !Utils.isEmpty(data.realStartingCell) ? posY : Math.max(posY, sheet.getLastRowNum()); ExcelWriterWorkbookDefinition workbookDefinition = - prepareWorkbookDefinition(numOfFields, splitNr, file, wb, sheet, posX, baseFileName, startY); + prepareWorkbookDefinition( + numOfFields, splitNr, file, wb, sheet, posX, baseFileName, startY); // may have to write a header here if (meta.isHeaderEnabled() - && !(!data.createNewSheet && meta.isAppendOmitHeader() && appendingToSheet)) { + && !(!data.createNewSheet && meta.isAppendOmitHeader() && appendingToSheet)) { data.currentWorkbookDefinition.setSheet(writeHeader(workbookDefinition, sheet, posX, posY)); } // Reload Worksheet in Streaming mode when a template is used if (meta.getFile().getExtension().equalsIgnoreCase("xlsx") - && meta.getFile().isStreamingData() - && meta.getTemplate().isTemplateEnabled()) { + && meta.getFile().isStreamingData() + && meta.getTemplate().isTemplateEnabled()) { try (InputStream inputStream = HopVfs.getInputStream(HopVfs.getFilename(file))) { XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inputStream); wb = new SXSSFWorkbook(xssfWorkbook, 100); sheet = wb.getSheet(data.realSheetname); // Replace workbookDefinition with reloaded one data.usedFiles.remove(workbookDefinition); - prepareWorkbookDefinition(numOfFields, splitNr, file, wb, sheet, posX, baseFileName, startY); + prepareWorkbookDefinition( + numOfFields, splitNr, file, wb, sheet, posX, baseFileName, startY); } } if (log.isDebug()) { logDebug( - BaseMessages.getString( - PKG, "ExcelWriterTransform.Log.FileOpened", file.getName().toString())); + BaseMessages.getString( + PKG, "ExcelWriterTransform.Log.FileOpened", file.getName().toString())); } } catch (Exception e) { @@ -1042,11 +1044,17 @@ public void prepareNextOutputFile(Object[] row) throws HopException { } } - private ExcelWriterWorkbookDefinition prepareWorkbookDefinition(int numOfFields, int splitNr, FileObject file, - Workbook wb, Sheet sheet, int posX, - String baseFileName, int startY) { + private ExcelWriterWorkbookDefinition prepareWorkbookDefinition( + int numOfFields, + int splitNr, + FileObject file, + Workbook wb, + Sheet sheet, + int posX, + String baseFileName, + int startY) { ExcelWriterWorkbookDefinition workbookDefinition = - new ExcelWriterWorkbookDefinition(baseFileName, file, wb, sheet, posX, startY); + new ExcelWriterWorkbookDefinition(baseFileName, file, wb, sheet, posX, startY); workbookDefinition.setSplitNr(splitNr); data.usedFiles.add(workbookDefinition); data.currentWorkbookDefinition = workbookDefinition; @@ -1062,8 +1070,8 @@ private Sheet openLine(Sheet sheet, int posY) { } private Sheet writeHeader( - ExcelWriterWorkbookDefinition workbookDefinition, Sheet sheet, int posX, int posY) - throws HopException { + ExcelWriterWorkbookDefinition workbookDefinition, Sheet sheet, int posX, int posY) + throws HopException { try { sheet = openLine(sheet, posY); Row xlsRow = sheet.getRow(posY); @@ -1105,13 +1113,13 @@ public boolean init() { data.realProtectedBy = resolve(meta.getFile().getProtectedBy()); data.shiftExistingCells = - ExcelWriterTransformMeta.ROW_WRITE_PUSH_DOWN.equals(meta.getRowWritingMethod()); + ExcelWriterTransformMeta.ROW_WRITE_PUSH_DOWN.equals(meta.getRowWritingMethod()); data.createNewSheet = - ExcelWriterTransformMeta.IF_SHEET_EXISTS_CREATE_NEW.equals( - meta.getFile().getIfSheetExists()); + ExcelWriterTransformMeta.IF_SHEET_EXISTS_CREATE_NEW.equals( + meta.getFile().getIfSheetExists()); data.createNewFile = - ExcelWriterTransformMeta.IF_FILE_EXISTS_CREATE_NEW.equals( - meta.getFile().getIfFileExists()); + ExcelWriterTransformMeta.IF_FILE_EXISTS_CREATE_NEW.equals( + meta.getFile().getIfFileExists()); return true; } return false; @@ -1159,9 +1167,9 @@ protected void protectSheet(Sheet sheet, String password) { */ private FileObject getFileLocation(Object[] row) throws HopFileException { String buildFilename = - (!meta.getFile().isFileNameInField()) - ? buildFilename(getNextSplitNr(meta.getFile().getFileName())) - : buildFilename(data.inputRowMeta, row); + (!meta.getFile().isFileNameInField()) + ? buildFilename(getNextSplitNr(meta.getFile().getFileName())) + : buildFilename(data.inputRowMeta, row); return HopVfs.getFileObject(buildFilename); } @@ -1190,4 +1198,4 @@ private int getNextSplitNr(String fileName) { } return splitNr; } -} \ No newline at end of file +} diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformData.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformData.java index 45aa6a932ef..658180fa13f 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformData.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.excelwriter; +import java.util.ArrayList; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; - public class ExcelWriterTransformData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformDialog.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformDialog.java index 0acf6dfcee1..1d5f7712b8c 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformDialog.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformDialog.java @@ -338,7 +338,7 @@ public void widgetSelected(SelectionEvent e) { // Create Parent Folder Label wlCreateParentFolder = new Label(fileGroup, SWT.RIGHT); wlCreateParentFolder.setText( - BaseMessages.getString(PKG, "ExcelWriterDialog.CreateParentFolder.Label")); + BaseMessages.getString(PKG, "ExcelWriterDialog.CreateParentFolder.Label")); PropsUi.setLook(wlCreateParentFolder); FormData fdlCreateParentFolder = new FormData(); fdlCreateParentFolder.left = new FormAttachment(0, 0); @@ -347,7 +347,7 @@ public void widgetSelected(SelectionEvent e) { wlCreateParentFolder.setLayoutData(fdlCreateParentFolder); wCreateParentFolder = new Button(fileGroup, SWT.CHECK); wCreateParentFolder.setToolTipText( - BaseMessages.getString(PKG, "ExcelWriterDialog.CreateParentFolder.Tooltip")); + BaseMessages.getString(PKG, "ExcelWriterDialog.CreateParentFolder.Tooltip")); PropsUi.setLook(wCreateParentFolder); FormData fdCreateParentFolder = new FormData(); fdCreateParentFolder.left = new FormAttachment(middle, 0); @@ -355,17 +355,17 @@ public void widgetSelected(SelectionEvent e) { fdCreateParentFolder.right = new FormAttachment(100, 0); wCreateParentFolder.setLayoutData(fdCreateParentFolder); wCreateParentFolder.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - input.setChanged(); - } - }); + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + input.setChanged(); + } + }); // Do not open new File at Init Label wlDoNotOpenNewFileInit = new Label(fileGroup, SWT.RIGHT); wlDoNotOpenNewFileInit.setText( - BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Label")); + BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Label")); PropsUi.setLook(wlDoNotOpenNewFileInit); FormData fdlDoNotOpenNewFileInit = new FormData(); fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0); @@ -374,7 +374,7 @@ public void widgetSelected(SelectionEvent e) { wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit); wDoNotOpenNewFileInit = new Button(fileGroup, SWT.CHECK); wDoNotOpenNewFileInit.setToolTipText( - BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Tooltip")); + BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Tooltip")); PropsUi.setLook(wDoNotOpenNewFileInit); FormData fdDoNotOpenNewFileInit = new FormData(); fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0); @@ -1209,7 +1209,6 @@ public void widgetSelected(SelectionEvent e) { // / END OF CONTENT GROUP - Group writeToExistingGroup = new Group(wContentComp, SWT.SHADOW_NONE); PropsUi.setLook(writeToExistingGroup); writeToExistingGroup.setText( @@ -1337,13 +1336,13 @@ public void widgetSelected(SelectionEvent arg0) { fieldLayout.marginHeight = 3; SelectionListener lsSelection = - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - fillFieldsLayoutFromSchema(); - input.setChanged(); - } - }; + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + fillFieldsLayoutFromSchema(); + input.setChanged(); + } + }; Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE); PropsUi.setLook(wFieldsComp); @@ -1351,7 +1350,8 @@ public void widgetSelected(SelectionEvent e) { Group fieldGroup = new Group(wFieldsComp, SWT.SHADOW_NONE); PropsUi.setLook(fieldGroup); - fieldGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ManualSchemaDefinition.Label")); + fieldGroup.setText( + BaseMessages.getString(PKG, "ExcelWriterDialog.ManualSchemaDefinition.Label")); FormLayout fieldGroupGroupLayout = new FormLayout(); fieldGroupGroupLayout.marginWidth = 10; @@ -1382,14 +1382,14 @@ public void widgetSelected(SelectionEvent e) { } wSchemaDefinition = - new MetaSelectionLine<>( - variables, - metadataProvider, - SchemaDefinition.class, - wFieldsComp, - SWT.NONE, - BaseMessages.getString(PKG, "ExcelWriterDialog.SchemaDefinition.Label"), - BaseMessages.getString(PKG, "ExcelWriterDialog.SchemaDefinition.Tooltip")); + new MetaSelectionLine<>( + variables, + metadataProvider, + SchemaDefinition.class, + wFieldsComp, + SWT.NONE, + BaseMessages.getString(PKG, "ExcelWriterDialog.SchemaDefinition.Label"), + BaseMessages.getString(PKG, "ExcelWriterDialog.SchemaDefinition.Tooltip")); PropsUi.setLook(wSchemaDefinition); FormData fdSchemaDefinition = new FormData(); @@ -1641,7 +1641,8 @@ private void fillFieldsLayoutFromSchema() { MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); mb.setMessage( - BaseMessages.getString(PKG, "ExcelWriterDialog.Load.SchemaDefinition.Message", schemaName)); + BaseMessages.getString( + PKG, "ExcelWriterDialog.Load.SchemaDefinition.Message", schemaName)); mb.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Load.SchemaDefinition.Title")); int answer = mb.open(); @@ -1649,7 +1650,7 @@ private void fillFieldsLayoutFromSchema() { if (!Utils.isEmpty(schemaName)) { try { SchemaDefinition schemaDefinition = - (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); + (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); if (schemaDefinition != null) { IRowMeta r = schemaDefinition.getRowMeta(); if (r != null) { diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMeta.java b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMeta.java index 9ff67b4435f..ae0379b44a4 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMeta.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMeta.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.excelwriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -36,12 +41,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - @Transform( id = "TypeExitExcelWriterTransform", image = "excelwriter.svg", @@ -355,7 +354,13 @@ public String[] getFiles(IVariables variables) { return retval; } - public String buildFilename(IVariables variables, int transformNr, int splitNr, boolean beamContext, String transformId, int bundleNr) { + public String buildFilename( + IVariables variables, + int transformNr, + int splitNr, + boolean beamContext, + String transformId, + int bundleNr) { SimpleDateFormat daf = new SimpleDateFormat(); // Replace possible environment variables... @@ -387,7 +392,7 @@ public String buildFilename(IVariables variables, int transformNr, int splitNr, retval += "_" + splitNr; } if (beamContext) { - retval+= "_"+transformId+"_"+bundleNr; + retval += "_" + transformId + "_" + bundleNr; } if (realextension != null && realextension.length() != 0) { diff --git a/plugins/transforms/excel/src/main/java/org/apache/hop/ui/core/widgets/TableViewExportToExcelToolbarButton.java b/plugins/transforms/excel/src/main/java/org/apache/hop/ui/core/widgets/TableViewExportToExcelToolbarButton.java index 029ae62090e..c6fdb4ba7b9 100644 --- a/plugins/transforms/excel/src/main/java/org/apache/hop/ui/core/widgets/TableViewExportToExcelToolbarButton.java +++ b/plugins/transforms/excel/src/main/java/org/apache/hop/ui/core/widgets/TableViewExportToExcelToolbarButton.java @@ -18,6 +18,10 @@ package org.apache.hop.ui.core.widgets; +import java.io.OutputStream; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.gui.plugin.GuiPlugin; @@ -47,11 +51,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.io.OutputStream; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - @GuiPlugin public class TableViewExportToExcelToolbarButton { diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseExcelParsingTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseExcelParsingTest.java index e12e36d1bba..320645ca256 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseExcelParsingTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseExcelParsingTest.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.excelinput; +import java.util.Arrays; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.variables.Variables; import org.apache.hop.pipeline.transforms.file.BaseFileField; @@ -24,8 +25,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.util.Arrays; - /** Base class for all Fixed input transform tests. */ @Ignore("No tests in abstract base class") public class BaseExcelParsingTest diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseParsingTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseParsingTest.java index f2696191353..db5deb1f56e 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseParsingTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/BaseParsingTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.excelinput; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -39,15 +47,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** Base class for all tests for BaseFileInput transforms. */ @Ignore("No tests in abstract base class") public abstract class BaseParsingTest< diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputContentParsingTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputContentParsingTest.java index 29fbc8e1941..4bd67576f6c 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputContentParsingTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputContentParsingTest.java @@ -17,14 +17,14 @@ package org.apache.hop.pipeline.transforms.excelinput; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.Const; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.poi.openxml4j.util.ZipSecureFile; import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class ExcelInputContentParsingTest extends BaseExcelParsingTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -218,7 +218,7 @@ protected void testLimitOptionSingleSheet( throws Exception { testLimitOption( - TEST_ROW_LIMIT_SINGLE_SHEET, + TEST_ROW_LIMIT_SINGLE_SHEET, startsWithHeader, new int[] {startRow}, CNST_1_ZERO_INT_ARRAY, @@ -227,8 +227,7 @@ protected void testLimitOptionSingleSheet( // Checks assertEquals("Wrong row count", TEST_ROW_LIMIT_SINGLE_SHEET, rows.size()); assertEquals("Wrong first result", firstResult, rows.get(0)[0]); - assertEquals( - "Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_SINGLE_SHEET - 1)[0]); + assertEquals("Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_SINGLE_SHEET - 1)[0]); } @Test @@ -270,8 +269,7 @@ public void testLimitOptionSingleSheet_Header_StartRow12() throws Exception { public void testLimitOptionSingleSheet_NoHeader_StartRow12() throws Exception { String firstResult = "12.0"; String lastResult = "21.0"; - testLimitOptionSingleSheet( - TEST_ROW_LIMIT_SINGLE_SHEET, false, 12, firstResult, lastResult); + testLimitOptionSingleSheet(TEST_ROW_LIMIT_SINGLE_SHEET, false, 12, firstResult, lastResult); } @Test @@ -279,7 +277,7 @@ public void testLimitOptionMultipleSheets_Header_StartRow0() throws Exception { String firstResult = "1.0"; String lastResult = "20.0"; testLimitOption( - TEST_ROW_LIMIT_MULTIPLE_SHEET, + TEST_ROW_LIMIT_MULTIPLE_SHEET, true, CNST_3_ZERO_INT_ARRAY, CNST_3_ZERO_INT_ARRAY, @@ -287,8 +285,7 @@ public void testLimitOptionMultipleSheets_Header_StartRow0() throws Exception { // Checks assertEquals("Wrong first result", firstResult, rows.get(0)[0]); - assertEquals( - "Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); + assertEquals("Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); } @Test @@ -296,7 +293,7 @@ public void testLimitOptionMultipleSheets_NoHeader_StartRow0() throws Exception String firstResult = "col"; String lastResult = "19.0"; testLimitOption( - TEST_ROW_LIMIT_MULTIPLE_SHEET, + TEST_ROW_LIMIT_MULTIPLE_SHEET, false, CNST_3_ZERO_INT_ARRAY, CNST_3_ZERO_INT_ARRAY, @@ -304,8 +301,7 @@ public void testLimitOptionMultipleSheets_NoHeader_StartRow0() throws Exception // Checks assertEquals("Wrong first result", firstResult, rows.get(0)[0]); - assertEquals( - "Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); + assertEquals("Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); } @Test @@ -313,7 +309,7 @@ public void testLimitOptionMultipleSheets_Header_StartRowX() throws Exception { String firstResult = "24.0"; String lastResult = "132.0"; testLimitOption( - TEST_ROW_LIMIT_MULTIPLE_SHEET, + TEST_ROW_LIMIT_MULTIPLE_SHEET, true, CNST_3_SHEET_START_ROW_ARRAY, CNST_3_ZERO_INT_ARRAY, @@ -321,8 +317,7 @@ public void testLimitOptionMultipleSheets_Header_StartRowX() throws Exception { // Checks assertEquals("Wrong first result", firstResult, rows.get(0)[0]); - assertEquals( - "Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); + assertEquals("Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); } @Test @@ -330,7 +325,7 @@ public void testLimitOptionMultipleSheets_NoHeader_StartRowX() throws Exception String firstResult = "23.0"; String lastResult = "102.0"; testLimitOption( - TEST_ROW_LIMIT_MULTIPLE_SHEET, + TEST_ROW_LIMIT_MULTIPLE_SHEET, false, CNST_3_SHEET_START_ROW_ARRAY, CNST_3_ZERO_INT_ARRAY, @@ -338,7 +333,6 @@ public void testLimitOptionMultipleSheets_NoHeader_StartRowX() throws Exception // Checks assertEquals("Wrong first result", firstResult, rows.get(0)[0]); - assertEquals( - "Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); + assertEquals("Wrong last result", lastResult, rows.get(TEST_ROW_LIMIT_MULTIPLE_SHEET - 1)[0]); } } diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMetaTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMetaTest.java index 2f8ce04ef04..06d6e1ddd44 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMetaTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputMetaTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.excelinput; +import static org.junit.Assert.assertEquals; + import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class ExcelInputMetaTest { @Test diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/OdfSheetTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/OdfSheetTest.java index aec6c47092f..3161e58f596 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/OdfSheetTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/OdfSheetTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.excelinput; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.spreadsheet.IKCell; import org.apache.hop.core.spreadsheet.IKWorkbook; @@ -24,8 +26,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class OdfSheetTest { private IKWorkbook ods341; diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiSheetTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiSheetTest.java index ce164c8e98d..77315a89901 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiSheetTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelinput/staxpoi/StaxPoiSheetTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.excelinput.staxpoi; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.InputStream; +import java.util.Collections; +import java.util.Date; +import java.util.Map; import org.apache.commons.io.IOUtils; import org.apache.hop.core.spreadsheet.IKCell; import org.apache.hop.core.spreadsheet.IKSheet; @@ -29,21 +43,6 @@ import org.mockito.stubbing.Answer; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf; -import java.io.InputStream; -import java.util.Collections; -import java.util.Date; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class StaxPoiSheetTest { private static final String BP_SHEET = diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMetaTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMetaTest.java index 1ef4c2273f6..3cfb326e622 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMetaTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformMetaTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.excelwriter; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -28,9 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Random; -import java.util.UUID; - public class ExcelWriterTransformMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -47,14 +46,12 @@ public void testRoundTrip() throws Exception { IFieldLoadSaveValidatorFactory validatorFactory = tester.getFieldLoadSaveValidatorFactory(); validatorFactory.registerValidator( - ExcelWriterFileField.class.getName(), - new ExcelWriterFileFieldValidator()); + ExcelWriterFileField.class.getName(), new ExcelWriterFileFieldValidator()); validatorFactory.registerValidator( - ExcelWriterTemplateField.class.getName(), - new ExcelWriterTemplateFieldValidator()); + ExcelWriterTemplateField.class.getName(), new ExcelWriterTemplateFieldValidator()); validatorFactory.registerValidator( - ExcelWriterTransformMeta.class.getDeclaredField("outputFields").getGenericType().toString(), - new ListLoadSaveValidator<>(new ExcelWriterOutputFieldValidator())); + ExcelWriterTransformMeta.class.getDeclaredField("outputFields").getGenericType().toString(), + new ListLoadSaveValidator<>(new ExcelWriterOutputFieldValidator())); tester.testSerialization(); } @@ -104,17 +101,17 @@ public boolean validateTestObject(ExcelWriterFileField testObject, Object actual } } - public static final class ExcelWriterTemplateFieldValidator implements IFieldLoadSaveValidator { + public static final class ExcelWriterTemplateFieldValidator + implements IFieldLoadSaveValidator { @Override public ExcelWriterTemplateField getTestObject() { return new ExcelWriterTemplateField( - new Random().nextBoolean(), - new Random().nextBoolean(), - new Random().nextBoolean(), - UUID.randomUUID().toString(), - UUID.randomUUID().toString() - ); + new Random().nextBoolean(), + new Random().nextBoolean(), + new Random().nextBoolean(), + UUID.randomUUID().toString(), + UUID.randomUUID().toString()); } @Override diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformTest.java index c0d798928cf..6c4e9e4311c 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransformTest.java @@ -222,18 +222,18 @@ public void testWriteUsingTemplateWithFormatting() throws Exception { verify(dataMock.currentWorkbookDefinition.getSheet()).getRow(1); } - @Test public void testWriteUsingTemplateWithFormatting_Streaming() throws Exception { - String path = Files.createTempDir().getAbsolutePath() + File.separator + "formatted_streaming.xlsx"; + String path = + Files.createTempDir().getAbsolutePath() + File.separator + "formatted_streaming.xlsx"; dataMock.fieldnrs = new int[] {0}; dataMock.linkfieldnrs = new int[] {-1}; dataMock.commentfieldnrs = new int[] {-1}; dataMock.createNewFile = true; dataMock.realTemplateFileName = - getClass().getResource("template_with_formatting_streaming.xlsx").getFile(); + getClass().getResource("template_with_formatting_streaming.xlsx").getFile(); dataMock.realSheetname = "Data"; dataMock.inputRowMeta = mock(IRowMeta.class); @@ -267,6 +267,7 @@ public void testWriteUsingTemplateWithFormatting_Streaming() throws Exception { verify(dataMock.currentWorkbookDefinition.getSheet(), times(1)).createRow(1); verify(dataMock.currentWorkbookDefinition.getSheet()).getRow(1); } + @Test public void testValueBigNumber() throws Exception { diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_FormulaRecalculationTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_FormulaRecalculationTest.java index 5e21e20e2a7..cc953cfa51b 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_FormulaRecalculationTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_FormulaRecalculationTest.java @@ -17,14 +17,6 @@ package org.apache.hop.pipeline.transforms.excelwriter; -import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.xssf.streaming.SXSSFWorkbook; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyBoolean; @@ -35,6 +27,14 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; +import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + public class ExcelWriterTransform_FormulaRecalculationTest { private ExcelWriterTransform transform; @@ -59,7 +59,8 @@ public void setUp() throws Exception { doReturn(templateMock).when(meta).getTemplate(); data = new ExcelWriterTransformData(); - ExcelWriterWorkbookDefinition workbookDefinition = new ExcelWriterWorkbookDefinition(null,null,null,null,0,0); + ExcelWriterWorkbookDefinition workbookDefinition = + new ExcelWriterWorkbookDefinition(null, null, null, null, 0, 0); data.currentWorkbookDefinition = workbookDefinition; } @@ -103,7 +104,8 @@ private void forcesToRecalculate_Sxssf(String property, boolean expectedFlag) th if (expectedFlag) { verify(data.currentWorkbookDefinition.getWorkbook()).setForceFormulaRecalculation(true); } else { - verify(data.currentWorkbookDefinition.getWorkbook(), never()).setForceFormulaRecalculation(anyBoolean()); + verify(data.currentWorkbookDefinition.getWorkbook(), never()) + .setForceFormulaRecalculation(anyBoolean()); } } diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_StyleFormatTest.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_StyleFormatTest.java index 4ffd85f9acd..2fa6277a9a5 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_StyleFormatTest.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/ExcelWriterTransform_StyleFormatTest.java @@ -17,6 +17,19 @@ package org.apache.hop.pipeline.transforms.excelwriter; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -40,20 +53,6 @@ import org.junit.Before; import org.junit.Test; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** Tests for applying Format and Style from cell (from a template) when writing fields */ public class ExcelWriterTransform_StyleFormatTest { diff --git a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/TransformMockUtil.java b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/TransformMockUtil.java index c50417f52e0..b063a23e2bc 100644 --- a/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/TransformMockUtil.java +++ b/plugins/transforms/excel/src/test/java/org/apache/hop/pipeline/transforms/excelwriter/TransformMockUtil.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.excelwriter; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -27,11 +31,6 @@ import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.mockito.ArgumentMatchers; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -57,8 +56,12 @@ TransformMockHelper getTransformMockHelper(Class meta, Class data, S public static T getTransform(Class klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor kons = klass.getConstructor( TransformMeta.class, @@ -78,8 +81,12 @@ T getTransform( Class transformMetaClass, Class transformDataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper( diff --git a/plugins/transforms/execinfo/src/test/java/org/apache/hop/pipeline/transforms/execinfo/ExecInfoMetaTest.java b/plugins/transforms/execinfo/src/test/java/org/apache/hop/pipeline/transforms/execinfo/ExecInfoMetaTest.java index 5f97ae2aa2c..974fe24c3ad 100644 --- a/plugins/transforms/execinfo/src/test/java/org/apache/hop/pipeline/transforms/execinfo/ExecInfoMetaTest.java +++ b/plugins/transforms/execinfo/src/test/java/org/apache/hop/pipeline/transforms/execinfo/ExecInfoMetaTest.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.execinfo; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -25,9 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class ExecInfoMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcess.java b/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcess.java index 23d26501b52..84b26324175 100644 --- a/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcess.java +++ b/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcess.java @@ -17,16 +17,6 @@ package org.apache.hop.pipeline.transforms.execprocess; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.RowDataUtil; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.pipeline.Pipeline; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.transform.BaseTransform; -import org.apache.hop.pipeline.transform.TransformMeta; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -37,6 +27,15 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.RowDataUtil; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.pipeline.Pipeline; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.transform.BaseTransform; +import org.apache.hop.pipeline.transform.TransformMeta; /** Execute a process * */ public class ExecProcess extends BaseTransform { diff --git a/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessData.java b/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessData.java index b96f4914811..5d750fce7ff 100644 --- a/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessData.java +++ b/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.execprocess; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class ExecProcessData extends BaseTransformData implements ITransformData { public int indexOfProcess; public List argumentIndexes; diff --git a/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessMeta.java b/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessMeta.java index a59ec4f105e..09962dd0219 100644 --- a/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessMeta.java +++ b/plugins/transforms/execprocess/src/main/java/org/apache/hop/pipeline/transforms/execprocess/ExecProcessMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.execprocess; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "ExecProcess", image = "execprocess.svg", diff --git a/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowDialog.java b/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowDialog.java index 49def641f78..89e2622ec6f 100644 --- a/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowDialog.java +++ b/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowDialog.java @@ -198,7 +198,7 @@ public void widgetSelected(SelectionEvent e) { new FocusListener() { @Override public void focusLost(FocusEvent e) { - //Ignore focusLost + // Ignore focusLost } @Override @@ -395,7 +395,7 @@ private void ok() { if (wConnection.getText() == null) { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage( - BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogMessage")); + BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogMessage")); mb.setText(BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogTitle")); mb.open(); return; diff --git a/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMeta.java b/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMeta.java index 45be854a8c8..8831e89ea6a 100644 --- a/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMeta.java +++ b/plugins/transforms/execsqlrow/src/main/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.execsqlrow; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.Result; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "ExecSqlRow", image = "execsqlrow.svg", diff --git a/plugins/transforms/execsqlrow/src/test/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMetaTest.java b/plugins/transforms/execsqlrow/src/test/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMetaTest.java index 42e3412898a..e7eadbb1801 100644 --- a/plugins/transforms/execsqlrow/src/test/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMetaTest.java +++ b/plugins/transforms/execsqlrow/src/test/java/org/apache/hop/pipeline/transforms/execsqlrow/ExecSqlRowMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.execsqlrow; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -25,11 +29,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ExecSqlRowMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = ExecSqlRowMeta.class; diff --git a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/Fake.java b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/Fake.java index b3906e9159a..ad533490476 100644 --- a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/Fake.java +++ b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/Fake.java @@ -18,6 +18,9 @@ package org.apache.hop.pipeline.transforms.fake; import com.github.javafaker.Faker; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Locale; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; @@ -26,10 +29,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Locale; - public class Fake extends BaseTransform { private static final Class PKG = FakeMeta.class; // For Translator diff --git a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeData.java b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeData.java index 0a4b6fe1df9..4d42cd01290 100644 --- a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeData.java +++ b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeData.java @@ -18,13 +18,12 @@ package org.apache.hop.pipeline.transforms.fake; import com.github.javafaker.Faker; +import java.lang.reflect.Method; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.lang.reflect.Method; -import java.util.List; - public class FakeData extends BaseTransformData implements ITransformData { public Faker faker; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeDialog.java b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeDialog.java index 705d490c7bf..f0fd96441aa 100644 --- a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeDialog.java +++ b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeDialog.java @@ -221,7 +221,8 @@ public void getData() { TableItem item = wFields.table.getItem(row); int col = 1; item.setText(col++, Const.NVL(fakeField.getName(), "")); - item.setText(col++, Const.NVL(FakerType.getTypeUsingName(fakeField.getType()).getDescription(), "")); + item.setText( + col++, Const.NVL(FakerType.getTypeUsingName(fakeField.getType()).getDescription(), "")); item.setText(col, Const.NVL(fakeField.getTopic(), "")); } wFields.removeEmptyRows(); diff --git a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeField.java b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeField.java index 68127b6a22d..e926b373e6c 100644 --- a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeField.java +++ b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeField.java @@ -58,7 +58,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -72,7 +74,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -86,7 +90,9 @@ public String getTopic() { return topic; } - /** @param topic The topic to set */ + /** + * @param topic The topic to set + */ public void setTopic(String topic) { this.topic = topic; } diff --git a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeMeta.java b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeMeta.java index 2a66901162a..d91ae3486b1 100644 --- a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeMeta.java +++ b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakeMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fake; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "Fake", image = "fake.svg", @@ -167,7 +166,9 @@ public String getLocale() { return locale; } - /** @param locale The locale to set */ + /** + * @param locale The locale to set + */ public void setLocale(String locale) { this.locale = locale; } @@ -181,7 +182,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java index 1d1ab0d805b..33513b75cb3 100644 --- a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java +++ b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java @@ -162,7 +162,9 @@ public Class getFakerClass() { return fakerClass; } - /** @param fakerClass The fakerClass to set */ + /** + * @param fakerClass The fakerClass to set + */ public void setFakerClass(Class fakerClass) { this.fakerClass = fakerClass; } @@ -176,7 +178,9 @@ public String getFakerMethod() { return fakerMethod; } - /** @param fakerMethod The fakerMethod to set */ + /** + * @param fakerMethod The fakerMethod to set + */ public void setFakerMethod(String fakerMethod) { this.fakerMethod = fakerMethod; } @@ -190,7 +194,9 @@ public String getDescription() { return description; } - /** @param description The description to set */ + /** + * @param description The description to set + */ public void setDescription(String description) { this.description = description; } diff --git a/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java b/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java index bbf9d8b9b22..8b55d6da52e 100644 --- a/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java +++ b/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java @@ -16,7 +16,7 @@ */ package org.apache.hop.pipeline.transforms.fake; - + import com.github.javafaker.Faker; import org.junit.Assert; import org.junit.Test; @@ -26,7 +26,7 @@ public class FakerTypeTest { @Test public void testFakerTypeMethodMapping() throws Exception { Faker faker = new Faker(); - for(FakerType type : FakerType.values() ) { + for (FakerType type : FakerType.values()) { try { faker.getClass().getMethod(type.getFakerMethod()); } catch (NoSuchMethodException | SecurityException e) { diff --git a/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceDialog.java b/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceDialog.java index d751ab27c1a..2563646f7a7 100644 --- a/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceDialog.java +++ b/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fieldschangesequence; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -51,9 +53,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class FieldsChangeSequenceDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = FieldsChangeSequenceMeta.class; // For Translator diff --git a/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceField.java b/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceField.java index 950f4b5d260..0880baa6150 100644 --- a/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceField.java +++ b/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.fieldschangesequence; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class FieldsChangeSequenceField { @HopMetadataProperty( diff --git a/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMeta.java b/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMeta.java index 899b22f94f2..857815fa6d2 100644 --- a/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMeta.java +++ b/plugins/transforms/fieldschangesequence/src/main/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fieldschangesequence; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** Add sequence depending of fields value change. */ @Transform( id = "FieldsChangeSequence", @@ -45,7 +44,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::FieldsChangeSequenceMeta.keyword", documentationUrl = "/pipeline/transforms/addfieldschangesequence.html") -public class FieldsChangeSequenceMeta extends BaseTransformMeta { +public class FieldsChangeSequenceMeta + extends BaseTransformMeta { private static final Class PKG = FieldsChangeSequenceMeta.class; // For Translator /** by which fields to display? */ @@ -92,12 +92,16 @@ public String getStart() { return start; } - /** @return Returns the resultfieldName. */ + /** + * @return Returns the resultfieldName. + */ public String getResultFieldName() { return resultFieldName; } - /** @param resultfieldName The resultfieldName to set. */ + /** + * @param resultfieldName The resultfieldName to set. + */ public void setResultFieldName(String resultfieldName) { this.resultFieldName = resultfieldName; } @@ -107,12 +111,16 @@ public Object clone() { return new FieldsChangeSequenceMeta(this); } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public List getFields() { return fields; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFields(List fieldName) { this.fields = fieldName; } diff --git a/plugins/transforms/fieldschangesequence/src/test/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMetaTest.java b/plugins/transforms/fieldschangesequence/src/test/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMetaTest.java index dbf5d441476..17d7e198bd3 100644 --- a/plugins/transforms/fieldschangesequence/src/test/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMetaTest.java +++ b/plugins/transforms/fieldschangesequence/src/test/java/org/apache/hop/pipeline/transforms/fieldschangesequence/FieldsChangeSequenceMetaTest.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.fieldschangesequence; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -27,8 +28,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.UUID; - public class FieldsChangeSequenceMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -42,7 +41,9 @@ public void testTransformMeta() throws Exception { LoadSaveTester tester = new LoadSaveTester<>(FieldsChangeSequenceMeta.class); - tester.getFieldLoadSaveValidatorFactory().registerValidator( + tester + .getFieldLoadSaveValidatorFactory() + .registerValidator( FieldsChangeSequenceMeta.class.getDeclaredField("fields").getGenericType().toString(), new ListLoadSaveValidator<>(new FieldChangeSequenceFieldValidator())); diff --git a/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter.java b/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter.java index 746fcc122b7..f70e099fa57 100644 --- a/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter.java +++ b/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fieldsplitter; +import static org.apache.hop.pipeline.transforms.fieldsplitter.FieldSplitterMeta.FSField; + import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -29,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import static org.apache.hop.pipeline.transforms.fieldsplitter.FieldSplitterMeta.FSField; - /** Split a single String fields into multiple parts based on certain conditions. */ public class FieldSplitter extends BaseTransform { private static final Class PKG = FieldSplitterMeta.class; // For Translator diff --git a/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterDialog.java b/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterDialog.java index 3c766489f3b..0ebcc1803b4 100644 --- a/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterDialog.java +++ b/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fieldsplitter; +import static org.apache.hop.pipeline.transforms.fieldsplitter.FieldSplitterMeta.FSField; + import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -48,8 +50,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import static org.apache.hop.pipeline.transforms.fieldsplitter.FieldSplitterMeta.FSField; - public class FieldSplitterDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = FieldSplitterMeta.class; // For Translator diff --git a/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterMeta.java b/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterMeta.java index 18422cb60f7..f4b60569392 100644 --- a/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterMeta.java +++ b/plugins/transforms/fieldsplitter/src/main/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitterMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fieldsplitter; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** * * Example1:

diff --git a/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter_EmptyStringVsNull_Test.java b/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter_EmptyStringVsNull_Test.java index 4be859928bf..d9f9873d399 100644 --- a/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter_EmptyStringVsNull_Test.java +++ b/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/FieldSplitter_EmptyStringVsNull_Test.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.fieldsplitter; +import static org.apache.hop.pipeline.transforms.fieldsplitter.FieldSplitterMeta.FSField; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + import java.util.Arrays; import java.util.List; import org.apache.hop.core.Const; @@ -33,11 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.apache.hop.pipeline.transforms.fieldsplitter.FieldSplitterMeta.FSField; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class FieldSplitter_EmptyStringVsNull_Test { private TransformMockHelper helper; @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/TransformMockUtil.java b/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/TransformMockUtil.java index 375f7332feb..cb75622fcb2 100644 --- a/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/TransformMockUtil.java +++ b/plugins/transforms/fieldsplitter/src/test/java/org/apache/hop/pipeline/transforms/fieldsplitter/TransformMockUtil.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.fieldsplitter; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -26,12 +31,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -57,8 +56,12 @@ TransformMockHelper getTransformMockHelper(Class meta, Str public static T getTransform(Class klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor kons = klass.getConstructor( TransformMeta.class, @@ -74,8 +77,12 @@ T getTransform(Class klass, TransformMockHelper mock) public static T getTransform( Class transformClass, Class transformMetaClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper(transformMetaClass, transformName)); diff --git a/plugins/transforms/fileexists/src/main/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMeta.java b/plugins/transforms/fileexists/src/main/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMeta.java index 96e50f5f5fb..35dab5d3067 100644 --- a/plugins/transforms/fileexists/src/main/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMeta.java +++ b/plugins/transforms/fileexists/src/main/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.fileexists; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -34,8 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "FileExists", image = "fileexists.svg", @@ -78,32 +77,44 @@ public FileExistsMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the filenamefield. */ + /** + * @return Returns the filenamefield. + */ public String getFilenamefield() { return filenamefield; } - /** @param filenamefield The filenamefield to set. */ + /** + * @param filenamefield The filenamefield to set. + */ public void setFilenamefield(String filenamefield) { this.filenamefield = filenamefield; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getResultfieldname() { return resultfieldname; } - /** @param resultfieldname The resultfieldname to set. */ + /** + * @param resultfieldname The resultfieldname to set. + */ public void setResultfieldname(String resultfieldname) { this.resultfieldname = resultfieldname; } - /** @param filetypefieldname The filetypefieldname to set. */ + /** + * @param filetypefieldname The filetypefieldname to set. + */ public void setFiletypefieldname(String filetypefieldname) { this.filetypefieldname = filetypefieldname; } - /** @return Returns the filetypefieldname. */ + /** + * @return Returns the filetypefieldname. + */ public String getFiletypefieldname() { return filetypefieldname; } diff --git a/plugins/transforms/fileexists/src/test/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMetaTest.java b/plugins/transforms/fileexists/src/test/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMetaTest.java index 75375273706..69453d438e5 100644 --- a/plugins/transforms/fileexists/src/test/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMetaTest.java +++ b/plugins/transforms/fileexists/src/test/java/org/apache/hop/pipeline/transforms/fileexists/FileExistsMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.fileexists; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class FileExistsMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/filelocked/src/main/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMeta.java b/plugins/transforms/filelocked/src/main/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMeta.java index efc20f65c5a..fe578d87bbb 100644 --- a/plugins/transforms/filelocked/src/main/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMeta.java +++ b/plugins/transforms/filelocked/src/main/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.filelocked; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** Check if a file is locked * */ @Transform( id = "FileLocked", @@ -68,22 +67,30 @@ public FileLockedMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the filenamefield. */ + /** + * @return Returns the filenamefield. + */ public String getFilenamefield() { return filenamefield; } - /** @param filenamefield The filenamefield to set. */ + /** + * @param filenamefield The filenamefield to set. + */ public void setFilenamefield(String filenamefield) { this.filenamefield = filenamefield; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getResultfieldname() { return resultfieldname; } - /** @param resultfieldname The resultfieldname to set. */ + /** + * @param resultfieldname The resultfieldname to set. + */ public void setResultfieldname(String resultfieldname) { this.resultfieldname = resultfieldname; } diff --git a/plugins/transforms/filelocked/src/test/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMetaTest.java b/plugins/transforms/filelocked/src/test/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMetaTest.java index de8ca2d19f2..00babb98d43 100644 --- a/plugins/transforms/filelocked/src/test/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMetaTest.java +++ b/plugins/transforms/filelocked/src/test/java/org/apache/hop/pipeline/transforms/filelocked/FileLockedMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.filelocked; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class FileLockedMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadata.java b/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadata.java index d2aafdda767..2ea181e9958 100644 --- a/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadata.java +++ b/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadata.java @@ -22,6 +22,14 @@ import com.opencsv.CSVReader; import com.opencsv.CSVReaderBuilder; import com.opencsv.exceptions.CsvValidationException; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopFileException; import org.apache.hop.core.exception.HopTransformException; @@ -39,15 +47,6 @@ import org.apache.hop.pipeline.transforms.filemetadata.util.delimiters.DelimiterDetectorBuilder; import org.apache.hop.pipeline.transforms.filemetadata.util.encoding.EncodingDetector; -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; - public class FileMetadata extends BaseTransform { private static final Class PKG = FileMetadata.class; @@ -140,29 +139,30 @@ public boolean processRow() throws HopException { public String getOutputFileName(Object[] row) throws HopException { String filename = null; if (row == null) { - filename = variables.resolve(meta.getFileName()); - if (filename == null) { - throw new HopFileException( - BaseMessages.getString(PKG, "FileMetadata.Exception.FileNameNotSet")); - } + filename = variables.resolve(meta.getFileName()); + if (filename == null) { + throw new HopFileException( + BaseMessages.getString(PKG, "FileMetadata.Exception.FileNameNotSet")); + } } else { int fileNameFieldIndex = getInputRowMeta().indexOfValue(meta.getFilenameField()); if (fileNameFieldIndex < 0) { throw new HopTransformException( - BaseMessages.getString( - PKG, "FileMetadata.Exception.FileNameFieldNotFound", meta.getFilenameField())); + BaseMessages.getString( + PKG, "FileMetadata.Exception.FileNameFieldNotFound", meta.getFilenameField())); } IValueMeta fileNameMeta = getInputRowMeta().getValueMeta(fileNameFieldIndex); filename = variables.resolve(fileNameMeta.getString(row[fileNameFieldIndex])); if (filename == null) { throw new HopFileException( - BaseMessages.getString(PKG, "FileMetadata.Exception.FileNameNotSet")); + BaseMessages.getString(PKG, "FileMetadata.Exception.FileNameNotSet")); } } return filename; } + private void buildOutputRows() throws HopException { // which index does the next field go to @@ -175,7 +175,8 @@ private void buildOutputRows() throws HopException { : RowDataUtil.allocateRowData(data.outputRowMeta.size()); // get the configuration from the dialog - String fileName = getOutputFileName((data.isReceivingInput && meta.isFilenameInField() ? r : null)); + String fileName = + getOutputFileName((data.isReceivingInput && meta.isFilenameInField() ? r : null)); // if the file does not exist, just send an empty row try { diff --git a/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataDialog.java b/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataDialog.java index 340382ced62..48b101962f3 100644 --- a/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataDialog.java +++ b/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.filemetadata; +import static org.apache.hop.pipeline.transforms.filemetadata.FileMetadataMeta.FMCandidate; + import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; @@ -28,7 +30,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.ITransformDialog; -import static org.apache.hop.pipeline.transforms.filemetadata.FileMetadataMeta.FMCandidate; import org.apache.hop.ui.core.PropsUi; import org.apache.hop.ui.core.dialog.BaseDialog; import org.apache.hop.ui.core.dialog.ErrorDialog; @@ -261,19 +262,19 @@ public void widgetSelected(SelectionEvent arg0) { fdFilenameField.right = new FormAttachment(100, -margin); wFilenameField.setLayoutData(fdFilenameField); wFilenameField.addFocusListener( - new FocusListener() { - @Override - public void focusLost(FocusEvent e) {} - - @Override - public void focusGained(FocusEvent e) { - Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); - shell.setCursor(busy); - getFields(); - shell.setCursor(null); - busy.dispose(); - } - }); + new FocusListener() { + @Override + public void focusLost(FocusEvent e) {} + + @Override + public void focusGained(FocusEvent e) { + Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); + shell.setCursor(busy); + getFields(); + shell.setCursor(null); + busy.dispose(); + } + }); // options panel for DELIMITED_LAYOUT Group gDelimitedLayout = new Group(shell, SWT.SHADOW_ETCHED_IN); diff --git a/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataMeta.java b/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataMeta.java index 5591d90b64d..000e9e59cd7 100644 --- a/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataMeta.java +++ b/plugins/transforms/filemetadata/src/main/java/org/apache/hop/pipeline/transforms/filemetadata/FileMetadataMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.filemetadata; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowMetaBuilder; @@ -26,9 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "FileMetadataPlugin", name = "i18n::FileMetadata.Name.Default", @@ -42,8 +41,7 @@ public class FileMetadataMeta extends BaseTransformMeta resultFilesList; diff --git a/plugins/transforms/filesfromresult/src/main/java/org/apache/hop/pipeline/transforms/filesfromresult/FilesFromResultMeta.java b/plugins/transforms/filesfromresult/src/main/java/org/apache/hop/pipeline/transforms/filesfromresult/FilesFromResultMeta.java index 7cd870ccdf7..3c60b90ad63 100644 --- a/plugins/transforms/filesfromresult/src/main/java/org/apache/hop/pipeline/transforms/filesfromresult/FilesFromResultMeta.java +++ b/plugins/transforms/filesfromresult/src/main/java/org/apache/hop/pipeline/transforms/filesfromresult/FilesFromResultMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.filesfromresult; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ResultFile; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "FilesFromResult", image = "filesfromresult.svg", diff --git a/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultData.java b/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultData.java index 56032c60f81..65ac4cae866 100644 --- a/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultData.java +++ b/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.filestoresult; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.ResultFile; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.List; - public class FilesToResultData extends BaseTransformData implements ITransformData { public List filenames; diff --git a/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultMeta.java b/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultMeta.java index c0a66f36b16..47e9bb05fde 100644 --- a/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultMeta.java +++ b/plugins/transforms/filestoresult/src/main/java/org/apache/hop/pipeline/transforms/filestoresult/FilesToResultMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.filestoresult; +import static org.apache.hop.core.ResultFile.FileType; + +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -29,10 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - -import static org.apache.hop.core.ResultFile.FileType; - @Transform( id = "FilesToResult", image = "filestoresult.svg", diff --git a/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRows.java b/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRows.java index b5eadb83f17..35c20896aae 100644 --- a/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRows.java +++ b/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRows.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.filterrows; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -29,8 +30,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.List; - /** Filters input rows base on conditions. */ public class FilterRows extends BaseTransform { diff --git a/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsDialog.java b/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsDialog.java index 4a42bdd25fb..fc33b0d1100 100644 --- a/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsDialog.java +++ b/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.filterrows; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Condition; import org.apache.hop.core.Const; @@ -47,8 +48,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class FilterRowsDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = FilterRowsMeta.class; // For Translator diff --git a/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMeta.java b/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMeta.java index bb67b26e3c1..52cec7efbe1 100644 --- a/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMeta.java +++ b/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.filterrows; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Optional; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Condition; import org.apache.hop.core.Const; @@ -43,11 +47,6 @@ import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - @Transform( id = "FilterRows", image = "filterrows.svg", @@ -179,13 +178,16 @@ public void check( List orphanFields = getOrphanFields(getCondition(), prev); if (!orphanFields.isEmpty()) { - errorMessage = new StringBuilder(BaseMessages.getString( - PKG, "FilterRowsMeta.CheckResult.FieldsNotFoundFromPreviousTransform") - + Const.CR); + errorMessage = + new StringBuilder( + BaseMessages.getString( + PKG, "FilterRowsMeta.CheckResult.FieldsNotFoundFromPreviousTransform") + + Const.CR); for (String field : orphanFields) { errorMessage.append("\t\t").append(field).append(Const.CR); } - cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage.toString(), transformMeta); + cr = + new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage.toString(), transformMeta); } else { cr = new CheckResult( diff --git a/plugins/transforms/filterrows/src/test/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMetaTest.java b/plugins/transforms/filterrows/src/test/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMetaTest.java index 0f977ca6c1d..3aa1183a3c1 100644 --- a/plugins/transforms/filterrows/src/test/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMetaTest.java +++ b/plugins/transforms/filterrows/src/test/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMetaTest.java @@ -16,7 +16,14 @@ */ package org.apache.hop.pipeline.transforms.filterrows; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import com.google.common.collect.ImmutableList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Condition; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; @@ -30,14 +37,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class FilterRowsMetaTest { @Before @@ -65,7 +64,9 @@ public void setUpLoadSave() throws Exception { @Test public void testSerialization() throws Exception { - FilterRowsMeta meta = TransformSerializationTestUtil.testSerialization("/filter-rows-transform-basic.xml", FilterRowsMeta.class); + FilterRowsMeta meta = + TransformSerializationTestUtil.testSerialization( + "/filter-rows-transform-basic.xml", FilterRowsMeta.class); Assert.assertEquals("True", meta.getTransformIOMeta().getTargetStreams().get(0).getSubject()); Assert.assertEquals("False", meta.getTransformIOMeta().getTargetStreams().get(1).getSubject()); diff --git a/plugins/transforms/flattener/src/main/java/org/apache/hop/pipeline/transforms/flattener/FlattenerMeta.java b/plugins/transforms/flattener/src/main/java/org/apache/hop/pipeline/transforms/flattener/FlattenerMeta.java index 64c1eaed857..0836f858777 100644 --- a/plugins/transforms/flattener/src/main/java/org/apache/hop/pipeline/transforms/flattener/FlattenerMeta.java +++ b/plugins/transforms/flattener/src/main/java/org/apache/hop/pipeline/transforms/flattener/FlattenerMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.flattener; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** The flattener transform meta-data */ @Transform( id = "Flattener,Flatterner", diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/Formula.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/Formula.java index 067942b26d9..76d223c1b8e 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/Formula.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/Formula.java @@ -17,7 +17,10 @@ package org.apache.hop.pipeline.transforms.formula; +import java.io.IOException; import java.sql.Timestamp; +import java.util.Arrays; +import java.util.HashMap; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -36,10 +39,6 @@ import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; - public class Formula extends BaseTransform { private XSSFWorkbook workBook; @@ -100,13 +99,14 @@ public boolean processRow() throws HopException { if (!Utils.isEmpty(fn.getReplaceField())) { data.replaceIndex[j] = data.outputRowMeta.indexOfValue(fn.getReplaceField()); - // keep track of the formula fields and the fields they replace for formula parsing later on. + // keep track of the formula fields and the fields they replace for formula parsing later + // on. replaceMap.put(fn.getFieldName(), fn.getReplaceField()); if (data.replaceIndex[j] < 0) { throw new HopException( - "Unknown field specified to replace with a formula result: [" - + fn.getReplaceField() - + "]"); + "Unknown field specified to replace with a formula result: [" + + fn.getReplaceField() + + "]"); } } else { data.replaceIndex[j] = -1; @@ -116,7 +116,6 @@ public boolean processRow() throws HopException { int tempIndex = getInputRowMeta().size(); - if (log.isRowLevel()) { logRowlevel("Read row #" + getLinesRead() + " : " + Arrays.toString(r)); } @@ -132,7 +131,9 @@ public boolean processRow() throws HopException { for (int i = 0; i < meta.getFormulas().size(); i++) { FormulaMetaFunction formula = meta.getFormulas().get(i); - FormulaParser parser = new FormulaParser(formula, data.outputRowMeta, outputRowData, sheetRow, variables, replaceMap); + FormulaParser parser = + new FormulaParser( + formula, data.outputRowMeta, outputRowData, sheetRow, variables, replaceMap); try { CellValue cellValue = parser.getFormulaValue(); CellType cellType = cellValue.getCellType(); @@ -163,7 +164,8 @@ public boolean processRow() throws HopException { formula.setNeedDataConversion(outputValueType != IValueMeta.TYPE_NUMBER); break; case IValueMeta.TYPE_TIMESTAMP: - outputValue = Timestamp.from(DateUtil.getJavaDate(cellValue.getNumberValue()).toInstant()); + outputValue = + Timestamp.from(DateUtil.getJavaDate(cellValue.getNumberValue()).toInstant()); data.returnType[i] = FormulaData.RETURN_TYPE_TIMESTAMP; formula.setNeedDataConversion(outputValueType != IValueMeta.TYPE_NUMBER); break; @@ -188,9 +190,11 @@ public boolean processRow() throws HopException { int realIndex = (data.replaceIndex[i] < 0) ? tempIndex++ : data.replaceIndex[i]; - outputRowData[realIndex] = getReturnValue(outputValue, data.returnType[i], realIndex, formula); - }catch(Exception e){ - throw new HopException("Formula '" + formula.getFormula() + "' could not not be parsed ", e); + outputRowData[realIndex] = + getReturnValue(outputValue, data.returnType[i], realIndex, formula); + } catch (Exception e) { + throw new HopException( + "Formula '" + formula.getFormula() + "' could not not be parsed ", e); } } diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaDialog.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaDialog.java index db9d98694ec..70914204cb1 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaDialog.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.formula; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -51,9 +53,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class FormulaDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = FormulaDialog.class; // For Translator @@ -290,6 +289,7 @@ protected void setComboBoxes() { FormulaDialog.this.fieldNames = fieldNames; }); } + /** Copy information from the meta-data currentMeta to the dialog fields. */ public void getData() { diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMeta.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMeta.java index b3946ecbed4..8d07db9ad81 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMeta.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.formula; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "Formula", image = "formula.svg", diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMetaFunction.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMetaFunction.java index c411b43b946..e1a15ad87eb 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMetaFunction.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/FormulaMetaFunction.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.formula; +import java.util.Objects; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class FormulaMetaFunction { public static final String XML_TAG = "formula"; diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/editor/FormulaEditor.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/editor/FormulaEditor.java index 825f1b15e52..535737df917 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/editor/FormulaEditor.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/editor/FormulaEditor.java @@ -77,7 +77,8 @@ public class FormulaEditor extends Dialog implements KeyListener { private SashForm rightSash; private IVariables variables; - public FormulaEditor(IVariables variables, Shell parent, int style, String formula, String[] inputFields) + public FormulaEditor( + IVariables variables, Shell parent, int style, String formula, String[] inputFields) throws Exception { super(parent, style); this.variables = variables; @@ -190,7 +191,9 @@ public void widgetSelected(SelectionEvent event) { // An expression editor on the right // - expressionEditor = new StyledTextComp(variables, rightSash, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + expressionEditor = + new StyledTextComp( + variables, rightSash, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); expressionEditor.setText(this.formula); expressionEditor.addModifyListener(event -> setStyles()); expressionEditor.addKeyListener(this); @@ -284,7 +287,7 @@ public static void main(String[] args) throws Exception { }; FormulaEditor lbe = new FormulaEditor( - null, + null, new Shell(display, SWT.NONE), SWT.NONE, "MID(UPPER([name] & \" \" & [firstname]);5;10)", diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionDescription.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionDescription.java index f477f3394d2..5887cbd863b 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionDescription.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionDescription.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.formula.function; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - public class FunctionDescription { public static final String XML_TAG = "function"; diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionLib.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionLib.java index 65e949a9229..7aea15609f2 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionLib.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/function/FunctionLib.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.formula.function; -import org.apache.hop.core.exception.HopXmlException; -import org.apache.hop.core.xml.XmlHandler; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.apache.hop.core.exception.HopXmlException; +import org.apache.hop.core.xml.XmlHandler; +import org.w3c.dom.Document; +import org.w3c.dom.Node; public class FunctionLib { diff --git a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/util/FormulaParser.java b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/util/FormulaParser.java index b660c9c659c..cd3ba88808a 100644 --- a/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/util/FormulaParser.java +++ b/plugins/transforms/formula/src/main/java/org/apache/hop/pipeline/transforms/formula/util/FormulaParser.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.formula.util; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; @@ -28,13 +34,6 @@ import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.Row; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class FormulaParser { private FormulaMetaFunction formulaMetaFunction; @@ -48,7 +47,12 @@ public class FormulaParser { private HashMap replaceMap; public FormulaParser( - FormulaMetaFunction formulaMetaFunction, IRowMeta rowMeta, Object[] dataRow, Row sheetRow, IVariables variables, HashMap replaceMap) { + FormulaMetaFunction formulaMetaFunction, + IRowMeta rowMeta, + Object[] dataRow, + Row sheetRow, + IVariables variables, + HashMap replaceMap) { this.formulaMetaFunction = formulaMetaFunction; this.rowMeta = rowMeta; this.dataRow = dataRow; @@ -61,22 +65,22 @@ public FormulaParser( formulaFieldList = getFormulaFieldList(formula); boolean getNewList = false; - for(String formulaField : formulaFieldList){ + for (String formulaField : formulaFieldList) { // check if we are working with a field that was replaced earlier. Set replaceKeys = replaceMap.keySet(); - if(replaceKeys.contains(formulaField)){ + if (replaceKeys.contains(formulaField)) { String realFieldName = replaceMap.get(formulaField); formula = formula.replaceAll("\\[" + formulaField + "\\]", "\\[" + realFieldName + "\\]"); getNewList = true; } } - if(getNewList){ + if (getNewList) { formulaFieldList = getFormulaFieldList(formula); } } - private List getFormulaFieldList(String formula){ + private List getFormulaFieldList(String formula) { List theFields = new ArrayList<>(); Pattern regex = Pattern.compile("\\[(.*?)\\]"); Matcher regexMatcher = regex.matcher(formula); @@ -116,7 +120,7 @@ public CellValue getFormulaValue() throws HopValueException { } else { cell.setCellValue(rowMeta.getString(dataRow, fieldPosition)); } - }else{ + } else { cell.setBlank(); } diff --git a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatch.java b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatch.java index 7a9bb5fffbc..89bb154010e 100644 --- a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatch.java +++ b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatch.java @@ -17,9 +17,13 @@ package org.apache.hop.pipeline.transforms.fuzzymatch; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.FMLookupValue; + import com.wcohen.ss.Jaro; import com.wcohen.ss.JaroWinkler; import com.wcohen.ss.NeedlemanWunsch; +import java.util.Iterator; import org.apache.commons.codec.language.DoubleMetaphone; import org.apache.commons.codec.language.Metaphone; import org.apache.commons.codec.language.RefinedSoundex; @@ -41,11 +45,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Iterator; - -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm; -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.FMLookupValue; - /** * Performs a fuzzy match for each main stream field row An approximative match is done in a lookup * stream diff --git a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchData.java b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchData.java index d4e47a2bdb1..43f36cf3819 100644 --- a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchData.java +++ b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.fuzzymatch; +import java.util.HashSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.HashSet; - public class FuzzyMatchData extends BaseTransformData implements ITransformData { public IRowMeta previousRowMeta; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchMeta.java b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchMeta.java index a62e12ec42b..91d97c9bc43 100644 --- a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchMeta.java +++ b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchMeta.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.fuzzymatch; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.DOUBLE_METAPHONE; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.METAPHONE; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.NONE; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.REFINED_SOUNDEX; +import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.SOUNDEX; + import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils; @@ -46,12 +52,6 @@ import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.DOUBLE_METAPHONE; -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.METAPHONE; -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.NONE; -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.REFINED_SOUNDEX; -import static org.apache.hop.pipeline.transforms.fuzzymatch.FuzzyMatchMeta.Algorithm.SOUNDEX; - @Transform( id = "FuzzyMatch", image = "fuzzymatch.svg", @@ -64,6 +64,7 @@ public class FuzzyMatchMeta extends BaseTransformMeta PKG = FuzzyMatchMeta.class; // For Translator public static final String DEFAULT_SEPARATOR = ","; + /** Algorithms type */ @HopMetadataProperty(key = "algorithm", storeWithCode = true) private Algorithm algorithm; diff --git a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/LetterPairSimilarity.java b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/LetterPairSimilarity.java index 6b56092f7af..9d69073e267 100644 --- a/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/LetterPairSimilarity.java +++ b/plugins/transforms/fuzzymatch/src/main/java/org/apache/hop/pipeline/transforms/fuzzymatch/LetterPairSimilarity.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.fuzzymatch; -import org.apache.hop.core.util.Utils; - import java.util.ArrayList; +import org.apache.hop.core.util.Utils; public class LetterPairSimilarity { @@ -39,7 +38,9 @@ public class LetterPairSimilarity { * Best Regards, Simon */ - /** @return an array of adjacent letter pairs contained in the input string */ + /** + * @return an array of adjacent letter pairs contained in the input string + */ private static String[] letterPairs(String str) { int numPairs = str.length() - 1; if (str.length() == 0) { @@ -52,7 +53,9 @@ private static String[] letterPairs(String str) { return pairs; } - /** @return an ArrayList of 2-character Strings. */ + /** + * @return an ArrayList of 2-character Strings. + */ private static ArrayList wordLetterPairs(String str) { ArrayList allPairs = new ArrayList<>(); // Tokenize the string and put the tokens/words into an array @@ -68,7 +71,9 @@ private static ArrayList wordLetterPairs(String str) { return allPairs; } - /** @return lexical similarity value in the range [0,1] */ + /** + * @return lexical similarity value in the range [0,1] + */ public static double getSimiliarity(String str1, String str2) { if (Utils.isEmpty(str1) && Utils.isEmpty(str2)) { return Double.valueOf(1); diff --git a/plugins/transforms/fuzzymatch/src/test/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchTest.java b/plugins/transforms/fuzzymatch/src/test/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchTest.java index eae5f3c979e..86a7cef377d 100644 --- a/plugins/transforms/fuzzymatch/src/test/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchTest.java +++ b/plugins/transforms/fuzzymatch/src/test/java/org/apache/hop/pipeline/transforms/fuzzymatch/FuzzyMatchTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.fuzzymatch; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -40,11 +45,6 @@ import org.junit.Test; import org.mockito.InjectMocks; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class FuzzyMatchTest { @InjectMocks private FuzzyMatchHandler fuzzyMatch; private TransformMockHelper mockHelper; diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FilterItem.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FilterItem.java index 0bacb7f8e07..1685b9890db 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FilterItem.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FilterItem.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.getfilenames; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class FilterItem { diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNames.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNames.java index 86de1423dd2..62078e31ef5 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNames.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNames.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.getfilenames; +import java.io.IOException; +import java.util.Date; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.Const; @@ -34,10 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.IOException; -import java.util.Date; -import java.util.List; - /** * Read all sorts of text files, convert them to rows and writes these to one or more output * streams. @@ -267,7 +266,7 @@ public boolean processRow() throws HopException { // See if we need to add the row number to the row... if (meta.isIncludeRowNumber() && !Utils.isEmpty(meta.getRowNumberField())) { - extraData[outputIndex++] = Long.valueOf(data.rownr+1); + extraData[outputIndex++] = Long.valueOf(data.rownr + 1); } data.rownr++; diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesData.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesData.java index a60dc3b47ff..ac60ebcb593 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesData.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesData.java @@ -17,14 +17,6 @@ package org.apache.hop.pipeline.transforms.getfilenames; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.fileinput.FileInputList; -import org.apache.hop.core.playlist.IFilePlayList; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; -import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; - import java.io.FileInputStream; import java.io.InputStreamReader; import java.text.DateFormatSymbols; @@ -35,6 +27,13 @@ import java.util.ArrayList; import java.util.List; import java.util.zip.ZipInputStream; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.fileinput.FileInputList; +import org.apache.hop.core.playlist.IFilePlayList; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; +import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; public class GetFileNamesData extends BaseTransformData implements ITransformData { public List lineBuffer; diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesDialog.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesDialog.java index 72db2954ff5..69105a73177 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesDialog.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesDialog.java @@ -985,7 +985,12 @@ public void getData(GetFileNamesMeta meta) { for (int i = 0; i < meta.getFilesList().size(); i++) { FileItem fi = meta.getFilesList().get(i); - wFilenameList.add(fi.getFileName(), fi.getFileMask(), fi.getExcludeFileMask(), fi.getFileRequired(), fi.getIncludeSubFolders()); + wFilenameList.add( + fi.getFileName(), + fi.getFileMask(), + fi.getExcludeFileMask(), + fi.getFileRequired(), + fi.getIncludeSubFolders()); } } diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java index f70840161d7..6eb1dd815c8 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java @@ -74,8 +74,8 @@ public class GetFileNamesMeta extends BaseTransformMeta { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCount.java b/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCount.java index bddb5a6704e..01781887594 100644 --- a/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCount.java +++ b/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCount.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.getfilesrowcount; +import static org.apache.hop.pipeline.transforms.getfilesrowcount.GetFilesRowsCountMeta.SeparatorFormat.CRLF; + +import java.io.InputStream; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.ResultFile; @@ -32,10 +35,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.getfilesrowcount.GetFilesRowsCountMeta.SeparatorFormat; -import java.io.InputStream; - -import static org.apache.hop.pipeline.transforms.getfilesrowcount.GetFilesRowsCountMeta.SeparatorFormat.CRLF; - /** Read all files, count rows number */ public class GetFilesRowsCount extends BaseTransform { diff --git a/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountData.java b/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountData.java index 3bd41e62c7f..cc72a8a67f8 100644 --- a/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountData.java +++ b/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountData.java @@ -23,8 +23,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.io.InputStream; - public class GetFilesRowsCountData extends BaseTransformData implements ITransformData { public String thisLine; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountMeta.java b/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountMeta.java index 4c42197996e..c78a3147a42 100644 --- a/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountMeta.java +++ b/plugins/transforms/getfilesrowcount/src/main/java/org/apache/hop/pipeline/transforms/getfilesrowcount/GetFilesRowsCountMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.getfilesrowcount; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; @@ -39,10 +42,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "GetFilesRowsCount", image = "getfilesrowcount.svg", diff --git a/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFolders.java b/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFolders.java index 4352d1f7232..250291c2527 100644 --- a/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFolders.java +++ b/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFolders.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.getsubfolders; +import java.util.Date; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Date; -import java.util.List; - /** * Read all subfolder inside a specified folder and convert them to rows and writes these to one or * more output streams. diff --git a/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFoldersMeta.java b/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFoldersMeta.java index f68e6f1175a..6d52f31e32e 100644 --- a/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFoldersMeta.java +++ b/plugins/transforms/getsubfolders/src/main/java/org/apache/hop/pipeline/transforms/getsubfolders/GetSubFoldersMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.getsubfolders; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -41,10 +44,6 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "GetSubFolders", image = "getsubfolders.svg", diff --git a/plugins/transforms/gettablenames/src/main/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesMeta.java b/plugins/transforms/gettablenames/src/main/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesMeta.java index 17e7fd2b2a6..90e935bf433 100644 --- a/plugins/transforms/gettablenames/src/main/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesMeta.java +++ b/plugins/transforms/gettablenames/src/main/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.gettablenames; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @InjectionSupported( localizationPrefix = "GetTableNames.Injection.", groups = {"FIELDS", "SETTINGS", "OUTPUT"}) diff --git a/plugins/transforms/gettablenames/src/test/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesTest.java b/plugins/transforms/gettablenames/src/test/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesTest.java index 331eefc720a..db976dae395 100644 --- a/plugins/transforms/gettablenames/src/test/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesTest.java +++ b/plugins/transforms/gettablenames/src/test/java/org/apache/hop/pipeline/transforms/gettablenames/GetTableNamesTest.java @@ -16,15 +16,6 @@ */ package org.apache.hop.pipeline.transforms.gettablenames; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILoggingObject; -import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; - import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.anyString; @@ -34,6 +25,15 @@ import static org.mockito.Mockito.when; import static org.powermock.reflect.Whitebox.setInternalState; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILoggingObject; +import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + public class GetTableNamesTest { private TransformMockHelper mockHelper; private GetTableNames getTableNamesSpy; diff --git a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/Aggregation.java b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/Aggregation.java index 1d6bec2ca8f..89d7419a296 100644 --- a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/Aggregation.java +++ b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/Aggregation.java @@ -18,11 +18,10 @@ package org.apache.hop.pipeline.transforms.groupby; +import java.util.Objects; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class Aggregation implements Cloneable { private static final Class PKG = Aggregation.class; // For Translator diff --git a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupBy.java b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupBy.java index 06a16d353b0..8ee3a6ea825 100644 --- a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupBy.java +++ b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupBy.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.groupby; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.StringJoiner; +import java.util.TreeSet; import org.apache.commons.math3.stat.descriptive.rank.Percentile; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -42,21 +56,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.SocketTimeoutException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.SortedSet; -import java.util.StringJoiner; -import java.util.TreeSet; - /** Groups data based on aggregation rules. (sum, count, ...) */ public class GroupBy extends BaseTransform { @@ -89,9 +88,9 @@ public boolean processRow() throws HopException { return false; } - allNullsAreZero = getVariableBoolean(Const.HOP_AGGREGATION_ALL_NULLS_ARE_ZERO, false); + allNullsAreZero = getVariableBoolean(Const.HOP_AGGREGATION_ALL_NULLS_ARE_ZERO, false); minNullIsValued = getVariableBoolean(Const.HOP_AGGREGATION_MIN_NULL_IS_VALUED, false); - + // What is the output looking like? // data.inputRowMeta = getInputRowMeta(); @@ -160,11 +159,14 @@ public boolean processRow() throws HopException { data.groupnrs = new int[meta.getGroupingFields().size()]; for (int i = 0; i < meta.getGroupingFields().size(); i++) { - data.groupnrs[i] = data.inputRowMeta.indexOfValue(meta.getGroupingFields().get(i).getName()); + data.groupnrs[i] = + data.inputRowMeta.indexOfValue(meta.getGroupingFields().get(i).getName()); if ((r != null) && (data.groupnrs[i] < 0)) { logError( BaseMessages.getString( - PKG, "GroupBy.Log.GroupFieldCouldNotFound", meta.getGroupingFields().get(i).getName())); + PKG, + "GroupBy.Log.GroupFieldCouldNotFound", + meta.getGroupingFields().get(i).getName())); setErrors(1); stopAll(); return false; @@ -569,7 +571,7 @@ void calcAggregate(Object[] row) throws HopValueException { if (subj != null) { SortedSet set = (SortedSet) value; set.add(subj); - } + } default: break; } @@ -651,7 +653,7 @@ void newAggregate(Object[] r) throws HopException { case Aggregation.TYPE_GROUP_CONCAT_DISTINCT: vMeta = new ValueMetaString(fieldName); v = new TreeSet<>(); - break; + break; default: // TODO raise an error here because we cannot continue successfully maybe the UI should // validate this @@ -789,7 +791,7 @@ Object[] getAggregateResult() throws HopValueException { } case Aggregation.TYPE_GROUP_CONCAT_COMMA: case Aggregation.TYPE_GROUP_CONCAT_STRING: - case Aggregation.TYPE_GROUP_CONCAT_STRING_CRLF: + case Aggregation.TYPE_GROUP_CONCAT_STRING_CRLF: ag = ((StringBuilder) ag).toString(); break; case Aggregation.TYPE_GROUP_CONCAT_DISTINCT: @@ -798,12 +800,12 @@ Object[] getAggregateResult() throws HopValueException { if (!Utils.isEmpty(aggregation.getValue())) { separator = resolve(aggregation.getValue()); } - StringJoiner joiner = new StringJoiner(separator); - for (Object value: (SortedSet) ag) { - joiner.add(subjMeta.getString(value)); + StringJoiner joiner = new StringJoiner(separator); + for (Object value : (SortedSet) ag) { + joiner.add(subjMeta.getString(value)); } ag = joiner.toString(); - break; + break; default: break; } diff --git a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByData.java b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByData.java index 0ca88ad853d..391b1844a9d 100644 --- a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByData.java +++ b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByData.java @@ -17,11 +17,6 @@ package org.apache.hop.pipeline.transforms.groupby; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; @@ -30,6 +25,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class GroupByData extends BaseTransformData implements ITransformData { public Object[] previous; @@ -41,6 +40,7 @@ public class GroupByData extends BaseTransformData implements ITransformData { public IRowMeta groupMeta; public IRowMeta groupAggMeta; // for speed: groupMeta+aggMeta public int[] groupnrs; + /** * array, length is equal to aggMeta value meta list size and metadata subject fields length. * Values corresponds to input values used to calculate target results. diff --git a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByDialog.java b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByDialog.java index 9b4800740f8..750cdc9b2a7 100644 --- a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByDialog.java +++ b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.groupby; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.IntStream; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -49,10 +52,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.IntStream; - public class GroupByDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = GroupByMeta.class; // For Translator @@ -193,7 +192,8 @@ public void widgetSelected(SelectionEvent e) { fdSortDir.top = new FormAttachment(wAllRows, margin); fdSortDir.right = new FormAttachment(wbSortDir, -margin); wSortDir.setLayoutData(fdSortDir); - wbSortDir.addListener(SWT.Selection, e-> BaseDialog.presentDirectoryDialog(shell, wSortDir, variables)); + wbSortDir.addListener( + SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wSortDir, variables)); // Whenever something changes, set the tooltip to the expanded version: wSortDir.addModifyListener(e -> wSortDir.setToolTipText(variables.resolve(wSortDir.getText()))); @@ -282,12 +282,12 @@ public void widgetSelected(SelectionEvent e) { fdAlwaysAddResult.right = new FormAttachment(100, 0); wAlwaysAddResult.setLayoutData(fdAlwaysAddResult); wAlwaysAddResult.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - input.setChanged(); - } - }); + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + input.setChanged(); + } + }); Label wlGroup = new Label(shell, SWT.NONE); wlGroup.setText(BaseMessages.getString(PKG, "GroupByDialog.Group.Label")); diff --git a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByMeta.java b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByMeta.java index 28940f73601..f9ed326894a 100644 --- a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByMeta.java +++ b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupByMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.groupby; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "GroupBy", image = "groupby.svg", @@ -53,45 +52,69 @@ public class GroupByMeta extends BaseTransformMeta { private static final Class PKG = GroupByMeta.class; // For Translator /** All rows need to pass, adding an extra row at the end of each group/block. */ - @HopMetadataProperty(key="all_rows", injectionKey = "PASS_ALL_ROWS", injectionKeyDescription = "GroupByMeta.Injection.PASS_ALL_ROWS") + @HopMetadataProperty( + key = "all_rows", + injectionKey = "PASS_ALL_ROWS", + injectionKeyDescription = "GroupByMeta.Injection.PASS_ALL_ROWS") private boolean passAllRows; /** Directory to store the temp files */ - @HopMetadataProperty(injectionKey = "TEMP_DIRECTORY", injectionKeyDescription = "GroupByMeta.Injection.TEMP_DIRECTORY") + @HopMetadataProperty( + injectionKey = "TEMP_DIRECTORY", + injectionKeyDescription = "GroupByMeta.Injection.TEMP_DIRECTORY") private String directory; /** Temp files prefix... */ - @HopMetadataProperty(injectionKey = "TEMP_FILE_PREFIX", injectionKeyDescription = "GroupByMeta.Injection.TEMP_FILE_PREFIX") + @HopMetadataProperty( + injectionKey = "TEMP_FILE_PREFIX", + injectionKeyDescription = "GroupByMeta.Injection.TEMP_FILE_PREFIX") private String prefix; /** Indicate that some rows don't need to be considered : TODO: make work in GUI & worker */ - @HopMetadataProperty(key="ignore_aggregate") + @HopMetadataProperty(key = "ignore_aggregate") private boolean aggregateIgnored; /** * name of the boolean field that indicates we need to ignore the row : TODO: make work in GUI & * worker */ - @HopMetadataProperty(key="field_ignore") + @HopMetadataProperty(key = "field_ignore") private String aggregateIgnoredField; /** Fields to group over */ - @HopMetadataProperty(groupKey = "group", key = "field", injectionGroupKey = "GROUPS", injectionGroupDescription = "GroupByMeta.Injection.GROUPS") + @HopMetadataProperty( + groupKey = "group", + key = "field", + injectionGroupKey = "GROUPS", + injectionGroupDescription = "GroupByMeta.Injection.GROUPS") private List groupingFields; - @HopMetadataProperty(groupKey = "fields", key = "field", injectionGroupKey = "AGGREGATIONS", injectionGroupDescription = "GroupByMeta.Injection.AGGREGATIONS") + @HopMetadataProperty( + groupKey = "fields", + key = "field", + injectionGroupKey = "AGGREGATIONS", + injectionGroupDescription = "GroupByMeta.Injection.AGGREGATIONS") private List aggregations; /** Add a linenr in the group, resetting to 0 in a new group. */ - @HopMetadataProperty(key="add_linenr", injectionKey = "ADD_GROUP_LINENR", injectionKeyDescription = "GroupByMeta.Injection.ADD_GROUP_LINENR") + @HopMetadataProperty( + key = "add_linenr", + injectionKey = "ADD_GROUP_LINENR", + injectionKeyDescription = "GroupByMeta.Injection.ADD_GROUP_LINENR") private boolean addingLineNrInGroup; /** The fieldname that will contain the added integer field */ - @HopMetadataProperty(key="linenr_fieldname", injectionKey = "ADD_GROUP_LINENR_FIELD", injectionKeyDescription = "GroupByMeta.Injection.ADD_GROUP_LINENR_FIELD") + @HopMetadataProperty( + key = "linenr_fieldname", + injectionKey = "ADD_GROUP_LINENR_FIELD", + injectionKeyDescription = "GroupByMeta.Injection.ADD_GROUP_LINENR_FIELD") private String lineNrInGroupField; /** Flag to indicate that we always give back one row. Defaults to true for existing pipelines. */ - @HopMetadataProperty(key="give_back_row", injectionKey = "ALWAYS_GIVE_ROW", injectionKeyDescription = "GroupByMeta.Injection.ALWAYS_GIVE_ROW") + @HopMetadataProperty( + key = "give_back_row", + injectionKey = "ALWAYS_GIVE_ROW", + injectionKeyDescription = "GroupByMeta.Injection.ALWAYS_GIVE_ROW") private boolean alwaysGivingBackOneRow; public GroupByMeta() { @@ -321,7 +344,6 @@ public void getFields( rowMeta.addRowMeta(fields); } - @Override public void check( List remarks, @@ -442,9 +464,9 @@ public List getAggregations() { public void setAggregations(List aggregations) { this.aggregations = aggregations; } - + @Override public boolean supportsMultiCopyExecution() { return false; - } + } } diff --git a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupingField.java b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupingField.java index 7a137fa8ada..e94460737dc 100644 --- a/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupingField.java +++ b/plugins/transforms/groupby/src/main/java/org/apache/hop/pipeline/transforms/groupby/GroupingField.java @@ -17,45 +17,45 @@ package org.apache.hop.pipeline.transforms.groupby; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class GroupingField implements Cloneable { - @HopMetadataProperty(injectionKey = "GROUP_FIELD", injectionKeyDescription = "GroupByMeta.Injection.GROUP_FIELD") - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public GroupingField() { - } - - public GroupingField(String name) { - this.name = name; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - GroupingField that = (GroupingField) o; - return Objects.equals(name, that.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public GroupingField clone() { - return new GroupingField(name); - } + @HopMetadataProperty( + injectionKey = "GROUP_FIELD", + injectionKeyDescription = "GroupByMeta.Injection.GROUP_FIELD") + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public GroupingField() {} + + public GroupingField(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GroupingField that = (GroupingField) o; + return Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public GroupingField clone() { + return new GroupingField(name); + } } diff --git a/plugins/transforms/groupby/src/test/java/org/apache/hop/pipeline/transforms/GroupByMetaTest.java b/plugins/transforms/groupby/src/test/java/org/apache/hop/pipeline/transforms/GroupByMetaTest.java index bb12318f5fb..d611da10aa1 100644 --- a/plugins/transforms/groupby/src/test/java/org/apache/hop/pipeline/transforms/GroupByMetaTest.java +++ b/plugins/transforms/groupby/src/test/java/org/apache/hop/pipeline/transforms/GroupByMetaTest.java @@ -18,6 +18,7 @@ package org.apache.hop.pipeline.transforms; +import java.util.List; import org.apache.hop.core.xml.XmlHandler; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; @@ -27,8 +28,6 @@ import org.junit.Assert; import org.junit.Test; -import java.util.List; - public class GroupByMetaTest { @Test diff --git a/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/Http.java b/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/Http.java index 4770004ecc6..513bba99613 100644 --- a/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/Http.java +++ b/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/Http.java @@ -17,12 +17,12 @@ package org.apache.hop.pipeline.transforms.http; +import com.google.common.annotations.VisibleForTesting; import java.net.HttpURLConnection; import java.net.URI; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; - import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -55,8 +55,6 @@ import org.apache.http.util.EntityUtils; import org.json.simple.JSONObject; -import com.google.common.annotations.VisibleForTesting; - /** Retrieves data from an Http endpoint */ public class Http extends BaseTransform { diff --git a/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpDialog.java b/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpDialog.java index 0a85e156ea3..0b5f3a35d66 100644 --- a/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpDialog.java +++ b/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.http; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -60,10 +63,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class HttpDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = HttpMeta.class; // For Translator @@ -105,7 +104,7 @@ public class HttpDialog extends BaseTransformDialog implements ITransformDialog private ColumnInfo[] colinfHeaders; private final List inputFields = new ArrayList<>(); - + private boolean gotEncodings = false; private TextVar wConnectionTimeOut; @@ -117,7 +116,7 @@ public class HttpDialog extends BaseTransformDialog implements ITransformDialog public HttpDialog( Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); - input = (HttpMeta) in; + input = (HttpMeta) in; } @Override @@ -167,9 +166,9 @@ public String open() { // START Settings GROUP Group gSettings = setupSettingGroup(wGeneralComp); - lastControl = setupUrlLine(lsMod, lastControl, gSettings); - lastControl = setupUrlInFieldLine( lastControl, gSettings); - lastControl = setupIgnoreSslLine (lastControl, gSettings); + lastControl = setupUrlLine(lsMod, lastControl, gSettings); + lastControl = setupUrlInFieldLine(lastControl, gSettings); + lastControl = setupIgnoreSslLine(lastControl, gSettings); lastControl = setupUrlFieldNameLine(lsMod, lastControl, gSettings); lastControl = setupEncodingLine(lsMod, lastControl, gSettings); setupConnectionTimeoutLine(lsMod, gSettings); @@ -261,7 +260,7 @@ public String open() { wAdditionalComp.setLayout(addLayout); PropsUi.setLook(wAdditionalComp); - setupParamBlock(lsMod,lastControl, wAdditionalComp); + setupParamBlock(lsMod, lastControl, wAdditionalComp); setupHeadBlock(lsMod, wAdditionalComp); // @@ -374,7 +373,8 @@ private void setupHeadBlock(ModifyListener lsMod, Composite wAdditionalComp) { wHeaders.setLayoutData(fdHeaders); } - private void setupParamBlock(ModifyListener lsMod, Control lastControl, Composite wAdditionalComp) { + private void setupParamBlock( + ModifyListener lsMod, Control lastControl, Composite wAdditionalComp) { int margin = props.getMargin(); Label wlFields = new Label(wAdditionalComp, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "HTTPDialog.Parameters.Label")); @@ -612,7 +612,7 @@ private void setupStatusCodeLine(ModifyListener lsMod, Group gOutputFields) { wResultCode.setLayoutData(fdResultCode); } - private void setupResultLine(ModifyListener lsMod, Control lastControl, Group gOutputFields) { + private void setupResultLine(ModifyListener lsMod, Control lastControl, Group gOutputFields) { // Result line... // int margin = props.getMargin(); @@ -755,7 +755,8 @@ public void focusGained(FocusEvent e) { return lastControl; } - private Control setupUrlFieldNameLine(ModifyListener lsMod, Control lastControl, Group gSettings) { + private Control setupUrlFieldNameLine( + ModifyListener lsMod, Control lastControl, Group gSettings) { // UrlField Line // int margin = props.getMargin(); @@ -861,7 +862,8 @@ public void widgetSelected(SelectionEvent e) { return lastControl; } - private Control setupUrlLine(ModifyListener lsMod, Control transformNameControl, Group gSettings) { + private Control setupUrlLine( + ModifyListener lsMod, Control transformNameControl, Group gSettings) { // The URL to use // int margin = props.getMargin(); diff --git a/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpMeta.java b/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpMeta.java index aebd6077266..cf09541ed4e 100644 --- a/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpMeta.java +++ b/plugins/transforms/http/src/main/java/org/apache/hop/pipeline/transforms/http/HttpMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.http; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,8 +39,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "Http", image = "http.svg", @@ -104,114 +103,158 @@ public HttpMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the connectionTimeout. */ + /** + * @return Returns the connectionTimeout. + */ public String getConnectionTimeout() { return connectionTimeout; } - /** @param connectionTimeout The connectionTimeout to set. */ + /** + * @param connectionTimeout The connectionTimeout to set. + */ public void setConnectionTimeout(String connectionTimeout) { this.connectionTimeout = connectionTimeout; } - /** @return Returns the closeIdleConnectionsTime. */ + /** + * @return Returns the closeIdleConnectionsTime. + */ public String getCloseIdleConnectionsTime() { return closeIdleConnectionsTime; } - /** @param closeIdleConnectionsTime The connectionTimeout to set. */ + /** + * @param closeIdleConnectionsTime The connectionTimeout to set. + */ public void setCloseIdleConnectionsTime(String closeIdleConnectionsTime) { this.closeIdleConnectionsTime = closeIdleConnectionsTime; } - /** @return Returns the socketTimeout. */ + /** + * @return Returns the socketTimeout. + */ public String getSocketTimeout() { return socketTimeout; } - /** @param socketTimeout The socketTimeout to set. */ + /** + * @param socketTimeout The socketTimeout to set. + */ public void setSocketTimeout(String socketTimeout) { this.socketTimeout = socketTimeout; } - /** @return Returns the argument. */ + /** + * @return Returns the argument. + */ public String[] getArgumentField() { return argumentField; } - /** @param argument The argument to set. */ + /** + * @param argument The argument to set. + */ public void setArgumentField(String[] argument) { this.argumentField = argument; } - /** @return Returns the headerFields. */ + /** + * @return Returns the headerFields. + */ public String[] getHeaderField() { return headerField; } - /** @param headerField The headerField to set. */ + /** + * @param headerField The headerField to set. + */ public void setHeaderField(String[] headerField) { this.headerField = headerField; } - /** @return Returns the argumentDirection. */ + /** + * @return Returns the argumentDirection. + */ public String[] getArgumentParameter() { return argumentParameter; } - /** @param argumentDirection The argumentDirection to set. */ + /** + * @param argumentDirection The argumentDirection to set. + */ public void setArgumentParameter(String[] argumentDirection) { this.argumentParameter = argumentDirection; } - /** @return Returns the headerParameter. */ + /** + * @return Returns the headerParameter. + */ public String[] getHeaderParameter() { return headerParameter; } - /** @param headerParameter The headerParameter to set. */ + /** + * @param headerParameter The headerParameter to set. + */ public void setHeaderParameter(String[] headerParameter) { this.headerParameter = headerParameter; } - /** @return Returns the procedure. */ + /** + * @return Returns the procedure. + */ public String getUrl() { return url; } - /** @param procedure The procedure to set. */ + /** + * @param procedure The procedure to set. + */ public void setUrl(String procedure) { this.url = procedure; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getFieldName() { return fieldName; } - /** @param resultName The resultName to set. */ + /** + * @param resultName The resultName to set. + */ public void setFieldName(String resultName) { this.fieldName = resultName; } - /** @return Is the url coded in a field? */ + /** + * @return Is the url coded in a field? + */ public boolean isUrlInField() { return urlInField; } - /** @param urlInField Is the url coded in a field? */ + /** + * @param urlInField Is the url coded in a field? + */ public void setUrlInField(boolean urlInField) { this.urlInField = urlInField; } - /** @return The field name that contains the url. */ + /** + * @return The field name that contains the url. + */ public String getUrlField() { return urlField; } - /** @param urlField name of the field that contains the url */ + /** + * @param urlField name of the field that contains the url + */ public void setUrlField(String urlField) { this.urlField = urlField; } @@ -357,8 +400,7 @@ public String getXml() { return retval.toString(); } - private void readData(Node transformNode) - throws HopXmlException { + private void readData(Node transformNode) throws HopXmlException { try { int nrargs; @@ -475,12 +517,16 @@ public boolean supportsErrorHandling() { return true; } - /** @return the encoding */ + /** + * @return the encoding + */ public String getEncoding() { return encoding; } - /** @param encoding the encoding to set */ + /** + * @param encoding the encoding to set + */ public void setEncoding(String encoding) { this.encoding = encoding; } @@ -548,17 +594,23 @@ public void setHttpPassword(String httpPassword) { this.httpPassword = httpPassword; } - /** @return */ + /** + * @return + */ public String getHttpPassword() { return httpPassword; } - /** @return the resultCodeFieldName */ + /** + * @return the resultCodeFieldName + */ public String getResultCodeFieldName() { return resultCodeFieldName; } - /** @param resultCodeFieldName the resultCodeFieldName to set */ + /** + * @param resultCodeFieldName the resultCodeFieldName to set + */ public void setResultCodeFieldName(String resultCodeFieldName) { this.resultCodeFieldName = resultCodeFieldName; } diff --git a/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpMetaLoadSaveTest.java b/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpMetaLoadSaveTest.java index 87e1179d605..c5d20ad188f 100644 --- a/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpMetaLoadSaveTest.java +++ b/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpMetaLoadSaveTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.http; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -29,11 +33,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class HttpMetaLoadSaveTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpTest.java b/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpTest.java index c89dea06b20..3a51152c98e 100644 --- a/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpTest.java +++ b/plugins/transforms/http/src/test/java/org/apache/hop/pipeline/transforms/http/HttpTest.java @@ -29,7 +29,6 @@ import java.io.ByteArrayInputStream; import java.net.HttpURLConnection; - import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.util.HttpClientManager; diff --git a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java index a2e802cf297..12d3822fb20 100644 --- a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java +++ b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java @@ -19,6 +19,7 @@ import static org.apache.hop.pipeline.transforms.httppost.HttpPostMeta.DEFAULT_ENCODING; +import com.google.common.annotations.VisibleForTesting; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; @@ -28,7 +29,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; - import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -64,8 +64,6 @@ import org.apache.http.util.EntityUtils; import org.json.simple.JSONObject; -import com.google.common.annotations.VisibleForTesting; - /** Make a HTTP Post call */ public class HttpPost extends BaseTransform { diff --git a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostArgumentField.java b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostArgumentField.java index 5c22c82f8e9..bffc9a55bbe 100644 --- a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostArgumentField.java +++ b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostArgumentField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.httppost; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class HttpPostArgumentField { @@ -75,7 +74,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HttpPostArgumentField that = (HttpPostArgumentField) o; - return header == that.header && Objects.equals(name, that.name) && Objects.equals(parameter, that.parameter); + return header == that.header + && Objects.equals(name, that.name) + && Objects.equals(parameter, that.parameter); } @Override diff --git a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostLookupField.java b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostLookupField.java index de462a5ee98..b98b2eea7d2 100644 --- a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostLookupField.java +++ b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostLookupField.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.httppost; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; public class HttpPostLookupField { diff --git a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostQuery.java b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostQuery.java index 43f46bf4090..9aca43ff580 100644 --- a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostQuery.java +++ b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostQuery.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.httppost; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class HttpPostQuery { diff --git a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostResultField.java b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostResultField.java index 0d4bfc346da..04b0b7163f9 100644 --- a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostResultField.java +++ b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostResultField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.httppost; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class HttpPostResultField { @@ -95,7 +94,10 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HttpPostResultField that = (HttpPostResultField) o; - return Objects.equals(code, that.code) && Objects.equals(name, that.name) && Objects.equals(responseTimeFieldName, that.responseTimeFieldName) && Objects.equals(responseHeaderFieldName, that.responseHeaderFieldName); + return Objects.equals(code, that.code) + && Objects.equals(name, that.name) + && Objects.equals(responseTimeFieldName, that.responseTimeFieldName) + && Objects.equals(responseHeaderFieldName, that.responseHeaderFieldName); } @Override diff --git a/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMetaTest.java b/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMetaTest.java index 341c4f34234..e3f58d0cb76 100644 --- a/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMetaTest.java +++ b/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.httppost; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Arrays; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -26,13 +32,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.Arrays; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - public class HttpPostMetaTest { @Before public void testLoadSaveRoundTrip() throws HopException { @@ -44,13 +43,11 @@ public void testSerialization() throws Exception { LoadSaveTester tester = new LoadSaveTester<>(HttpPostMeta.class); IFieldLoadSaveValidatorFactory factory = tester.getFieldLoadSaveValidatorFactory(); factory.registerValidator( - HttpPostMeta.class.getDeclaredField("lookupFields").getGenericType().toString(), - new ListLoadSaveValidator<>(new HttpPostLookupFieldValidator()) - ); + HttpPostMeta.class.getDeclaredField("lookupFields").getGenericType().toString(), + new ListLoadSaveValidator<>(new HttpPostLookupFieldValidator())); factory.registerValidator( - HttpPostMeta.class.getDeclaredField("resultFields").getGenericType().toString(), - new ListLoadSaveValidator<>(new HttpPostResultFieldValidator()) - ); + HttpPostMeta.class.getDeclaredField("resultFields").getGenericType().toString(), + new ListLoadSaveValidator<>(new HttpPostResultFieldValidator())); tester.testSerialization(); } @@ -64,36 +61,50 @@ public void setDefault() { assertEquals("UTF-8", meta.getEncoding()); } - public static final class HttpPostLookupFieldValidator implements IFieldLoadSaveValidator { + public static final class HttpPostLookupFieldValidator + implements IFieldLoadSaveValidator { @Override public HttpPostLookupField getTestObject() { HttpPostLookupField field = new HttpPostLookupField(); - field.getArgumentField().addAll(Arrays.asList( - new HttpPostArgumentField(UUID.randomUUID().toString(), UUID.randomUUID().toString(), new Random().nextBoolean()), - new HttpPostArgumentField(UUID.randomUUID().toString(), UUID.randomUUID().toString(), new Random().nextBoolean()), - new HttpPostArgumentField(UUID.randomUUID().toString(), UUID.randomUUID().toString(), new Random().nextBoolean()) - )); - field.getQueryField().addAll(Arrays.asList( - new HttpPostQuery(UUID.randomUUID().toString(), UUID.randomUUID().toString()), - new HttpPostQuery(UUID.randomUUID().toString(), UUID.randomUUID().toString()) - )); + field + .getArgumentField() + .addAll( + Arrays.asList( + new HttpPostArgumentField( + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + new Random().nextBoolean()), + new HttpPostArgumentField( + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + new Random().nextBoolean()), + new HttpPostArgumentField( + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + new Random().nextBoolean()))); + field + .getQueryField() + .addAll( + Arrays.asList( + new HttpPostQuery(UUID.randomUUID().toString(), UUID.randomUUID().toString()), + new HttpPostQuery(UUID.randomUUID().toString(), UUID.randomUUID().toString()))); return field; } @Override public boolean validateTestObject(HttpPostLookupField testObject, Object actual) { - if (!(actual instanceof HttpPostLookupField)){ + if (!(actual instanceof HttpPostLookupField)) { return false; } HttpPostLookupField actualObject = (HttpPostLookupField) actual; // Check the argument fields... // - if (testObject.getArgumentField().size()!=actualObject.getArgumentField().size()) { + if (testObject.getArgumentField().size() != actualObject.getArgumentField().size()) { return false; } - for (int i=0;i { + public static final class HttpPostResultFieldValidator + implements IFieldLoadSaveValidator { @Override public HttpPostResultField getTestObject() { - return new HttpPostResultField(UUID.randomUUID().toString(), - UUID.randomUUID().toString(), - UUID.randomUUID().toString(), - UUID.randomUUID().toString()); + return new HttpPostResultField( + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + UUID.randomUUID().toString(), + UUID.randomUUID().toString()); } @Override diff --git a/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostTest.java b/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostTest.java index 370a593231a..14096e8926b 100644 --- a/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostTest.java +++ b/plugins/transforms/httppost/src/test/java/org/apache/hop/pipeline/transforms/httppost/HttpPostTest.java @@ -17,17 +17,17 @@ package org.apache.hop.pipeline.transforms.httppost; -import org.apache.hop.core.exception.HopException; -import org.apache.http.NameValuePair; -import org.apache.http.message.BasicNameValuePair; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; +import org.apache.hop.core.exception.HopException; +import org.apache.http.NameValuePair; +import org.apache.http.message.BasicNameValuePair; +import org.junit.Test; + public class HttpPostTest { @Test diff --git a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/Field.java b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/Field.java index b02582ac332..09c5ab3301e 100644 --- a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/Field.java +++ b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/Field.java @@ -17,81 +17,94 @@ package org.apache.hop.pipeline.transforms.ifnull; -import org.apache.hop.metadata.api.HopMetadataProperty; import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class Field { - @HopMetadataProperty(key = "name", injectionKey = "FIELD_NAME", injectionKeyDescription = "IfNull.Injection.FIELD_NAME") - private String name; - - @HopMetadataProperty(key = "value", injectionKey = "REPLACE_VALUE", injectionKeyDescription = "IfNull.Injection.REPLACE_VALUE") - private String value; - - @HopMetadataProperty(key = "mask", injectionKey = "REPLACE_MASK", injectionKeyDescription = "IfNull.Injection.REPLACE_MASK") - private String mask; - - @HopMetadataProperty(key = "set_empty_string", injectionKey = "SET_EMPTY_STRING", injectionKeyDescription = "IfNull.Injection.SET_EMPTY_STRING") - private boolean setEmptyString; - - public Field() { - } - - public Field(Field field) { - this.name = field.name; - this.value = field.value; - this.mask = field.mask; - this.setEmptyString = field.setEmptyString; - } - - public String getName() { - return name; - } - - public void setName(String fieldName) { - this.name = fieldName; - } - - public String getValue() { - return value; - } - - public void setValue(String replaceValue) { - this.value = replaceValue; - } - - public String getMask() { - return mask; - } - - public void setMask(String replaceMask) { - this.mask = replaceMask; - } - - public boolean isSetEmptyString() { - return setEmptyString; - } - - public void setSetEmptyString(boolean setEmptyString) { - this.setEmptyString = setEmptyString; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Field field = (Field) o; - return Objects.equals(name, field.name) && Objects.equals(value, field.value) && Objects.equals(mask, field.mask) && this.setEmptyString==field.setEmptyString; - } - - @Override - public int hashCode() { - return Objects.hash(name, value, mask, setEmptyString); - } - - @Override - public Field clone() { - return new Field(this); - } + @HopMetadataProperty( + key = "name", + injectionKey = "FIELD_NAME", + injectionKeyDescription = "IfNull.Injection.FIELD_NAME") + private String name; + + @HopMetadataProperty( + key = "value", + injectionKey = "REPLACE_VALUE", + injectionKeyDescription = "IfNull.Injection.REPLACE_VALUE") + private String value; + + @HopMetadataProperty( + key = "mask", + injectionKey = "REPLACE_MASK", + injectionKeyDescription = "IfNull.Injection.REPLACE_MASK") + private String mask; + + @HopMetadataProperty( + key = "set_empty_string", + injectionKey = "SET_EMPTY_STRING", + injectionKeyDescription = "IfNull.Injection.SET_EMPTY_STRING") + private boolean setEmptyString; + + public Field() {} + + public Field(Field field) { + this.name = field.name; + this.value = field.value; + this.mask = field.mask; + this.setEmptyString = field.setEmptyString; + } + + public String getName() { + return name; + } + + public void setName(String fieldName) { + this.name = fieldName; + } + + public String getValue() { + return value; + } + + public void setValue(String replaceValue) { + this.value = replaceValue; + } + + public String getMask() { + return mask; + } + + public void setMask(String replaceMask) { + this.mask = replaceMask; + } + + public boolean isSetEmptyString() { + return setEmptyString; + } + + public void setSetEmptyString(boolean setEmptyString) { + this.setEmptyString = setEmptyString; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Field field = (Field) o; + return Objects.equals(name, field.name) + && Objects.equals(value, field.value) + && Objects.equals(mask, field.mask) + && this.setEmptyString == field.setEmptyString; + } + + @Override + public int hashCode() { + return Objects.hash(name, value, mask, setEmptyString); + } + + @Override + public Field clone() { + return new Field(this); + } } - diff --git a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNull.java b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNull.java index 91e0e696f3e..c734a047208 100644 --- a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNull.java +++ b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNull.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.ifnull; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.StringUtil; @@ -27,10 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - /** Sets a field value to a constant if it is null */ public class IfNull extends BaseTransform { @@ -82,12 +81,9 @@ public boolean processRow() throws HopException { Field field = meta.getFields().get(i); data.fieldnrs[i] = data.outputRowMeta.indexOfValue(field.getName()); if (data.fieldnrs[i] < 0) { - logError( - BaseMessages.getString( - PKG, "IfNull.Log.CanNotFindField", field.getName())); + logError(BaseMessages.getString(PKG, "IfNull.Log.CanNotFindField", field.getName())); throw new HopException( - BaseMessages.getString( - PKG, "IfNull.Log.CanNotFindField", field.getName())); + BaseMessages.getString(PKG, "IfNull.Log.CanNotFindField", field.getName())); } data.defaultValues[i] = resolve(field.getValue()); data.defaultMasks[i] = resolve(field.getMask()); @@ -116,9 +112,7 @@ public boolean processRow() throws HopException { if (!alllistTypes.contains(valueType.getName())) { throw new HopException( BaseMessages.getString( - PKG, - "IfNull.Log.CanNotFindValueType", - valueType.getName())); + PKG, "IfNull.Log.CanNotFindValueType", valueType.getName())); } data.ListTypes.put(valueType.getName(), i); diff --git a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullData.java b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullData.java index 386fc791070..64738180fd9 100644 --- a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullData.java +++ b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.ifnull; +import java.util.HashMap; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashMap; - public class IfNullData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullDialog.java b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullDialog.java index 4fad9b7c712..6236b79ca4d 100644 --- a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullDialog.java +++ b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.ifnull; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -51,10 +54,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class IfNullDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = IfNullMeta.class; // For Translator @@ -514,11 +513,11 @@ public void getData() { wSelectValuesType.setSelection(input.isSelectValuesType()); Table table = wValueTypes.table; - if ( !input.getValueTypes().isEmpty() ) { + if (!input.getValueTypes().isEmpty()) { table.removeAll(); } for (int i = 0; i < input.getValueTypes().size(); i++) { - ValueType valueType = input.getValueTypes().get(i); + ValueType valueType = input.getValueTypes().get(i); TableItem ti = new TableItem(table, SWT.NONE); ti.setText(0, "" + (i + 1)); if (valueType.getName() != null) { @@ -605,7 +604,7 @@ private void ok() { int nrtypes = wValueTypes.nrNonEmpty(); int nrFields = wFields.nrNonEmpty(); - + input.getValueTypes().clear(); for (int i = 0; i < nrtypes; i++) { TableItem ti = wValueTypes.getNonEmpty(i); diff --git a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMeta.java b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMeta.java index fa868e94bf9..13502c8ebb2 100644 --- a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMeta.java +++ b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.ifnull; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -29,8 +31,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; @Transform( id = "IfNull", @@ -44,28 +44,49 @@ public class IfNullMeta extends BaseTransformMeta { private static final Class PKG = IfNullMeta.class; // For Translator - @HopMetadataProperty(groupKey = "fields", key = "field", injectionGroupKey = "FIELDS", + @HopMetadataProperty( + groupKey = "fields", + key = "field", + injectionGroupKey = "FIELDS", injectionGroupDescription = "IfNull.Injection.FIELDS") private List fields; - @HopMetadataProperty(groupKey = "valuetypes", key = "valuetype", injectionGroupKey = "VALUE_TYPES", + @HopMetadataProperty( + groupKey = "valuetypes", + key = "valuetype", + injectionGroupKey = "VALUE_TYPES", injectionGroupDescription = "IfNull.Injection.VALUE_TYPES") private List valueTypes; - @HopMetadataProperty(key = "selectFields", injectionKey = "SELECT_FIELDS", injectionKeyDescription = "IfNull.Injection.SELECT_FIELDS") + @HopMetadataProperty( + key = "selectFields", + injectionKey = "SELECT_FIELDS", + injectionKeyDescription = "IfNull.Injection.SELECT_FIELDS") private boolean selectFields; - @HopMetadataProperty(key = "selectValuesType", injectionKey = "SELECT_VALUES_TYPE", injectionKeyDescription = "IfNull.Injection.SELECT_VALUES_TYPE") + @HopMetadataProperty( + key = "selectValuesType", + injectionKey = "SELECT_VALUES_TYPE", + injectionKeyDescription = "IfNull.Injection.SELECT_VALUES_TYPE") private boolean selectValuesType; - - @HopMetadataProperty(key = "replaceAllByValue", injectionKey = "REPLACE_ALL_BY_VALUE", injectionKeyDescription = "IfNull.Injection.REPLACE_ALL_BY_VALUE") + + @HopMetadataProperty( + key = "replaceAllByValue", + injectionKey = "REPLACE_ALL_BY_VALUE", + injectionKeyDescription = "IfNull.Injection.REPLACE_ALL_BY_VALUE") private String replaceAllByValue; - @HopMetadataProperty(key = "replaceAllMask", injectionKey = "REPLACE_ALL_MASK", injectionKeyDescription = "IfNull.Injection.REPLACE_ALL_MASK") + @HopMetadataProperty( + key = "replaceAllMask", + injectionKey = "REPLACE_ALL_MASK", + injectionKeyDescription = "IfNull.Injection.REPLACE_ALL_MASK") private String replaceAllMask; /** The flag to set auto commit on or off on the connection */ - @HopMetadataProperty(key = "setEmptyStringAll", injectionKey = "SET_EMPTY_STRING_ALL", injectionKeyDescription = "IfNull.Injection.SET_EMPTY_STRING_ALL") + @HopMetadataProperty( + key = "setEmptyStringAll", + injectionKey = "SET_EMPTY_STRING_ALL", + injectionKeyDescription = "IfNull.Injection.SET_EMPTY_STRING_ALL") private boolean setEmptyStringAll; public IfNullMeta() { @@ -73,29 +94,33 @@ public IfNullMeta() { this.valueTypes = new ArrayList<>(); this.fields = new ArrayList<>(); } - + public IfNullMeta(final IfNullMeta meta) { - this(); + this(); this.selectFields = meta.selectFields; this.selectValuesType = meta.selectValuesType; this.replaceAllByValue = meta.replaceAllByValue; this.replaceAllMask = meta.replaceAllMask; this.setEmptyStringAll = meta.setEmptyStringAll; - - for (Field field:meta.fields) { + + for (Field field : meta.fields) { this.fields.add(new Field(field)); } - for (ValueType vt:meta.valueTypes) { + for (ValueType vt : meta.valueTypes) { this.valueTypes.add(new ValueType(vt)); - } + } } - /** @return Returns the setEmptyStringAll. */ + /** + * @return Returns the setEmptyStringAll. + */ public boolean isSetEmptyStringAll() { return setEmptyStringAll; } - /** @param setEmptyStringAll The setEmptyStringAll to set. */ + /** + * @param setEmptyStringAll The setEmptyStringAll to set. + */ public void setSetEmptyStringAll(boolean setEmptyStringAll) { this.setEmptyStringAll = setEmptyStringAll; } diff --git a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/ValueType.java b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/ValueType.java index 54f5b57a705..1edc27d058a 100644 --- a/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/ValueType.java +++ b/plugins/transforms/ifnull/src/main/java/org/apache/hop/pipeline/transforms/ifnull/ValueType.java @@ -22,30 +22,41 @@ public class ValueType { /** which types to display? */ - @HopMetadataProperty(key = "name", injectionKey = "TYPE_NAME", injectionKeyDescription = "IfNull.Injection.TYPE_NAME") + @HopMetadataProperty( + key = "name", + injectionKey = "TYPE_NAME", + injectionKeyDescription = "IfNull.Injection.TYPE_NAME") private String name; /** by which value we replace */ - @HopMetadataProperty(key = "value", injectionKey = "TYPE_REPLACE_VALUE", injectionKeyDescription = "IfNull.Injection.TYPE_REPLACE_VALUE") + @HopMetadataProperty( + key = "value", + injectionKey = "TYPE_REPLACE_VALUE", + injectionKeyDescription = "IfNull.Injection.TYPE_REPLACE_VALUE") private String value; - @HopMetadataProperty(key = "mask", injectionKey = "TYPE_REPLACE_MASK", injectionKeyDescription = "IfNull.Injection.TYPE_REPLACE_MASK") + @HopMetadataProperty( + key = "mask", + injectionKey = "TYPE_REPLACE_MASK", + injectionKeyDescription = "IfNull.Injection.TYPE_REPLACE_MASK") private String mask; /** Flag : set empty string for type */ - @HopMetadataProperty(key = "set_type_empty_string", injectionKey = "SET_TYPE_EMPTY_STRING", injectionKeyDescription = "IfNull.Injection.SET_TYPE_EMPTY_STRING") + @HopMetadataProperty( + key = "set_type_empty_string", + injectionKey = "SET_TYPE_EMPTY_STRING", + injectionKeyDescription = "IfNull.Injection.SET_TYPE_EMPTY_STRING") private boolean setEmptyString; - public ValueType() { - } + public ValueType() {} public ValueType(ValueType other) { - this.name = other.name; - this.value = other.value; - this.mask = other.mask; - this.setEmptyString = other.setEmptyString; + this.name = other.name; + this.value = other.value; + this.mask = other.mask; + this.setEmptyString = other.setEmptyString; } - + public String getName() { return name; } @@ -77,4 +88,4 @@ public boolean isSetEmptyString() { public void setSetEmptyString(boolean setEmptyString) { this.setEmptyString = setEmptyString; } -} \ No newline at end of file +} diff --git a/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaInjectionTest.java b/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaInjectionTest.java index 3efce9cf6e2..42aab48d97f 100644 --- a/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaInjectionTest.java +++ b/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaInjectionTest.java @@ -37,12 +37,12 @@ public void test() throws Exception { check("REPLACE_VALUE", () -> meta.getFields().get(0).getValue()); check("REPLACE_MASK", () -> meta.getFields().get(0).getMask()); check("SET_EMPTY_STRING", () -> meta.getFields().get(0).isSetEmptyString()); - + check("TYPE_NAME", () -> meta.getValueTypes().get(0).getName()); check("TYPE_REPLACE_VALUE", () -> meta.getValueTypes().get(0).getValue()); - check("TYPE_REPLACE_MASK", () -> meta.getValueTypes().get(0).getMask()); + check("TYPE_REPLACE_MASK", () -> meta.getValueTypes().get(0).getMask()); check("SET_TYPE_EMPTY_STRING", () -> meta.getValueTypes().get(0).isSetEmptyString()); - + check("SELECT_FIELDS", () -> meta.isSelectFields()); check("SELECT_VALUES_TYPE", () -> meta.isSelectValuesType()); check("REPLACE_ALL_BY_VALUE", () -> meta.getReplaceAllByValue()); diff --git a/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaTest.java b/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaTest.java index 0b5fa53473e..a36cbf0ac4a 100644 --- a/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaTest.java +++ b/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullMetaTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -30,56 +31,56 @@ public class IfNullMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - + @Before public void setUpLoadSave() throws Exception { HopEnvironment.init(); PluginRegistry.init(); } - + @Test public void testLoadSaveValueType() throws Exception { IfNullMeta meta = TransformSerializationTestUtil.testSerialization( "/if-null-transform-value-type.xml", IfNullMeta.class); - + assertTrue(meta.isSelectValuesType()); assertEquals(3, meta.getValueTypes().size()); assertFalse(meta.isSelectFields()); - assertEquals(0, meta.getFields().size()); - + assertEquals(0, meta.getFields().size()); + assertEquals("String", meta.getValueTypes().get(0).getName()); - assertNull(meta.getValueTypes().get(0).getValue()); + assertNull(meta.getValueTypes().get(0).getValue()); assertTrue(meta.getValueTypes().get(0).isSetEmptyString()); assertEquals("Number", meta.getValueTypes().get(1).getName()); - assertNull(meta.getValueTypes().get(1).getValue()); - assertFalse(meta.getValueTypes().get(1).isSetEmptyString()); + assertNull(meta.getValueTypes().get(1).getValue()); + assertFalse(meta.getValueTypes().get(1).isSetEmptyString()); assertEquals("Date", meta.getValueTypes().get(2).getName()); - assertNull(meta.getValueTypes().get(2).getValue()); - assertFalse(meta.getValueTypes().get(2).isSetEmptyString()); + assertNull(meta.getValueTypes().get(2).getValue()); + assertFalse(meta.getValueTypes().get(2).isSetEmptyString()); } - + @Test public void testLoadSaveField() throws Exception { - IfNullMeta meta = - TransformSerializationTestUtil.testSerialization( + IfNullMeta meta = + TransformSerializationTestUtil.testSerialization( "/if-null-transform-field.xml", IfNullMeta.class); - + assertFalse(meta.isSelectValuesType()); assertEquals(0, meta.getValueTypes().size()); assertTrue(meta.isSelectFields()); - assertEquals(3, meta.getFields().size()); - + assertEquals(3, meta.getFields().size()); + assertEquals("F1", meta.getFields().get(0).getName()); - assertEquals("EMPTY",meta.getFields().get(0).getValue()); + assertEquals("EMPTY", meta.getFields().get(0).getValue()); assertFalse(meta.getFields().get(0).isSetEmptyString()); assertEquals("F2", meta.getFields().get(1).getName()); - assertEquals("01019999",meta.getFields().get(1).getValue()); - assertEquals("ddMMYYYY",meta.getFields().get(1).getMask()); - assertFalse(meta.getFields().get(1).isSetEmptyString()); + assertEquals("01019999", meta.getFields().get(1).getValue()); + assertEquals("ddMMYYYY", meta.getFields().get(1).getMask()); + assertFalse(meta.getFields().get(1).isSetEmptyString()); assertEquals("F3", meta.getFields().get(2).getName()); - assertNull(meta.getFields().get(2).getValue()); - assertTrue(meta.getFields().get(2).isSetEmptyString()); + assertNull(meta.getFields().get(2).getValue()); + assertTrue(meta.getFields().get(2).isSetEmptyString()); } @Test diff --git a/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullTest.java b/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullTest.java index 2a4859c93c4..3827ee38d9f 100644 --- a/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullTest.java +++ b/plugins/transforms/ifnull/src/test/java/org/apache/hop/pipeline/transforms/ifnull/IfNullTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.ifnull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; import junit.framework.Assert; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; @@ -38,13 +46,6 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; /** Tests for IfNull transform */ public class IfNullTest { @@ -67,7 +68,9 @@ public void setUp() { @After public void clean() - throws NoSuchFieldException, SecurityException, IllegalArgumentException, + throws NoSuchFieldException, + SecurityException, + IllegalArgumentException, IllegalAccessException { smh.cleanUp(); } diff --git a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdate.java b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdate.java index e835643d4f6..ff6a68bdfe1 100644 --- a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdate.java +++ b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdate.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.insertupdate; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.ArrayUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; @@ -33,10 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - /** * Performs a lookup in a database table. If the key doesn't exist it inserts values into the table, * otherwise it performs an update of the changed values. If nothing changed, do nothing. diff --git a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateData.java b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateData.java index 0006570beaa..b4ac86e0c03 100644 --- a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateData.java +++ b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.insertupdate; +import java.sql.PreparedStatement; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.sql.PreparedStatement; - /** Stores data for the Insert/Update transform. */ public class InsertUpdateData extends BaseTransformData implements ITransformData { public Database db; diff --git a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java index 6bc7ba34aed..b76d06037e2 100644 --- a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java +++ b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.insertupdate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -64,11 +68,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class InsertUpdateDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = InsertUpdateMeta.class; // For Translator @@ -90,7 +89,7 @@ public class InsertUpdateDialog extends BaseTransformDialog implements ITransfor /** List of ColumnInfo that should have the field names of the selected database table */ private final List tableFieldColumns = new ArrayList<>(); - + /** List of ColumnInfo that should have the field names of the input fields */ private final List inputFieldColumns = new ArrayList<>(); @@ -300,9 +299,9 @@ public void widgetSelected(SelectionEvent e) { ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false); - - tableFieldColumns.add(ciKey[0]); - inputFieldColumns.add(ciKey[2]); + + tableFieldColumns.add(ciKey[0]); + inputFieldColumns.add(ciKey[2]); inputFieldColumns.add(ciKey[3]); wKey = @@ -374,10 +373,10 @@ public void widgetSelected(SelectionEvent e) { BaseMessages.getString(PKG, "InsertUpdateDialog.ColumnInfo.Update"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {"Y", "N"}); - + tableFieldColumns.add(ciReturn[0]); - inputFieldColumns.add(ciReturn[1]); - + inputFieldColumns.add(ciReturn[1]); + wReturn = new TableView( variables, @@ -427,24 +426,25 @@ public void widgetSelected(SelectionEvent e) { return transformName; } - /** - * Search the fields in the background - */ + /** Search the fields in the background */ protected void setInputFieldCombo() { - shell.getDisplay().asyncExec(() -> { - TransformMeta transformMeta = pipelineMeta.findTransform(transformName); - if (transformMeta != null) { - try { - IRowMeta rowMeta = pipelineMeta.getPrevTransformFields(variables, transformMeta); - String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); - for (ColumnInfo colInfo : inputFieldColumns) { - colInfo.setComboValues(fieldNames); - } - } catch (HopException e) { - logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); - } - } - }); + shell + .getDisplay() + .asyncExec( + () -> { + TransformMeta transformMeta = pipelineMeta.findTransform(transformName); + if (transformMeta != null) { + try { + IRowMeta rowMeta = pipelineMeta.getPrevTransformFields(variables, transformMeta); + String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); + for (ColumnInfo colInfo : inputFieldColumns) { + colInfo.setComboValues(fieldNames); + } + } catch (HopException e) { + logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); + } + } + }); } /** @@ -723,43 +723,47 @@ private void getInfo(InsertUpdateMeta inf) { } private void setTableFieldCombo() { - shell.getDisplay().asyncExec(() -> { - if (!wTable.isDisposed() && !wConnection.isDisposed() && !wSchema.isDisposed()) { - final String tableName = wTable.getText(); - final String connectionName = wConnection.getText(); - final String schemaName = wSchema.getText(); - - // clear - for (ColumnInfo colInfo : tableFieldColumns) { - colInfo.setComboValues(new String[] {}); - } - if (!Utils.isEmpty(tableName)) { - DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); - if (databaseMeta != null) { - try (Database database = new Database(loggingObject, variables, databaseMeta)) { - database.connect(); - - IRowMeta rowMeta = database.getTableFieldsMeta(variables.resolve(schemaName), - variables.resolve(tableName)); - if (null != rowMeta) { - String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); - if (null != fieldNames) { - for (ColumnInfo colInfo : tableFieldColumns) { - colInfo.setComboValues(fieldNames); + shell + .getDisplay() + .asyncExec( + () -> { + if (!wTable.isDisposed() && !wConnection.isDisposed() && !wSchema.isDisposed()) { + final String tableName = wTable.getText(); + final String connectionName = wConnection.getText(); + final String schemaName = wSchema.getText(); + + // clear + for (ColumnInfo colInfo : tableFieldColumns) { + colInfo.setComboValues(new String[] {}); + } + if (!Utils.isEmpty(tableName)) { + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); + if (databaseMeta != null) { + try (Database database = new Database(loggingObject, variables, databaseMeta)) { + database.connect(); + + IRowMeta rowMeta = + database.getTableFieldsMeta( + variables.resolve(schemaName), variables.resolve(tableName)); + if (null != rowMeta) { + String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); + if (null != fieldNames) { + for (ColumnInfo colInfo : tableFieldColumns) { + colInfo.setComboValues(fieldNames); + } + } + } + } catch (Exception e) { + for (ColumnInfo colInfo : tableFieldColumns) { + colInfo.setComboValues(new String[] {}); + } + // ignore any errors here. drop downs will not be + // filled, but no problem for the user + } } } } - } catch (Exception e) { - for (ColumnInfo colInfo : tableFieldColumns) { - colInfo.setComboValues(new String[] {}); - } - // ignore any errors here. drop downs will not be - // filled, but no problem for the user - } - } - } - } - }); + }); } private void ok() { diff --git a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateLookupField.java b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateLookupField.java index ed785142877..fcdd416a313 100644 --- a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateLookupField.java +++ b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateLookupField.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.insertupdate; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.metadata.api.HopMetadataProperty; public class InsertUpdateLookupField { @@ -86,22 +85,30 @@ protected void init() { tableName = BaseMessages.getString(PKG, "InsertUpdateMeta.DefaultTableName"); } - /** @return the schemaName */ + /** + * @return the schemaName + */ public String getSchemaName() { return schemaName; } - /** @param schemaName the schemaName to set */ + /** + * @param schemaName the schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } - /** @return Returns the tableName. */ + /** + * @return Returns the tableName. + */ public String getTableName() { return tableName; } - /** @param tableName The tableName to set. */ + /** + * @param tableName The tableName to set. + */ public void setTableName(String tableName) { this.tableName = tableName; } diff --git a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMeta.java b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMeta.java index 6bb6cd31567..fdba54fa7ed 100644 --- a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMeta.java +++ b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.insertupdate; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -43,9 +45,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.utils.RowMetaUtils; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "InsertUpdate", image = "insertupdate.svg", diff --git a/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMetaTest.java b/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMetaTest.java index a5b7730c2e4..f50df75b135 100644 --- a/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMetaTest.java +++ b/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateMetaTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.insertupdate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.database.Database; @@ -48,14 +55,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class InsertUpdateMetaTest { LoadSaveTester loadSaveTester; @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateTestLazyConversion.java b/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateTestLazyConversion.java index de4474d3674..4e3e290f7ff 100644 --- a/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateTestLazyConversion.java +++ b/plugins/transforms/insertupdate/src/test/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateTestLazyConversion.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.insertupdate; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.sql.PreparedStatement; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.database.Database; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -29,17 +38,9 @@ import org.junit.Before; import org.junit.Test; -import java.sql.PreparedStatement; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** @see InsertUpdate */ +/** + * @see InsertUpdate + */ public class InsertUpdateTestLazyConversion { TransformMockHelper smh; diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/Janino.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/Janino.java index 36dce4322e3..b9098cd45c4 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/Janino.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/Janino.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.janino; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; @@ -32,9 +34,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.codehaus.janino.ExpressionEvaluator; -import java.util.ArrayList; -import java.util.List; - /** Calculate new field values using pre-defined functions. */ public class Janino extends BaseTransform { diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoData.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoData.java index f0b7e4f774a..d58f575e986 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoData.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoData.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.janino; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.codehaus.janino.ExpressionEvaluator; -import java.util.List; - public class JaninoData extends BaseTransformData implements ITransformData { public static final int RETURN_TYPE_STRING = 0; public static final int RETURN_TYPE_NUMBER = 1; diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoDialog.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoDialog.java index c92ada801a8..ace58128285 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoDialog.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.janino; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -45,9 +47,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class JaninoDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = JaninoMeta.class; // For Translator diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMeta.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMeta.java index 503a9a8236e..8372c6c835f 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMeta.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMeta.java @@ -16,6 +16,9 @@ */ package org.apache.hop.pipeline.transforms.janino; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -37,10 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - @InjectionSupported( localizationPrefix = "Janino.Injection.", groups = { diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaFunction.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaFunction.java index 622674a9fa1..77f5203e379 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaFunction.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaFunction.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.janino; +import java.util.Objects; import org.apache.hop.core.Const; import org.apache.hop.core.injection.Injection; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Node; -import java.util.Objects; - public class JaninoMetaFunction implements Cloneable { public static final String XML_TAG = "formula"; @@ -118,42 +117,58 @@ public JaninoMetaFunction(Node calcnode) { replaceField = XmlHandler.getTagValue(calcnode, "replace_field"); } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } - /** @return Returns the valueLength. */ + /** + * @return Returns the valueLength. + */ public int getValueLength() { return valueLength; } - /** @param valueLength The valueLength to set. */ + /** + * @param valueLength The valueLength to set. + */ public void setValueLength(int valueLength) { this.valueLength = valueLength; } - /** @return Returns the valuePrecision. */ + /** + * @return Returns the valuePrecision. + */ public int getValuePrecision() { return valuePrecision; } - /** @param valuePrecision The valuePrecision to set. */ + /** + * @param valuePrecision The valuePrecision to set. + */ public void setValuePrecision(int valuePrecision) { this.valuePrecision = valuePrecision; } - /** @return Returns the valueType. */ + /** + * @return Returns the valueType. + */ public int getValueType() { return valueType; } - /** @param valueType The valueType to set. */ + /** + * @param valueType The valueType to set. + */ public void setValueType(int valueType) { this.valueType = valueType; } @@ -163,22 +178,30 @@ public void setValueType(String typeDesc) { this.valueType = ValueMetaFactory.getIdForValueMeta(typeDesc); } - /** @return the formula */ + /** + * @return the formula + */ public String getFormula() { return formula; } - /** @param formula the formula to set */ + /** + * @param formula the formula to set + */ public void setFormula(String formula) { this.formula = formula; } - /** @return the replaceField */ + /** + * @return the replaceField + */ public String getReplaceField() { return replaceField; } - /** @param replaceField the replaceField to set */ + /** + * @param replaceField the replaceField to set + */ public void setReplaceField(String replaceField) { this.replaceField = replaceField; } diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilter.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilter.java index c2cbff99b7c..019c677692d 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilter.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilter.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.javafilter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; @@ -31,11 +35,6 @@ import org.apache.hop.pipeline.transform.stream.IStream; import org.codehaus.janino.ExpressionEvaluator; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** Calculate new field values using pre-defined functions. */ public class JavaFilter extends BaseTransform { @@ -76,11 +75,14 @@ public boolean processRow() throws HopException { TransformMeta to = targetStreams.get(0).getTransformMeta(); PipelineHopMeta hop = getPipelineMeta().findPipelineHop(getTransformMeta(), to); if (hop != null && hop.isEnabled()) { - data.trueRowSet = findOutputRowSet(getTransformName(), getCopy(), - targetStreams.get(0).getTransformName(), 0); + data.trueRowSet = + findOutputRowSet( + getTransformName(), getCopy(), targetStreams.get(0).getTransformName(), 0); if (data.trueRowSet == null) { throw new HopException( - BaseMessages.getString(PKG, "JavaFilter.Log.TargetTransformInvalid", + BaseMessages.getString( + PKG, + "JavaFilter.Log.TargetTransformInvalid", targetStreams.get(0).getTransformName())); } } @@ -92,11 +94,14 @@ public boolean processRow() throws HopException { TransformMeta to = targetStreams.get(1).getTransformMeta(); PipelineHopMeta hop = getPipelineMeta().findPipelineHop(getTransformMeta(), to); if (hop != null && hop.isEnabled()) { - data.falseRowSet = findOutputRowSet(getTransformName(), getCopy(), - targetStreams.get(1).getTransformName(), 0); + data.falseRowSet = + findOutputRowSet( + getTransformName(), getCopy(), targetStreams.get(1).getTransformName(), 0); if (data.falseRowSet == null) { throw new HopException( - BaseMessages.getString(PKG, "JavaFilter.Log.TargetTransformInvalid", + BaseMessages.getString( + PKG, + "JavaFilter.Log.TargetTransformInvalid", targetStreams.get(1).getTransformName())); } } @@ -121,10 +126,10 @@ public boolean processRow() throws HopException { if (data.trueRowSet != null) { if (log.isRowLevel()) { logRowlevel( - "Sending row to true :" - + data.trueTransformName - + " : " - + getInputRowMeta().getString(r)); + "Sending row to true :" + + data.trueTransformName + + " : " + + getInputRowMeta().getString(r)); } putRowTo(data.outputRowMeta, r, data.trueRowSet); } @@ -132,10 +137,10 @@ public boolean processRow() throws HopException { if (data.falseRowSet != null) { if (log.isRowLevel()) { logRowlevel( - "Sending row to false :" - + data.falseTransformName - + " : " - + getInputRowMeta().getString(r)); + "Sending row to false :" + + data.falseTransformName + + " : " + + getInputRowMeta().getString(r)); } putRowTo(data.outputRowMeta, r, data.falseRowSet); } diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterData.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterData.java index 8528eb64728..6eb87976d5b 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterData.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterData.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.javafilter; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.codehaus.janino.ExpressionEvaluator; -import java.util.List; - public class JavaFilterData extends BaseTransformData implements ITransformData { public static final int RETURN_TYPE_STRING = 0; public static final int RETURN_TYPE_NUMBER = 1; diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterDialog.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterDialog.java index 47f9ee65e0b..cb638a6bb4a 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterDialog.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterDialog.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.javafilter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -42,12 +47,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class JavaFilterDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = JavaFilterMeta.class; // For Translator diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterMeta.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterMeta.java index 00c9131866e..4aafdd6fafc 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterMeta.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/javafilter/JavaFilterMeta.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.javafilter; +import java.util.List; +import java.util.Objects; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; -import java.util.List; -import java.util.Objects; - /** Contains the meta-data for the java filter transform: calculates conditions using Janino */ @Transform( id = "JavaFilter", diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelper.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelper.java index ded10d20240..a3d62ccf1d9 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelper.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelper.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.io.Serializable; +import java.math.BigDecimal; +import java.net.InetAddress; +import java.sql.Timestamp; +import java.util.Date; +import java.util.regex.Pattern; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -25,13 +31,6 @@ import org.apache.hop.core.row.value.ValueMetaTimestamp; import org.apache.hop.i18n.BaseMessages; -import java.io.Serializable; -import java.math.BigDecimal; -import java.net.InetAddress; -import java.sql.Timestamp; -import java.util.Date; -import java.util.regex.Pattern; - public class FieldHelper { private static final Class PKG = FieldHelper.class; // For Translator diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformClassBase.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformClassBase.java index 2a11d46c5cd..f76b4d5e302 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformClassBase.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformClassBase.java @@ -16,6 +16,9 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.BlockingRowSet; import org.apache.hop.core.IRowSet; import org.apache.hop.core.ResultFile; @@ -43,10 +46,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.apache.hop.pipeline.transforms.userdefinedjavaclass.UserDefinedJavaClassMeta.FieldInfo; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public abstract class TransformClassBase { private static final Class PKG = UserDefinedJavaClassMeta.class; // For Translator diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClass.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClass.java index 7af90391da0..1cb15481d28 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClass.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClass.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.util.List; +import java.util.Map; import org.apache.hop.core.BlockingRowSet; import org.apache.hop.core.IRowSet; import org.apache.hop.core.ResultFile; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; -import java.util.Map; - public class UserDefinedJavaClass extends BaseTransform { private TransformClassBase child; diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassCodeSnippits.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassCodeSnippits.java index d70d1ad71ee..153409ccf28 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassCodeSnippits.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassCodeSnippits.java @@ -16,6 +16,11 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.xml.XmlHandler; @@ -23,12 +28,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class UserDefinedJavaClassCodeSnippits { private static final Class PKG = UserDefinedJavaClass.class; // For Translator private static UserDefinedJavaClassCodeSnippits snippitsHelper = null; diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassData.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassData.java index 463c2bcba8e..0b6ec908627 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassData.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassData.java @@ -16,12 +16,11 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Map; - public class UserDefinedJavaClassData extends BaseTransformData implements ITransformData { public IRowMeta inputRowMeta; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDef.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDef.java index 3b6f4efe7d5..e6b62b8c8be 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDef.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDef.java @@ -16,13 +16,12 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.security.MessageDigest; +import java.util.Objects; import org.apache.commons.codec.binary.Hex; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.injection.Injection; -import java.security.MessageDigest; -import java.util.Objects; - public class UserDefinedJavaClassDef implements Cloneable { public enum ClassType { NORMAL_CLASS, diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDialog.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDialog.java index 74578e1df38..0d7eb60d60f 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDialog.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassDialog.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -90,18 +101,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; - public class UserDefinedJavaClassDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = UserDefinedJavaClassMeta.class; // For Translator @@ -1202,7 +1201,8 @@ private void getInfo(UserDefinedJavaClassMeta meta) { int colNr = 1; transformDefinition.tag = item.getText(colNr++); transformDefinition.transformName = item.getText(colNr++); - transformDefinition.transformMeta = pipelineMeta.findTransform(transformDefinition.transformName); + transformDefinition.transformMeta = + pipelineMeta.findTransform(transformDefinition.transformName); transformDefinition.description = item.getText(colNr++); meta.getInfoTransformDefinitions().add(transformDefinition); } @@ -1215,7 +1215,8 @@ private void getInfo(UserDefinedJavaClassMeta meta) { int colNr = 1; transformDefinition.tag = item.getText(colNr++); transformDefinition.transformName = item.getText(colNr++); - transformDefinition.transformMeta = pipelineMeta.findTransform(transformDefinition.transformName); + transformDefinition.transformMeta = + pipelineMeta.findTransform(transformDefinition.transformName); transformDefinition.description = item.getText(colNr++); meta.getTargetTransformDefinitions().add(transformDefinition); } diff --git a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMeta.java b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMeta.java index 762b22b8085..af4c6da9c46 100644 --- a/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMeta.java +++ b/plugins/transforms/janino/src/main/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMeta.java @@ -20,6 +20,13 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -50,14 +57,6 @@ import org.codehaus.janino.Scanner; import org.w3c.dom.Node; -import java.io.IOException; -import java.io.StringReader; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - @InjectionSupported( localizationPrefix = "UserDefinedJavaClass.Injection.", groups = {"PARAMETERS", "TARGET_TRANSFORMS", "INFO_TRANSFORMS", "JAVA_CLASSES", "FIELD_INFO"}) @@ -69,7 +68,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Scripting", keywords = "i18n::UserDefinedJavaClassMeta.keyword", documentationUrl = "/pipeline/transforms/userdefinedjavaclass.html") -public class UserDefinedJavaClassMeta extends BaseTransformMeta { +public class UserDefinedJavaClassMeta + extends BaseTransformMeta { private static final Class PKG = UserDefinedJavaClassMeta.class; // For Translator public enum ElementNames { @@ -737,32 +737,44 @@ public boolean supportsErrorHandling() { return true; } - /** @return the clearingResultFields */ + /** + * @return the clearingResultFields + */ public boolean isClearingResultFields() { return clearingResultFields; } - /** @param clearingResultFields the clearingResultFields to set */ + /** + * @param clearingResultFields the clearingResultFields to set + */ public void setClearingResultFields(boolean clearingResultFields) { this.clearingResultFields = clearingResultFields; } - /** @return the infoTransformDefinitions */ + /** + * @return the infoTransformDefinitions + */ public List getInfoTransformDefinitions() { return infoTransformDefinitions; } - /** @param infoTransformDefinitions the infoTransformDefinitions to set */ + /** + * @param infoTransformDefinitions the infoTransformDefinitions to set + */ public void setInfoTransformDefinitions(List infoTransformDefinitions) { this.infoTransformDefinitions = infoTransformDefinitions; } - /** @return the targetTransformDefinitions */ + /** + * @return the targetTransformDefinitions + */ public List getTargetTransformDefinitions() { return targetTransformDefinitions; } - /** @param targetTransformDefinitions the targetTransformDefinitions to set */ + /** + * @param targetTransformDefinitions the targetTransformDefinitions to set + */ public void setTargetTransformDefinitions( List targetTransformDefinitions) { this.targetTransformDefinitions = targetTransformDefinitions; @@ -773,12 +785,16 @@ public boolean excludeFromRowLayoutVerification() { return true; } - /** @return the usageParameters */ + /** + * @return the usageParameters + */ public List getUsageParameters() { return usageParameters; } - /** @param usageParameters the usageParameters to set */ + /** + * @param usageParameters the usageParameters to set + */ public void setUsageParameters(List usageParameters) { this.usageParameters = usageParameters; } diff --git a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaTest.java b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaTest.java index 090e78beefb..9acfe326a95 100644 --- a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaTest.java +++ b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/janino/JaninoMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.janino; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.plugins.PluginRegistry; @@ -30,13 +36,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class JaninoMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelperTest.java b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelperTest.java index b2325fcc665..b28064ef3ef 100644 --- a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelperTest.java +++ b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/FieldHelperTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.powermock.api.mockito.PowerMockito.whenNew; +import static org.powermock.reflect.Whitebox.getMethod; + +import java.net.InetAddress; +import java.sql.Timestamp; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.core.row.IRowMeta; @@ -36,21 +50,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import java.net.InetAddress; -import java.sql.Timestamp; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.powermock.api.mockito.PowerMockito.whenNew; -import static org.powermock.reflect.Whitebox.getMethod; - @RunWith(PowerMockRunner.class) @PrepareForTest({FieldHelper.class, FieldHelperTest.class}) public class FieldHelperTest { diff --git a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformDefinitionTest.java b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformDefinitionTest.java index 069785a9581..2546579bd00 100644 --- a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformDefinitionTest.java +++ b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/TransformDefinitionTest.java @@ -17,10 +17,10 @@ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; -import org.junit.Test; - import static org.junit.Assert.fail; +import org.junit.Test; + /** User: Dzmitry Stsiapanau Date: 2/6/14 Time: 2:29 PM */ public class TransformDefinitionTest { @Test diff --git a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaInjectionTest.java b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaInjectionTest.java index 2d4c9b31c99..ee0b148ed57 100644 --- a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaInjectionTest.java +++ b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaInjectionTest.java @@ -16,6 +16,9 @@ */ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaInteger; @@ -25,10 +28,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; - -import static org.junit.Assert.assertEquals; - public class UserDefinedJavaClassMetaInjectionTest extends BaseMetadataInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaTest.java b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaTest.java index 41a777435bd..60fed5ac5d5 100644 --- a/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaTest.java +++ b/plugins/transforms/janino/src/test/java/org/apache/hop/pipeline/transforms/userdefinedjavaclass/UserDefinedJavaClassMetaTest.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.userdefinedjavaclass; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.pipeline.transform.TransformMeta; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class UserDefinedJavaClassMetaTest { @Test diff --git a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctions.java b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctions.java index fbe44fdd37d..6b8801e30d6 100644 --- a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctions.java +++ b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctions.java @@ -18,34 +18,6 @@ package org.apache.hop.pipeline.transforms.javascript; import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileType; -import org.apache.commons.vfs2.FileUtil; -import org.apache.hop.core.Const; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowDataUtil; -import org.apache.hop.core.row.ValueDataUtil; -import org.apache.hop.core.util.EnvUtil; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.core.vfs.HopVfs; -import org.apache.hop.pipeline.engine.IPipelineEngine; -import org.apache.hop.pipeline.transform.ITransform; -import org.apache.hop.pipeline.transforms.loadfileinput.LoadFileInput; -import org.apache.hop.ui.core.dialog.MessageBox; -import org.apache.hop.ui.hopgui.HopGui; -import org.eclipse.swt.SWT; -import org.mozilla.javascript.Context; -import org.mozilla.javascript.EvaluatorException; -import org.mozilla.javascript.Function; -import org.mozilla.javascript.JavaScriptException; -import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; -import org.mozilla.javascript.WrappedException; - import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; @@ -74,6 +46,33 @@ import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileType; +import org.apache.commons.vfs2.FileUtil; +import org.apache.hop.core.Const; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowDataUtil; +import org.apache.hop.core.row.ValueDataUtil; +import org.apache.hop.core.util.EnvUtil; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.core.vfs.HopVfs; +import org.apache.hop.pipeline.engine.IPipelineEngine; +import org.apache.hop.pipeline.transform.ITransform; +import org.apache.hop.pipeline.transforms.loadfileinput.LoadFileInput; +import org.apache.hop.ui.core.dialog.MessageBox; +import org.apache.hop.ui.hopgui.HopGui; +import org.eclipse.swt.SWT; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.EvaluatorException; +import org.mozilla.javascript.Function; +import org.mozilla.javascript.JavaScriptException; +import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.ScriptableObject; +import org.mozilla.javascript.WrappedException; public class ScriptValuesAddedFunctions extends ScriptableObject { @@ -669,7 +668,7 @@ public static Object dateDiff( } else if (strType.equals("w")) { int iDays = (int) ((endL - startL) / 86400000); return Double.valueOf(iDays / 7); - } else if (strType.equals("ms")) { + } else if (strType.equals("ms")) { return Double.valueOf(endL - startL); } else if (strType.equals("ss")) { return Double.valueOf(((endL - startL) / 1000)); diff --git a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDialog.java b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDialog.java index ac783736ed8..253d4f3e045 100644 --- a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDialog.java +++ b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDialog.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.javascript; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.Date; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -96,14 +103,6 @@ import org.mozilla.javascript.ast.ScriptNode; import org.mozilla.javascript.tools.ToolErrorReporter; -import java.lang.reflect.Method; -import java.math.BigDecimal; -import java.util.Collections; -import java.util.Date; -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; - public class ScriptValuesDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = ScriptValuesMeta.class; // For Translator diff --git a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDummy.java b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDummy.java index 58505fa788e..d330f198e10 100644 --- a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDummy.java +++ b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesDummy.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.javascript; +import java.awt.event.ComponentListener; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.hop.core.IRowSet; import org.apache.hop.core.ResultFile; import org.apache.hop.core.exception.HopException; @@ -38,12 +43,6 @@ import org.apache.hop.pipeline.transform.ITransformStartedListener; import org.apache.hop.pipeline.transform.TransformMeta; -import java.awt.event.ComponentListener; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; - /** Dummy class used for test(). */ public class ScriptValuesDummy implements ITransform { private IRowMeta inputRowMeta; @@ -359,20 +358,16 @@ public boolean isUsingThreadPriorityManagment() { return false; } - public void setUsingThreadPriorityManagment(boolean usingThreadPriorityManagment) { - } + public void setUsingThreadPriorityManagment(boolean usingThreadPriorityManagment) {} @Override - public void setRunning(boolean running) { - } + public void setRunning(boolean running) {} @Override - public void setStopped(boolean stopped) { - } + public void setStopped(boolean stopped) {} @Override - public void setSafeStopped(boolean stopped) { - } + public void setSafeStopped(boolean stopped) {} @Override public int rowsetInputSize() { @@ -424,16 +419,13 @@ public boolean isPaused() { } @Override - public void identifyErrorOutput() { - } + public void identifyErrorOutput() {} @Override - public void setPartitioned(boolean partitioned) { - } + public void setPartitioned(boolean partitioned) {} @Override - public void setRepartitioning(int partitioningMethod) { - } + public void setRepartitioning(int partitioningMethod) {} @Override public boolean canProcessOneRow() { @@ -449,8 +441,7 @@ public boolean isWaitingForData() { return false; } - public void setWaitingForData(boolean waitingForData) { - } + public void setWaitingForData(boolean waitingForData) {} public boolean isIdle() { return false; @@ -460,24 +451,19 @@ public boolean isPassingData() { return false; } - public void setPassingData(boolean passingData) { - } + public void setPassingData(boolean passingData) {} @Override - public void batchComplete() throws HopException { - } + public void batchComplete() throws HopException {} @Override - public void startBundle() throws HopException { - } + public void startBundle() throws HopException {} @Override - public void finishBundle() throws HopException { - } + public void finishBundle() throws HopException {} @Override - public void setMetadataProvider(IHopMetadataProvider metadataProvider) { - } + public void setMetadataProvider(IHopMetadataProvider metadataProvider) {} @Override public IHopMetadataProvider getMetadataProvider() { @@ -490,8 +476,7 @@ public int getCurrentInputRowSetNr() { } @Override - public void setCurrentOutputRowSetNr(int index) { - } + public void setCurrentOutputRowSetNr(int index) {} @Override public int getCurrentOutputRowSetNr() { @@ -499,8 +484,7 @@ public int getCurrentOutputRowSetNr() { } @Override - public void setCurrentInputRowSetNr(int index) { - } + public void setCurrentInputRowSetNr(int index) {} @Override public ITransformMeta getMeta() { diff --git a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesHelp.java b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesHelp.java index 519e210d3e8..5431a02bcfe 100644 --- a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesHelp.java +++ b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesHelp.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.javascript; +import java.io.InputStream; +import java.util.Hashtable; import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.xml.XmlHandler; import org.w3c.dom.Document; @@ -24,9 +26,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import java.io.InputStream; -import java.util.Hashtable; - public class ScriptValuesHelp { private static Document dom; diff --git a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMeta.java b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMeta.java index e19d8c4b0e6..288ae7c3a09 100644 --- a/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMeta.java +++ b/plugins/transforms/javascript/src/main/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMeta.java @@ -18,6 +18,12 @@ package org.apache.hop.pipeline.transforms.javascript; import com.google.common.annotations.VisibleForTesting; +import java.math.BigDecimal; +import java.net.URL; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Properties; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -52,13 +58,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.math.BigDecimal; -import java.net.URL; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Properties; - @Transform( id = "ScriptValueMod", image = "javascript.svg", diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_GetVariableScopeTest.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_GetVariableScopeTest.java index 4166f6f34af..5466e96c16d 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_GetVariableScopeTest.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_GetVariableScopeTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.javascript; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.mozilla.javascript.EvaluatorException; -import static org.junit.Assert.assertEquals; - public class ScriptValueAddFunctions_GetVariableScopeTest { @Test diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_SetVariableScopeTest.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_SetVariableScopeTest.java index 501d68320e9..843b2d24a45 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_SetVariableScopeTest.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValueAddFunctions_SetVariableScopeTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.javascript; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; import org.apache.hop.pipeline.Pipeline; @@ -27,11 +32,6 @@ import org.junit.Ignore; import org.junit.Test; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - public class ScriptValueAddFunctions_SetVariableScopeTest { private static final String VARIABLE_NAME = "variable-name"; private static final String VARIABLE_VALUE = "variable-value"; diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctionsTest.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctionsTest.java index 562e75f64fa..acfcb9f6010 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctionsTest.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesAddedFunctionsTest.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.javascript; -import org.junit.Assert; -import org.junit.Test; - import java.util.Calendar; import java.util.Date; +import org.junit.Assert; +import org.junit.Test; public class ScriptValuesAddedFunctionsTest { diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaInjectionTest.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaInjectionTest.java index 3980531262b..76e6d3f762e 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaInjectionTest.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaInjectionTest.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.javascript; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaInteger; @@ -28,8 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class ScriptValuesMetaInjectionTest extends BaseMetadataInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaTest.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaTest.java index ae13e46802f..068e399a440 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaTest.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesMetaTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.javascript; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.core.row.IValueMeta; @@ -36,13 +42,6 @@ import org.junit.Test; import org.powermock.reflect.Whitebox; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class ScriptValuesMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesTest.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesTest.java index 8cffa26511d..09c566764ac 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesTest.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/ScriptValuesTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.javascript; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; + +import java.math.BigDecimal; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.RowMeta; @@ -29,11 +33,6 @@ import org.junit.Ignore; import org.junit.Test; -import java.math.BigDecimal; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; - public class ScriptValuesTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/TransformMockUtil.java b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/TransformMockUtil.java index 301080d5edf..69fd69ad6a4 100644 --- a/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/TransformMockUtil.java +++ b/plugins/transforms/javascript/src/test/java/org/apache/hop/pipeline/transforms/javascript/TransformMockUtil.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.javascript; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -27,11 +31,6 @@ import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.mockito.ArgumentMatchers; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -62,8 +61,12 @@ TransformMockHelper getTransformMockHelper( public static T getTransform(Class klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor kons = klass.getConstructor( TransformMeta.class, @@ -83,8 +86,12 @@ T getTransform( Class transformMetaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper(transformMetaClass, dataClass, transformName)); diff --git a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataData.java b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataData.java index 9a34290e6e0..82d4f172df9 100644 --- a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataData.java +++ b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataData.java @@ -17,14 +17,13 @@ package org.apache.pipeline.transform.jdbcmetadata; +import java.lang.reflect.Method; +import java.sql.Connection; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.lang.reflect.Method; -import java.sql.Connection; - public class JdbcMetadataData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataDialog.java b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataDialog.java index 033a1332ea7..62813bea7cf 100644 --- a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataDialog.java +++ b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataDialog.java @@ -176,6 +176,7 @@ private ComboVar createArgumentUI( return comboVar; } + /** Create UI to enter arguments. Return a new set of arguments to store in the meta object */ private List createArgumentsUI(Object[] argumentDescriptors, List currentValues) { logDebug( diff --git a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataMeta.java b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataMeta.java index 29b910599be..9b864701f58 100644 --- a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataMeta.java +++ b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/JdbcMetadataMeta.java @@ -17,6 +17,12 @@ package org.apache.pipeline.transform.jdbcmetadata; +import java.lang.reflect.Method; +import java.sql.DatabaseMetaData; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.exception.HopValueException; @@ -32,13 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.lang.reflect.Method; -import java.sql.DatabaseMetaData; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @Transform( id = "JdbcMetadata", image = "jdbcmetadata.svg", @@ -386,11 +385,10 @@ public void setDefault() { methodName = "getCatalogs"; argumentSourceFields = false; outputFields = new ArrayList<>(); - outputFields.add(new OutputField("TABLE_CAT","TABLE_CAT")); + outputFields.add(new OutputField("TABLE_CAT", "TABLE_CAT")); } - @HopMetadataProperty - private String connection; + @HopMetadataProperty private String connection; public String getConnection() { return connection; @@ -401,8 +399,8 @@ public void setConnection(String connection) { } /** Stores the whether the input row should be returned even if no metadata was found */ - @HopMetadataProperty - private boolean alwaysPassInputRow; + @HopMetadataProperty private boolean alwaysPassInputRow; + /** * @return whether fields are to be used as arguments */ @@ -418,8 +416,8 @@ public void setAlwaysPassInputRow(boolean alwaysPassInputRow) { } /** Stores the name of the method used to get the metadata */ - @HopMetadataProperty - private String methodName; + @HopMetadataProperty private String methodName; + /** * Getter for the name method used to get metadata * @@ -428,6 +426,7 @@ public void setAlwaysPassInputRow(boolean alwaysPassInputRow) { public String getMethodName() { return methodName; } + /** * Setter for the name of the method used to get metadata * @@ -508,14 +507,15 @@ public Method getMethod() throws Exception { } /** Stores the whether fields are to be used for method arguments */ - @HopMetadataProperty - private boolean argumentSourceFields; + @HopMetadataProperty private boolean argumentSourceFields; + /** * @return whether fields are to be used as arguments */ public boolean isArgumentSourceFields() { return argumentSourceFields; } + /** * @param argumentSourceFields whether fields should be used as arguments */ @@ -524,14 +524,15 @@ public void setArgumentSourceFields(boolean argumentSourceFields) { } /** Stores the whether to remove the fields used as arguments from the output row */ - @HopMetadataProperty - private boolean removeArgumentFields; + @HopMetadataProperty private boolean removeArgumentFields; + /** * @return whether to remove the fields used as arguments from the output row */ public boolean isRemoveArgumentFields() { return removeArgumentFields; } + /** * @param removeArgumentFields whether fields used as arguments should be removed from the output * row @@ -543,6 +544,7 @@ public void setRemoveArgumentFields(boolean removeArgumentFields) { /** Stores method arguments */ @HopMetadataProperty(groupKey = "arguments", key = "argument") private List arguments; + /** * @return get method arguments */ @@ -558,8 +560,9 @@ public void setArguments(List arguments) { } /** Stores the selection of fields that are added to the stream */ - @HopMetadataProperty(groupKey = "outputFields", key="outputField") + @HopMetadataProperty(groupKey = "outputFields", key = "outputField") private List outputFields; + /** * @return the selection of fields added to the stream */ @@ -632,12 +635,13 @@ public void getFields( continue; } field = - new ValueMetaBase(outputField.getRename() == null ? fieldName : outputField.getRename(), field.getType()); + new ValueMetaBase( + outputField.getRename() == null ? fieldName : outputField.getRename(), + field.getType()); field.setOrigin(origin); rowMeta.addValueMeta(field); break; } } } - } diff --git a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/OutputField.java b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/OutputField.java index b3b3d7e8a9c..8ad02c04909 100644 --- a/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/OutputField.java +++ b/plugins/transforms/jdbc-metadata/src/main/java/org/apache/pipeline/transform/jdbcmetadata/OutputField.java @@ -21,34 +21,30 @@ public class OutputField { - @HopMetadataProperty - private String name; + @HopMetadataProperty private String name; - @HopMetadataProperty - private String rename; + @HopMetadataProperty private String rename; - public OutputField() { - } + public OutputField() {} - public OutputField(String name, String rename) { - this.name = name; - this.rename = rename; - } + public OutputField(String name, String rename) { + this.name = name; + this.rename = rename; + } + public String getName() { + return name; + } - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } + public String getRename() { + return rename; + } - public String getRename() { - return rename; - } - - public void setRename(String rename) { - this.rename = rename; - } + public void setRename(String rename) { + this.rename = rename; + } } diff --git a/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRows.java b/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRows.java index 8a868708c35..a7d06391fdf 100644 --- a/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRows.java +++ b/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRows.java @@ -17,17 +17,6 @@ package org.apache.hop.pipeline.transforms.joinrows; -import org.apache.hop.core.IRowSet; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.pipeline.Pipeline; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.transform.BaseTransform; -import org.apache.hop.pipeline.transform.TransformMeta; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; @@ -38,6 +27,16 @@ import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.IRowSet; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.pipeline.Pipeline; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.transform.BaseTransform; +import org.apache.hop.pipeline.transform.TransformMeta; /** Performs a cartesian product between 2 or more input streams. */ public class JoinRows extends BaseTransform { diff --git a/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsData.java b/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsData.java index 52878487cc1..49a8c3cbef7 100644 --- a/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsData.java +++ b/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsData.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.joinrows; -import org.apache.hop.core.IRowSet; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.List; +import org.apache.hop.core.IRowSet; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class JoinRowsData extends BaseTransformData implements ITransformData { public File[] file; diff --git a/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsDialog.java b/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsDialog.java index 4fa3bb3f716..809cc168090 100644 --- a/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsDialog.java +++ b/plugins/transforms/joinrows/src/main/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.joinrows; +import java.util.List; import org.apache.hop.core.Condition; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -46,8 +47,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class JoinRowsDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = JoinRowsMeta.class; // For Translator diff --git a/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsMetaTest.java b/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsMetaTest.java index 4b0b0967724..affc6f790a6 100644 --- a/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsMetaTest.java +++ b/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsMetaTest.java @@ -16,6 +16,14 @@ */ package org.apache.hop.pipeline.transforms.joinrows; +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNull; +import static org.mockito.Mockito.mock; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -29,15 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; -import static org.mockito.Mockito.mock; - public class JoinRowsMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = JoinRowsMeta.class; diff --git a/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsTest.java b/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsTest.java index 6c95a960e0d..9980a74b07c 100644 --- a/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsTest.java +++ b/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/JoinRowsTest.java @@ -17,6 +17,19 @@ package org.apache.hop.pipeline.transforms.joinrows; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; import org.apache.hop.core.BlockingRowSet; import org.apache.hop.core.IRowSet; import org.apache.hop.core.RowMetaAndData; @@ -38,20 +51,6 @@ import org.junit.Ignore; import org.junit.Test; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class JoinRowsTest { private JoinRowsMeta meta; diff --git a/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/TransformRowsCollector.java b/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/TransformRowsCollector.java index 2c99e4e152a..cf93c202a0f 100644 --- a/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/TransformRowsCollector.java +++ b/plugins/transforms/joinrows/src/test/java/org/apache/hop/pipeline/transforms/joinrows/TransformRowsCollector.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.joinrows; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.ArrayList; -import java.util.List; - /** * Helper class for testcases. You can add an instance of this class to a transform to read all of * the Rows the transform read or wrote. diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInput.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInput.java index fd7448a0a89..ec7ba956122 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInput.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInput.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.jsoninput; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.BitSet; import org.apache.commons.lang.NotImplementedException; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -41,11 +45,6 @@ import org.apache.hop.pipeline.transforms.jsoninput.reader.InputsReader; import org.apache.hop.pipeline.transforms.jsoninput.reader.RowOutputConverter; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.BitSet; - /** * Read Json files, parse them and convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputData.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputData.java index de820aec663..5373fd7055f 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputData.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.jsoninput; +import java.io.InputStream; +import java.util.BitSet; +import java.util.Iterator; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transforms.file.BaseFileInputTransformData; import org.apache.hop.pipeline.transforms.jsoninput.reader.IJsonReader; -import java.io.InputStream; -import java.util.BitSet; -import java.util.Iterator; - public class JsonInputData extends BaseFileInputTransformData implements ITransformData { public Object[] previousRow; public IRowMeta inputRowMeta; diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputDialog.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputDialog.java index 9dac564a92b..6b6120da580 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputDialog.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputDialog.java @@ -21,6 +21,15 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.MappingJsonFactory; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -70,16 +79,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - public class JsonInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = JsonInputMeta.class; // For Translator @@ -1482,11 +1481,7 @@ private void refreshFields(InputStream inputStream) { String name = path.substring(dotIndex + 1); TableItem item = new TableItem(wFields.table, SWT.NONE); // Remove bracket syntax in case attribute name contains spaces - item.setText( - 1, - name.contains(" ") - ? name.replace("['", "").replace("']", "") - : name); + item.setText(1, name.contains(" ") ? name.replace("['", "").replace("']", "") : name); item.setText(2, path); item.setText(3, "String"); } diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMeta.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMeta.java index 9bc18b2794e..aa16f56cd32 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMeta.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.jsoninput; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -48,11 +52,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - /** Store run-time data on the JsonInput transform. */ @Transform( id = "JsonInput", @@ -755,7 +754,7 @@ private static boolean getDefaultPathLeafToNull(Node transformnode) { * @param nrFiles * @param nrFields */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") public void allocate(int nrFiles, int nrFields) { initArrayFields(nrFiles, nrFields); } diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReader.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReader.java index d1935e90cb7..f61d41d008e 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReader.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReader.java @@ -22,6 +22,10 @@ import com.jayway.jsonpath.Option; import com.jayway.jsonpath.ParseContext; import com.jayway.jsonpath.ReadContext; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.IRowSet; import org.apache.hop.core.SingleRowRowSet; @@ -32,11 +36,6 @@ import org.apache.hop.pipeline.transforms.jsoninput.JsonInputMeta; import org.apache.hop.pipeline.transforms.jsoninput.exception.JsonInputException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; - public class FastJsonReader implements IJsonReader { private static final Class PKG = JsonInputMeta.class; // For Translator @@ -138,8 +137,8 @@ private static JsonPath[] compilePaths(JsonInputField[] fields) throws HopExcept paths[i++] = JsonPath.compile(field.getPath()); } } catch (Exception e) { - throw new HopException(BaseMessages.getString( - PKG, "JsonParser.JsonPath.Compile.Error", e.getMessage())); + throw new HopException( + BaseMessages.getString(PKG, "JsonParser.JsonPath.Compile.Error", e.getMessage())); } return paths; } @@ -197,6 +196,7 @@ private static class TransposedRowSet extends SingleRowRowSet { private List> results; private final int rowCount; private int rowNbr; + /** * if should skip null-only rows; size won't be exact if set. If HOP_JSON_INPUT_INCLUDE_NULLS is * "Y" (default behavior) then nulls will be included otherwise they will not diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/IJsonReader.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/IJsonReader.java index baa90e07944..6c020b70dbc 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/IJsonReader.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/IJsonReader.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.jsoninput.reader; +import java.io.InputStream; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.transforms.jsoninput.JsonInputField; -import java.io.InputStream; - public interface IJsonReader { /** diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/InputsReader.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/InputsReader.java index 93f0820b980..1fa624de988 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/InputsReader.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/InputsReader.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.jsoninput.reader; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Iterator; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -30,12 +35,6 @@ import org.apache.hop.pipeline.transforms.jsoninput.JsonInputData; import org.apache.hop.pipeline.transforms.jsoninput.JsonInputMeta; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.Iterator; - public class InputsReader implements Iterable { private JsonInput transform; diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/RowOutputConverter.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/RowOutputConverter.java index 01298dd6abe..234101707c1 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/RowOutputConverter.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/reader/RowOutputConverter.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.jsoninput.reader; +import java.util.Map; import net.minidev.json.JSONObject; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -25,8 +26,6 @@ import org.apache.hop.core.row.RowDataUtil; import org.apache.hop.pipeline.transforms.jsoninput.JsonInputData; -import java.util.Map; - /** Converts raw reader to output row values */ public class RowOutputConverter { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/BaseFileOutputMeta.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/BaseFileOutputMeta.java index d1f92557161..a914b844fec 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/BaseFileOutputMeta.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/BaseFileOutputMeta.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.jsonoutput; +import java.text.SimpleDateFormat; +import java.util.Date; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.pipeline.transform.BaseTransformMeta; -import java.text.SimpleDateFormat; -import java.util.Date; - /** A base implementation for all output file based metas. */ public abstract class BaseFileOutputMeta
extends BaseTransformMeta { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutput.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutput.java index a23d72ffa54..68e26660765 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutput.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutput.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.jsonoutput; +import java.io.BufferedOutputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.Objects; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; @@ -34,11 +38,6 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import java.io.BufferedOutputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.util.Objects; - /** Converts input rows to one or more Xml files. */ public class JsonOutput extends BaseTransform { private static final Class PKG = JsonOutput.class; // For Translator diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputData.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputData.java index 1fbe3091fb4..d8d27511bb2 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputData.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputData.java @@ -17,18 +17,17 @@ package org.apache.hop.pipeline.transforms.jsonoutput; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - import java.io.Writer; import java.text.DateFormatSymbols; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; public class JsonOutputData extends BaseTransformData implements ITransformData { public IRowMeta inputRowMeta; diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputDialog.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputDialog.java index 1d9e815bb30..343a3d05b7c 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputDialog.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.jsonoutput; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -62,11 +66,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - public class JsonOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = JsonOutputMeta.class; // For Translator @@ -952,7 +951,8 @@ private void updateOperation() { wAddToResult.setEnabled(activeFile); wbShowFiles.setEnabled(activeFile); - boolean activeOutputValue = !Objects.equals(wOperation.getText(), JsonOutputMeta.OPERATION_TYPE_WRITE_TO_FILE); + boolean activeOutputValue = + !Objects.equals(wOperation.getText(), JsonOutputMeta.OPERATION_TYPE_WRITE_TO_FILE); wlOutputValue.setEnabled(activeOutputValue); wOutputValue.setEnabled(activeOutputValue); diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputField.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputField.java index cf8a0fea3fd..114cbaf40ab 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputField.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputField.java @@ -22,16 +22,15 @@ /** Describes a single field in an Json output file */ public class JsonOutputField implements Cloneable { @HopMetadataProperty( - key = "name", - injectionGroupKey = "FIELDS", - injectionKeyDescription = "JsonOutput.Injection.JSON_FIELDNAME" - ) + key = "name", + injectionGroupKey = "FIELDS", + injectionKeyDescription = "JsonOutput.Injection.JSON_FIELDNAME") private String fieldName; + @HopMetadataProperty( - key = "element", - injectionGroupKey = "FIELDS", - injectionKeyDescription = "JsonOutput.Injection.JSON_ELEMENTNAME" - ) + key = "element", + injectionGroupKey = "FIELDS", + injectionKeyDescription = "JsonOutput.Injection.JSON_ELEMENTNAME") private String elementName; public JsonOutputField( @@ -83,12 +82,16 @@ public void setFieldName(String fieldname) { this.fieldName = fieldname; } - /** @return Returns the elementName. */ + /** + * @return Returns the elementName. + */ public String getElementName() { return elementName; } - /** @param elementName The elementName to set. */ + /** + * @param elementName The elementName to set. + */ public void setElementName(String elementName) { this.elementName = elementName; } diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputMeta.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputMeta.java index b6b1ad7ac85..fdda407f7a8 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputMeta.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.jsonoutput; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -32,11 +36,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - /** This class knows how to handle the MetaData for the Json output transform */ @Transform( id = "JsonOutput", @@ -223,7 +222,7 @@ public void setDefault() { nrRowsInBloc = "1"; operationType = OPERATION_TYPE_WRITE_TO_FILE; extension = "json"; - doNotOpenNewFileInit=true; + doNotOpenNewFileInit = true; int nrFields = 0; for (int i = 0; i < nrFields; i++) { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/BaseFileOutputMeta.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/BaseFileOutputMeta.java index 4769fe755f6..73986678ab5 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/BaseFileOutputMeta.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/BaseFileOutputMeta.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.jsonoutputenhanced; +import java.text.SimpleDateFormat; +import java.util.Date; import org.apache.hop.core.injection.Injection; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; import org.apache.hop.pipeline.transform.BaseTransformMeta; -import java.text.SimpleDateFormat; -import java.util.Date; - /** A base implementation for all output file based metas. */ public abstract class BaseFileOutputMeta
extends BaseTransformMeta { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutput.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutput.java index 5faf5474d28..27c61247bbe 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutput.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutput.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.jsonoutputenhanced; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -43,11 +48,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; public class JsonOutput extends BaseTransform { private static final Class PKG = @@ -127,9 +127,9 @@ public boolean processRow() throws HopException { public void manageRowItems(Object[] row) throws HopException { ObjectNode itemNode; - + boolean sameGroup = sameGroup(prevRow, row); - + if (meta.isUseSingleItemPerGroup()) { /* * If grouped rows are forced to produce a single item, reuse the same itemNode as long as the @@ -138,9 +138,9 @@ public void manageRowItems(Object[] row) throws HopException { if (!sameGroup || currentNode == null) { currentNode = new ObjectNode(nc); } - + itemNode = currentNode; - + } else { // Create a new object with specified fields itemNode = new ObjectNode(nc); @@ -158,7 +158,7 @@ public void manageRowItems(Object[] row) throws HopException { String jsonAttributeName = getJsonAttributeName(outputField); boolean putBlank = !outputField.isRemoveIfBlank(); - + /* * Prepare the array node to collect all values of a field inside a group into an array. Skip * fields appearing in the grouped fields since they are always unique per group. @@ -170,7 +170,8 @@ public void manageRowItems(Object[] row) throws HopException { } else { arNode = (ArrayNode) itemNode.get(jsonAttributeName); } - // In case whe have an array to store data, the flag to remove blanks is effectivly deactivated. + // In case whe have an array to store data, the flag to remove blanks is effectivly + // deactivated. putBlank = false; } @@ -271,7 +272,7 @@ public void manageRowItems(Object[] row) throws HopException { if (!meta.isUseSingleItemPerGroup() || data.jsonKeyGroupItems.size() == 0) { data.jsonKeyGroupItems.add(itemNode); } - + prevRow = data.inputRowMeta.cloneRow(row); // copy the row to previous data.nrRow++; @@ -418,9 +419,15 @@ private void serializeJson(List jsonItemsList) { try { if (meta.getJsonBloc() != null && meta.getJsonBloc().length() > 0) { // TBD Try to understand if this can have a performance impact and do it better... - theNode.set(meta.getJsonBloc(), - mapper.readTree(mapper.writeValueAsString(jsonItemsList.size() > 1 ? jsonItemsList - : (!meta.isUseArrayWithSingleInstance() ? jsonItemsList.get(0) : jsonItemsList)))); + theNode.set( + meta.getJsonBloc(), + mapper.readTree( + mapper.writeValueAsString( + jsonItemsList.size() > 1 + ? jsonItemsList + : (!meta.isUseArrayWithSingleInstance() + ? jsonItemsList.get(0) + : jsonItemsList)))); if (meta.isJsonPrittified()) { data.jsonSerialized = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(theNode); } else { @@ -507,7 +514,7 @@ private void initDataFieldsPositionsArray() throws HopException { throw new HopException(BaseMessages.getString(PKG, "JsonOutput.Exception.FieldNotFound")); JsonOutputField field = meta.getOutputFields()[i]; field.setElementName(variables.resolve(field.getElementName())); - + /* * Mark all output fields that are part of the group key fields. This way we can avoid * collecting unique values of each group inside an array. Feature #3287 @@ -548,8 +555,7 @@ public void dispose() { } private void createParentFolder(String filename) throws HopTransformException { - if (!meta.isCreateParentFolder()) - return; + if (!meta.isCreateParentFolder()) return; // Check for parent folder FileObject parentfolder = null; try { @@ -583,8 +589,7 @@ private void createParentFolder(String filename) throws HopTransformException { public boolean openNewFile() { - if (data.writer != null) - return true; + if (data.writer != null) return true; boolean retval = false; try { @@ -634,8 +639,7 @@ public String buildFilename() { } private boolean closeFile() { - if (data.writer == null) - return true; + if (data.writer == null) return true; boolean retval = false; try { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputData.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputData.java index 493227acf5b..6f357ae43a7 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputData.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputData.java @@ -18,13 +18,12 @@ package org.apache.hop.pipeline.transforms.jsonoutputenhanced; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.Writer; import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class JsonOutputData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputDialog.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputDialog.java index 8d8883ce2d8..8b1f00fc309 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputDialog.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.jsonoutputenhanced; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -63,10 +66,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class JsonOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = JsonOutputMeta.class; // needed by Translator!! @@ -570,7 +569,7 @@ public void widgetSelected(SelectionEvent e) { input.setChanged(); } }); - + Label wlUseSingleItemPerGroup = new Label(wSettings, SWT.RIGHT); wlUseSingleItemPerGroup.setText( BaseMessages.getString(PKG, "JsonOutputDialog.UseSingleItemPerGroup.Label")); @@ -586,8 +585,7 @@ public void widgetSelected(SelectionEvent e) { PropsUi.setLook(wUseSingleItemPerGroup); FormData fdUseSingleItemPerGroup = new FormData(); fdUseSingleItemPerGroup.left = new FormAttachment(middle, 0); - fdUseSingleItemPerGroup.top = - new FormAttachment(wlUseSingleItemPerGroup, 0, SWT.CENTER); + fdUseSingleItemPerGroup.top = new FormAttachment(wlUseSingleItemPerGroup, 0, SWT.CENTER); fdUseSingleItemPerGroup.right = new FormAttachment(100, 0); wUseSingleItemPerGroup.setLayoutData(fdUseSingleItemPerGroup); wUseSingleItemPerGroup.addSelectionListener( @@ -960,7 +958,7 @@ private void createExtensionLine(ModifyListener lsMod, int middle, int margin) { new FocusListener() { @Override public void focusLost(FocusEvent e) { - //Ignore event + // Ignore event } @Override diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputField.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputField.java index 17c36987e1f..23c6ef78d93 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputField.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputField.java @@ -35,7 +35,7 @@ public class JsonOutputField implements Cloneable { @Injection(name = "JSON_REMOVEIFBLANK", group = "FIELDS") private boolean removeIfBlank; - + public boolean isKeyField; public boolean isJSONFragment() { diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java index 0a8768d76f6..00770e8426c 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.jsonoutputenhanced; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,8 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "EnhancedJsonOutput", image = "JSO.svg", @@ -357,9 +356,7 @@ private void readData(Node transformnode) throws HopXmlException { .equalsIgnoreCase( XmlHandler.getTagValue(transformnode, "use_arrays_with_single_instance")); useSingleItemPerGroup = - "Y" - .equalsIgnoreCase( - XmlHandler.getTagValue(transformnode, "use_single_item_per_group")); + "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformnode, "use_single_item_per_group")); jsonPrittified = "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformnode, "json_prittified")); @@ -504,9 +501,8 @@ public String getXml() { .append( XmlHandler.addTagValue("use_arrays_with_single_instance", useArrayWithSingleInstance)); retval - .append(" ") - .append( - XmlHandler.addTagValue("use_single_item_per_group", useSingleItemPerGroup)); + .append(" ") + .append(XmlHandler.addTagValue("use_single_item_per_group", useSingleItemPerGroup)); retval.append(" ").append(XmlHandler.addTagValue("json_prittified", jsonPrittified)); retval.append(" ").append(XmlHandler.addTagValue("encoding", encoding)); retval.append(" ").append(XmlHandler.addTagValue("addtoresult", addToResult)); diff --git a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/types/JsonExplorerFileType.java b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/types/JsonExplorerFileType.java index 4320f471cef..1074cda80a4 100644 --- a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/types/JsonExplorerFileType.java +++ b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/types/JsonExplorerFileType.java @@ -46,9 +46,9 @@ public JsonExplorerFileType() { new String[] {"JSON files"}, FileTypeCapabilities.getCapabilities( IHopFileType.CAPABILITY_SAVE, - IHopFileType.CAPABILITY_CLOSE, + IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY, - IHopFileType.CAPABILITY_COPY, + IHopFileType.CAPABILITY_COPY, IHopFileType.CAPABILITY_SELECT)); } diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/TestUtilities.java b/plugins/transforms/json/src/test/java/org/apache/hop/TestUtilities.java index 7dd165ded24..94ba8722d2e 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/TestUtilities.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/TestUtilities.java @@ -17,6 +17,17 @@ package org.apache.hop; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import junit.framework.ComparisonFailure; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopValueException; @@ -34,18 +45,6 @@ import org.apache.hop.pipeline.transforms.injector.InjectorMeta; import org.apache.hop.pipeline.transforms.sort.SortRowsMeta; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - public class TestUtilities { private static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; @@ -390,8 +389,7 @@ public static String getStringFromInput(InputStream in) throws IOException { public static Pipeline loadAndRunPipeline(String path, Object... parameters) throws Exception { PipelineMeta pipelineMeta = - new PipelineMeta( - path, new MemoryMetadataProvider(), Variables.getADefaultVariableSpace()); + new PipelineMeta(path, new MemoryMetadataProvider(), Variables.getADefaultVariableSpace()); Pipeline trans = new LocalPipelineEngine(pipelineMeta); if (parameters != null) { diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/TransformRowsCollector.java b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/TransformRowsCollector.java index c7f1d1e638a..293ba011950 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/TransformRowsCollector.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/TransformRowsCollector.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.ArrayList; -import java.util.List; - /** * Helper class for testcases. You can add an instance of this class to a transform to read all of * the Rows the transform read or wrote. diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaLoadSaveTest.java b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaLoadSaveTest.java index 281a72b51ea..186751164cf 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaLoadSaveTest.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaLoadSaveTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.jsoninput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.transform.ITransformMeta; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -26,13 +32,6 @@ import org.apache.hop.pipeline.transforms.loadsave.validator.StringLoadSaveValidator; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class JsonInputMetaLoadSaveTest implements IInitializer { static final int FILE_COUNT = new Random().nextInt(20) + 1; @@ -100,13 +99,7 @@ public void testLoadSave() throws HopException { LoadSaveTester tester = new LoadSaveTester( - JsonInputMeta.class, - attributes, - getterMap, - setterMap, - attributesMap, - typeMap, - this); + JsonInputMeta.class, attributes, getterMap, setterMap, attributesMap, typeMap, this); tester.testSerialization(); } diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaTest.java b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaTest.java index 62d31dfb5ea..bdb1fe2902f 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaTest.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.jsoninput; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.regex.Pattern; +import java.util.stream.Collectors; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopXmlException; import org.apache.hop.core.row.IRowMeta; @@ -32,15 +40,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class JsonInputMetaTest { public static final String DATA = "data"; diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputTest.java b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputTest.java index f13c607d9e6..a42c047c39e 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputTest.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputTest.java @@ -17,8 +17,27 @@ package org.apache.hop.pipeline.transforms.jsoninput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import junit.framework.ComparisonFailure; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; @@ -53,26 +72,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class JsonInputTest { protected static final String BASE_RAM_DIR = "ram:///jsonInputTest/"; diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReaderTest.java b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReaderTest.java index 6065392d7a1..6b346bd2b59 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReaderTest.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsoninput/reader/FastJsonReaderTest.java @@ -17,7 +17,16 @@ package org.apache.hop.pipeline.transforms.jsoninput.reader; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + import com.jayway.jsonpath.Option; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumSet; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.pipeline.transforms.jsoninput.JsonInputField; @@ -25,16 +34,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.EnumSet; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; - public class FastJsonReaderTest { private static final Option[] DEFAULT_OPTIONS = { Option.SUPPRESS_EXCEPTIONS, Option.ALWAYS_RETURN_LIST, Option.DEFAULT_PATH_LEAF_TO_NULL @@ -102,16 +101,15 @@ public void testFastJsonReaderGetMaxRowSize() throws HopException { List l1 = new ArrayList<>(); List l2 = new ArrayList<>(); List l3 = new ArrayList<>(); - l1.add( 1 ); - l2.add( 1 ); - l2.add( 2 ); - l3.add( 1 ); - l3.add( 2 ); - l3.add( 3 ); - mainList.add( l1 ); - mainList.add( l2 ); - mainList.add( l3 ); - assertEquals( 3, FastJsonReader.getMaxRowSize( Collections.singletonList( mainList ) ) ); + l1.add(1); + l2.add(1); + l2.add(2); + l3.add(1); + l3.add(2); + l3.add(3); + mainList.add(l1); + mainList.add(l2); + mainList.add(l3); + assertEquals(3, FastJsonReader.getMaxRowSize(Collections.singletonList(mainList))); } - } diff --git a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputTest.java b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputTest.java index 8aea7ae9d02..fb692c0f4d7 100644 --- a/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputTest.java +++ b/plugins/transforms/json/src/test/java/org/apache/hop/pipeline/transforms/jsonoutput/JsonOutputTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.jsonoutput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; @@ -52,15 +62,6 @@ import org.apache.hop.pipeline.transforms.rowgenerator.RowGeneratorMeta; import org.json.simple.JSONObject; import org.junit.Assert; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.anyString; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; public class JsonOutputTest extends TestCase { diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInput.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInput.java index dea3a92d16f..b1866816f50 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInput.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInput.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.kafka.consumer; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Properties; +import java.util.Set; +import java.util.stream.Collectors; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Result; @@ -43,12 +48,6 @@ import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.common.errors.WakeupException; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Properties; -import java.util.Set; -import java.util.stream.Collectors; - /** Consume messages from a Kafka topic */ public class KafkaConsumerInput extends BaseTransform { @@ -56,12 +55,12 @@ public class KafkaConsumerInput private static final Class PKG = KafkaConsumerInputMeta.class; // For Translator public KafkaConsumerInput( - TransformMeta transformMeta, - KafkaConsumerInputMeta meta, - KafkaConsumerInputData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline) { + TransformMeta transformMeta, + KafkaConsumerInputMeta meta, + KafkaConsumerInputData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); } @@ -80,7 +79,7 @@ public boolean init() { log.logError("Error determining output row metadata", e); } - data.incomingRowsBuffer= new ArrayList<>(); + data.incomingRowsBuffer = new ArrayList<>(); data.batchDuration = Const.toInt(resolve(meta.getBatchDuration()), 0); data.batchSize = Const.toInt(resolve(meta.getBatchSize()), 0); @@ -116,7 +115,7 @@ private void initSubPipeline() throws HopException { logDetailed("Loaded sub-pipeline '" + realFilename + "'"); LocalPipelineEngine kafkaPipeline = - new LocalPipelineEngine(subTransMeta, this, getPipeline()); + new LocalPipelineEngine(subTransMeta, this, getPipeline()); kafkaPipeline.prepareExecution(); kafkaPipeline.setLogLevel(getPipeline().getLogLevel()); kafkaPipeline.setPreviousResult(new Result()); @@ -133,9 +132,9 @@ private void initSubPipeline() throws HopException { if (iTransform instanceof InjectorMeta) { if (data.rowProducer != null) { throw new HopException( - "You can only have one copy of the injector transform '" - + transformMeta.getName() - + "' to accept the Kafka messages"); + "You can only have one copy of the injector transform '" + + transformMeta.getName() + + "' to accept the Kafka messages"); } // Attach an injector to this transform // @@ -145,7 +144,7 @@ private void initSubPipeline() throws HopException { if (data.rowProducer == null) { throw new HopException( - "Unable to find an Injector transform in the Kafka pipeline. Such a transform is needed to accept data from this Kafka Consumer transform."); + "Unable to find an Injector transform in the Kafka pipeline. Such a transform is needed to accept data from this Kafka Consumer transform."); } // See if we need to grab result records from the sub-pipeline... @@ -154,19 +153,19 @@ private void initSubPipeline() throws HopException { ITransform transform = kafkaPipeline.findRunThread(meta.getSubTransform()); if (transform == null) { throw new HopException( - "Unable to find transform '" + meta.getSubTransform() + "' to retrieve rows from"); + "Unable to find transform '" + meta.getSubTransform() + "' to retrieve rows from"); } transform.addRowListener( - new RowAdapter() { - - @Override - public void rowWrittenEvent(IRowMeta rowMeta, Object[] row) - throws HopTransformException { - // Write this row to the next transform(s) - // - KafkaConsumerInput.this.putRow(rowMeta, row); - } - }); + new RowAdapter() { + + @Override + public void rowWrittenEvent(IRowMeta rowMeta, Object[] row) + throws HopTransformException { + // Write this row to the next transform(s) + // + KafkaConsumerInput.this.putRow(rowMeta, row); + } + }); } kafkaPipeline.setLogChannel(getLogChannel()); kafkaPipeline.startThreads(); @@ -218,11 +217,11 @@ public static Consumer buildKafkaConsumer(IVariables variables, KafkaConsumerInp // The basics // config.put( - ConsumerConfig.GROUP_ID_CONFIG, - variables.resolve(Const.NVL(meta.getConsumerGroup(), "Apache Hop"))); + ConsumerConfig.GROUP_ID_CONFIG, + variables.resolve(Const.NVL(meta.getConsumerGroup(), "Apache Hop"))); config.put( - ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, - variables.resolve(meta.getDirectBootstrapServers())); + ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, + variables.resolve(meta.getDirectBootstrapServers())); config.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, meta.isAutoCommit()); // Timeout : max batch wait @@ -244,7 +243,7 @@ public static Consumer buildKafkaConsumer(IVariables variables, KafkaConsumerInp String keySerializerClass = meta.getKeyField().getOutputType().getKafkaDeserializerClass(); config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, keySerializerClass); String valueSerializerClass = - meta.getMessageField().getOutputType().getKafkaDeserializerClass(); + meta.getMessageField().getOutputType().getKafkaDeserializerClass(); config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, valueSerializerClass); // Other options? @@ -266,9 +265,9 @@ public boolean processRow() throws HopException { // If we get any, process them... // try { - Duration duration = Duration.ofMillis(data.batchDuration > 0 ? data.batchDuration : Long.MAX_VALUE); - ConsumerRecords records = - data.consumer.poll(duration); + Duration duration = + Duration.ofMillis(data.batchDuration > 0 ? data.batchDuration : Long.MAX_VALUE); + ConsumerRecords records = data.consumer.poll(duration); if (!data.isKafkaConsumerClosing) { if (records.isEmpty()) { @@ -297,7 +296,8 @@ public boolean processRow() throws HopException { if (data.executor.getErrors() > 0 && errorHandlingConditionIsSatisfied()) { // If error handling is enabled return record that generates error in subpipeline // For future improvements in managing rows that generates error in sub pipeline - // loop through the lines of the collected lines buffer even if we assume to have only one line + // loop through the lines of the collected lines buffer even if we assume to have only + // one line // in the buffer for (int i = 0; i < data.incomingRowsBuffer.size(); i++) { putError( @@ -317,7 +317,8 @@ public boolean processRow() throws HopException { } } - // Confirm everything is processed. In case error handling is enabled, this is valid too because it helps in + // Confirm everything is processed. In case error handling is enabled, this is valid too + // because it helps in // "removing" failing items from the kafka queue // data.consumer.commitAsync(); @@ -355,7 +356,7 @@ public boolean processRow() throws HopException { return true; } - private boolean errorHandlingConditionIsSatisfied () { + private boolean errorHandlingConditionIsSatisfied() { // Added a check to be sure that lines collecting for error handling is limited // to the case of batchSize = 1. return getTransformMeta().isDoingErrorHandling() && data.batchSize == 1; diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputData.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputData.java index f32a6543aa9..63b544a7943 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputData.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputData.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.kafka.consumer; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.RowProducer; import org.apache.hop.pipeline.SingleThreadedPipelineExecutor; @@ -24,8 +25,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.kafka.clients.consumer.Consumer; -import java.util.List; - public class KafkaConsumerInputData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public Consumer consumer; @@ -36,7 +35,6 @@ public class KafkaConsumerInputData extends BaseTransformData implements ITransf public boolean isKafkaConsumerClosing; public List incomingRowsBuffer; - /** */ public KafkaConsumerInputData() { super(); diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputDialog.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputDialog.java index 60434b64857..80779a33fa1 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputDialog.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputDialog.java @@ -17,7 +17,14 @@ package org.apache.hop.pipeline.transforms.kafka.consumer; +import static java.util.Optional.ofNullable; + import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -70,14 +77,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import static java.util.Optional.ofNullable; - public class KafkaConsumerInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = KafkaConsumerInputDialog.class; // For Translator @@ -383,7 +382,7 @@ protected void buildSetup(Composite wSetupComp) { wlConsumerGroup.setText(BaseMessages.getString(PKG, "KafkaConsumerInputDialog.ConsumerGroup")); FormData fdlConsumerGroup = new FormData(); fdlConsumerGroup.left = new FormAttachment(0, 0); - fdlConsumerGroup.top = new FormAttachment(wConsumerGroup, 0, SWT.CENTER); + fdlConsumerGroup.top = new FormAttachment(wConsumerGroup, 0, SWT.CENTER); fdlConsumerGroup.right = new FormAttachment(middle, -margin); wlConsumerGroup.setLayoutData(fdlConsumerGroup); fdConsumerGroup.left = new FormAttachment(wlConsumerGroup, margin); diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputMeta.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputMeta.java index 29fca433cda..4e524022651 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputMeta.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerInputMeta.java @@ -18,6 +18,14 @@ package org.apache.hop.pipeline.transforms.kafka.consumer; import com.google.common.base.Preconditions; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -46,15 +54,6 @@ import org.apache.hop.pipeline.transforms.pipelineexecutor.PipelineExecutorMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - @Transform( id = "KafkaConsumer", image = "KafkaConsumerInput.svg", diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputData.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputData.java index 5af31bb35d9..6fd7f5ebf87 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputData.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputData.java @@ -23,9 +23,9 @@ import org.apache.kafka.clients.producer.Producer; public class KafkaProducerOutputData extends BaseTransformData implements ITransformData { - public IValueMeta keyValueMeta; - public IValueMeta msgValueMeta; - public Producer kafkaProducer; + public IValueMeta keyValueMeta; + public IValueMeta msgValueMeta; + public Producer kafkaProducer; public int keyFieldIndex; public int messageFieldIndex; public boolean isOpen; diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputDialog.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputDialog.java index 0b2cba1505b..3e5befbc0a8 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputDialog.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputDialog.java @@ -18,6 +18,10 @@ package org.apache.hop.pipeline.transforms.kafka.producer; import com.google.common.collect.ImmutableMap; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopTransformException; @@ -56,11 +60,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - public class KafkaProducerOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = KafkaProducerOutputMeta.class; // For Translator @@ -439,13 +438,13 @@ private boolean checkIfFieldExists(String fieldName) { boolean fieldFound = false; try { IRowMeta r = pipelineMeta.getPrevTransformFields(variables, transformName); - String[] fieldNames = r.getFieldNames(); - for (int count = 0; count < fieldNames.length; count++) { - if (fieldName.equals(fieldNames[count])) { - fieldFound = true; - break; - } + String[] fieldNames = r.getFieldNames(); + for (int count = 0; count < fieldNames.length; count++) { + if (fieldName.equals(fieldNames[count])) { + fieldFound = true; + break; } + } } catch (HopTransformException ke) { new ErrorDialog( shell, diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputMeta.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputMeta.java index 4d6563cebe6..90b41d425b3 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputMeta.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/producer/KafkaProducerOutputMeta.java @@ -18,6 +18,12 @@ package org.apache.hop.pipeline.transforms.kafka.producer; import com.google.common.base.Preconditions; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.injection.Injection; @@ -30,13 +36,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - @Transform( id = "KafkaProducerOutput", image = "KafkaProducerOutput.svg", @@ -48,7 +47,8 @@ @InjectionSupported( localizationPrefix = "KafkaProducerOutputMeta.Injection.", groups = {"CONFIGURATION_PROPERTIES"}) -public class KafkaProducerOutputMeta extends BaseTransformMeta { +public class KafkaProducerOutputMeta + extends BaseTransformMeta { public static final String DIRECT_BOOTSTRAP_SERVERS = "directBootstrapServers"; public static final String CLIENT_ID = "clientId"; diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaDialogHelper.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaDialogHelper.java index 9ce298842f4..0fbc7f3bb18 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaDialogHelper.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaDialogHelper.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.kafka.shared; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.logging.LogChannel; @@ -39,18 +50,6 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.TableItem; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; -import java.util.stream.Stream; - public class KafkaDialogHelper { private IVariables variables; private KafkaFactory kafkaFactory; @@ -83,7 +82,10 @@ public void clusterNameChanged(Event event) { Map config = getConfig(optionsTable); CompletableFuture.supplyAsync(() -> listTopics(directBootstrapServers, config)) .thenAccept( - topicMap -> HopGui.getInstance().getDisplay().syncExec(() -> populateTopics(topicMap, current))); + topicMap -> + HopGui.getInstance() + .getDisplay() + .syncExec(() -> populateTopics(topicMap, current))); } private void populateTopics(Map> topicMap, String current) { @@ -131,10 +133,10 @@ public static void populateFieldsList( comboVar.setText(current); try { IRowMeta rmi = pipelineMeta.getPrevTransformFields(variables, transformName); - for (int i = 0; i < rmi.size(); i++) { - IValueMeta vmb = rmi.getValueMeta(i); - comboVar.add(vmb.getName()); - } + for (int i = 0; i < rmi.size(); i++) { + IValueMeta vmb = rmi.getValueMeta(i); + comboVar.add(vmb.getName()); + } } catch (HopTransformException ex) { // do nothing LogChannel.UI.logError("Error getting fields", ex); diff --git a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaFactory.java b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaFactory.java index 3048e99ea91..69bdce3a9b3 100644 --- a/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaFactory.java +++ b/plugins/transforms/kafka/src/main/java/org/apache/hop/pipeline/transforms/kafka/shared/KafkaFactory.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.kafka.shared; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; import org.apache.hop.pipeline.transforms.kafka.consumer.KafkaConsumerField; import org.apache.hop.pipeline.transforms.kafka.consumer.KafkaConsumerInputMeta; import org.apache.hop.pipeline.transforms.kafka.producer.KafkaProducerOutputMeta; @@ -27,10 +30,6 @@ import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerConfig; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - public class KafkaFactory { private Function, Consumer> consumerFunction; private Function, Producer> producerFunction; diff --git a/plugins/transforms/kafka/src/test/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerFieldTest.java b/plugins/transforms/kafka/src/test/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerFieldTest.java index fd601136e75..7105ab19637 100644 --- a/plugins/transforms/kafka/src/test/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerFieldTest.java +++ b/plugins/transforms/kafka/src/test/java/org/apache/hop/pipeline/transforms/kafka/consumer/KafkaConsumerFieldTest.java @@ -17,16 +17,16 @@ package org.apache.hop.pipeline.transforms.kafka.consumer; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.when; + import org.apache.hop.core.row.IValueMeta; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class KafkaConsumerFieldTest { KafkaConsumerField field; diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnection.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnection.java index 655b49b2f99..7e271038cde 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnection.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnection.java @@ -16,17 +16,12 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.core.row.value.ValueMetaFactory; -import org.apache.hop.core.util.StringUtil; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.i18n.BaseMessages; - +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.naming.NameClassPair; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; @@ -42,12 +37,16 @@ import javax.naming.ldap.PagedResultsControl; import javax.naming.ldap.PagedResultsResponseControl; import javax.naming.ldap.SortControl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.core.row.value.ValueMetaFactory; +import org.apache.hop.core.util.StringUtil; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.i18n.BaseMessages; public class LdapConnection { private static Class classFromResourcesPackage = LdapInputMeta.class; // For Translator diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInput.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInput.java index 74a6aeaaf30..3375bc9aecd 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInput.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInput.java @@ -16,6 +16,9 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.HashSet; +import javax.naming.NamingEnumeration; +import javax.naming.directory.Attribute; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.exception.HopException; @@ -30,10 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import javax.naming.NamingEnumeration; -import javax.naming.directory.Attribute; -import java.util.HashSet; - /** Read LDAP Host, convert them to rows and writes these to one or more output streams. */ public class LdapInput extends BaseTransform { private static final Class PKG = LdapInputMeta.class; // For Translator diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputData.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputData.java index 9ff9650922a..7d059be8e06 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputData.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputData.java @@ -16,13 +16,12 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.HashSet; +import javax.naming.directory.Attributes; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import javax.naming.directory.Attributes; -import java.util.HashSet; - public class LdapInputData extends BaseTransformData implements ITransformData { public String thisline; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputDialog.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputDialog.java index c98932c5660..53f89b219e1 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputDialog.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputDialog.java @@ -1496,7 +1496,6 @@ private void getInfo(LdapInputMeta in) throws HopException { field.setRepeated( BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(13))); - in.getInputFields()[i] = field; } in.setSearchScope(LdapInputMeta.getSearchScopeByDesc(wSearchScope.getText())); diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputField.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputField.java index fe9287b3e15..76c1eefc649 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputField.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputField.java @@ -16,13 +16,12 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.HashSet; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; import org.apache.hop.core.util.Utils; import org.apache.hop.i18n.BaseMessages; -import java.util.HashSet; - /** Describes an LDAP Input */ public class LdapInputField implements Cloneable { private static final Class PKG = LdapInputMeta.class; // For Translator diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMeta.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMeta.java index 7bb61f29157..11a164b12ae 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMeta.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMeta.java @@ -16,6 +16,7 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,8 +39,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "LDAPInput", name = "i18n::LdapInput.Name", @@ -48,7 +47,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", keywords = "i18n::LdapInputMeta.keyword", documentationUrl = "/pipeline/transforms/ldapinput.html") -public class LdapInputMeta extends BaseTransformMeta implements ILdapMeta { +public class LdapInputMeta extends BaseTransformMeta + implements ILdapMeta { private static final Class PKG = LdapInputMeta.class; // For Translator /** Flag indicating that we use authentication for connection */ @@ -131,92 +131,126 @@ public LdapInputMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the input useCertificate. */ + /** + * @return Returns the input useCertificate. + */ @Override public boolean isUseCertificate() { return useCertificate; } - /** @return Returns the useCertificate. */ + /** + * @return Returns the useCertificate. + */ public void setUseCertificate(boolean value) { this.useCertificate = value; } - /** @return Returns the input trustAllCertificates. */ + /** + * @return Returns the input trustAllCertificates. + */ @Override public boolean isTrustAllCertificates() { return trustAllCertificates; } - /** @return Returns the input trustAllCertificates. */ + /** + * @return Returns the input trustAllCertificates. + */ public void setTrustAllCertificates(boolean value) { this.trustAllCertificates = value; } - /** @return Returns the trustStorePath. */ + /** + * @return Returns the trustStorePath. + */ @Override public String getTrustStorePassword() { return trustStorePassword; } - /** @param value the trustStorePassword to set. */ + /** + * @param value the trustStorePassword to set. + */ public void setTrustStorePassword(String value) { this.trustStorePassword = value; } - /** @return Returns the trustStorePath. */ + /** + * @return Returns the trustStorePath. + */ @Override public String getTrustStorePath() { return trustStorePath; } - /** @param value the trustStorePath to set. */ + /** + * @param value the trustStorePath to set. + */ public void setTrustStorePath(String value) { this.trustStorePath = value; } - /** @return Returns the protocol. */ + /** + * @return Returns the protocol. + */ @Override public String getProtocol() { return protocol; } - /** @param value the protocol to set. */ + /** + * @param value the protocol to set. + */ public void setProtocol(String value) { this.protocol = value; } - /** @return Returns the input dynamicSearch. */ + /** + * @return Returns the input dynamicSearch. + */ public boolean isDynamicSearch() { return dynamicSearch; } - /** @return Returns the input dynamicSearch. */ + /** + * @return Returns the input dynamicSearch. + */ public void setDynamicSearch(boolean dynamicSearch) { this.dynamicSearch = dynamicSearch; } - /** @return Returns the input dynamicSeachFieldName. */ + /** + * @return Returns the input dynamicSeachFieldName. + */ public String getDynamicSearchFieldName() { return dynamicSeachFieldName; } - /** @return Returns the input dynamicSeachFieldName. */ + /** + * @return Returns the input dynamicSeachFieldName. + */ public void setDynamicSearchFieldName(String dynamicSeachFieldName) { this.dynamicSeachFieldName = dynamicSeachFieldName; } - /** @return Returns the input dynamicFilter. */ + /** + * @return Returns the input dynamicFilter. + */ public boolean isDynamicFilter() { return dynamicFilter; } - /** @param dynamicFilter the dynamicFilter to set. */ + /** + * @param dynamicFilter the dynamicFilter to set. + */ public void setDynamicFilter(boolean dynamicFilter) { this.dynamicFilter = dynamicFilter; } - /** @return Returns the input dynamicFilterFieldName. */ + /** + * @return Returns the input dynamicFilterFieldName. + */ public String getDynamicFilterFieldName() { return dynamicFilterFieldName; } @@ -226,154 +260,214 @@ public void setDynamicFilterFieldName(String dynamicFilterFieldName) { this.dynamicFilterFieldName = dynamicFilterFieldName; } - /** @return Returns the input useAuthentication. */ + /** + * @return Returns the input useAuthentication. + */ public boolean isUseAuthentication() { return useAuthentication; } - /** @param useAuthentication The useAuthentication to set. */ + /** + * @param useAuthentication The useAuthentication to set. + */ public void setUseAuthentication(boolean useAuthentication) { this.useAuthentication = useAuthentication; } - /** @return Returns the input usePaging. */ + /** + * @return Returns the input usePaging. + */ public boolean isPaging() { return usePaging; } - /** @param usePaging The usePaging to set. */ + /** + * @param usePaging The usePaging to set. + */ public void setPaging(boolean usePaging) { this.usePaging = usePaging; } - /** @return Returns the input fields. */ + /** + * @return Returns the input fields. + */ public LdapInputField[] getInputFields() { return inputFields; } - /** @param inputFields The input fields to set. */ + /** + * @param inputFields The input fields to set. + */ public void setInputFields(LdapInputField[] inputFields) { this.inputFields = inputFields; } - /** @return Returns the includeRowNumber. */ + /** + * @return Returns the includeRowNumber. + */ public boolean isIncludeRowNumber() { return includeRowNumber; } - /** @param includeRowNumber The includeRowNumber to set. */ + /** + * @param includeRowNumber The includeRowNumber to set. + */ public void setIncludeRowNumber(boolean includeRowNumber) { this.includeRowNumber = includeRowNumber; } - /** @return Returns the host name. */ + /** + * @return Returns the host name. + */ @Override public String getHost() { return host; } - /** @param host The host to set. */ + /** + * @param host The host to set. + */ public void setHost(String host) { this.host = host; } - /** @return Returns the user name. */ + /** + * @return Returns the user name. + */ public String getUserName() { return userName; } - /** @param userName The username to set. */ + /** + * @param userName The username to set. + */ public void setUserName(String userName) { this.userName = userName; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } - /** @return Returns the Port. */ + /** + * @return Returns the Port. + */ @Override public String getPort() { return port; } - /** @param port The port to set. */ + /** + * @param port The port to set. + */ public void setPort(String port) { this.port = port; } - /** @return Returns the filter string. */ + /** + * @return Returns the filter string. + */ public String getFilterString() { return filterString; } - /** @param filterString The filter string to set. */ + /** + * @param filterString The filter string to set. + */ public void setFilterString(String filterString) { this.filterString = filterString; } - /** @return Returns the search string. */ + /** + * @return Returns the search string. + */ public String getSearchBase() { return searchBase; } - /** @param searchBase The filter Search Base to set. */ + /** + * @param searchBase The filter Search Base to set. + */ public void setSearchBase(String searchBase) { this.searchBase = searchBase; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public int getRowLimit() { return rowLimit; } - /** @param timeLimit The timeout time limit to set. */ + /** + * @param timeLimit The timeout time limit to set. + */ public void setTimeLimit(int timeLimit) { this.timeLimit = timeLimit; } - /** @return Returns the time limit. */ + /** + * @return Returns the time limit. + */ public int getTimeLimit() { return timeLimit; } - /** @param multiValuedSeparator The multi-valued separator filed. */ + /** + * @param multiValuedSeparator The multi-valued separator filed. + */ public void setMultiValuedSeparator(String multiValuedSeparator) { this.multiValuedSeparator = multiValuedSeparator; } - /** @return Returns the multi valued separator. */ + /** + * @return Returns the multi valued separator. + */ public String getMultiValuedSeparator() { return multiValuedSeparator; } - /** @param pagesize The pagesize. */ + /** + * @param pagesize The pagesize. + */ public void setPageSize(String pagesize) { this.pagesize = pagesize; } - /** @return Returns the pagesize. */ + /** + * @return Returns the pagesize. + */ public String getPageSize() { return pagesize; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(int rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the rowNumberField. */ + /** + * @return Returns the rowNumberField. + */ public String getRowNumberField() { return rowNumberField; } - /** @param rowNumberField The rowNumberField to set. */ + /** + * @param rowNumberField The rowNumberField to set. + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocol.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocol.java index c45c7a5d376..62898fd64ce 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocol.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocol.java @@ -16,6 +16,14 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.Collection; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; @@ -23,15 +31,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.ldap.InitialLdapContext; -import java.util.Collection; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Map; -import java.util.Set; - /** Class encapsulating Ldap protocol configuration */ public class LdapProtocol { diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactory.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactory.java index 9096099ac24..8d8a9481ec6 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactory.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactory.java @@ -16,13 +16,12 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.logging.ILogChannel; -import org.apache.hop.core.variables.IVariables; - import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.logging.ILogChannel; +import org.apache.hop.core.variables.IVariables; public class LdapProtocolFactory { protected static final List> protocols = initProtocols(); diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapSslProtocol.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapSslProtocol.java index 7079ff0d6e0..bbfcde8b985 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapSslProtocol.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapSslProtocol.java @@ -16,15 +16,14 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.Collection; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.truststore.CustomSocketFactory; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; -import java.util.Collection; -import java.util.Map; - public class LdapSslProtocol extends LdapProtocol { private final boolean trustAllCertificates; diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapTlsProtocol.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapTlsProtocol.java index 934535e548a..0d18752120e 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapTlsProtocol.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapinput/LdapTlsProtocol.java @@ -16,18 +16,17 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.io.IOException; +import java.util.Collection; +import java.util.Map; +import javax.naming.NamingException; +import javax.naming.ldap.StartTlsRequest; +import javax.naming.ldap.StartTlsResponse; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.truststore.CustomSocketFactory; import org.apache.hop.core.variables.IVariables; -import javax.naming.NamingException; -import javax.naming.ldap.StartTlsRequest; -import javax.naming.ldap.StartTlsResponse; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; - public class LdapTlsProtocol extends LdapSslProtocol { private StartTlsResponse startTlsResponse; diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutput.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutput.java index 5d3332d9717..bb77e1be089 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutput.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutput.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.ldapoutput; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.exception.HopException; @@ -27,13 +29,7 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.ldapinput.LdapConnection; -import java.util.ArrayList; -import java.util.List; - - -/** - * Write to LDAP. - */ +/** Write to LDAP. */ public class LdapOutput extends BaseTransform { private static Class classFromResourcesPackage = LdapOutputMeta.class; // For Translator diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputDialog.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputDialog.java index 5dc3548028e..06a85997cc5 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputDialog.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputDialog.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.ldapoutput; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -67,9 +69,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class LdapOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = LdapOutputMeta.class; // For Translator @@ -1245,7 +1244,6 @@ private void getInfo(LdapOutputMeta in) throws HopException { in.allocate(nrFields); - for (int i = 0; i < nrFields; i++) { TableItem item = wReturn.getNonEmpty(i); in.getUpdateLookup()[i] = item.getText(1); diff --git a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMeta.java b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMeta.java index c422a14ba43..4b983c749de 100644 --- a/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMeta.java +++ b/plugins/transforms/ldap/src/main/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMeta.java @@ -16,6 +16,7 @@ */ package org.apache.hop.pipeline.transforms.ldapoutput; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transforms.ldapinput.LdapProtocolFactory; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "LDAPOutput", name = "i18n::LdapOutput.Name", @@ -45,7 +44,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Output", keywords = "i18n::LdapOutputMeta.keyword", documentationUrl = "/pipeline/transforms/ldapoutput.html") -public class LdapOutputMeta extends BaseTransformMeta implements ILdapMeta { +public class LdapOutputMeta extends BaseTransformMeta + implements ILdapMeta { private static final Class PKG = LdapOutputMeta.class; // For Translator /** Flag indicating that we use authentication for connection */ @@ -166,57 +166,77 @@ public LdapOutputMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the input useCertificate. */ + /** + * @return Returns the input useCertificate. + */ @Override public boolean isUseCertificate() { return useCertificate; } - /** @return Returns the useCertificate. */ + /** + * @return Returns the useCertificate. + */ public void setUseCertificate(boolean value) { this.useCertificate = value; } - /** @return Returns the input trustAllCertificates. */ + /** + * @return Returns the input trustAllCertificates. + */ @Override public boolean isTrustAllCertificates() { return trustAllCertificates; } - /** @return Returns the input trustAllCertificates. */ + /** + * @return Returns the input trustAllCertificates. + */ public void setTrustAllCertificates(boolean value) { this.trustAllCertificates = value; } - /** @return Returns the trustStorePath. */ + /** + * @return Returns the trustStorePath. + */ @Override public String getTrustStorePassword() { return trustStorePassword; } - /** @param value the trustStorePassword to set. */ + /** + * @param value the trustStorePassword to set. + */ public void setTrustStorePassword(String value) { this.trustStorePassword = value; } - /** @return Returns the trustStorePath. */ + /** + * @return Returns the trustStorePath. + */ @Override public String getTrustStorePath() { return trustStorePath; } - /** @param value the trustStorePath to set. */ + /** + * @param value the trustStorePath to set. + */ public void setTrustStorePath(String value) { this.trustStorePath = value; } - /** @return Returns the protocol. */ + /** + * @return Returns the protocol. + */ @Override public String getProtocol() { return protocol; } - /** @param value the protocol to set. */ + /** + * @param value the protocol to set. + */ public void setProtocol(String value) { this.protocol = value; } @@ -355,63 +375,87 @@ public static String getDerefAliasesTypeDesc(int i) { return derefAliasesTypeDesc[i]; } - /** @return Returns the updateStream. */ + /** + * @return Returns the updateStream. + */ public String[] getUpdateStream() { return updateStream; } - /** @param updateStream The updateStream to set. */ + /** + * @param updateStream The updateStream to set. + */ public void setUpdateStream(String[] updateStream) { this.updateStream = updateStream; } - /** @return Returns the updateLookup. */ + /** + * @return Returns the updateLookup. + */ public String[] getUpdateLookup() { return updateLookup; } - /** @param updateLookup The updateLookup to set. */ + /** + * @param updateLookup The updateLookup to set. + */ public void setUpdateLookup(String[] updateLookup) { this.updateLookup = updateLookup; } - /** @return Returns the input useAuthentication. */ + /** + * @return Returns the input useAuthentication. + */ public boolean isUseAuthentication() { return useAuthentication; } - /** @param useAuthentication The useAuthentication to set. */ + /** + * @param useAuthentication The useAuthentication to set. + */ public void setUseAuthentication(boolean useAuthentication) { this.useAuthentication = useAuthentication; } - /** @return Returns the host name. */ + /** + * @return Returns the host name. + */ @Override public String getHost() { return host; } - /** @param host The host to set. */ + /** + * @param host The host to set. + */ public void setHost(String host) { this.host = host; } - /** @return Returns the user name. */ + /** + * @return Returns the user name. + */ public String getUserName() { return userName; } - /** @param userName The username to set. */ + /** + * @param userName The username to set. + */ public void setUserName(String userName) { this.userName = userName; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } @@ -424,23 +468,31 @@ public String getDnField() { return this.dnFieldName; } - /** @return Returns the Port. */ + /** + * @return Returns the Port. + */ @Override public String getPort() { return port; } - /** @param port The port to set. */ + /** + * @param port The port to set. + */ public void setPort(String port) { this.port = port; } - /** @return Returns the failIfNotExist. */ + /** + * @return Returns the failIfNotExist. + */ public boolean isFailIfNotExist() { return failIfNotExist; } - /** @param failIfNotExist The failIfNotExist to set. */ + /** + * @param failIfNotExist The failIfNotExist to set. + */ public void setFailIfNotExist(boolean failIfNotExist) { this.failIfNotExist = failIfNotExist; } @@ -464,52 +516,72 @@ public Object clone() { return retval; } - /** @param value The deleteRDN filed. */ + /** + * @param value The deleteRDN filed. + */ public void setDeleteRDN(boolean value) { this.deleteRDN = value; } - /** @return Returns the deleteRDN. */ + /** + * @return Returns the deleteRDN. + */ public boolean isDeleteRDN() { return deleteRDN; } - /** @param value The newDnFieldName filed. */ + /** + * @param value The newDnFieldName filed. + */ public void setNewDnFieldName(String value) { this.newDnFieldName = value; } - /** @return Returns the newDnFieldName. */ + /** + * @return Returns the newDnFieldName. + */ public String getNewDnFieldName() { return newDnFieldName; } - /** @param value The oldDnFieldName filed. */ + /** + * @param value The oldDnFieldName filed. + */ public void setOldDnFieldName(String value) { this.oldDnFieldName = value; } - /** @return Returns the oldDnFieldName. */ + /** + * @return Returns the oldDnFieldName. + */ public String getOldDnFieldName() { return oldDnFieldName; } - /** @param searchBase The searchBase filed. */ + /** + * @param searchBase The searchBase filed. + */ public void setSearchBaseDN(String searchBase) { this.searchBase = searchBase; } - /** @return Returns the searchBase. */ + /** + * @return Returns the searchBase. + */ public String getSearchBaseDN() { return searchBase; } - /** @param multiValuedSeparator The multi-valued separator filed. */ + /** + * @param multiValuedSeparator The multi-valued separator filed. + */ public void setMultiValuedSeparator(String multiValuedSeparator) { this.multiValuedSeparator = multiValuedSeparator; } - /** @return Returns the multi valued separator. */ + /** + * @return Returns the multi valued separator. + */ public String getMultiValuedSeparator() { return multiValuedSeparator; } diff --git a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnectionTest.java b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnectionTest.java index 118b8681b52..1a6075fc210 100644 --- a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnectionTest.java +++ b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapConnectionTest.java @@ -16,6 +16,9 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.variables.IVariables; @@ -29,9 +32,6 @@ import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class LdapConnectionTest { diff --git a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMetaTest.java b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMetaTest.java index b2e2bc50f17..0a38859a4cf 100644 --- a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMetaTest.java +++ b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputMetaTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -30,13 +36,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class LdapInputMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = LdapInputMeta.class; diff --git a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputTest.java b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputTest.java index ae68d77c118..54427c1ba4e 100644 --- a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputTest.java +++ b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapInputTest.java @@ -16,12 +16,6 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; -import org.apache.hop.core.logging.ILoggingObject; -import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -29,6 +23,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import org.apache.hop.core.logging.ILoggingObject; +import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + /** Tests LDAP Input Transform */ public class LdapInputTest { private static TransformMockHelper mockHelper; diff --git a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapMockProtocol.java b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapMockProtocol.java index 6ac20dc21f3..feffbf61b81 100644 --- a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapMockProtocol.java +++ b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapMockProtocol.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.Collection; +import javax.naming.ldap.InitialLdapContext; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.variables.IVariables; import org.mockito.Mockito; -import javax.naming.ldap.InitialLdapContext; -import java.util.Collection; - /** Mock LDAP connection protocol, for testing */ public class LdapMockProtocol extends LdapProtocol { public static InitialLdapContext mockContext; diff --git a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactoryTest.java b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactoryTest.java index a89b25d77c4..65fef178723 100644 --- a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactoryTest.java +++ b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapinput/LdapProtocolFactoryTest.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.ldapinput; +import java.util.Collections; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.variables.IVariables; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; -import java.util.Collections; - public class LdapProtocolFactoryTest { @Test diff --git a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMetaTest.java b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMetaTest.java index 37125cb61af..404da77c852 100644 --- a/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMetaTest.java +++ b/plugins/transforms/ldap/src/test/java/org/apache/hop/pipeline/transforms/ldapoutput/LdapOutputMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.ldapoutput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -33,11 +37,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class LdapOutputMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInput.java b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInput.java index 12c234cdb8b..a5db4b1b0c8 100644 --- a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInput.java +++ b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInput.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import java.io.BufferedInputStream; +import java.io.InputStream; +import java.util.Date; +import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -35,11 +39,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.util.Date; -import java.util.List; - /** * Read files, parse them and convert them to rows and writes these to one or more output streams. */ diff --git a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputData.java b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputData.java index 54f8e1276fd..cece460f44a 100644 --- a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputData.java +++ b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import java.util.Date; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.fileinput.FileInputList; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Date; - public class LoadFileInputData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public IRowMeta convertRowMeta; diff --git a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputDialog.java b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputDialog.java index 82c4c96b657..0b6ead1d696 100644 --- a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputDialog.java +++ b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import java.nio.charset.Charset; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -64,9 +66,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; - public class LoadFileInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = LoadFileInputMeta.class; // For Translator @@ -1397,7 +1396,6 @@ private void getInfo(LoadFileInputMeta in) throws HopException { field.setRepeated( BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(11))); - in.getInputFields()[i] = field; } in.setShortFileNameField(wShortFileFieldName.getText()); diff --git a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMeta.java b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMeta.java index b7145086777..1d0f598f942 100644 --- a/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMeta.java +++ b/plugins/transforms/loadfileinput/src/main/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -46,10 +49,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - @Transform( id = "LoadFileInput", image = "loadfileinput.svg", @@ -161,72 +160,100 @@ public LoadFileInputMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the shortFileFieldName. */ + /** + * @return Returns the shortFileFieldName. + */ public String getShortFileNameField() { return shortFileFieldName; } - /** @param field The shortFileFieldName to set. */ + /** + * @param field The shortFileFieldName to set. + */ public void setShortFileNameField(String field) { shortFileFieldName = field; } - /** @return Returns the pathFieldName. */ + /** + * @return Returns the pathFieldName. + */ public String getPathField() { return pathFieldName; } - /** @param field The pathFieldName to set. */ + /** + * @param field The pathFieldName to set. + */ public void setPathField(String field) { this.pathFieldName = field; } - /** @return Returns the hiddenFieldName. */ + /** + * @return Returns the hiddenFieldName. + */ public String isHiddenField() { return hiddenFieldName; } - /** @param field The hiddenFieldName to set. */ + /** + * @param field The hiddenFieldName to set. + */ public void setIsHiddenField(String field) { hiddenFieldName = field; } - /** @return Returns the lastModificationTimeFieldName. */ + /** + * @return Returns the lastModificationTimeFieldName. + */ public String getLastModificationDateField() { return lastModificationTimeFieldName; } - /** @param field The lastModificationTimeFieldName to set. */ + /** + * @param field The lastModificationTimeFieldName to set. + */ public void setLastModificationDateField(String field) { lastModificationTimeFieldName = field; } - /** @return Returns the uriNameFieldName. */ + /** + * @return Returns the uriNameFieldName. + */ public String getUriField() { return uriNameFieldName; } - /** @param field The uriNameFieldName to set. */ + /** + * @param field The uriNameFieldName to set. + */ public void setUriField(String field) { uriNameFieldName = field; } - /** @return Returns the uriNameFieldName. */ + /** + * @return Returns the uriNameFieldName. + */ public String getRootUriField() { return rootUriNameFieldName; } - /** @param field The rootUriNameFieldName to set. */ + /** + * @param field The rootUriNameFieldName to set. + */ public void setRootUriField(String field) { rootUriNameFieldName = field; } - /** @return Returns the extensionFieldName. */ + /** + * @return Returns the extensionFieldName. + */ public String getExtensionField() { return extensionFieldName; } - /** @param field The extensionFieldName to set. */ + /** + * @param field The extensionFieldName to set. + */ public void setExtensionField(String field) { extensionFieldName = field; } @@ -239,37 +266,51 @@ public void setFileRequired(String[] fileRequired) { this.fileRequired = fileRequired; } - /** @return Returns the excludeFileMask. */ + /** + * @return Returns the excludeFileMask. + */ public String[] getExcludeFileMask() { return excludeFileMask; } - /** @param excludeFileMask The excludeFileMask to set. */ + /** + * @param excludeFileMask The excludeFileMask to set. + */ public void setExcludeFileMask(String[] excludeFileMask) { this.excludeFileMask = excludeFileMask; } - /** @return the add result filesname flag */ + /** + * @return the add result filesname flag + */ public boolean getAddResultFile() { return addresultfile; } - /** @return the IsIgnoreEmptyFile flag */ + /** + * @return the IsIgnoreEmptyFile flag + */ public boolean isIgnoreEmptyFile() { return ignoreEmptyFile; } - /** @param isIgnoreEmptyFile IsIgnoreEmptyFile to set */ + /** + * @param isIgnoreEmptyFile IsIgnoreEmptyFile to set + */ public void setIgnoreEmptyFile(boolean isIgnoreEmptyFile) { this.ignoreEmptyFile = isIgnoreEmptyFile; } - /** @return the IsIgnoreMissingPath flag */ + /** + * @return the IsIgnoreMissingPath flag + */ public boolean isIgnoreMissingPath() { return ignoreMissingPath; } - /** @param ignoreMissingPath ignoreMissingPath to set */ + /** + * @param ignoreMissingPath ignoreMissingPath to set + */ public void setIgnoreMissingPath(boolean ignoreMissingPath) { this.ignoreMissingPath = ignoreMissingPath; } @@ -278,12 +319,16 @@ public void setAddResultFile(boolean addresultfile) { this.addresultfile = addresultfile; } - /** @return Returns the input fields. */ + /** + * @return Returns the input fields. + */ public LoadFileInputField[] getInputFields() { return inputFields; } - /** @param inputFields The input fields to set. */ + /** + * @param inputFields The input fields to set. + */ public void setInputFields(LoadFileInputField[] inputFields) { this.inputFields = inputFields; } @@ -313,17 +358,23 @@ public void setFileInFields(boolean isInFields) { this.fileinfield = isInFields; } - /** @return Returns the fileMask. */ + /** + * @return Returns the fileMask. + */ public String[] getFileMask() { return fileMask; } - /** @param fileMask The fileMask to set. */ + /** + * @param fileMask The fileMask to set. + */ public void setFileMask(String[] fileMask) { this.fileMask = fileMask; } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String[] getFileName() { return fileName; } @@ -360,67 +411,93 @@ public String getRequiredFilesDesc(String tt) { } } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String[] fileName) { this.fileName = fileName; } - /** @return Returns the filenameField. */ + /** + * @return Returns the filenameField. + */ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set. */ + /** + * @param filenameField The filenameField to set. + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } - /** @return Returns the includeFilename. */ + /** + * @return Returns the includeFilename. + */ public boolean getIncludeFilename() { return includeFilename; } - /** @param includeFilename The includeFilename to set. */ + /** + * @param includeFilename The includeFilename to set. + */ public void setIncludeFilename(boolean includeFilename) { this.includeFilename = includeFilename; } - /** @return Returns the includeRowNumber. */ + /** + * @return Returns the includeRowNumber. + */ public boolean getIncludeRowNumber() { return includeRowNumber; } - /** @param includeRowNumber The includeRowNumber to set. */ + /** + * @param includeRowNumber The includeRowNumber to set. + */ public void setIncludeRowNumber(boolean includeRowNumber) { this.includeRowNumber = includeRowNumber; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public long getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(long rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the rowNumberField. */ + /** + * @return Returns the rowNumberField. + */ public String getRowNumberField() { return rowNumberField; } - /** @param rowNumberField The rowNumberField to set. */ + /** + * @param rowNumberField The rowNumberField to set. + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } - /** @return the encoding */ + /** + * @return the encoding + */ public String getEncoding() { return encoding; } - /** @param encoding the encoding to set */ + /** + * @param encoding the encoding to set + */ public void setEncoding(String encoding) { this.encoding = encoding; } diff --git a/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMetaTest.java b/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMetaTest.java index 2de4d441e71..18cb2dc0cce 100644 --- a/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMetaTest.java +++ b/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputMetaTest.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import static org.junit.Assert.assertEquals; + +import java.io.StringReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.metadata.api.IHopMetadataProvider; @@ -34,18 +45,6 @@ import org.w3c.dom.Document; import org.xml.sax.InputSource; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.StringReader; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; - /** User: Dzmitry Stsiapanau Date: 12/17/13 Time: 3:11 PM */ public class LoadFileInputMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputTest.java b/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputTest.java index 65c58a3c884..81072cbfb37 100644 --- a/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputTest.java +++ b/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/LoadFileInputTest.java @@ -17,6 +17,21 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Field; +import java.nio.charset.Charset; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -45,22 +60,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Field; -import java.nio.charset.Charset; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - public class LoadFileInputTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -120,12 +119,11 @@ public void setup() throws FileSystemException { loadFileInputMeta = spy(new LoadFileInputMeta()); fileInputList = new FileInputList(); - Mockito.doReturn(fileInputList) - .when(loadFileInputMeta) - .getFiles(any(IVariables.class)); + Mockito.doReturn(fileInputList).when(loadFileInputMeta).getFiles(any(IVariables.class)); String transformId = PluginRegistry.getInstance().getPluginId(TransformPluginType.class, loadFileInputMeta); - TransformMeta transformMeta = new TransformMeta(transformId, "Load File Input", loadFileInputMeta); + TransformMeta transformMeta = + new TransformMeta(transformId, "Load File Input", loadFileInputMeta); pipelineMeta.addTransform(transformMeta); loadFileInputData = new LoadFileInputData(); diff --git a/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/PDI_6976_Test.java b/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/PDI_6976_Test.java index a126b06644d..4311c369b04 100644 --- a/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/PDI_6976_Test.java +++ b/plugins/transforms/loadfileinput/src/test/java/org/apache/hop/pipeline/transforms/loadfileinput/PDI_6976_Test.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.loadfileinput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.List; +import javax.tools.FileObject; import junit.framework.TestCase; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.fileinput.FileInputList; @@ -28,16 +37,6 @@ import org.junit.Test; import org.mockito.stubbing.Answer; -import javax.tools.FileObject; -import java.util.List; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - /** * Tests for LoadFileInputMeta class * diff --git a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/Mail.java b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/Mail.java index 5134ee80897..5636fa4f12a 100644 --- a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/Mail.java +++ b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/Mail.java @@ -28,6 +28,18 @@ import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.MimeMultipart; import jakarta.mail.util.ByteArrayDataSource; +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; @@ -46,19 +58,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - /** Send mail transform. based on Mail action */ public class Mail extends BaseTransform { @@ -282,7 +281,7 @@ public boolean processRow() throws HopException { // cache the position of the Authentication password field if (data.indexOfAuthenticationPass < 0) { - String realAuthenticationPassword = meta.getAuthenticationPassword(); + String realAuthenticationPassword = meta.getAuthenticationPassword(); data.indexOfAuthenticationPass = data.previousRowMeta.indexOfValue(realAuthenticationPassword); if (data.indexOfAuthenticationPass < 0) { @@ -499,7 +498,9 @@ public boolean processRow() throws HopException { } String authpass = null; if (data.indexOfAuthenticationPass > -1) { - authpass = Utils.resolvePassword(variables, data.previousRowMeta.getString( r, data.indexOfAuthenticationPass )); + authpass = + Utils.resolvePassword( + variables, data.previousRowMeta.getString(r, data.indexOfAuthenticationPass)); } String subject = null; diff --git a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailData.java b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailData.java index ad0dc5ebb06..bd15155a2de 100644 --- a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailData.java +++ b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailData.java @@ -19,16 +19,13 @@ import jakarta.mail.internet.MimeBodyPart; import jakarta.mail.internet.MimeMultipart; +import java.util.HashSet; +import java.util.Properties; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashSet; -import java.util.Properties; - -/** - * Send mail transform. based on Mail action - */ +/** Send mail transform. based on Mail action */ public class MailData extends BaseTransformData implements ITransformData { public int indexOfDestination; public int indexOfDestinationCc; diff --git a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailDialog.java b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailDialog.java index a9dfd941027..c52f7efe274 100644 --- a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailDialog.java +++ b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailDialog.java @@ -15,9 +15,10 @@ * limitations under the License. */ - package org.apache.hop.pipeline.transforms.mail; +import java.nio.charset.Charset; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -59,9 +60,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; - public class MailDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MailMeta.class; // For Translator diff --git a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailMeta.java b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailMeta.java index a544a2e376d..2157e96aa77 100644 --- a/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailMeta.java +++ b/plugins/transforms/mail/src/main/java/org/apache/hop/pipeline/transforms/mail/MailMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.mail; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - /** Send mail transform. based on Mail action */ @Transform( id = "Mail", diff --git a/plugins/transforms/mail/src/test/java/org/apache/hop/pipeline/transforms/mail/MailMetaTest.java b/plugins/transforms/mail/src/test/java/org/apache/hop/pipeline/transforms/mail/MailMetaTest.java index 40844dec1ad..ce9a7a4ad0a 100644 --- a/plugins/transforms/mail/src/test/java/org/apache/hop/pipeline/transforms/mail/MailMetaTest.java +++ b/plugins/transforms/mail/src/test/java/org/apache/hop/pipeline/transforms/mail/MailMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.mail; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -30,11 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MailMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = MailMeta.class; diff --git a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIterator.java b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIterator.java index dbc1a59e43e..23ebd22dcb6 100644 --- a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIterator.java +++ b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIterator.java @@ -20,7 +20,6 @@ import jakarta.mail.Folder; import jakarta.mail.Message; import jakarta.mail.MessagingException; - import java.util.Iterator; public class BatchFolderIterator implements Iterator { diff --git a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInput.java b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInput.java index 3b3f62c19b2..cc68b5391f9 100644 --- a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInput.java +++ b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInput.java @@ -19,6 +19,11 @@ import jakarta.mail.Header; import jakarta.mail.Message; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.List; import org.apache.commons.collections4.iterators.ArrayIterator; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; @@ -34,12 +39,6 @@ import org.apache.hop.workflow.actions.getpop.MailConnection; import org.apache.hop.workflow.actions.getpop.MailConnectionMeta; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Enumeration; -import java.util.List; - /** Read data from POP3/IMAP server and input data to the next transforms. */ public class MailInput extends BaseTransform { private static final Class PKG = MailInputMeta.class; // For Translator diff --git a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputData.java b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputData.java index 314716cf2c3..7054bdfd962 100644 --- a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputData.java +++ b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputData.java @@ -18,13 +18,12 @@ package org.apache.hop.pipeline.transforms.mailinput; import jakarta.mail.Message; +import java.util.Iterator; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.workflow.actions.getpop.MailConnection; -import java.util.Iterator; - public class MailInputData extends BaseTransformData implements ITransformData { public IRowMeta inputRowMeta; public int totalpreviousfields; diff --git a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputDialog.java b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputDialog.java index e34cd6b3187..25f32c45ee9 100644 --- a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputDialog.java +++ b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputDialog.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.mailinput; import jakarta.mail.Folder; +import java.text.SimpleDateFormat; +import java.util.Calendar; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -76,9 +78,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.text.SimpleDateFormat; -import java.util.Calendar; - public class MailInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MailInputMeta.class; // For Translator diff --git a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMeta.java b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMeta.java index 119dec09d1a..7cc7bb284f4 100644 --- a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMeta.java +++ b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.mailinput; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -40,8 +41,6 @@ import org.apache.hop.workflow.actions.getpop.MailConnectionMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "MailInput", image = "mailinput.svg", @@ -382,7 +381,9 @@ public void setIncludeSubFolders(boolean includesubfolders) { this.includesubfolders = includesubfolders; } - /** @return Returns the useproxy. */ + /** + * @return Returns the useproxy. + */ public boolean isUseProxy() { return this.useproxy; } @@ -399,7 +400,9 @@ public String getProxyUsername() { return this.proxyusername; } - /** @return Returns the usedynamicfolder. */ + /** + * @return Returns the usedynamicfolder. + */ public boolean isDynamicFolder() { return this.usedynamicfolder; } @@ -552,27 +555,37 @@ public void setValueImapList(int value) { this.valueimaplist = value; } - /** @return Returns the input fields. */ + /** + * @return Returns the input fields. + */ public MailInputField[] getInputFields() { return inputFields; } - /** @param inputFields The input fields to set. */ + /** + * @param inputFields The input fields to set. + */ public void setInputFields(MailInputField[] inputFields) { this.inputFields = inputFields; } - /** @return Returns the password. */ + /** + * @return Returns the password. + */ public String getPassword() { return password; } - /** @param delete The delete to set. */ + /** + * @param delete The delete to set. + */ public void setDelete(boolean delete) { this.delete = delete; } - /** @return Returns the delete. */ + /** + * @return Returns the delete. + */ public boolean getDelete() { return delete; } @@ -593,21 +606,24 @@ public void setIMAPFolder(String folder) { this.imapfolder = folder; } - /** @param usessl The usessl to set. */ + /** + * @param usessl The usessl to set. + */ public void setUseSSL(boolean usessl) { this.usessl = usessl; } - /** @return Returns the usessl. */ + /** + * @return Returns the usessl. + */ public boolean isUseSSL() { return usessl; } /** - * @param usexoauth2 - * The usexoauth2 to set. + * @param usexoauth2 The usexoauth2 to set. */ - public void setUseXOAUTH2( boolean usexoauth2 ) { + public void setUseXOAUTH2(boolean usexoauth2) { this.usexoauth2 = usexoauth2; } @@ -618,7 +634,9 @@ public boolean isUseXOAUTH2() { return usexoauth2; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } diff --git a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/SearchEnabledFolderIterator.java b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/SearchEnabledFolderIterator.java index dbaedd5c44c..69e6d193a0a 100644 --- a/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/SearchEnabledFolderIterator.java +++ b/plugins/transforms/mailinput/src/main/java/org/apache/hop/pipeline/transforms/mailinput/SearchEnabledFolderIterator.java @@ -19,7 +19,6 @@ import jakarta.mail.Message; import jakarta.mail.search.SearchTerm; - import java.util.Iterator; public class SearchEnabledFolderIterator implements Iterator { diff --git a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIteratorName.java b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIteratorName.java index a9501447422..e5fc27467a7 100644 --- a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIteratorName.java +++ b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/BatchFolderIteratorName.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.mailinput; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import jakarta.mail.Folder; import jakarta.mail.Message; import jakarta.mail.MessagingException; @@ -25,10 +29,6 @@ import org.junit.Test; import org.mockito.stubbing.Answer; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class BatchFolderIteratorName { static Folder folder = null; diff --git a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMetaTest.java b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMetaTest.java index 6698bd00a1f..17a477056c2 100644 --- a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMetaTest.java +++ b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputMetaTest.java @@ -22,7 +22,12 @@ * * @see MailInputMeta */ - +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -39,13 +44,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class MailInputMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = MailInputMeta.class; diff --git a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputTest.java b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputTest.java index b25a728a8ad..44cceb30cea 100644 --- a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputTest.java +++ b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/MailInputTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.mailinput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.apache.hop.workflow.actions.getpop.MailConnectionMeta; @@ -26,10 +30,6 @@ import org.junit.Ignore; import org.junit.Test; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class MailInputTest { private TransformMockHelper mockHelper; diff --git a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/ParseMailInputTest.java b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/ParseMailInputTest.java index 4ee3037c567..19d4f9247e3 100644 --- a/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/ParseMailInputTest.java +++ b/plugins/transforms/mailinput/src/test/java/org/apache/hop/pipeline/transforms/mailinput/ParseMailInputTest.java @@ -17,10 +17,21 @@ package org.apache.hop.pipeline.transforms.mailinput; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import jakarta.mail.Address; import jakarta.mail.Header; import jakarta.mail.Message; import jakarta.mail.MessagingException; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.Enumeration; +import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -38,18 +49,6 @@ import org.mockito.AdditionalMatchers; import org.mockito.Mockito; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.Enumeration; -import java.util.regex.Pattern; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class ParseMailInputTest { // mock is existed per-class instance loaded by junit loader diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/InputField.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/InputField.java index 9f1290072de..b8a5dffd0cd 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/InputField.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/InputField.java @@ -18,9 +18,8 @@ package org.apache.hop.pipeline.transforms.input; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class InputField { @HopMetadataProperty private String name; @@ -49,7 +48,10 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InputField that = (InputField) o; - return Objects.equals(name, that.name) && Objects.equals(type, that.type) && Objects.equals(length, that.length) && Objects.equals(precision, that.precision); + return Objects.equals(name, that.name) + && Objects.equals(type, that.type) + && Objects.equals(length, that.length) + && Objects.equals(precision, that.precision); } @Override diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/MappingInputMeta.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/MappingInputMeta.java index 39cf2200758..78d9ac63240 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/MappingInputMeta.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/input/MappingInputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.input; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -35,9 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "MappingInput", name = "i18n::BaseTransform.TypeLongDesc.MappingInput", diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingIODefinition.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingIODefinition.java index 470e49be743..51988093969 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingIODefinition.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingIODefinition.java @@ -17,10 +17,10 @@ package org.apache.hop.pipeline.transforms.mapping; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopXmlException; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.hop.metadata.api.HopMetadataObject; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.HopMetadataWrapper; import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; @@ -28,11 +28,8 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - /** Helps to define the input or output specifications for the Mapping transform. */ -@HopMetadataWrapper(tag="mapping") +@HopMetadataWrapper(tag = "mapping") public class MappingIODefinition implements Cloneable { public static final String XML_TAG = "mapping"; @@ -108,11 +105,9 @@ public MappingIODefinition(Node mappingNode) throws HopXmlException { this(); XmlMetadataUtil.deSerializeFromXml( - this, - mappingNode, - MappingIODefinition.class, - new MemoryMetadataProvider()); + this, mappingNode, MappingIODefinition.class, new MemoryMetadataProvider()); } + /* inputTransformName = XmlHandler.getTagValue(mappingNode, "input_transform"); outputTransformName = XmlHandler.getTagValue(mappingNode, "output_transform"); @@ -136,6 +131,7 @@ public String getXml() throws HopException { return XmlMetadataUtil.serializeObjectToXml(this); } + /* StringBuilder xml = new StringBuilder(200); diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingParameters.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingParameters.java index c2427e4ce63..78879933fe8 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingParameters.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/MappingParameters.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.mapping; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil; -import java.util.ArrayList; -import java.util.List; - /** * We need out mapping to be parameterized.
* This we do with the use of environment variables.
@@ -58,7 +57,7 @@ public MappingParameters(MappingParameters p) { public String[] getVariables() { String[] vars = new String[variableMappings.size()]; - for (int i=0;i { @@ -127,11 +126,12 @@ public void prepareMappingExecution() throws HopException { data.mappingPipelineMeta.setPipelineType(PipelineMeta.PipelineType.SingleThreaded); } SimpleMappingData simpleMappingData = getData(); - // Resolve pipeline full name in case variables are used and pipeline meta is not initialized in advance + // Resolve pipeline full name in case variables are used and pipeline meta is not initialized in + // advance if (simpleMappingData.mappingPipelineMeta == null) { - simpleMappingData.mappingPipelineMeta = new PipelineMeta(variables.resolve(meta.getFilename()), metadataProvider, variables); + simpleMappingData.mappingPipelineMeta = + new PipelineMeta(variables.resolve(meta.getFilename()), metadataProvider, variables); simpleMappingData.mappingPipelineMeta.clearChanged(); - } String runConfigName = resolve(meta.getRunConfigurationName()); diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingData.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingData.java index e4b57fd9cc7..0db63ee9d0d 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingData.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingData.java @@ -17,8 +17,9 @@ package org.apache.hop.pipeline.transforms.mapping; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.SingleThreadedPipelineExecutor; import org.apache.hop.pipeline.engine.IPipelineEngine; @@ -28,9 +29,6 @@ import org.apache.hop.pipeline.transforms.input.MappingInput; import org.apache.hop.pipeline.transforms.output.MappingOutput; -import java.util.ArrayList; -import java.util.List; - public class SimpleMappingData extends BaseTransformData implements ITransformData { public LocalPipelineEngine mappingPipeline; diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java index 907a2785f81..5d8a5c7d3d0 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java @@ -361,7 +361,8 @@ public void getData() { addOutputMappingDefinitionTab(outputMapping, 1); // Prepare a regexp checker to see if the pipeline name contains a variable - // boolean containsVar = Pattern.matches("^[/\\w]*(\\$\\{\\w+})[/.\\w]*", mappingMeta.getFilename()); + // boolean containsVar = Pattern.matches("^[/\\w]*(\\$\\{\\w+})[/.\\w]*", + // mappingMeta.getFilename()); Pattern p = Pattern.compile("^[/\\w]*(\\$\\{\\w+})[/.\\w]*"); Matcher m = p.matcher(mappingMeta.getFilename()); @@ -778,11 +779,11 @@ private void ok() { loadPipeline(); } catch (HopException e) { new ErrorDialog( - shell, - BaseMessages.getString(PKG, "SimpleMappingDialog.ErrorLoadingSpecifiedPipeline.Title"), - BaseMessages.getString( - PKG, "SimpleMappingDialog.ErrorLoadingSpecifiedPipeline.Message"), - e); + shell, + BaseMessages.getString(PKG, "SimpleMappingDialog.ErrorLoadingSpecifiedPipeline.Title"), + BaseMessages.getString( + PKG, "SimpleMappingDialog.ErrorLoadingSpecifiedPipeline.Message"), + e); return; } } diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java index 97b7482f2b7..25de0924ab6 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.mapping; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -42,9 +44,6 @@ import org.apache.hop.resource.ResourceEntry.ResourceType; import org.apache.hop.resource.ResourceReference; -import java.util.ArrayList; -import java.util.List; - /** Meta-data for the Mapping transform: contains name of the (sub-) pipeline to execute */ @Transform( id = "SimpleMapping", diff --git a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/output/MappingOutputMeta.java b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/output/MappingOutputMeta.java index 6a1b8d79a9a..5b861c2071b 100644 --- a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/output/MappingOutputMeta.java +++ b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/output/MappingOutputMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.output; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -28,8 +29,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "MappingOutput", name = "i18n::BaseTransform.TypeLongDesc.MappingOuptut", diff --git a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/input/MappingInputMetaTest.java b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/input/MappingInputMetaTest.java index be997847c0c..8c68dece0b0 100644 --- a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/input/MappingInputMetaTest.java +++ b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/input/MappingInputMetaTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.input; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.core.xml.XmlHandler; @@ -31,8 +33,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import static org.junit.Assert.assertEquals; - public class MappingInputMetaTest { @Before public void setUp() throws Exception { diff --git a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java index 07180fadf6e..25b3569b1ed 100644 --- a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java +++ b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java @@ -32,9 +32,7 @@ public void setUpLoadSave() throws Exception { @Test public void testSerialization() throws Exception { TransformSerializationTestUtil.testSerialization( - "/simple-mapping-transform.xml", - SimpleMappingMeta.class - ); + "/simple-mapping-transform.xml", SimpleMappingMeta.class); /*Document document = XmlHandler.loadXmlFile(this.getClass().getResourceAsStream("/simple-mapping-transform.xml")); Node transformNode = XmlHandler.getSubNode(document, TransformMeta.XML_TAG); diff --git a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java index d60006f7c7c..94348ec7470 100644 --- a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java +++ b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java @@ -16,6 +16,19 @@ */ package org.apache.hop.pipeline.transforms.mapping; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.core.row.IRowMeta; @@ -33,19 +46,6 @@ import org.junit.Test; import org.mockito.Mockito; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SimpleMappingTest { private static final String MAPPING_INPUT_TRANSFORM_NAME = "MAPPING_INPUT_TRANSFORM_NAME"; diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GGroup.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GGroup.java index 0ca7495450e..1af75071d58 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GGroup.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GGroup.java @@ -29,8 +29,7 @@ public class GGroup { injectionGroupDescription = "MemoryGroupBy.Injection.FIELDS") private String field; - public GGroup() { - } + public GGroup() {} public GGroup(GGroup g) { this.field = g.field; diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GroupTypeConverter.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GroupTypeConverter.java index 21c3182ebe7..b7731469499 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GroupTypeConverter.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/GroupTypeConverter.java @@ -18,14 +18,14 @@ package org.apache.hop.pipeline.transforms.memgroupby; -import org.apache.hop.core.Const; -import org.apache.hop.core.injection.InjectionTypeConverter; - import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.None; import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.getTypeWithCode; import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.getTypeWithDescription; import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.values; +import org.apache.hop.core.Const; +import org.apache.hop.core.injection.InjectionTypeConverter; + public class GroupTypeConverter extends InjectionTypeConverter { public GroupTypeConverter() {} diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupBy.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupBy.java index 44087e3b266..2dbe801870c 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupBy.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupBy.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.CountAll; +import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.CountAny; +import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.CountDistinct; +import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.Percentile; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -45,11 +50,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByData.HashEntry; -import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.CountAll; -import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.CountAny; -import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.CountDistinct; -import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.Percentile; - /** Groups information based on aggregation rules. (sum, count, ...) */ public class MemoryGroupBy extends BaseTransform { private static final Class PKG = MemoryGroupByMeta.class; // For Translator diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByData.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByData.java index 97fececaf43..5807d1a53bf 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByData.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import java.util.HashMap; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashMap; - public class MemoryGroupByData extends BaseTransformData implements ITransformData { public class HashEntry { private Object[] groupData; diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDialog.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDialog.java index cd13b0c837c..2d6c4c91f63 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDialog.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -47,8 +49,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; public class MemoryGroupByDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MemoryGroupByMeta.class; // For Translator @@ -250,7 +250,7 @@ public void widgetSelected(SelectionEvent arg0) { if (transformMeta != null) { try { IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta); - + // Remember these fields... for (int i = 0; i < row.size(); i++) { inputFields.add(row.getValueMeta(i).getName()); diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMeta.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMeta.java index 55c4ecabe89..2ea3409a3be 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMeta.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.transforms.PTransform; import org.apache.beam.sdk.values.PCollection; @@ -46,10 +49,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.memgroupby.beam.GroupByTransform; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "MemoryGroupBy", image = "memorygroupby.svg", @@ -162,7 +161,7 @@ public void getFields( valueType = IValueMeta.TYPE_NUMBER; } mask = subj.getConversionMask(); - break; + break; case Median: case Percentile: case StandardDeviation: @@ -479,5 +478,5 @@ public void setAlwaysGivingBackOneRow(boolean alwaysGivingBackOneRow) { @Override public boolean supportsMultiCopyExecution() { return false; - } + } } diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByFn.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByFn.java index d8772bb4693..fea0bb7b1fd 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByFn.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByFn.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.memgroupby.beam; +import java.math.BigDecimal; import org.apache.beam.sdk.metrics.Counter; import org.apache.beam.sdk.metrics.Metrics; import org.apache.beam.sdk.transforms.DoFn; @@ -32,8 +33,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.math.BigDecimal; - public class GroupByFn extends DoFn>, HopRow> { private String counterName; diff --git a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByTransform.java b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByTransform.java index f1da554e612..9bfa1b4d9aa 100644 --- a/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByTransform.java +++ b/plugins/transforms/memgroupby/src/main/java/org/apache/hop/pipeline/transforms/memgroupby/beam/GroupByTransform.java @@ -91,12 +91,7 @@ public PCollection expand(PCollection input) { // PCollection> groupSubjects = input.apply( - ParDo.of( - new HopKeyValueFn( - rowMetaJson, - groupFields, - subjects, - transformName))); + ParDo.of(new HopKeyValueFn(rowMetaJson, groupFields, subjects, transformName))); // Now we need to aggregate the groups with a Combine GroupByKey byKey = GroupByKey.create(); @@ -136,7 +131,9 @@ public String getRowMetaJson() { return rowMetaJson; } - /** @param rowMetaJson The inputRowMetaJson to set */ + /** + * @param rowMetaJson The inputRowMetaJson to set + */ public void setRowMetaJson(String rowMetaJson) { this.rowMetaJson = rowMetaJson; } @@ -150,7 +147,9 @@ public String[] getGroupFields() { return groupFields; } - /** @param groupFields The groupFields to set */ + /** + * @param groupFields The groupFields to set + */ public void setGroupFields(String[] groupFields) { this.groupFields = groupFields; } @@ -164,7 +163,9 @@ public String[] getSubjects() { return subjects; } - /** @param subjects The subjects to set */ + /** + * @param subjects The subjects to set + */ public void setSubjects(String[] subjects) { this.subjects = subjects; } @@ -178,7 +179,9 @@ public String[] getAggregations() { return aggregations; } - /** @param aggregations The aggregations to set */ + /** + * @param aggregations The aggregations to set + */ public void setAggregations(String[] aggregations) { this.aggregations = aggregations; } @@ -192,7 +195,9 @@ public String[] getResultFields() { return resultFields; } - /** @param resultFields The resultFields to set */ + /** + * @param resultFields The resultFields to set + */ public void setResultFields(String[] resultFields) { this.resultFields = resultFields; } diff --git a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationNullsTest.java b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationNullsTest.java index 2edb82d6358..e7eb54f55be 100644 --- a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationNullsTest.java +++ b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationNullsTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.logging.ILoggingObject; @@ -39,13 +45,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import java.util.HashMap; -import java.util.List; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) @PrepareForTest({ValueMetaFactory.class}) public class MemoryGroupByAggregationNullsTest { diff --git a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationTest.java b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationTest.java index e7d4589d23a..fee60f481c3 100644 --- a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationTest.java +++ b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByAggregationTest.java @@ -17,6 +17,19 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.google.common.base.Functions; import com.google.common.base.Optional; import com.google.common.collect.ContiguousSet; @@ -54,19 +67,6 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class MemoryGroupByAggregationTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDataTest.java b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDataTest.java index 7ee2f78e6a9..73b13abe6d9 100644 --- a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDataTest.java +++ b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByDataTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.when; + +import java.util.HashMap; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.junit.Before; @@ -25,13 +31,6 @@ import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import java.util.HashMap; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class MemoryGroupByDataTest { diff --git a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaGetFieldsTest.java b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaGetFieldsTest.java index 70761bf5a06..45992c32996 100644 --- a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaGetFieldsTest.java +++ b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaGetFieldsTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.powermock.api.mockito.PowerMockito.mockStatic; + import java.util.List; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.row.IRowMeta; @@ -34,20 +48,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.powermock.api.mockito.PowerMockito.mockStatic; - @RunWith(PowerMockRunner.class) @PrepareForTest({ValueMetaFactory.class}) public class MemoryGroupByMetaGetFieldsTest { diff --git a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaTest.java b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaTest.java index 98cf7af62d8..a367d6cbdda 100644 --- a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaTest.java +++ b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByMetaTest.java @@ -16,24 +16,6 @@ */ package org.apache.hop.pipeline.transforms.memgroupby; -import java.util.Arrays; -import java.util.List; -import org.apache.hop.core.HopEnvironment; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.RowMeta; -import org.apache.hop.core.row.value.ValueMetaBigNumber; -import org.apache.hop.core.row.value.ValueMetaBinary; -import org.apache.hop.core.row.value.ValueMetaBoolean; -import org.apache.hop.core.row.value.ValueMetaDate; -import org.apache.hop.core.row.value.ValueMetaInteger; -import org.apache.hop.core.row.value.ValueMetaInternetAddress; -import org.apache.hop.core.row.value.ValueMetaNumber; -import org.apache.hop.core.row.value.ValueMetaString; -import org.apache.hop.core.row.value.ValueMetaTimestamp; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.Average; import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.ConcatComma; import static org.apache.hop.pipeline.transforms.memgroupby.MemoryGroupByMeta.GroupType.ConcatString; @@ -53,6 +35,25 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; +import org.apache.hop.core.HopEnvironment; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.row.RowMeta; +import org.apache.hop.core.row.value.ValueMetaBigNumber; +import org.apache.hop.core.row.value.ValueMetaBinary; +import org.apache.hop.core.row.value.ValueMetaBoolean; +import org.apache.hop.core.row.value.ValueMetaDate; +import org.apache.hop.core.row.value.ValueMetaInteger; +import org.apache.hop.core.row.value.ValueMetaInternetAddress; +import org.apache.hop.core.row.value.ValueMetaNumber; +import org.apache.hop.core.row.value.ValueMetaString; +import org.apache.hop.core.row.value.ValueMetaTimestamp; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; import org.junit.Before; import org.junit.Test; diff --git a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByNewAggregateTest.java b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByNewAggregateTest.java index a9fa65761fc..2b0d1e16f9d 100644 --- a/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByNewAggregateTest.java +++ b/plugins/transforms/memgroupby/src/test/java/org/apache/hop/pipeline/transforms/memgroupby/MemoryGroupByNewAggregateTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.memgroupby; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; import junit.framework.Assert; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -32,14 +39,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class MemoryGroupByNewAggregateTest { static TransformMockHelper mockHelper; @@ -83,10 +82,10 @@ public void setUp() throws Exception { data.subjectnrs = new int[types.length]; - int i=0; + int i = 0; for (GroupType type : types) { data.subjectnrs[i] = i++; - new GAggregate("x"+1, "x", type, null); + new GAggregate("x" + 1, "x", type, null); } MemoryGroupByMeta meta = new MemoryGroupByMeta(); diff --git a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/LeftKey.java b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/LeftKey.java index e8b5b7cd8fc..f38de66e950 100644 --- a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/LeftKey.java +++ b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/LeftKey.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.mergejoin; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class LeftKey { @HopMetadataProperty( @@ -64,7 +63,9 @@ public String getKey() { return key; } - /** @param key The key to set */ + /** + * @param key The key to set + */ public void setKey(String key) { this.key = key; } diff --git a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoin.java b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoin.java index 625ca5ac627..fba683d6fbc 100644 --- a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoin.java +++ b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoin.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.mergejoin; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -30,10 +33,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** * Merge rows from 2 sorted streams and output joined rows with matched key fields. Use this instead * of hash join is both your input streams are too big to fit in memory. Note that both the inputs diff --git a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinData.java b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinData.java index 78955d42f88..7f33aa72383 100644 --- a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinData.java +++ b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.mergejoin; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class MergeJoinData extends BaseTransformData implements ITransformData { public Object[] one; public Object[] two; diff --git a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinDialog.java b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinDialog.java index 0c592f41393..cd313001a75 100644 --- a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinDialog.java +++ b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.mergejoin; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -47,7 +48,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; public class MergeJoinDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MergeJoinMeta.class; // For Translator @@ -284,12 +284,12 @@ public String open() { fdKeys2.bottom = new FormAttachment(wbKeys2, -2 * margin); fdKeys2.right = new FormAttachment(100, 0); wKeys2.setLayoutData(fdKeys2); - + wTransform1.addListener(SWT.Modify, e -> updateFieldNames(ciKeys1[0], ciKeys2[0])); wTransform2.addListener(SWT.Modify, e -> updateFieldNames(ciKeys1[0], ciKeys2[0])); this.getData(); - this.updateFieldNames(ciKeys1[0], ciKeys2[0]); + this.updateFieldNames(ciKeys1[0], ciKeys2[0]); input.setChanged(backupChanged); BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); @@ -417,26 +417,26 @@ private void getKeys2() { e); } } - + // Search the fields in the background // - private void updateFieldNames(ColumnInfo leftColumn, ColumnInfo rightColumn) { + private void updateFieldNames(ColumnInfo leftColumn, ColumnInfo rightColumn) { final Runnable runnable = () -> { leftColumn.setComboValues(new String[] {""}); rightColumn.setComboValues(new String[] {""}); - + TransformMeta transformMeta = pipelineMeta.findTransform(wTransform1.getText()); if (transformMeta != null) { try { IRowMeta row = pipelineMeta.getTransformFields(variables, transformMeta); - String[] fieldNames = ConstUi.sortFieldNames(row.getFieldNames()); + String[] fieldNames = ConstUi.sortFieldNames(row.getFieldNames()); leftColumn.setComboValues(fieldNames); } catch (HopException e) { logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); } } - + transformMeta = pipelineMeta.findTransform(wTransform2.getText()); if (transformMeta != null) { try { @@ -446,8 +446,8 @@ private void updateFieldNames(ColumnInfo leftColumn, ColumnInfo rightColumn) { } catch (HopException e) { logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); } - } + } }; - shell.getDisplay().asyncExec(runnable); + shell.getDisplay().asyncExec(runnable); } } diff --git a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMeta.java b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMeta.java index b1b08997e24..a3ec8c52f41 100644 --- a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMeta.java +++ b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.mergejoin; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -41,9 +43,6 @@ import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "MergeJoin", image = "mergejoin.svg", @@ -239,7 +238,9 @@ public String getJoinType() { return joinType; } - /** @param joinType The joinType to set */ + /** + * @param joinType The joinType to set + */ public void setJoinType(String joinType) { this.joinType = joinType; } @@ -253,7 +254,9 @@ public String getLeftTransformName() { return leftTransformName; } - /** @param leftTransformName The leftTransformName to set */ + /** + * @param leftTransformName The leftTransformName to set + */ public void setLeftTransformName(String leftTransformName) { this.leftTransformName = leftTransformName; } @@ -267,7 +270,9 @@ public String getRightTransformName() { return rightTransformName; } - /** @param rightTransformName The rightTransformName to set */ + /** + * @param rightTransformName The rightTransformName to set + */ public void setRightTransformName(String rightTransformName) { this.rightTransformName = rightTransformName; } @@ -281,7 +286,9 @@ public List getKeyFields1() { return keyFields1; } - /** @param keyFields1 The keyFields1 to set */ + /** + * @param keyFields1 The keyFields1 to set + */ public void setKeyFields1(List keyFields1) { this.keyFields1 = keyFields1; } @@ -295,7 +302,9 @@ public List getKeyFields2() { return keyFields2; } - /** @param keyFields2 The keyFields2 to set */ + /** + * @param keyFields2 The keyFields2 to set + */ public void setKeyFields2(List keyFields2) { this.keyFields2 = keyFields2; } diff --git a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/RightKey.java b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/RightKey.java index fb4966b4924..2930f8854ab 100644 --- a/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/RightKey.java +++ b/plugins/transforms/mergejoin/src/main/java/org/apache/hop/pipeline/transforms/mergejoin/RightKey.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.mergejoin; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class RightKey { @HopMetadataProperty( @@ -64,7 +63,9 @@ public String getKey() { return key; } - /** @param key The key to set */ + /** + * @param key The key to set + */ public void setKey(String key) { this.key = key; } diff --git a/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaInjectionTransform.java b/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaInjectionTransform.java index ee393d9c67c..711d9191241 100644 --- a/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaInjectionTransform.java +++ b/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaInjectionTransform.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.mergejoin; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.injection.bean.BeanInjectionInfo; import org.apache.hop.core.injection.bean.BeanInjector; @@ -25,11 +29,6 @@ import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; - public class MergeJoinMetaInjectionTransform { @Test diff --git a/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaTest.java b/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaTest.java index 2a1f73c8588..02074e132f1 100644 --- a/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaTest.java +++ b/plugins/transforms/mergejoin/src/test/java/org/apache/hop/pipeline/transforms/mergejoin/MergeJoinMetaTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.mergejoin; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; @@ -37,17 +47,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - public class MergeJoinMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRows.java b/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRows.java index a8d4c142706..dc2f7847de7 100644 --- a/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRows.java +++ b/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRows.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.mergerows; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopRowException; import org.apache.hop.core.exception.HopTransformException; @@ -31,9 +33,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.Arrays; -import java.util.List; - /** * Merge rows from 2 sorted streams to detect changes. Use this as feed for a dimension in case you * have no time stamps in your source system. @@ -69,7 +68,7 @@ public boolean processRow() throws HopException { data.oneRowSet = findInputRowSet(infoStreams.get(0).getTransformName()); // twoRowSet is the "Comparison" stream data.twoRowSet = findInputRowSet(infoStreams.get(1).getTransformName()); - + data.one = getRowFrom(data.oneRowSet); data.two = getRowFrom(data.twoRowSet); @@ -173,7 +172,7 @@ public boolean processRow() throws HopException { int compareValues = data.oneRowSet.getRowMeta().compare(data.one, data.two, data.valueNrs); if (compareValues == 0) { outputRow = data.two; // documented behavior: use the comparison stream - outputIndex = data.twoRowSet.getRowMeta().size(); + outputIndex = data.twoRowSet.getRowMeta().size(); flagField = VALUE_IDENTICAL; } else { // Return the compare (most recent) row diff --git a/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsDialog.java b/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsDialog.java index 4e7ddba716f..ab81ceb11c5 100644 --- a/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsDialog.java +++ b/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.mergerows; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -49,8 +50,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class MergeRowsDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MergeRowsMeta.class; // For Translator public static final String STRING_SORT_WARNING_PARAMETER = "MergeRowsSortWarning"; @@ -349,13 +348,11 @@ private void ok() { input.allocate(nrKeys, nrValues); - for (int i = 0; i < nrKeys; i++) { TableItem item = wKeys.getNonEmpty(i); input.getKeyFields()[i] = item.getText(1); } - for (int i = 0; i < nrValues; i++) { TableItem item = wValues.getNonEmpty(i); input.getValueFields()[i] = item.getText(1); diff --git a/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMeta.java b/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMeta.java index 7396dd1f4bc..00d97a79480 100644 --- a/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMeta.java +++ b/plugins/transforms/mergerows/src/main/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.mergerows; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -46,8 +47,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.w3c.dom.Node; -import java.util.List; - @InjectionSupported(localizationPrefix = "MergeRows.Injection.") @Transform( id = "MergeRows", @@ -69,22 +68,30 @@ public class MergeRowsMeta extends BaseTransformMeta { @Injection(name = "VALUE_FIELDS") private String[] valueFields; - /** @return Returns the keyFields. */ + /** + * @return Returns the keyFields. + */ public String[] getKeyFields() { return keyFields; } - /** @param keyFields The keyFields to set. */ + /** + * @param keyFields The keyFields to set. + */ public void setKeyFields(String[] keyFields) { this.keyFields = keyFields; } - /** @return Returns the valueFields. */ + /** + * @return Returns the valueFields. + */ public String[] getValueFields() { return valueFields; } - /** @param valueFields The valueFields to set. */ + /** + * @param valueFields The valueFields to set. + */ public void setValueFields(String[] valueFields) { this.valueFields = valueFields; } @@ -99,12 +106,16 @@ public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider) readData(transformNode); } - /** @return Returns the flagField. */ + /** + * @return Returns the flagField. + */ public String getFlagField() { return flagField; } - /** @param flagField The flagField to set. */ + /** + * @param flagField The flagField to set. + */ public void setFlagField(String flagField) { this.flagField = flagField; } diff --git a/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaCheckTest.java b/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaCheckTest.java index afc635d8fc7..e8f448a8aed 100644 --- a/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaCheckTest.java +++ b/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaCheckTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.mergerows; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -30,17 +40,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class MergeRowsMetaCheckTest { private PipelineMeta pipelineMeta; diff --git a/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaTest.java b/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaTest.java index 27909024032..5eecd33e524 100644 --- a/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaTest.java +++ b/plugins/transforms/mergerows/src/test/java/org/apache/hop/pipeline/transforms/mergerows/MergeRowsMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.mergerows; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -31,11 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MergeRowsMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = MergeRowsMeta.class; diff --git a/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInput.java b/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInput.java index 5c0db5887e0..b3d5edb536b 100644 --- a/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInput.java +++ b/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInput.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.metainput; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.json.simple.JSONObject; -import java.util.ArrayList; -import java.util.List; - public class MetadataInput extends BaseTransform { public MetadataInput( TransformMeta transformMeta, diff --git a/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInputMeta.java b/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInputMeta.java index 3cc31974d57..39da4136807 100644 --- a/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInputMeta.java +++ b/plugins/transforms/metadata/src/main/java/org/apache/hop/pipeline/transforms/metainput/MetadataInputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.metainput; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.row.IRowMeta; @@ -27,10 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - @Transform( id = "MetadataInput", name = "i18n::MetadataInput.Transform.Name", diff --git a/plugins/transforms/metadata/src/test/java/org/apache/hop/pipeline/transforms/metadata/MetadataInputMetaTest.java b/plugins/transforms/metadata/src/test/java/org/apache/hop/pipeline/transforms/metadata/MetadataInputMetaTest.java index 646a9a5ddf0..7076c8ec509 100644 --- a/plugins/transforms/metadata/src/test/java/org/apache/hop/pipeline/transforms/metadata/MetadataInputMetaTest.java +++ b/plugins/transforms/metadata/src/test/java/org/apache/hop/pipeline/transforms/metadata/MetadataInputMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.metadata; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -24,11 +28,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MetadataInputMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInject.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInject.java index 91b643271b1..c416b66afbc 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInject.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInject.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.metainject; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -45,21 +59,6 @@ import org.apache.hop.pipeline.transform.RowAdapter; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - /** Read a simple CSV file Just output Strings found in the file... */ public class MetaInject extends BaseTransform { private static final Class PKG = MetaInject.class; // For Translator @@ -100,7 +99,7 @@ public boolean processRow() throws HopException { row = getRowFrom(rowSet); } - if (list.isEmpty()){ + if (list.isEmpty()) { receivedRows = false; break; } @@ -442,12 +441,15 @@ private void newInjection(String targetTransform, ITransformMeta targetTransform } } - /** Inject constant values. + /** + * Inject constant values. + * * @param variables * @param targetTransform * @param targetTransformMeta */ - private void newInjectionConstants(IVariables variables, String targetTransform, ITransformMeta targetTransformMeta) + private void newInjectionConstants( + IVariables variables, String targetTransform, ITransformMeta targetTransformMeta) throws HopException { if (log.isDetailed()) { logDetailed("Handing transform '" + targetTransform + "' constants injection!"); @@ -470,8 +472,7 @@ private void newInjectionConstants(IVariables variables, String targetTransform, if (injector.hasProperty(targetTransformMeta, target.getAttributeKey())) { // target transform has specified key String value = variables.resolve(source.getField()); - injector.setProperty( - targetTransformMeta, target.getAttributeKey(), null, value); + injector.setProperty(targetTransformMeta, target.getAttributeKey(), null, value); } else { // target transform doesn't have specified key - just report but don't fail like in 6.0 logError( diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectData.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectData.java index 6cfec738e52..6eb39d7730f 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectData.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.metainject; +import java.util.List; +import java.util.Map; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.ITransformMeta; -import java.util.List; -import java.util.Map; - public class MetaInjectData extends BaseTransformData implements ITransformData { public PipelineMeta pipelineMeta; public Map transformInjectionMetasMap; diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectDialog.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectDialog.java index 1172bf8a107..edc0852780b 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectDialog.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectDialog.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.metainject; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -86,15 +94,6 @@ import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.swt.widgets.TreeItem; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - public class MetaInjectDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MetaInjectMeta.class; // For Translator @@ -614,8 +613,8 @@ private void addInjectTab() { wInjectComp.setLayout(fileLayout); // Add a search bar at the top... - ToolBar treeTb = new ToolBar(wInjectComp, SWT.HORIZONTAL | SWT.FLAT); - PropsUi.setLook(treeTb, PropsUi.WIDGET_STYLE_DEFAULT); + ToolBar treeTb = new ToolBar(wInjectComp, SWT.HORIZONTAL | SWT.FLAT); + PropsUi.setLook(treeTb, PropsUi.WIDGET_STYLE_DEFAULT); ToolItem wFilter = new ToolItem(treeTb, SWT.SEPARATOR); wSearchText = new Text(treeTb, SWT.SEARCH | SWT.CANCEL | SWT.ICON_SEARCH | SWT.ICON_CANCEL); wSearchText.setData(BaseDialog.NO_DEFAULT_HANDLER, true); @@ -669,7 +668,7 @@ private void addInjectTab() { fdTree.bottom = new FormAttachment(100, 0); wTree.setLayoutData(fdTree); PropsUi.setLook(wTree); - + ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo( diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMapping.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMapping.java index a6ba5f657fb..8e4153b177c 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMapping.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMapping.java @@ -1,69 +1,69 @@ -/* - * 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 org.apache.hop.pipeline.transforms.metainject; - -import org.apache.hop.core.injection.Injection; - -public class MetaInjectMapping { - - @Injection(name = "MAPPING_SOURCE_TRANSFORM", group = "MAPPING_FIELDS") - private String sourceTransform; - - @Injection(name = "MAPPING_SOURCE_FIELD", group = "MAPPING_FIELDS") - private String sourceField; - - @Injection(name = "MAPPING_TARGET_TRANSFORM", group = "MAPPING_FIELDS") - private String targetTransform; - - @Injection(name = "MAPPING_TARGET_FIELD", group = "MAPPING_FIELDS") - private String targetField; - - public MetaInjectMapping() {} - - public String getSourceTransform() { - return sourceTransform; - } - - public void setSourceTransform(String sourceTransform) { - this.sourceTransform = sourceTransform; - } - - public String getSourceField() { - return sourceField; - } - - public void setSourceField(String sourceField) { - this.sourceField = sourceField; - } - - public String getTargetTransform() { - return targetTransform; - } - - public void setTargetTransform(String targetTransform) { - this.targetTransform = targetTransform; - } - - public String getTargetField() { - return targetField; - } - - public void setTargetField(String targetField) { - this.targetField = targetField; - } -} +/* + * 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 org.apache.hop.pipeline.transforms.metainject; + +import org.apache.hop.core.injection.Injection; + +public class MetaInjectMapping { + + @Injection(name = "MAPPING_SOURCE_TRANSFORM", group = "MAPPING_FIELDS") + private String sourceTransform; + + @Injection(name = "MAPPING_SOURCE_FIELD", group = "MAPPING_FIELDS") + private String sourceField; + + @Injection(name = "MAPPING_TARGET_TRANSFORM", group = "MAPPING_FIELDS") + private String targetTransform; + + @Injection(name = "MAPPING_TARGET_FIELD", group = "MAPPING_FIELDS") + private String targetField; + + public MetaInjectMapping() {} + + public String getSourceTransform() { + return sourceTransform; + } + + public void setSourceTransform(String sourceTransform) { + this.sourceTransform = sourceTransform; + } + + public String getSourceField() { + return sourceField; + } + + public void setSourceField(String sourceField) { + this.sourceField = sourceField; + } + + public String getTargetTransform() { + return targetTransform; + } + + public void setTargetTransform(String targetTransform) { + this.targetTransform = targetTransform; + } + + public String getTargetField() { + return targetField; + } + + public void setTargetField(String targetField) { + this.targetField = targetField; + } +} diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMeta.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMeta.java index cfacb1945c9..f7eca8528d7 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMeta.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMeta.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.metainject; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopException; @@ -48,12 +53,6 @@ import org.apache.hop.resource.ResourceReference; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - @Transform( id = "MetaInject", image = "GenericTransform.svg", @@ -66,9 +65,7 @@ localizationPrefix = "MetaInject.Injection.", groups = {"SOURCE_OUTPUT_FIELDS", "MAPPING_FIELDS"}) public class MetaInjectMeta extends BaseTransformMeta - implements - ITransformMetaChangeListener, - ISubPipelineAwareMeta { + implements ITransformMetaChangeListener, ISubPipelineAwareMeta { private static final Class PKG = MetaInjectMeta.class; // For Translator @@ -229,7 +226,8 @@ public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider) } targetFile = XmlHandler.getTagValue(transformNode, TARGET_FILE); - createParentFolder = "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformNode, CREATE_PARENT_FOLDER)); + createParentFolder = + "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformNode, CREATE_PARENT_FOLDER)); noExecution = "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformNode, NO_EXECUTION)); streamSourceTransformName = XmlHandler.getTagValue(transformNode, STREAM_SOURCE_TRANSFORM); @@ -290,12 +288,16 @@ public void setTargetSourceMapping( this.targetSourceMapping = targetSourceMapping; } - /** @return the fileName */ + /** + * @return the fileName + */ public String getFileName() { return fileName; } - /** @param fileName the fileName to set */ + /** + * @param fileName the fileName to set + */ public void setFileName(String fileName) { this.fileName = fileName; } @@ -417,32 +419,44 @@ public boolean excludeFromRowLayoutVerification() { return true; } - /** @return the sourceTransformName */ + /** + * @return the sourceTransformName + */ public String getSourceTransformName() { return sourceTransformName; } - /** @param sourceTransformName the sourceTransformName to set */ + /** + * @param sourceTransformName the sourceTransformName to set + */ public void setSourceTransformName(String sourceTransformName) { this.sourceTransformName = sourceTransformName; } - /** @return the targetFile */ + /** + * @return the targetFile + */ public String getTargetFile() { return targetFile; } - /** @param targetFile the targetFile to set */ + /** + * @param targetFile the targetFile to set + */ public void setTargetFile(String targetFile) { this.targetFile = targetFile; } - /** @return the noExecution */ + /** + * @return the noExecution + */ public boolean isNoExecution() { return noExecution; } - /** @param noExecution the noExecution to set */ + /** + * @param noExecution the noExecution to set + */ public void setNoExecution(boolean noExecution) { this.noExecution = noExecution; } diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/SourceTransformField.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/SourceTransformField.java index 6866ccbd8c3..37fb35bc32a 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/SourceTransformField.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/SourceTransformField.java @@ -53,22 +53,30 @@ public int hashCode() { return Objects.hash(transformName, field); } - /** @return the transform name */ + /** + * @return the transform name + */ public String getTransformName() { return transformName; } - /** @param transformName the transform name to set */ + /** + * @param transformName the transform name to set + */ public void setTransformName(String transformName) { this.transformName = transformName; } - /** @return the field */ + /** + * @return the field + */ public String getField() { return field; } - /** @param field the field to set */ + /** + * @param field the field to set + */ public void setField(String field) { this.field = field; } diff --git a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/TargetTransformAttribute.java b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/TargetTransformAttribute.java index fc42e787951..1461ae27b6e 100644 --- a/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/TargetTransformAttribute.java +++ b/plugins/transforms/metainject/src/main/java/org/apache/hop/pipeline/transforms/metainject/TargetTransformAttribute.java @@ -52,22 +52,30 @@ public int hashCode() { return transformName.hashCode() ^ attributeKey.hashCode(); } - /** @return the transform name */ + /** + * @return the transform name + */ public String getTransformName() { return transformName; } - /** @param transformName the transform name to set */ + /** + * @param transformName the transform name to set + */ public void setTransformName(String transformName) { this.transformName = transformName; } - /** @return the attributeKey */ + /** + * @return the attributeKey + */ public String getAttributeKey() { return attributeKey; } - /** @param attributeKey the attributeKey to set */ + /** + * @param attributeKey the attributeKey to set + */ public void setAttributeKey(String attributeKey) { this.attributeKey = attributeKey; } diff --git a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaInjectionTest.java b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaInjectionTest.java index 734a8251af0..21bf86434fd 100644 --- a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaInjectionTest.java +++ b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaInjectionTest.java @@ -1,62 +1,62 @@ -/* - * 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 org.apache.hop.pipeline.transforms.metainject; - -import org.apache.hop.core.injection.BaseMetadataInjectionTest; -import org.apache.hop.core.row.value.ValueMetaBase; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -public class MetaInjectMetaInjectionTest extends BaseMetadataInjectionTest { - @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - - private static final String TEST_ID = "TEST_ID"; - - @Before - public void setup() throws Exception { - setup(new MetaInjectMeta()); - } - - @Test - public void test() throws Exception { - check("FILE_NAME", () -> meta.getFileName()); - check("SOURCE_TRANSFORM_NAME", () -> meta.getSourceTransformName()); - check("TARGET_FILE", () -> meta.getTargetFile()); - check("NO_EXECUTION", () -> meta.isNoExecution()); - check("STREAMING_SOURCE_TRANSFORM", () -> meta.getStreamSourceTransformName()); - check("STREAMING_TARGET_TRANSFORM", () -> meta.getStreamTargetTransformName()); - check("SOURCE_OUTPUT_NAME", () -> meta.getSourceOutputFields().get(0).getName()); - String[] typeNames = ValueMetaBase.getAllTypes(); - - checkStringToInt( - "SOURCE_OUTPUT_TYPE", - () -> meta.getSourceOutputFields().get(0).getType(), - typeNames, - getTypeCodes(typeNames)); - check("SOURCE_OUTPUT_LENGTH", () -> meta.getSourceOutputFields().get(0).getLength()); - check("SOURCE_OUTPUT_PRECISION", () -> meta.getSourceOutputFields().get(0).getPrecision()); - check( - "MAPPING_SOURCE_TRANSFORM", () -> meta.getMetaInjectMapping().get(0).getSourceTransform()); - check("MAPPING_SOURCE_FIELD", () -> meta.getMetaInjectMapping().get(0).getSourceField()); - check( - "MAPPING_TARGET_TRANSFORM", () -> meta.getMetaInjectMapping().get(0).getTargetTransform()); - check("MAPPING_TARGET_FIELD", () -> meta.getMetaInjectMapping().get(0).getTargetField()); - } -} +/* + * 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 org.apache.hop.pipeline.transforms.metainject; + +import org.apache.hop.core.injection.BaseMetadataInjectionTest; +import org.apache.hop.core.row.value.ValueMetaBase; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +public class MetaInjectMetaInjectionTest extends BaseMetadataInjectionTest { + @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); + + private static final String TEST_ID = "TEST_ID"; + + @Before + public void setup() throws Exception { + setup(new MetaInjectMeta()); + } + + @Test + public void test() throws Exception { + check("FILE_NAME", () -> meta.getFileName()); + check("SOURCE_TRANSFORM_NAME", () -> meta.getSourceTransformName()); + check("TARGET_FILE", () -> meta.getTargetFile()); + check("NO_EXECUTION", () -> meta.isNoExecution()); + check("STREAMING_SOURCE_TRANSFORM", () -> meta.getStreamSourceTransformName()); + check("STREAMING_TARGET_TRANSFORM", () -> meta.getStreamTargetTransformName()); + check("SOURCE_OUTPUT_NAME", () -> meta.getSourceOutputFields().get(0).getName()); + String[] typeNames = ValueMetaBase.getAllTypes(); + + checkStringToInt( + "SOURCE_OUTPUT_TYPE", + () -> meta.getSourceOutputFields().get(0).getType(), + typeNames, + getTypeCodes(typeNames)); + check("SOURCE_OUTPUT_LENGTH", () -> meta.getSourceOutputFields().get(0).getLength()); + check("SOURCE_OUTPUT_PRECISION", () -> meta.getSourceOutputFields().get(0).getPrecision()); + check( + "MAPPING_SOURCE_TRANSFORM", () -> meta.getMetaInjectMapping().get(0).getSourceTransform()); + check("MAPPING_SOURCE_FIELD", () -> meta.getMetaInjectMapping().get(0).getSourceField()); + check( + "MAPPING_TARGET_TRANSFORM", () -> meta.getMetaInjectMapping().get(0).getTargetTransform()); + check("MAPPING_TARGET_FIELD", () -> meta.getMetaInjectMapping().get(0).getTargetField()); + } +} diff --git a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaLoadSaveTest.java b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaLoadSaveTest.java index 93924a0b52d..f2e0a4ea40f 100644 --- a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaLoadSaveTest.java +++ b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaLoadSaveTest.java @@ -1,191 +1,191 @@ -/* - * 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 org.apache.hop.pipeline.transforms.metainject; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; -import org.apache.hop.pipeline.transforms.loadsave.validator.ListLoadSaveValidator; -import org.apache.hop.pipeline.transforms.loadsave.validator.MapLoadSaveValidator; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -public class MetaInjectMetaLoadSaveTest { - @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - - LoadSaveTester loadSaveTester; - Class testMetaClass = MetaInjectMeta.class; - - @Before - public void setUpLoadSave() throws Exception { - List attributes = - Arrays.asList( - "fileName", - "sourceTransformName", - "targetFile", - "noExecution", - "streamSourceTransformName", - "streamTargetTransformName", - "sourceOutputFields"); - - Map getterMap = new HashMap<>(); - Map setterMap = new HashMap<>(); - - Map> attrValidatorMap = new HashMap<>(); - attrValidatorMap.put( - "sourceOutputFields", - new ListLoadSaveValidator<>(new MetaInjectOutputFieldLoadSaveValidator(), 5)); - // - // Note - these seem to be runtime-built and not persisted. - attrValidatorMap.put( - "metaInjectMapping", - new ListLoadSaveValidator<>(new MetaInjectMappingLoadSaveValidator(), 5)); - attrValidatorMap.put( - "targetSourceMapping", - new MapLoadSaveValidator<>( - new TargetTransformAttributeLoadSaveValidator(), - new SourceTransformFieldLoadSaveValidator(), - 5)); - - Map> typeValidatorMap = new HashMap<>(); - - loadSaveTester = - new LoadSaveTester( - testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap); - } - - @Test - public void testSerialization() throws HopException { - loadSaveTester.testSerialization(); - } - - public class MetaInjectOutputFieldLoadSaveValidator - implements IFieldLoadSaveValidator { - final Random rand = new Random(); - - @Override - public MetaInjectOutputField getTestObject() { - MetaInjectOutputField rtn = new MetaInjectOutputField(); - rtn.setName(UUID.randomUUID().toString()); - rtn.setLength(rand.nextInt(100)); - rtn.setPrecision(rand.nextInt(9)); - rtn.setType(rand.nextInt(7)); - return rtn; - } - - @Override - public boolean validateTestObject(MetaInjectOutputField testObject, Object actual) { - if (!(actual instanceof MetaInjectOutputField)) { - return false; - } - MetaInjectOutputField another = (MetaInjectOutputField) actual; - return new EqualsBuilder() - .append(testObject.getLength(), another.getLength()) - .append(testObject.getPrecision(), another.getPrecision()) - .append(testObject.getName(), another.getName()) - .append(testObject.getType(), another.getType()) - .isEquals(); - } - } - - // MetaInjectMappingLoadSaveValidator - public class MetaInjectMappingLoadSaveValidator - implements IFieldLoadSaveValidator { - final Random rand = new Random(); - - @Override - public MetaInjectMapping getTestObject() { - MetaInjectMapping rtn = new MetaInjectMapping(); - rtn.setSourceField(UUID.randomUUID().toString()); - rtn.setSourceTransform(UUID.randomUUID().toString()); - rtn.setTargetField(UUID.randomUUID().toString()); - rtn.setTargetTransform(UUID.randomUUID().toString()); - return rtn; - } - - @Override - public boolean validateTestObject(MetaInjectMapping testObject, Object actual) { - if (!(actual instanceof MetaInjectMapping)) { - return false; - } - MetaInjectMapping another = (MetaInjectMapping) actual; - return new EqualsBuilder() - .append(testObject.getSourceField(), another.getSourceField()) - .append(testObject.getSourceTransform(), another.getSourceTransform()) - .append(testObject.getTargetField(), another.getTargetField()) - .append(testObject.getTargetTransform(), another.getTargetTransform()) - .isEquals(); - } - } - // TargetTransformAttributeLoadSaveValidator - public class TargetTransformAttributeLoadSaveValidator - implements IFieldLoadSaveValidator { - final Random rand = new Random(); - - @Override - public TargetTransformAttribute getTestObject() { - return new TargetTransformAttribute( - UUID.randomUUID().toString(), UUID.randomUUID().toString(), rand.nextBoolean()); - } - - @Override - public boolean validateTestObject(TargetTransformAttribute testObject, Object actual) { - if (!(actual instanceof TargetTransformAttribute)) { - return false; - } - TargetTransformAttribute another = (TargetTransformAttribute) actual; - return new EqualsBuilder() - .append(testObject.getTransformName(), another.getTransformName()) - .append(testObject.getAttributeKey(), another.getAttributeKey()) - .append(testObject.isDetail(), another.isDetail()) - .isEquals(); - } - } - - // SourceTransformFieldLoadSaveValidator - public class SourceTransformFieldLoadSaveValidator - implements IFieldLoadSaveValidator { - final Random rand = new Random(); - - @Override - public SourceTransformField getTestObject() { - return new SourceTransformField(UUID.randomUUID().toString(), UUID.randomUUID().toString()); - } - - @Override - public boolean validateTestObject(SourceTransformField testObject, Object actual) { - if (!(actual instanceof SourceTransformField)) { - return false; - } - SourceTransformField another = (SourceTransformField) actual; - return new EqualsBuilder() - .append(testObject.getTransformName(), another.getTransformName()) - .append(testObject.getField(), another.getField()) - .isEquals(); - } - } -} +/* + * 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 org.apache.hop.pipeline.transforms.metainject; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; +import org.apache.hop.pipeline.transforms.loadsave.validator.ListLoadSaveValidator; +import org.apache.hop.pipeline.transforms.loadsave.validator.MapLoadSaveValidator; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +public class MetaInjectMetaLoadSaveTest { + @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); + + LoadSaveTester loadSaveTester; + Class testMetaClass = MetaInjectMeta.class; + + @Before + public void setUpLoadSave() throws Exception { + List attributes = + Arrays.asList( + "fileName", + "sourceTransformName", + "targetFile", + "noExecution", + "streamSourceTransformName", + "streamTargetTransformName", + "sourceOutputFields"); + + Map getterMap = new HashMap<>(); + Map setterMap = new HashMap<>(); + + Map> attrValidatorMap = new HashMap<>(); + attrValidatorMap.put( + "sourceOutputFields", + new ListLoadSaveValidator<>(new MetaInjectOutputFieldLoadSaveValidator(), 5)); + // + // Note - these seem to be runtime-built and not persisted. + attrValidatorMap.put( + "metaInjectMapping", + new ListLoadSaveValidator<>(new MetaInjectMappingLoadSaveValidator(), 5)); + attrValidatorMap.put( + "targetSourceMapping", + new MapLoadSaveValidator<>( + new TargetTransformAttributeLoadSaveValidator(), + new SourceTransformFieldLoadSaveValidator(), + 5)); + + Map> typeValidatorMap = new HashMap<>(); + + loadSaveTester = + new LoadSaveTester( + testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap); + } + + @Test + public void testSerialization() throws HopException { + loadSaveTester.testSerialization(); + } + + public class MetaInjectOutputFieldLoadSaveValidator + implements IFieldLoadSaveValidator { + final Random rand = new Random(); + + @Override + public MetaInjectOutputField getTestObject() { + MetaInjectOutputField rtn = new MetaInjectOutputField(); + rtn.setName(UUID.randomUUID().toString()); + rtn.setLength(rand.nextInt(100)); + rtn.setPrecision(rand.nextInt(9)); + rtn.setType(rand.nextInt(7)); + return rtn; + } + + @Override + public boolean validateTestObject(MetaInjectOutputField testObject, Object actual) { + if (!(actual instanceof MetaInjectOutputField)) { + return false; + } + MetaInjectOutputField another = (MetaInjectOutputField) actual; + return new EqualsBuilder() + .append(testObject.getLength(), another.getLength()) + .append(testObject.getPrecision(), another.getPrecision()) + .append(testObject.getName(), another.getName()) + .append(testObject.getType(), another.getType()) + .isEquals(); + } + } + + // MetaInjectMappingLoadSaveValidator + public class MetaInjectMappingLoadSaveValidator + implements IFieldLoadSaveValidator { + final Random rand = new Random(); + + @Override + public MetaInjectMapping getTestObject() { + MetaInjectMapping rtn = new MetaInjectMapping(); + rtn.setSourceField(UUID.randomUUID().toString()); + rtn.setSourceTransform(UUID.randomUUID().toString()); + rtn.setTargetField(UUID.randomUUID().toString()); + rtn.setTargetTransform(UUID.randomUUID().toString()); + return rtn; + } + + @Override + public boolean validateTestObject(MetaInjectMapping testObject, Object actual) { + if (!(actual instanceof MetaInjectMapping)) { + return false; + } + MetaInjectMapping another = (MetaInjectMapping) actual; + return new EqualsBuilder() + .append(testObject.getSourceField(), another.getSourceField()) + .append(testObject.getSourceTransform(), another.getSourceTransform()) + .append(testObject.getTargetField(), another.getTargetField()) + .append(testObject.getTargetTransform(), another.getTargetTransform()) + .isEquals(); + } + } + + // TargetTransformAttributeLoadSaveValidator + public class TargetTransformAttributeLoadSaveValidator + implements IFieldLoadSaveValidator { + final Random rand = new Random(); + + @Override + public TargetTransformAttribute getTestObject() { + return new TargetTransformAttribute( + UUID.randomUUID().toString(), UUID.randomUUID().toString(), rand.nextBoolean()); + } + + @Override + public boolean validateTestObject(TargetTransformAttribute testObject, Object actual) { + if (!(actual instanceof TargetTransformAttribute)) { + return false; + } + TargetTransformAttribute another = (TargetTransformAttribute) actual; + return new EqualsBuilder() + .append(testObject.getTransformName(), another.getTransformName()) + .append(testObject.getAttributeKey(), another.getAttributeKey()) + .append(testObject.isDetail(), another.isDetail()) + .isEquals(); + } + } + + // SourceTransformFieldLoadSaveValidator + public class SourceTransformFieldLoadSaveValidator + implements IFieldLoadSaveValidator { + final Random rand = new Random(); + + @Override + public SourceTransformField getTestObject() { + return new SourceTransformField(UUID.randomUUID().toString(), UUID.randomUUID().toString()); + } + + @Override + public boolean validateTestObject(SourceTransformField testObject, Object actual) { + if (!(actual instanceof SourceTransformField)) { + return false; + } + SourceTransformField another = (SourceTransformField) actual; + return new EqualsBuilder() + .append(testObject.getTransformName(), another.getTransformName()) + .append(testObject.getField(), another.getField()) + .isEquals(); + } + } +} diff --git a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaTest.java b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaTest.java index f1f9c62c822..e93b3b858ee 100644 --- a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaTest.java +++ b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMetaTest.java @@ -1,147 +1,146 @@ -/* - * 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 org.apache.hop.pipeline.transforms.metainject; - -import org.apache.hop.core.HopClientEnvironment; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.variables.Variables; -import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; -import org.apache.hop.metadata.api.IHopMetadataProvider; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.transform.TransformMeta; -import org.apache.hop.resource.IResourceNaming; -import org.apache.hop.resource.ResourceDefinition; -import org.apache.hop.resource.ResourceReference; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - -public class MetaInjectMetaTest { - - private static final String SOURCE_TRANSFORM_NAME = "SOURCE_TRANSFORM_NAME"; - - private static final String SOURCE_FIELD_NAME = "SOURCE_TRANSFORM_NAME"; - - private static final String TARGET_TRANSFORM_NAME = "TARGET_TRANSFORM_NAME"; - - private static final String TARGET_FIELD_NAME = "TARGET_TRANSFORM_NAME"; - - private static final String TEST_FILE_NAME = "TEST_FILE_NAME"; - - private static final String EXPORTED_FILE_NAME = TEST_FILE_NAME; - - private static MetaInjectMeta metaInjectMeta; - - @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - - @BeforeClass - public static void SetUp() throws Exception { - if (!HopClientEnvironment.isInitialized()) { - HopClientEnvironment.init(); - } - metaInjectMeta = new MetaInjectMeta(); - } - - @Before - public void before() { - metaInjectMeta = new MetaInjectMeta(); - } - - @Test - public void getResourceDependencies() { - PipelineMeta pipelineMeta = mock(PipelineMeta.class); - TransformMeta transformMeta = mock(TransformMeta.class); - - List actualResult = - metaInjectMeta.getResourceDependencies(new Variables(), transformMeta); - assertEquals(1, actualResult.size()); - ResourceReference reference = actualResult.iterator().next(); - assertEquals(0, reference.getEntries().size()); - } - - @Test - public void getResourceDependencies_with_defined_fileName() { - PipelineMeta pipelineMeta = mock(PipelineMeta.class); - TransformMeta transformMeta = mock(TransformMeta.class); - metaInjectMeta.setFileName("FILE_NAME"); - // doReturn("FILE_NAME_WITH_SUBSTITUTIONS").when(pipelineMeta).environmentSubstitute("FILE_NAME"); - - List actualResult = - metaInjectMeta.getResourceDependencies(new Variables(), transformMeta); - assertEquals(1, actualResult.size()); - ResourceReference reference = actualResult.iterator().next(); - assertEquals(1, reference.getEntries().size()); - } - - @Test - public void exportResources() throws HopException { - IVariables variables = mock(IVariables.class); - IResourceNaming resourceNamingInterface = mock(IResourceNaming.class); - IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class); - - MetaInjectMeta injectMetaSpy = spy(metaInjectMeta); - PipelineMeta pipelineMeta = mock(PipelineMeta.class); - Map definitions = Collections.emptyMap(); - doReturn(TEST_FILE_NAME) - .when(pipelineMeta) - .exportResources(variables, definitions, resourceNamingInterface, metadataProvider); - doReturn(pipelineMeta).when(injectMetaSpy).loadPipelineMeta(metadataProvider, variables); - - String actualExportedFileName = - injectMetaSpy.exportResources( - variables, definitions, resourceNamingInterface, metadataProvider); - assertEquals(TEST_FILE_NAME, actualExportedFileName); - assertEquals(EXPORTED_FILE_NAME, injectMetaSpy.getFileName()); - verify(pipelineMeta) - .exportResources(variables, definitions, resourceNamingInterface, metadataProvider); - } - - @Test - public void convertToMap() { - MetaInjectMapping metaInjectMapping = new MetaInjectMapping(); - metaInjectMapping.setSourceTransform(SOURCE_TRANSFORM_NAME); - metaInjectMapping.setSourceField(SOURCE_FIELD_NAME); - metaInjectMapping.setTargetTransform(TARGET_TRANSFORM_NAME); - metaInjectMapping.setTargetField(TARGET_FIELD_NAME); - - Map actualResult = - MetaInjectMeta.convertToMap(Collections.singletonList(metaInjectMapping)); - - assertEquals(1, actualResult.size()); - - TargetTransformAttribute targetTransformAttribute = actualResult.keySet().iterator().next(); - assertEquals(TARGET_TRANSFORM_NAME, targetTransformAttribute.getTransformName()); - assertEquals(TARGET_FIELD_NAME, targetTransformAttribute.getAttributeKey()); - - SourceTransformField sourceTransformField = actualResult.values().iterator().next(); - assertEquals(SOURCE_TRANSFORM_NAME, sourceTransformField.getTransformName()); - assertEquals(SOURCE_FIELD_NAME, sourceTransformField.getField()); - } -} +/* + * 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 org.apache.hop.pipeline.transforms.metainject; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.apache.hop.core.HopClientEnvironment; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.variables.Variables; +import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; +import org.apache.hop.metadata.api.IHopMetadataProvider; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.transform.TransformMeta; +import org.apache.hop.resource.IResourceNaming; +import org.apache.hop.resource.ResourceDefinition; +import org.apache.hop.resource.ResourceReference; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +public class MetaInjectMetaTest { + + private static final String SOURCE_TRANSFORM_NAME = "SOURCE_TRANSFORM_NAME"; + + private static final String SOURCE_FIELD_NAME = "SOURCE_TRANSFORM_NAME"; + + private static final String TARGET_TRANSFORM_NAME = "TARGET_TRANSFORM_NAME"; + + private static final String TARGET_FIELD_NAME = "TARGET_TRANSFORM_NAME"; + + private static final String TEST_FILE_NAME = "TEST_FILE_NAME"; + + private static final String EXPORTED_FILE_NAME = TEST_FILE_NAME; + + private static MetaInjectMeta metaInjectMeta; + + @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); + + @BeforeClass + public static void SetUp() throws Exception { + if (!HopClientEnvironment.isInitialized()) { + HopClientEnvironment.init(); + } + metaInjectMeta = new MetaInjectMeta(); + } + + @Before + public void before() { + metaInjectMeta = new MetaInjectMeta(); + } + + @Test + public void getResourceDependencies() { + PipelineMeta pipelineMeta = mock(PipelineMeta.class); + TransformMeta transformMeta = mock(TransformMeta.class); + + List actualResult = + metaInjectMeta.getResourceDependencies(new Variables(), transformMeta); + assertEquals(1, actualResult.size()); + ResourceReference reference = actualResult.iterator().next(); + assertEquals(0, reference.getEntries().size()); + } + + @Test + public void getResourceDependencies_with_defined_fileName() { + PipelineMeta pipelineMeta = mock(PipelineMeta.class); + TransformMeta transformMeta = mock(TransformMeta.class); + metaInjectMeta.setFileName("FILE_NAME"); + // doReturn("FILE_NAME_WITH_SUBSTITUTIONS").when(pipelineMeta).environmentSubstitute("FILE_NAME"); + + List actualResult = + metaInjectMeta.getResourceDependencies(new Variables(), transformMeta); + assertEquals(1, actualResult.size()); + ResourceReference reference = actualResult.iterator().next(); + assertEquals(1, reference.getEntries().size()); + } + + @Test + public void exportResources() throws HopException { + IVariables variables = mock(IVariables.class); + IResourceNaming resourceNamingInterface = mock(IResourceNaming.class); + IHopMetadataProvider metadataProvider = mock(IHopMetadataProvider.class); + + MetaInjectMeta injectMetaSpy = spy(metaInjectMeta); + PipelineMeta pipelineMeta = mock(PipelineMeta.class); + Map definitions = Collections.emptyMap(); + doReturn(TEST_FILE_NAME) + .when(pipelineMeta) + .exportResources(variables, definitions, resourceNamingInterface, metadataProvider); + doReturn(pipelineMeta).when(injectMetaSpy).loadPipelineMeta(metadataProvider, variables); + + String actualExportedFileName = + injectMetaSpy.exportResources( + variables, definitions, resourceNamingInterface, metadataProvider); + assertEquals(TEST_FILE_NAME, actualExportedFileName); + assertEquals(EXPORTED_FILE_NAME, injectMetaSpy.getFileName()); + verify(pipelineMeta) + .exportResources(variables, definitions, resourceNamingInterface, metadataProvider); + } + + @Test + public void convertToMap() { + MetaInjectMapping metaInjectMapping = new MetaInjectMapping(); + metaInjectMapping.setSourceTransform(SOURCE_TRANSFORM_NAME); + metaInjectMapping.setSourceField(SOURCE_FIELD_NAME); + metaInjectMapping.setTargetTransform(TARGET_TRANSFORM_NAME); + metaInjectMapping.setTargetField(TARGET_FIELD_NAME); + + Map actualResult = + MetaInjectMeta.convertToMap(Collections.singletonList(metaInjectMapping)); + + assertEquals(1, actualResult.size()); + + TargetTransformAttribute targetTransformAttribute = actualResult.keySet().iterator().next(); + assertEquals(TARGET_TRANSFORM_NAME, targetTransformAttribute.getTransformName()); + assertEquals(TARGET_FIELD_NAME, targetTransformAttribute.getAttributeKey()); + + SourceTransformField sourceTransformField = actualResult.values().iterator().next(); + assertEquals(SOURCE_TRANSFORM_NAME, sourceTransformField.getTransformName()); + assertEquals(SOURCE_FIELD_NAME, sourceTransformField.getField()); + } +} diff --git a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMigrationTest.java b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMigrationTest.java index 5848b863568..f5b99861a37 100644 --- a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMigrationTest.java +++ b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectMigrationTest.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.metainject; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.HashMap; import java.util.Map; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class MetaInjectMigrationTest { @Test diff --git a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectTest.java b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectTest.java index f24364f81aa..761f2f7900f 100644 --- a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectTest.java +++ b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/MetaInjectTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.metainject; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.injection.Injection; import org.apache.hop.core.injection.InjectionSupported; import org.apache.hop.core.logging.LogChannel; @@ -34,21 +48,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(PowerMockRunner.class) @PrepareForTest({MetaInject.class}) public class MetaInjectTest { @@ -265,7 +264,8 @@ private PipelineMeta mockSingleTransformPipelineMeta( } @InjectionSupported(localizationPrefix = "", groups = "groups") - private static class InjectableTestTransformMeta extends BaseTransformMeta { + private static class InjectableTestTransformMeta + extends BaseTransformMeta { @Injection(name = "THERE") private String there; diff --git a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/TransformMockUtil.java b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/TransformMockUtil.java index 1af6d21ee0d..20094ec403c 100644 --- a/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/TransformMockUtil.java +++ b/plugins/transforms/metainject/src/test/java/org/apache/hop/pipeline/transforms/metainject/TransformMockUtil.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.metainject; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -24,11 +28,6 @@ import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.mockito.ArgumentMatchers; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -56,8 +55,12 @@ public static TransformMockHelper getTransformMockHelper( } public static MetaInject getTransform(Class klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor kons = klass.getConstructor( TransformMeta.class, @@ -82,8 +85,12 @@ public static MetaInject getTransform( Class transformMetaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper(transformMetaClass, dataClass, transformName)); diff --git a/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructure.java b/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructure.java index 14f7a298c96..3733343a653 100644 --- a/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructure.java +++ b/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructure.java @@ -126,7 +126,7 @@ public boolean processRow() throws HopException { if (meta.isIncludeMaskField()) { outputRow = RowDataUtil.addValueData(outputRow, pos++, v.getConversionMask()); } - + if (meta.isIncludeOriginField()) { outputRow = RowDataUtil.addValueData(outputRow, pos++, v.getOrigin()); } diff --git a/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureDialog.java b/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureDialog.java index c1d49eed8ce..d173066f31a 100644 --- a/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureDialog.java +++ b/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureDialog.java @@ -430,8 +430,7 @@ public void widgetSelected(SelectionEvent e) { // Mask Field Label wlMaskField = new Label(shell, SWT.RIGHT); - wlMaskField.setText( - BaseMessages.getString(PKG, "TransformMetaStructureMeta.MaskField.Label")); + wlMaskField.setText(BaseMessages.getString(PKG, "TransformMetaStructureMeta.MaskField.Label")); PropsUi.setLook(wlMaskField); FormData fdlMaskField = new FormData(); fdlMaskField.left = new FormAttachment(0, 0); @@ -447,8 +446,8 @@ public void widgetSelected(SelectionEvent e) { fdMaskField.top = new FormAttachment(wlMaskField, 0, SWT.CENTER); fdMaskField.right = new FormAttachment(100, -margin); wMaskField.setLayoutData(fdMaskField); - wMaskField.setEnabled(true); - + wMaskField.setEnabled(true); + // Include Length field Label wlIncludeLength = new Label(shell, SWT.RIGHT); wlIncludeLength.setText( @@ -674,8 +673,8 @@ public void getData() { } wMaskField.setEnabled(input.isIncludeMaskField()); - wIncludeMask.setSelection(input.isIncludeMaskField()); - + wIncludeMask.setSelection(input.isIncludeMaskField()); + wTypeField.setEnabled(input.isIncludeTypeField()); wIncludeType.setSelection(input.isIncludeTypeField()); diff --git a/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureMeta.java b/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureMeta.java index 36f4fa68b44..a6f2f4658e8 100644 --- a/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureMeta.java +++ b/plugins/transforms/metastructure/src/main/java/org/apache/hop/pipeline/transforms/metastructure/TransformMetaStructureMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.metastructure; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "TransformMetaStructure", name = "i18n::TransformMetaStructure.Transform.Name", @@ -43,7 +42,8 @@ keywords = "i18n::TransformMetaStructureMeta.keyword", documentationUrl = "/pipeline/transforms/metastructure.html", image = "metastructure.svg") -public class TransformMetaStructureMeta extends BaseTransformMeta { +public class TransformMetaStructureMeta + extends BaseTransformMeta { private static final Class PKG = TransformMetaStructureMeta.class; // needed by Translator @@ -74,14 +74,14 @@ public class TransformMetaStructureMeta extends BaseTransformMeta { private static final Class PKG = - MonetDbBulkLoaderMeta.class; // for i18n purposes, needed by Translator2!! + MonetDbBulkLoaderMeta.class; // for i18n purposes, needed by Translator2!! private IRowMeta physicalTableRowMeta; private static final String ERROR_LOADING_DATA = "Error loading data: "; public MonetDbBulkLoader( - TransformMeta transformMeta, - MonetDbBulkLoaderMeta meta, - MonetDbBulkLoaderData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline) { + TransformMeta transformMeta, + MonetDbBulkLoaderMeta meta, + MonetDbBulkLoaderData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); } @@ -188,7 +188,7 @@ public boolean processRow() throws HopException { } protected void writeRowToMonetDB(IRowMeta rowMeta, Object[] r, DatabaseMeta dm) - throws HopException { + throws HopException { if (data.bufferIndex == data.bufferSize || log.isDebug()) { writeBufferToMonetDB(dm); } @@ -251,10 +251,10 @@ protected void addRowToBuffer(IRowMeta rowMeta, Object[] r) throws HopException } } break; - // - // formatter pattern to - // the user. - // + // + // formatter pattern to + // the user. + // case IValueMeta.TYPE_TIMESTAMP: case IValueMeta.TYPE_DATE: // Keep the data format as indicated. @@ -280,10 +280,10 @@ protected void addRowToBuffer(IRowMeta rowMeta, Object[] r) throws HopException // TIMESTAMP - DATE and TIME put together (e.g., 2012-12-21 15:51:36) if (colMeta != null - && colMeta.getOriginalColumnTypeName().equalsIgnoreCase("date")) { + && colMeta.getOriginalColumnTypeName().equalsIgnoreCase("date")) { line.append(data.monetDateMeta.getString(value)); } else if (colMeta != null - && colMeta.getOriginalColumnTypeName().equalsIgnoreCase("time")) { + && colMeta.getOriginalColumnTypeName().equalsIgnoreCase("time")) { line.append(data.monetTimeMeta.getString(value)); } else { // colMeta.getOriginalColumnTypeName().equalsIgnoreCase("timestamp") @@ -316,12 +316,12 @@ protected void addRowToBuffer(IRowMeta rowMeta, Object[] r) throws HopException IValueMeta valueMetaInt = new ValueMetaInteger(valueMeta.getName()); Long precision = Long.valueOf(colMeta.getPrecision()); line.append( - ValueDataUtil.round( - valueMeta, - dbl, - valueMetaInt, - precision, - java.math.BigDecimal.ROUND_HALF_UP)); + ValueDataUtil.round( + valueMeta, + dbl, + valueMetaInt, + precision, + java.math.BigDecimal.ROUND_HALF_UP)); } } break; @@ -341,12 +341,12 @@ protected void addRowToBuffer(IRowMeta rowMeta, Object[] r) throws HopException IValueMeta valueMetaInt = new ValueMetaInteger(valueMeta.getName()); Long precision = Long.valueOf(colMeta.getPrecision()); line.append( - ValueDataUtil.round( - valueMeta, - bd, - valueMetaInt, - precision, - java.math.BigDecimal.ROUND_HALF_UP)); + ValueDataUtil.round( + valueMeta, + bd, + valueMetaInt, + precision, + java.math.BigDecimal.ROUND_HALF_UP)); } } break; @@ -375,8 +375,8 @@ public void truncate() throws HopException { String cmd; String table = data.schemaTable; String truncateStatement = - meta.getDatabaseMeta() - .getTruncateTableStatement(variables, meta.getSchemaName(), meta.getTableName()); + meta.getDatabaseMeta() + .getTruncateTableStatement(variables, meta.getSchemaName(), meta.getTableName()); if (truncateStatement == null) { throw new HopException("Truncate table is not supported!"); } @@ -412,7 +412,7 @@ public void autoAdjustSchema(MonetDbBulkLoaderMeta meta) throws HopException { logDetailed("getTransformname: " + getTransformName()); } SqlStatement statement = - meta.getTableDdl(variables, getPipelineMeta(), getTransformName(), true, data, true); + meta.getTableDdl(variables, getPipelineMeta(), getTransformName(), true, data, true); if (log.isDetailed()) { logDetailed("Statement: " + statement); } @@ -451,15 +451,15 @@ protected void writeBufferToMonetDB(DatabaseMeta dm) throws HopException { } cmdBuff - .append("COPY ") - .append(data.bufferIndex) - .append(" RECORDS INTO ") - .append(data.schemaTable) - .append(" FROM STDIN USING DELIMITERS '") - .append(data.separator) - .append("','" + Const.CR + "','") - .append(data.quote) - .append("' NULL AS '" + nullRep + "';"); + .append("COPY ") + .append(data.bufferIndex) + .append(" RECORDS INTO ") + .append(data.schemaTable) + .append(" FROM STDIN USING DELIMITERS '") + .append(data.separator) + .append("','" + Const.CR + "','") + .append(data.quote) + .append("' NULL AS '" + nullRep + "';"); String cmd = cmdBuff.toString(); // See if we need to execute extra SQL statements... @@ -538,7 +538,7 @@ protected void verifyDatabaseConnection() throws HopException { // Confirming Database Connection is defined. if (meta.getDatabaseMeta() == null) { throw new HopException( - BaseMessages.getString(PKG, "MonetDbBulkLoaderMeta.GetSQL.NoConnectionDefined")); + BaseMessages.getString(PKG, "MonetDbBulkLoaderMeta.GetSQL.NoConnectionDefined")); } } @@ -598,16 +598,16 @@ public boolean init() { // Support parameterized database connection names String connectionName = meta.getDbConnectionName(); if (!Utils.isEmpty(connectionName) - && connectionName.startsWith("${") - && connectionName.endsWith("}")) { + && connectionName.startsWith("${") + && connectionName.endsWith("}")) { meta.setDatabaseMeta(getPipelineMeta().findDatabase(resolve(connectionName), variables)); } // Schema-table combination... data.schemaTable = - meta.getDatabaseMeta(this) - .getQuotedSchemaTableCombination( - variables, meta.getSchemaName(), meta.getTableName()); + meta.getDatabaseMeta(this) + .getQuotedSchemaTableCombination( + variables, meta.getSchemaName(), meta.getTableName()); return true; } @@ -634,13 +634,13 @@ protected MapiSocket getMonetDBConnection() throws Exception { } protected static MapiSocket getMonetDBConnection( - String host, int port, String user, String password, String db) throws Exception { + String host, int port, String user, String password, String db) throws Exception { return getMonetDBConnection(host, port, user, password, db, null); } protected static MapiSocket getMonetDBConnection( - String host, int port, String user, String password, String db, ILogChannel log) - throws Exception { + String host, int port, String user, String password, String db, ILogChannel log) + throws Exception { MapiSocket mserver = new MapiSocket(); mserver.setDatabase(db); mserver.setLanguage("sql"); @@ -691,8 +691,8 @@ protected void executeSql(String query) throws Exception { * @param database to connect to */ protected static void executeSql( - String query, String host, int port, String user, String password, String db) - throws Exception { + String query, String host, int port, String user, String password, String db) + throws Exception { MapiSocket mserver = null; try { mserver = getMonetDBConnection(host, port, user, password, db); @@ -726,9 +726,9 @@ protected static void executeSql( switch (type) { case ERROR: - case RESULT: - break; - default: + case RESULT: + break; + default: // unknown, header, ... break; } diff --git a/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java b/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java index 03cdfa9840c..a7ab15cfd89 100644 --- a/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java +++ b/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.monetdbbulkloader; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -73,9 +75,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class MonetDbBulkLoaderDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MonetDbBulkLoaderMeta.class; // for i18n purposes, needed by Translator2!! @@ -763,8 +762,11 @@ public void widgetSelected(SelectionEvent arg0) { }; new Thread(runnable).start(); - wbLogFile.addListener(SWT.Selection, e->BaseDialog.presentFileDialog(shell, - wLogFile, variables,new String[] {"*"}, ALL_FILETYPES, true )); + wbLogFile.addListener( + SWT.Selection, + e -> + BaseDialog.presentFileDialog( + shell, wLogFile, variables, new String[] {"*"}, ALL_FILETYPES, true)); // Add listeners wOk.addListener(SWT.Selection, e -> ok()); @@ -811,12 +813,13 @@ protected void setTableFieldCombo() { } if (!Utils.isEmpty(tableName)) { DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); - if (databaseMeta != null) { + if (databaseMeta != null) { try (Database db = new Database(loggingObject, variables, databaseMeta)) { db.connect(); String schemaTable = - databaseMeta.getQuotedSchemaTableCombination(variables, schemaName, tableName); + databaseMeta.getQuotedSchemaTableCombination( + variables, schemaName, tableName); IRowMeta r = db.getTableFields(schemaTable); if (null != r) { String[] fieldNames = r.getFieldNames(); @@ -831,7 +834,7 @@ protected void setTableFieldCombo() { colInfo.setComboValues(new String[] {}); } // ignore any errors here. drop downs will not be - // filled, but no problem for the user + // filled, but no problem for the user } } } diff --git a/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbVersion.java b/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbVersion.java index cdc227fed50..50cc126cfd6 100644 --- a/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbVersion.java +++ b/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbVersion.java @@ -16,9 +16,8 @@ */ package org.apache.hop.pipeline.transforms.monetdbbulkloader; -import org.apache.hop.i18n.BaseMessages; - import java.util.regex.Pattern; +import org.apache.hop.i18n.BaseMessages; public class MonetDbVersion implements Comparable { private static final Class PKG = @@ -87,17 +86,23 @@ public MonetDbVersion(String productVersion) throws MonetDbVersionException { parseVersion(productVersion); } - /** @return the minorVersion */ + /** + * @return the minorVersion + */ public Integer getMinorVersion() { return minorVersion; } - /** @return the majorVersion */ + /** + * @return the majorVersion + */ public Integer getMajorVersion() { return majorVersion; } - /** @return the patchVersion */ + /** + * @return the patchVersion + */ public Integer getPatchVersion() { return patchVersion; } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/AuthContext.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/AuthContext.java index aafc3092558..d7237cc778f 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/AuthContext.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/AuthContext.java @@ -17,11 +17,11 @@ package org.apache.hop.mongo; -import javax.security.auth.Subject; -import javax.security.auth.login.LoginContext; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import javax.security.auth.Subject; +import javax.security.auth.login.LoginContext; /** * A context for executing authorized actions on behalf of an authenticated user via a {@link diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosHelper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosHelper.java index 3d3ec0869da..d677d65aee4 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosHelper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosHelper.java @@ -17,10 +17,9 @@ package org.apache.hop.mongo; -import org.apache.hop.mongo.KerberosUtil.JaasAuthenticationMode; - import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; +import org.apache.hop.mongo.KerberosUtil.JaasAuthenticationMode; /** A collection of helper functions to make working with Hop and Kerberos easier. */ public class KerberosHelper { diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosUtil.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosUtil.java index da13509aa2c..b97de173157 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosUtil.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/KerberosUtil.java @@ -18,18 +18,17 @@ package org.apache.hop.mongo; import com.sun.security.auth.module.Krb5LoginModule; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.mongo.wrapper.MongoClientWrapper; - +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import javax.security.auth.Subject; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag; import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.mongo.wrapper.MongoClientWrapper; /** * A collection of utilities for working with Kerberos. diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProp.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProp.java index 54a5509edd4..68724fe08c7 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProp.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProp.java @@ -18,7 +18,6 @@ package org.apache.hop.mongo; import com.mongodb.MongoClientOptions; - import javax.net.ssl.SSLSocketFactory; /** diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoPropToOption.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoPropToOption.java index 6fc74ba2ac5..d767f6152f0 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoPropToOption.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoPropToOption.java @@ -22,10 +22,9 @@ import com.mongodb.ReadPreference; import com.mongodb.WriteConcern; import com.mongodb.util.JSON; -import org.apache.hop.i18n.BaseMessages; - import java.util.ArrayList; import java.util.Arrays; +import org.apache.hop.i18n.BaseMessages; class MongoPropToOption { private static final Class PKG = MongoPropToOption.class; // For Translator diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProperties.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProperties.java index 3f2630989fe..bf5c08a797f 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProperties.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/MongoProperties.java @@ -19,7 +19,6 @@ import com.mongodb.MongoClientOptions; import com.mongodb.ReadPreference; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -41,7 +40,9 @@ private MongoProperties(Map props) { this.props = props; } - /** @return the value associated with prop, or null if unset. */ + /** + * @return the value associated with prop, or null if unset. + */ public String get(MongoProp prop) { return props.get(prop); } @@ -73,7 +74,9 @@ public boolean useAllReplicaSetMembers() { return Boolean.valueOf(props.get(MongoProp.USE_ALL_REPLICA_SET_MEMBERS)); } - /** @return the com.mongodb.ReadPreference associated with the MongoProp.readPreference value. */ + /** + * @return the com.mongodb.ReadPreference associated with the MongoProp.readPreference value. + */ public ReadPreference getReadPreference() { return ReadPreference.valueOf(props.get(MongoProp.readPreference)); } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/NamedReadPreference.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/NamedReadPreference.java index ec453639dfe..039cd793684 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/NamedReadPreference.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/NamedReadPreference.java @@ -22,7 +22,6 @@ import com.mongodb.Tag; import com.mongodb.TagSet; import com.mongodb.TaggableReadPreference; - import java.util.ArrayList; import java.util.Collection; import java.util.List; diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java index 9fd4174ff0e..293c3aea4a1 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java @@ -18,6 +18,7 @@ package org.apache.hop.mongo.metadata; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.logging.ILogChannel; @@ -44,8 +45,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class MongoDbConnectionEditor extends MetadataEditor implements IMetadataEditor { diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/DefaultMongoClientFactory.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/DefaultMongoClientFactory.java index 69d948fc417..c61fb1d3d32 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/DefaultMongoClientFactory.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/DefaultMongoClientFactory.java @@ -21,7 +21,6 @@ import com.mongodb.MongoClientOptions; import com.mongodb.MongoCredential; import com.mongodb.ServerAddress; - import java.util.List; public class DefaultMongoClientFactory implements MongoClientFactory { diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandler.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandler.java index 970407b0d05..e02b58e9a5f 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandler.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandler.java @@ -17,15 +17,14 @@ package org.apache.hop.mongo.wrapper; -import org.apache.hop.mongo.AuthContext; -import org.apache.hop.mongo.MongoDbException; - import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import org.apache.hop.mongo.AuthContext; +import org.apache.hop.mongo.MongoDbException; /** * Handles proxying all method calls through an AuthContext. This allows methods to be executed as diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapper.java index 93bb3513877..150bc7e43c3 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapper.java @@ -21,6 +21,9 @@ import com.mongodb.MongoClient; import com.mongodb.MongoClientOptions; import com.mongodb.MongoCredential; +import java.util.ArrayList; +import java.util.List; +import javax.security.auth.login.LoginContext; import org.apache.hop.mongo.AuthContext; import org.apache.hop.mongo.KerberosHelper; import org.apache.hop.mongo.MongoDbException; @@ -30,10 +33,6 @@ import org.apache.hop.mongo.wrapper.collection.KerberosMongoCollectionWrapper; import org.apache.hop.mongo.wrapper.collection.MongoCollectionWrapper; -import javax.security.auth.login.LoginContext; -import java.util.ArrayList; -import java.util.List; - /** * Implementation of MongoClientWrapper which uses the GSSAPI auth mechanism. Should only be * instantiated by MongoClientWrapperFactory. diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientFactory.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientFactory.java index b0127c92687..f65fa213b03 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientFactory.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientFactory.java @@ -21,7 +21,6 @@ import com.mongodb.MongoClientOptions; import com.mongodb.MongoCredential; import com.mongodb.ServerAddress; - import java.util.List; /** User: Dzmitry Stsiapanau Date: 04/06/2016 Time: 12:37 */ diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapper.java index 86b24953aa1..a4ce9390cf7 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapper.java @@ -20,11 +20,10 @@ import com.mongodb.DBObject; import com.mongodb.MongoCredential; import com.mongodb.ReplicaSetStatus; -import org.apache.hop.mongo.MongoDbException; -import org.apache.hop.mongo.wrapper.collection.MongoCollectionWrapper; - import java.util.List; import java.util.Set; +import org.apache.hop.mongo.MongoDbException; +import org.apache.hop.mongo.wrapper.collection.MongoCollectionWrapper; /** * Defines the wrapper interface for all interactions with a MongoClient. This interface for the @@ -125,6 +124,8 @@ List getReplicaSetMembersThatSatisfyTagSets(List tagSets) ReturnType perform(String db, MongoDBAction action) throws MongoDbException; - /** @return the ReplicaSetStatus for the cluster. */ + /** + * @return the ReplicaSetStatus for the cluster. + */ ReplicaSetStatus getReplicaSetStatus(); } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactory.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactory.java index 7667a763850..d4c26da0032 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactory.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactory.java @@ -17,14 +17,13 @@ package org.apache.hop.mongo.wrapper; +import java.lang.reflect.Proxy; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.MongoProp; import org.apache.hop.mongo.MongoProperties; import org.apache.hop.mongo.MongoUtilLogger; import org.apache.hop.mongo.Util; -import java.lang.reflect.Proxy; - /** * MongoClientWrapperFactory is used to instantiate MongoClientWrapper objects appropriate for given * configuration properties, i.e. using the correct authentication mechanism, server info, and diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapper.java index 66c38527efa..e68e2309a12 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapper.java @@ -26,6 +26,10 @@ import com.mongodb.MongoCredential; import com.mongodb.ReplicaSetStatus; import com.mongodb.ServerAddress; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.MongoProp; @@ -36,11 +40,6 @@ import org.apache.hop.mongo.wrapper.collection.MongoCollectionWrapper; import org.bson.Document; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * Implementation of MongoClientWrapper which uses the MONGO-CR auth mechanism. Should only be * instantiated by MongoClientWrapperFactory. diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapper.java index c0a25b412f6..92e21e32c40 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapper.java @@ -18,14 +18,13 @@ import com.mongodb.MongoClient; import com.mongodb.MongoCredential; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.MongoProp; import org.apache.hop.mongo.MongoProperties; import org.apache.hop.mongo.MongoUtilLogger; -import java.util.ArrayList; -import java.util.List; - /** * Implementation of MongoClientWrapper which uses no credentials. Should only be instantiated by * MongoClientWrapperFactory. diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapper.java index e1e80353a90..16ab57dc5ed 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapper.java @@ -23,13 +23,12 @@ import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.WriteResult; -import org.apache.hop.mongo.MongoDbException; -import org.apache.hop.mongo.wrapper.cursor.DefaultCursorWrapper; -import org.apache.hop.mongo.wrapper.cursor.MongoCursorWrapper; - import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.hop.mongo.MongoDbException; +import org.apache.hop.mongo.wrapper.cursor.DefaultCursorWrapper; +import org.apache.hop.mongo.wrapper.cursor.MongoCursorWrapper; public class DefaultMongoCollectionWrapper implements MongoCollectionWrapper { private final DBCollection collection; diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/MongoCollectionWrapper.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/MongoCollectionWrapper.java index 44293318061..65cbb3f8c49 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/MongoCollectionWrapper.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/collection/MongoCollectionWrapper.java @@ -21,11 +21,10 @@ import com.mongodb.Cursor; import com.mongodb.DBObject; import com.mongodb.WriteResult; +import java.util.List; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.wrapper.cursor.MongoCursorWrapper; -import java.util.List; - /** * Defines the wrapper interface for all interactions with a MongoCollection via a * MongoClientWrapper. All method calls should correspond directly to the call in the underlying diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoArrayExpansion.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoArrayExpansion.java index 37c23831213..71464173765 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoArrayExpansion.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoArrayExpansion.java @@ -19,6 +19,8 @@ import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -27,9 +29,6 @@ import org.apache.hop.i18n.BaseMessages; import org.apache.hop.pipeline.transforms.mongodbinput.MongoDbInputData; -import java.util.ArrayList; -import java.util.List; - public class MongoArrayExpansion { protected static Class PKG = MongoArrayExpansion.class; // For Translator diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoField.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoField.java index b3e0d15988f..9f38e013eb0 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoField.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongoField.java @@ -19,6 +19,10 @@ import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.injection.Injection; @@ -30,11 +34,6 @@ import org.bson.BsonUndefined; import org.bson.types.Binary; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - public class MongoField implements Comparable { protected static Class PKG = MongoField.class; // For Translator diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImpl.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImpl.java index b3ea25eeab3..0dbd7a4b144 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImpl.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImpl.java @@ -25,6 +25,13 @@ import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.util.JSON; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.LogChannel; @@ -46,14 +53,6 @@ import org.bson.types.ObjectId; import org.bson.types.Symbol; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - public class MongodbInputDiscoverFieldsImpl implements MongoDbInputDiscoverFields { private static final Class PKG = MongodbInputDiscoverFieldsImpl.class; // For Translator diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodb/MongoDbMeta.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodb/MongoDbMeta.java index 431e9c0a2e0..0ff26640dff 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodb/MongoDbMeta.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodb/MongoDbMeta.java @@ -41,7 +41,9 @@ public String getConnectionName() { return connectionName; } - /** @param connectionName The connectionName to set */ + /** + * @param connectionName The connectionName to set + */ public void setConnectionName(String connectionName) { this.connectionName = connectionName; } @@ -55,7 +57,9 @@ public String getCollection() { return collection; } - /** @param collection The collection to set */ + /** + * @param collection The collection to set + */ public void setCollection(String collection) { this.collection = collection; } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDelete.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDelete.java index 70c8630c7c5..b8fa22209e2 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDelete.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDelete.java @@ -21,6 +21,9 @@ import com.mongodb.DBObject; import com.mongodb.MongoException; import com.mongodb.WriteResult; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -34,10 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * Class MongoDbDelete, providing MongoDB delete functionality. User able to create criteria base on * incoming fields. @@ -362,6 +361,6 @@ final void checkInputFieldsMatch(IRowMeta rmi, List mongoFie } public void setWriteRetries(int writeRetries) { - this.writeRetries = writeRetries; + this.writeRetries = writeRetries; } } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteData.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteData.java index 748f41e9413..ec40401b487 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteData.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteData.java @@ -19,6 +19,9 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBObject; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; @@ -33,10 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** Data class for the MongoDbDelete step */ public class MongoDbDeleteData extends BaseTransformData implements ITransformData { @@ -46,6 +45,7 @@ public class MongoDbDeleteData extends BaseTransformData implements ITransformDa public MongoDbConnection connection; public MongoClientWrapper clientWrapper; public MongoCollectionWrapper collection; + /** cursor for a standard query */ public MongoCursorWrapper cursor; diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteField.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteField.java index ddbda034692..78c2ce4b548 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteField.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteField.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.mongodbdelete; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.metadata.api.HopMetadataProperty; public class MongoDbDeleteField implements Cloneable { diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteMeta.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteMeta.java index 4b70524a813..6a0c2c835c2 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteMeta.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbdelete/MongoDbDeleteMeta.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.mongodbdelete; +import java.util.List; import org.apache.hop.core.annotations.Transform; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.pipeline.transforms.mongodb.MongoDbMeta; -import java.util.List; - /** Meta data class for MongoDbDelete transform. */ @Transform( id = "MongoDbDelete", @@ -69,8 +68,7 @@ public class MongoDbDeleteMeta extends MongoDbMeta fields); diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInput.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInput.java index 6de38dadcaa..bc48a4be9cc 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInput.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInput.java @@ -21,6 +21,7 @@ import com.mongodb.DBObject; import com.mongodb.ServerAddress; import com.mongodb.util.JSON; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; @@ -34,8 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - public class MongoDbInput extends BaseTransform { private static final Class PKG = MongoDbInputMeta.class; // For i18n - Translator diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputData.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputData.java index c4a563876c3..7c8ddd4df67 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputData.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputData.java @@ -20,6 +20,9 @@ import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; import com.mongodb.DBObject; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowDataUtil; @@ -34,10 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - public class MongoDbInputData extends BaseTransformData implements ITransformData { public static final int MONGO_DEFAULT_PORT = 27017; diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDialog.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDialog.java index 8a1f048d105..8ae47f996db 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDialog.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDialog.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.mongodbinput; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -65,12 +70,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class MongoDbInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MongoDbInputMeta.class; // For i18n - Translator diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDiscoverFields.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDiscoverFields.java index 2361200f93f..b0e3e165297 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDiscoverFields.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDiscoverFields.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.mongodbinput; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.variables.IVariables; import org.apache.hop.mongo.metadata.MongoDbConnection; import org.apache.hop.mongo.wrapper.field.MongoField; -import java.util.List; - public interface MongoDbInputDiscoverFields { List discoverFields( diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMeta.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMeta.java index c30f9f67544..b43f6f2e133 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMeta.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.mongodbinput; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -38,9 +40,6 @@ import org.apache.hop.pipeline.transforms.mongodb.MongoDbMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "MongoDbInput", image = "mongodb-input.svg", @@ -242,32 +241,44 @@ public void check( metadataProvider); } - /** @return the fields */ + /** + * @return the fields + */ public String getFieldsName() { return jsonField; } - /** @param fields a field name to set */ + /** + * @param fields a field name to set + */ public void setFieldsName(String fields) { this.jsonField = fields; } - /** @return the jsonFieldName */ + /** + * @return the jsonFieldName + */ public String getJsonFieldName() { return jsonFieldName; } - /** @param jsonFieldName the jsonFieldName to set */ + /** + * @param jsonFieldName the jsonFieldName to set + */ public void setJsonFieldName(String jsonFieldName) { this.jsonFieldName = jsonFieldName; } - /** @return the jsonQuery */ + /** + * @return the jsonQuery + */ public String getJsonQuery() { return jsonQuery; } - /** @param jsonQuery the jsonQuery to set */ + /** + * @param jsonQuery the jsonQuery to set + */ public void setJsonQuery(String jsonQuery) { this.jsonQuery = jsonQuery; } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutput.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutput.java index f1437a2edbb..562904359fa 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutput.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutput.java @@ -21,6 +21,11 @@ import com.mongodb.MongoException; import com.mongodb.MongoExecutionTimeoutException; import com.mongodb.WriteResult; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -33,12 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * Class providing an output transform for writing data to a MongoDB collection. Supports insert, * truncate, upsert, multi-update (update all matching docs) and modifier update (update only @@ -289,9 +288,9 @@ protected void commitUpdate(DBObject updateQuery, DBObject insertUpdate, Object[ BaseMessages.getString(PKG, "MongoDbOutput.Messages.Message.Retry", writeRetryDelay)); try { Thread.sleep(writeRetryDelay * 1000); - + } catch (InterruptedException e) { - + } } } @@ -394,9 +393,9 @@ protected void doBatch() throws HopException, MongoDbException { } try { Thread.sleep(writeRetryDelay * 1000); - + } catch (InterruptedException e) { - + } } } diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputData.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputData.java index e93acab9195..8502fbc588c 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputData.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputData.java @@ -22,6 +22,12 @@ import com.mongodb.DBObject; import com.mongodb.MongoException; import com.mongodb.util.JSON; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -38,13 +44,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - /** Data class for the MongoDbOutput transform */ public class MongoDbOutputData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDialog.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDialog.java index fd5e7412db2..5d5835b500f 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDialog.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDialog.java @@ -19,6 +19,9 @@ import com.mongodb.DBObject; import com.mongodb.MongoClient; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -61,10 +64,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - /** Dialog class for the MongoDB output transform */ public class MongoDbOutputDialog extends BaseTransformDialog implements ITransformDialog { diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMeta.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMeta.java index 0ebf58f6a61..6df8714e7b9 100644 --- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMeta.java +++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.mongodboutput; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -35,9 +37,6 @@ import org.apache.hop.pipeline.transforms.mongodb.MongoDbMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - /** * Class providing an output transform for writing data to a MongoDB collection. Supports insert, * truncate, upsert, multi-update (update all matching docs) and modifier update (update only @@ -315,7 +314,9 @@ public List getMongoIndexes() { return mongoIndexes; } - /** @param r the number of retry attempts to make */ + /** + * @param r the number of retry attempts to make + */ public void setWriteRetries(String r) { writeRetries = r; } diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/AuthContextTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/AuthContextTest.java index 1d26cc07b59..4737f8f16b1 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/AuthContextTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/AuthContextTest.java @@ -17,19 +17,18 @@ package org.apache.hop.mongo; -import org.hamcrest.CoreMatchers; -import org.junit.Test; - -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import org.hamcrest.CoreMatchers; +import org.junit.Test; + public class AuthContextTest { @Test diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/KerberosUtilTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/KerberosUtilTest.java index c5c8adc5b2e..96ee6b31f2a 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/KerberosUtilTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/KerberosUtilTest.java @@ -17,11 +17,11 @@ package org.apache.hop.mongo; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import org.junit.Test; + public class KerberosUtilTest { @Test diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropToOptionTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropToOptionTest.java index f66d7813e25..f1b17ed2a36 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropToOptionTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropToOptionTest.java @@ -17,6 +17,12 @@ package org.apache.hop.mongo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; + import com.mongodb.BasicDBObject; import com.mongodb.WriteConcern; import com.mongodb.util.JSONParseException; @@ -27,12 +33,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; - public class MongoPropToOptionTest { @Mock private MongoUtilLogger log; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropertiesTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropertiesTest.java index 68751d12375..c6be123dc23 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropertiesTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/MongoPropertiesTest.java @@ -17,17 +17,16 @@ package org.apache.hop.mongo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import com.mongodb.MongoClientOptions; import com.mongodb.ReadPreference; +import javax.net.ssl.SSLSocketFactory; import org.junit.Test; import org.mockito.Mockito; -import javax.net.ssl.SSLSocketFactory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class MongoPropertiesTest { @Test public void testBuildsMongoClientOptions() throws Exception { diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/HopMongoUtilLoggerTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/HopMongoUtilLoggerTest.java index 3f6801e99ec..94d0725d389 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/HopMongoUtilLoggerTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/HopMongoUtilLoggerTest.java @@ -17,15 +17,15 @@ package org.apache.hop.mongo.wrapper; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + import org.apache.hop.core.logging.ILogChannel; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - public class HopMongoUtilLoggerTest { @Mock ILogChannel logChannelInterface; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandlerTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandlerTest.java index 4e2534e4249..6a7ca4a579a 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandlerTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosInvocationHandlerTest.java @@ -17,21 +17,20 @@ package org.apache.hop.mongo.wrapper; -import org.apache.hop.mongo.AuthContext; -import org.apache.hop.mongo.MongoDbException; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import org.apache.hop.mongo.AuthContext; +import org.apache.hop.mongo.MongoDbException; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + public class KerberosInvocationHandlerTest { @Test public void testInvocationHandlerCallsDoAsWhichCallsDelegate() diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapperTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapperTest.java index 4135a797afa..548cf981dfc 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapperTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/KerberosMongoClientWrapperTest.java @@ -17,8 +17,16 @@ package org.apache.hop.mongo.wrapper; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.mongodb.DBCollection; import com.mongodb.MongoClient; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import org.apache.hop.mongo.AuthContext; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.MongoUtilLogger; @@ -27,15 +35,6 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class KerberosMongoClientWrapperTest { @Test public void testWrapProperlyWrapsCollection() throws MongoDbException, PrivilegedActionException { diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactoryTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactoryTest.java index a472809b3d6..2ba9a13d852 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactoryTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoClientWrapperFactoryTest.java @@ -17,6 +17,8 @@ package org.apache.hop.mongo.wrapper; +import static org.junit.Assert.assertThat; + import org.apache.hop.mongo.MongoProp; import org.apache.hop.mongo.MongoProperties; import org.apache.hop.mongo.MongoUtilLogger; @@ -26,8 +28,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.junit.Assert.assertThat; - public class MongoClientWrapperFactoryTest { @Mock DefaultMongoClientFactory mongoClientFactory; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoFieldTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoFieldTest.java index 846ce79c49e..ba3d3b3b078 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoFieldTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/MongoFieldTest.java @@ -17,7 +17,20 @@ package org.apache.hop.mongo.wrapper; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import com.mongodb.BasicDBObject; +import java.math.BigDecimal; +import java.util.Date; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.plugins.PluginRegistry; @@ -31,20 +44,6 @@ import org.mockito.MockitoAnnotations; import org.mockito.stubbing.Answer; -import java.math.BigDecimal; -import java.util.Date; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class MongoFieldTest { @Mock IVariables variables; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapperTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapperTest.java index a80ecd1e941..adf02f06fb8 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapperTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/NoAuthMongoClientWrapperTest.java @@ -17,6 +17,9 @@ package org.apache.hop.mongo.wrapper; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertTrue; + import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; import com.mongodb.DB; @@ -26,6 +29,12 @@ import com.mongodb.MongoClientOptions; import com.mongodb.MongoCredential; import com.mongodb.ServerAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.MongoProp; @@ -42,16 +51,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.assertTrue; - public class NoAuthMongoClientWrapperTest { public static String REP_SET_CONFIG = diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapperTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapperTest.java index b27c5a64c32..d16fc438038 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapperTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/UsernamePasswordMongoClientWrapperTest.java @@ -17,6 +17,7 @@ package org.apache.hop.mongo.wrapper; import com.mongodb.MongoCredential; +import java.util.List; import org.apache.hop.mongo.MongoProp; import org.apache.hop.mongo.MongoProperties; import org.apache.hop.mongo.MongoUtilLogger; @@ -26,8 +27,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import java.util.List; - /** Test class for {@link org.apache.hop.mongo.wrapper.UsernamePasswordMongoClientWrapper}. */ public class UsernamePasswordMongoClientWrapperTest { diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapperTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapperTest.java index 605a7710afa..8e2ee7a204b 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapperTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/collection/DefaultMongoCollectionWrapperTest.java @@ -16,11 +16,23 @@ */ package org.apache.hop.mongo.wrapper.collection; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.mongodb.AggregationOptions; import com.mongodb.BasicDBObject; import com.mongodb.Cursor; import com.mongodb.DBCollection; import com.mongodb.DBObject; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.mongo.MongoDbException; import org.apache.hop.mongo.wrapper.cursor.MongoCursorWrapper; import org.hamcrest.CoreMatchers; @@ -29,19 +41,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class DefaultMongoCollectionWrapperTest { private DefaultMongoCollectionWrapper defaultMongoCollectionWrapper; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImplTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImplTest.java index 57c79b3a803..b4f9596384a 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImplTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/mongo/wrapper/field/MongodbInputDiscoverFieldsImplTest.java @@ -17,11 +17,24 @@ package org.apache.hop.mongo.wrapper.field; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.core.row.value.ValueMetaPluginType; @@ -44,20 +57,6 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class MongodbInputDiscoverFieldsImplTest { private IVariables variables; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/BaseMongoDbTransformTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/BaseMongoDbTransformTest.java index aa520f489e5..a067cef342f 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/BaseMongoDbTransformTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/BaseMongoDbTransformTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.mongodbinput; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + import com.mongodb.Cursor; import com.mongodb.DBObject; import org.apache.hop.core.logging.HopLogStore; @@ -39,11 +44,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - /** Common mock setup for MongoDbOutputTest and MongoDbInput */ public class BaseMongoDbTransformTest { diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDataTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDataTest.java index 911f6ff1c56..89f4faf948f 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDataTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputDataTest.java @@ -17,8 +17,22 @@ package org.apache.hop.pipeline.transforms.mongodbinput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import com.mongodb.BasicDBObject; import com.mongodb.DBObject; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -34,21 +48,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.anyString; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class MongoDbInputDataTest { private IHopMetadataProvider metadataProvider; private MongoDbInputData mongoDbInputData; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMetaTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMetaTest.java index 9ebce259b13..4343a3d53d0 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMetaTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodbinput/MongoDbInputMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.mongodbinput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -32,11 +36,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MongoDbInputMetaTest { @BeforeClass public static void beforeClass() throws HopException { diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDataTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDataTest.java index a4457a5ee11..1d54e0f416c 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDataTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputDataTest.java @@ -17,8 +17,25 @@ package org.apache.hop.pipeline.transforms.mongodboutput; +import static junit.framework.TestCase.fail; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; @@ -39,24 +56,6 @@ import org.mockito.MockitoAnnotations; import org.mockito.stubbing.Answer; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static junit.framework.TestCase.fail; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class MongoDbOutputDataTest { @Mock private IVariables variables; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaInjectionTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaInjectionTest.java index dd673d73040..8a3d519e6c4 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaInjectionTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaInjectionTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.mongodboutput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; @@ -24,10 +28,6 @@ import org.junit.Before; import org.junit.Test; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** MDI test for MongoDbOutput. */ public class MongoDbOutputMetaInjectionTest extends BaseMetadataInjectionTest { private ILogChannelFactory oldLogChannelInterfaceFactory; diff --git a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaTest.java b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaTest.java index fbe53b16e39..2e6f757721b 100644 --- a/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaTest.java +++ b/plugins/transforms/mongodb/src/test/java/org/apache/hop/pipeline/transforms/mongodboutput/MongoDbOutputMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.mongodboutput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -32,11 +36,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MongoDbOutputMetaTest { @BeforeClass public static void beforeClass() throws HopException { diff --git a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoin.java b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoin.java index f95d89870d0..29150c95ecd 100644 --- a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoin.java +++ b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoin.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.multimerge; +import java.util.ArrayList; +import java.util.List; +import java.util.PriorityQueue; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -33,10 +36,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.List; -import java.util.PriorityQueue; - /** * Merge rows from 2 sorted streams and output joined rows with matched key fields. Use this instead * of hash join is both your input streams are too big to fit in memory. Note that both the inputs @@ -287,10 +286,10 @@ public boolean processRow() throws HopException { data.queue.clear(); for (int i = 0; i < streamSize; i++) { while (data.rows[i] != null && !isStopped()) { - try{ + try { data.rows[i] = getRowFrom(data.rowSets[i]); - }catch (Exception e){ - //break loop + } catch (Exception e) { + // break loop break; } } diff --git a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinData.java b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinData.java index 044889af7d3..80d3be6eb09 100644 --- a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinData.java +++ b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.multimerge; +import java.util.Comparator; +import java.util.List; +import java.util.PriorityQueue; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Comparator; -import java.util.List; -import java.util.PriorityQueue; - public class MultiMergeJoinData extends BaseTransformData implements ITransformData { public static class QueueEntry { public Object[] row; diff --git a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinDialog.java b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinDialog.java index 05ef68781e3..368886c7beb 100644 --- a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinDialog.java +++ b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.multimerge; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -55,11 +58,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - - public class MultiMergeJoinDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = MultiMergeJoinMeta.class; // For Translator @@ -368,25 +366,28 @@ private void configureKeys( fdbKeys.left = new FormAttachment(0, 0); fdbKeys.right = new FormAttachment(100, -margin); getKeyButton.setLayoutData(fdbKeys); - getKeyButton.addListener(SWT.Selection, e -> { - BaseTransformDialog.getFieldsFromPrevious( - prev, wKeys, 1, new int[] {1}, new int[] {}, -1, -1, null); - }); - - Listener onOk = (e) -> { - int nrKeys = wKeys.nrNonEmpty(); - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < nrKeys; i++) { - TableItem item = wKeys.getNonEmpty(i); - sb.append(item.getText(1)); - if (nrKeys > 1 && i != nrKeys - 1) { - sb.append(","); - } - } - keyValTextBox.setText(sb.toString()); - subShell.close(); - }; - + getKeyButton.addListener( + SWT.Selection, + e -> { + BaseTransformDialog.getFieldsFromPrevious( + prev, wKeys, 1, new int[] {1}, new int[] {}, -1, -1, null); + }); + + Listener onOk = + (e) -> { + int nrKeys = wKeys.nrNonEmpty(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < nrKeys; i++) { + TableItem item = wKeys.getNonEmpty(i); + sb.append(item.getText(1)); + if (nrKeys > 1 && i != nrKeys - 1) { + sb.append(","); + } + } + keyValTextBox.setText(sb.toString()); + subShell.close(); + }; + // Some buttons Button okButton = new Button(subShell, SWT.PUSH); okButton.setText(BaseMessages.getString(PKG, "System.Button.OK")); @@ -394,17 +395,17 @@ private void configureKeys( Button cancelButton = new Button(subShell, SWT.PUSH); cancelButton.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); cancelButton.addListener(SWT.Selection, e -> subShell.close()); - + this.setButtonPositions(new Button[] {okButton, cancelButton}, margin, null); - + for (int i = 0; i < keys.length; i++) { TableItem item = wKeys.table.getItem(i); if (keys[i] != null) { item.setText(1, keys[i]); } - } - - BaseDialog.defaultShellHandling(subShell, x-> onOk.handleEvent(null), x -> {}); + } + + BaseDialog.defaultShellHandling(subShell, x -> onOk.handleEvent(null), x -> {}); } protected void setComboBoxes() { diff --git a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinMeta.java b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinMeta.java index 6cc958b1a47..dc4737d9e7a 100644 --- a/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinMeta.java +++ b/plugins/transforms/multimerge/src/main/java/org/apache/hop/pipeline/transforms/multimerge/MultiMergeJoinMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.multimerge; +import java.util.List; import org.apache.commons.lang.ArrayUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -40,8 +41,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.w3c.dom.Node; -import java.util.List; - @InjectionSupported(localizationPrefix = "MultiMergeJoin.Injection.") @Transform( id = "MultiwayMergeJoin", diff --git a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/Normaliser.java b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/Normaliser.java index 6236ca04dd2..778aff05077 100644 --- a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/Normaliser.java +++ b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/Normaliser.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.normaliser; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Set; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.i18n.BaseMessages; @@ -25,11 +29,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; - /** Normalise de-normalised input data. */ public class Normaliser extends BaseTransform { private static final Class PKG = NormaliserMeta.class; // For Translator @@ -72,7 +71,7 @@ public boolean processRow() throws HopException { data.type_occ = new ArrayList<>(); data.maxlen = 0; - for (NormaliserField field : meta.getNormaliserFields()) { + for (NormaliserField field : meta.getNormaliserFields()) { typeValue = field.getValue(); if (!data.type_occ.contains(typeValue)) { data.type_occ.add(typeValue); @@ -94,9 +93,7 @@ public boolean processRow() throws HopException { if (dataFieldNr < 0) { logError( BaseMessages.getString( - PKG, - "Normaliser.Log.CouldNotFindFieldInRow", - field.getName())); + PKG, "Normaliser.Log.CouldNotFindFieldInRow", field.getName())); setErrors(1); stopAll(); return false; diff --git a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserData.java b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserData.java index 7656d0c8398..61d4af30981 100644 --- a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserData.java +++ b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.normaliser; +import java.util.List; +import java.util.Map; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; -import java.util.Map; - public class NormaliserData extends BaseTransformData implements ITransformData { public List type_occ; public int maxlen; diff --git a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserDialog.java b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserDialog.java index 5f9a47c0542..bf8171d2166 100644 --- a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserDialog.java +++ b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.normaliser; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.util.Utils; @@ -44,9 +46,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class NormaliserDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = NormaliserMeta.class; // For Translator @@ -236,7 +235,7 @@ public void getData() { item.setText(NAME_INDEX, field.getName()); } if (field.getValue() != null) { - item.setText(VALUE_INDEX,field.getValue()); + item.setText(VALUE_INDEX, field.getValue()); } if (field.getNorm() != null) { item.setText(NORM_INDEX, field.getNorm()); @@ -267,10 +266,9 @@ private void ok() { int i; - int nrFields = wFields.nrNonEmpty(); + int nrFields = wFields.nrNonEmpty(); input.getNormaliserFields().clear(); - for (i = 0; i < nrFields; i++) { TableItem item = wFields.getNonEmpty(i); NormaliserField field = new NormaliserField(); diff --git a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserField.java b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserField.java index 286dc41c45f..abf161d021e 100644 --- a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserField.java +++ b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserField.java @@ -17,18 +17,27 @@ package org.apache.hop.pipeline.transforms.normaliser; -import org.apache.hop.metadata.api.HopMetadataProperty; import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class NormaliserField { - @HopMetadataProperty(key="name", injectionKey = "NAME", injectionKeyDescription = "NormaliserMeta.Injection.NAME") + @HopMetadataProperty( + key = "name", + injectionKey = "NAME", + injectionKeyDescription = "NormaliserMeta.Injection.NAME") private String name; - @HopMetadataProperty(key="value", injectionKey = "VALUE", injectionKeyDescription = "NormaliserMeta.Injection.VALUE") + @HopMetadataProperty( + key = "value", + injectionKey = "VALUE", + injectionKeyDescription = "NormaliserMeta.Injection.VALUE") private String value; - @HopMetadataProperty(key="norm", injectionKey = "NORMALISED", injectionKeyDescription = "NormaliserMeta.Injection.NORMALISED") + @HopMetadataProperty( + key = "norm", + injectionKey = "NORMALISED", + injectionKeyDescription = "NormaliserMeta.Injection.NORMALISED") private String norm; public NormaliserField() { @@ -40,33 +49,45 @@ public NormaliserField(NormaliserField field) { this.value = field.value; this.norm = field.norm; } - - /** @return the name */ + + /** + * @return the name + */ public String getName() { return name; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setName(String name) { this.name = name; } - /** @return the value */ + /** + * @return the value + */ public String getValue() { return value; } - /** @param value the value to set */ + /** + * @param value the value to set + */ public void setValue(String value) { this.value = value; } - /** @return the norm */ + /** + * @return the norm + */ public String getNorm() { return norm; } - /** @param norm the norm to set */ + /** + * @param norm the norm to set + */ public void setNorm(String norm) { this.norm = norm; } @@ -111,4 +132,4 @@ public boolean equals(Object obj) { } return true; } -} \ No newline at end of file +} diff --git a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMeta.java b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMeta.java index 51c1c67cbd6..ff323c9c419 100644 --- a/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMeta.java +++ b/plugins/transforms/normaliser/src/main/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.normaliser; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,11 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /* DATE PRODUCT1_NR PRODUCT1_SL PRODUCT2_NR PRODUCT2_SL PRODUCT3_NR PRODUCT3_SL @@ -74,31 +73,41 @@ public class NormaliserMeta extends BaseTransformMeta PKG = NormaliserMeta.class; // For Translator /** Name of the new type-field */ - @HopMetadataProperty(key="typefield", injectionKey = "TYPEFIELD", injectionKeyDescription = "NormaliserMeta.Injection.TYPEFIELD") - private String typeField; - - @HopMetadataProperty(groupKey = "fields", key = "field", injectionGroupKey = "FIELDS", - injectionGroupDescription = "NormaliserMeta.Injection.FIELDS") + @HopMetadataProperty( + key = "typefield", + injectionKey = "TYPEFIELD", + injectionKeyDescription = "NormaliserMeta.Injection.TYPEFIELD") + private String typeField; + + @HopMetadataProperty( + groupKey = "fields", + key = "field", + injectionGroupKey = "FIELDS", + injectionGroupDescription = "NormaliserMeta.Injection.FIELDS") private List normaliserFields; public NormaliserMeta() { super(); this.normaliserFields = new ArrayList<>(); } - - public NormaliserMeta(NormaliserMeta meta) { + + public NormaliserMeta(NormaliserMeta meta) { this(); for (NormaliserField field : meta.normaliserFields) { normaliserFields.add(new NormaliserField(field)); } } - /** @return Returns the typeField. */ + /** + * @return Returns the typeField. + */ public String getTypeField() { return typeField; } - /** @param typeField The typeField to set. */ + /** + * @param typeField The typeField to set. + */ public void setTypeField(String typeField) { this.typeField = typeField; } @@ -113,7 +122,7 @@ public void setNormaliserFields(List normaliserFields) { public Set getFieldNames() { Set fieldNames = new HashSet<>(); - + for (NormaliserField field : normaliserFields) { if (field.getName() != null) { fieldNames.add(field.getName().toLowerCase()); @@ -122,10 +131,9 @@ public Set getFieldNames() { return fieldNames; } - @Override public Object clone() { - return new NormaliserMeta(this); + return new NormaliserMeta(this); } @Override @@ -149,8 +157,8 @@ public void getFields( List normOcc = new ArrayList<>(); List fieldOcc = new ArrayList<>(); int maxlen = 0; - //for (int i = 0; i < normaliserFields.length; i++) { - for (NormaliserField field : normaliserFields) { + // for (int i = 0; i < normaliserFields.length; i++) { + for (NormaliserField field : normaliserFields) { if (!normOcc.contains(field.getNorm())) { normOcc.add(field.getNorm()); fieldOcc.add(field.getName()); @@ -189,7 +197,7 @@ public void getFields( // Now remove all the normalized fields... // - for (NormaliserField field : normaliserFields) { + for (NormaliserField field : normaliserFields) { int idx = row.indexOfValue(field.getName()); if (idx >= 0) { row.removeValueMeta(idx); @@ -227,7 +235,7 @@ public void check( boolean errorFound = false; for (NormaliserField field : normaliserFields) { - IValueMeta valueMeta = prev.searchValueMeta(field.getName()); + IValueMeta valueMeta = prev.searchValueMeta(field.getName()); if (valueMeta == null) { if (first) { first = false; diff --git a/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMetaTest.java b/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMetaTest.java index ab23e8f864e..da8b3cc4fae 100644 --- a/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMetaTest.java +++ b/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserMetaTest.java @@ -25,7 +25,7 @@ import org.junit.Test; public class NormaliserMetaTest { - + @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @Before @@ -39,9 +39,9 @@ public void testSerialization() throws Exception { NormaliserMeta meta = TransformSerializationTestUtil.testSerialization( "/normaliser-transform.xml", NormaliserMeta.class); - - //assertEquals(2, meta.getFields().size()); - //assertEquals("fieldName", meta.getFields().get(0).getName()); - //assertEquals("two", meta.getFields().get(0).getValue()); + + // assertEquals(2, meta.getFields().size()); + // assertEquals("fieldName", meta.getFields().get(0).getName()); + // assertEquals("two", meta.getFields().get(0).getValue()); } } diff --git a/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserTest.java b/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserTest.java index bbfa68aad26..2ef78e8e7f1 100644 --- a/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserTest.java +++ b/plugins/transforms/normaliser/src/test/java/org/apache/hop/pipeline/transforms/normaliser/NormaliserTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.normaliser; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; @@ -28,13 +34,6 @@ import org.junit.BeforeClass; import org.junit.ClassRule; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - public class NormaliserTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIf.java b/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIf.java index ce341bfe7e6..2b735ca0fb5 100644 --- a/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIf.java +++ b/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIf.java @@ -61,12 +61,11 @@ public boolean processRow() throws HopException { data.nullValue = new Object[fieldsLength]; data.nullValueMeta = new IValueMeta[fieldsLength]; for (int i = 0; i < fieldsLength; i++) { - NullIfField field = meta.getFields().get(i); + NullIfField field = meta.getFields().get(i); data.keynr[i] = data.outputRowMeta.indexOfValue(field.getName()); if (data.keynr[i] < 0) { logError( - BaseMessages.getString( - PKG, "NullIf.Log.CouldNotFindFieldInRow", field.getName())); + BaseMessages.getString(PKG, "NullIf.Log.CouldNotFindFieldInRow", field.getName())); setErrors(1); stopAll(); return false; @@ -75,11 +74,10 @@ public boolean processRow() throws HopException { // convert from input string entered by the user ValueMetaString vms = new ValueMetaString(); - // look for an empty string to replace with null - String value = (field.getValue() == null) ? Const.EMPTY_STRING : field.getValue(); + // look for an empty string to replace with null + String value = (field.getValue() == null) ? Const.EMPTY_STRING : field.getValue(); vms.setConversionMask(data.nullValueMeta[i].getConversionMask()); - data.nullValue[i] = - data.nullValueMeta[i].convertData(vms, value); + data.nullValue[i] = data.nullValueMeta[i].convertData(vms, value); } } diff --git a/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfField.java b/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfField.java index dcbe17cf9e8..71d4d31dde0 100644 --- a/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfField.java +++ b/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfField.java @@ -17,59 +17,59 @@ package org.apache.hop.pipeline.transforms.nullif; -import org.apache.hop.core.Const; -import org.apache.hop.core.row.value.ValueMetaBase; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class NullIfField implements Cloneable { - @HopMetadataProperty(injectionKey = "FIELDNAME", injectionKeyDescription = "NullIf.Injection.FIELDNAME") - private String name; + @HopMetadataProperty( + injectionKey = "FIELDNAME", + injectionKeyDescription = "NullIf.Injection.FIELDNAME") + private String name; + + @HopMetadataProperty( + injectionKey = "FIELDVALUE", + injectionKeyDescription = "NullIf.Injection.FIELDVALUE") + private String value; + + public NullIfField() {} + + public NullIfField(String name, String value) { + this.name = name; + this.value = value; + } - @HopMetadataProperty(injectionKey = "FIELDVALUE", injectionKeyDescription = "NullIf.Injection.FIELDVALUE") - private String value; - - public NullIfField() { - } + public String getName() { + return name; + } - public NullIfField(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + public void setValue(String value) { + this.value = value; + } - public void setValue(String value) { - this.value = value; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - NullIfField field = (NullIfField) o; - return Objects.equals(name, field.name) && Objects.equals(value, field.value); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + NullIfField field = (NullIfField) o; + return Objects.equals(name, field.name) && Objects.equals(value, field.value); + } - @Override - public int hashCode() { - return Objects.hash(name, value); - } + @Override + public int hashCode() { + return Objects.hash(name, value); + } - @Override - public NullIfField clone() { - return new NullIfField(name, value); - } + @Override + public NullIfField clone() { + return new NullIfField(name, value); + } } diff --git a/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfMeta.java b/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfMeta.java index b61814dbcfd..241c18de659 100644 --- a/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfMeta.java +++ b/plugins/transforms/nullif/src/main/java/org/apache/hop/pipeline/transforms/nullif/NullIfMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.nullif; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -29,8 +31,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; @Transform( id = "NullIf", @@ -44,7 +44,10 @@ public class NullIfMeta extends BaseTransformMeta { private static final Class PKG = NullIfMeta.class; // For Translator - @HopMetadataProperty(groupKey = "fields", key = "field", injectionGroupKey = "FIELDS", + @HopMetadataProperty( + groupKey = "fields", + key = "field", + injectionGroupKey = "FIELDS", injectionGroupDescription = "NullIf.Injection.FIELDS") private List fields; @@ -52,14 +55,14 @@ public NullIfMeta() { super(); this.fields = new ArrayList<>(); } - - public NullIfMeta(NullIfMeta meta) { + + public NullIfMeta(NullIfMeta meta) { this(); for (NullIfField field : meta.fields) { fields.add(new NullIfField(field.getName(), field.getValue())); } } - + public List getFields() { return fields; } @@ -70,7 +73,7 @@ public void setFields(List fields) { @Override public Object clone() { - return new NullIfMeta(this); + return new NullIfMeta(this); } @Override diff --git a/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfMetaTest.java b/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfMetaTest.java index 4512be8d1fe..75addda2aca 100644 --- a/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfMetaTest.java +++ b/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfMetaTest.java @@ -18,6 +18,7 @@ package org.apache.hop.pipeline.transforms.nullif; import static org.junit.Assert.assertEquals; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -40,9 +41,9 @@ public void testSerialization() throws Exception { NullIfMeta meta = TransformSerializationTestUtil.testSerialization( "/null-if-transform.xml", NullIfMeta.class); - + assertEquals(2, meta.getFields().size()); assertEquals("fieldName", meta.getFields().get(0).getName()); - assertEquals("two", meta.getFields().get(0).getValue()); + assertEquals("two", meta.getFields().get(0).getValue()); } } diff --git a/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfTest.java b/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfTest.java index e84530d5264..c03e783acd2 100644 --- a/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfTest.java +++ b/plugins/transforms/nullif/src/test/java/org/apache/hop/pipeline/transforms/nullif/NullIfTest.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.nullif; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import junit.framework.Assert; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.IRowSet; @@ -38,18 +50,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - public class NullIfTest { TransformMockHelper smh; @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRange.java b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRange.java index 1fad115c93b..1b985f52ab2 100644 --- a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRange.java +++ b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRange.java @@ -53,11 +53,11 @@ public boolean processRow() throws HopException { if (first) { first = false; - // Prepare lower and upper bound + // Prepare lower and upper bound for (NumberRangeRule rule : meta.getRules()) { rule.init(); } - + numberRange = new NumberRangeSet(meta.getRules(), meta.getFallBackValue()); data.outputRowMeta = getInputRowMeta().clone(); // Prepare output fields diff --git a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeDialog.java b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeDialog.java index 3616cfd662c..ee6c2259b6f 100644 --- a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeDialog.java +++ b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeDialog.java @@ -118,7 +118,9 @@ public void focusGained(FocusEvent e) { }); fallBackValueControl = createLine( - lsMod, BaseMessages.getString(PKG, "NumberRangeDialog.DefaultValue"), outputFieldControl); + lsMod, + BaseMessages.getString(PKG, "NumberRangeDialog.DefaultValue"), + outputFieldControl); createRulesTable(lsMod); @@ -156,7 +158,9 @@ private void createRulesTable(ModifyListener lsMod) { false); colinf[2] = new ColumnInfo( - BaseMessages.getString(PKG, "NumberRangeDialog.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false); + BaseMessages.getString(PKG, "NumberRangeDialog.Value"), + ColumnInfo.COLUMN_TYPE_TEXT, + false); rulesControl = new TableView( @@ -266,9 +270,9 @@ public void getData() { for (int i = 0; i < input.getRules().size(); i++) { NumberRangeRule rule = input.getRules().get(i); TableItem item = rulesControl.table.getItem(i); - item.setText(1, Const.NVL(rule.getLowerBound(),"")); - item.setText(2, Const.NVL(rule.getUpperBound(),"")); - item.setText(3, Const.NVL(rule.getValue(),"")); + item.setText(1, Const.NVL(rule.getLowerBound(), "")); + item.setText(2, Const.NVL(rule.getUpperBound(), "")); + item.setText(3, Const.NVL(rule.getValue(), "")); } rulesControl.setRowNums(); rulesControl.optWidth(true); @@ -288,7 +292,7 @@ private void ok() { transformName = wTransformName.getText(); // return value input.setInputField(inputFieldControl.getText()); - input.setOutputField(outputFieldControl.getText()); + input.setOutputField(outputFieldControl.getText()); input.setFallBackValue(fallBackValueControl.getText()); input.emptyRules(); @@ -299,7 +303,7 @@ private void ok() { String lowerBoundStr = item.getText(1); String upperBoundStr = item.getText(2); String value = item.getText(3); - + input.addRule(lowerBoundStr, upperBoundStr, value); } @@ -322,11 +326,10 @@ private void loadComboOptions() { } catch (HopException ke) { new ErrorDialog( - shell, - BaseMessages.getString(PKG, "NumberRangeDialog.Title"), + shell, + BaseMessages.getString(PKG, "NumberRangeDialog.Title"), BaseMessages.getString(PKG, "NumberRangeDialog.FailedToGetFields.DialogMessage"), ke); } } } - diff --git a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMeta.java b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMeta.java index b3c2888fe0a..c0bfcbec7ae 100644 --- a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMeta.java +++ b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.numberrange; +import java.util.LinkedList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.LinkedList; -import java.util.List; - @Transform( id = "NumberRange", image = "numberrange.svg", @@ -47,17 +46,30 @@ public class NumberRangeMeta extends BaseTransformMeta { private static final Class PKG = NumberRangeMeta.class; // For Translator - - @HopMetadataProperty(key ="inputField", injectionKey = "INPUT_FIELD", injectionKeyDescription = "NumberRangeMeta.Injection.INPUT_FIELD") + + @HopMetadataProperty( + key = "inputField", + injectionKey = "INPUT_FIELD", + injectionKeyDescription = "NumberRangeMeta.Injection.INPUT_FIELD") private String inputField; - @HopMetadataProperty(key ="outputField", injectionKey = "OUTPUT_FIELD", injectionKeyDescription = "NumberRangeMeta.Injection.OUTPUT_FIELD") + @HopMetadataProperty( + key = "outputField", + injectionKey = "OUTPUT_FIELD", + injectionKeyDescription = "NumberRangeMeta.Injection.OUTPUT_FIELD") private String outputField; - @HopMetadataProperty(key ="fallBackValue", injectionKey = "FALL_BACK_VALUE", injectionKeyDescription = "NumberRangeMeta.Injection.FALL_BACK_VALUE") + @HopMetadataProperty( + key = "fallBackValue", + injectionKey = "FALL_BACK_VALUE", + injectionKeyDescription = "NumberRangeMeta.Injection.FALL_BACK_VALUE") private String fallBackValue; - @HopMetadataProperty(groupKey = "rules", key = "rule", injectionGroupKey = "RULES", injectionGroupDescription = "NumberRangeMeta.Injection.RULES") + @HopMetadataProperty( + groupKey = "rules", + key = "rule", + injectionGroupKey = "RULES", + injectionGroupDescription = "NumberRangeMeta.Injection.RULES") private List rules; public NumberRangeMeta() { @@ -147,8 +159,8 @@ public void check( transforminfo); remarks.add(cr); } - - // Check that the lower and upper bounds are numerics + + // Check that the lower and upper bounds are numerics for (NumberRangeRule rule : this.rules) { try { if (!Utils.isEmpty(rule.getLowerBound())) { @@ -158,10 +170,15 @@ public void check( Double.valueOf(rule.getUpperBound()); } } catch (NumberFormatException e) { - cr = new CheckResult( - ICheckResult.TYPE_RESULT_ERROR, + cr = + new CheckResult( + ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( - PKG, "NumberRangeMeta.CheckResult.NotNumericRule", rule.getLowerBound(), rule.getUpperBound(), rule.getValue()), + PKG, + "NumberRangeMeta.CheckResult.NotNumericRule", + rule.getLowerBound(), + rule.getUpperBound(), + rule.getValue()), transforminfo); remarks.add(cr); } diff --git a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeRule.java b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeRule.java index 91ec0a06f25..8bfb1135d39 100644 --- a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeRule.java +++ b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeRule.java @@ -17,58 +17,66 @@ package org.apache.hop.pipeline.transforms.numberrange; +import java.util.Objects; import org.apache.hop.core.util.Utils; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - /** Contains one rule for a number range */ public class NumberRangeRule { /** Lower bound for which the rule matches (lowerBound <= x) */ - @HopMetadataProperty(key ="lower_bound", injectionKey = "LOWER_BOUND", injectionKeyDescription = "NumberRangeMeta.Injection.LOWER_BOUND") + @HopMetadataProperty( + key = "lower_bound", + injectionKey = "LOWER_BOUND", + injectionKeyDescription = "NumberRangeMeta.Injection.LOWER_BOUND") private String lowerBound; /** Upper bound for which the rule matches (x < upperBound) */ - @HopMetadataProperty(key ="upper_bound", injectionKey = "UPPER_BOUND", injectionKeyDescription = "NumberRangeMeta.Injection.UPPER_BOUND") + @HopMetadataProperty( + key = "upper_bound", + injectionKey = "UPPER_BOUND", + injectionKeyDescription = "NumberRangeMeta.Injection.UPPER_BOUND") private String upperBound; /** Value that is returned if the number to be tested is within the range */ - @HopMetadataProperty(key ="value", injectionKey = "VALUE", injectionKeyDescription = "NumberRangeMeta.Injection.VALUE") + @HopMetadataProperty( + key = "value", + injectionKey = "VALUE", + injectionKeyDescription = "NumberRangeMeta.Injection.VALUE") private String value; - + private double lowerBoundValue; private double upperBoundValue; - public NumberRangeRule() { + public NumberRangeRule() {} - } - public NumberRangeRule(String lowerBound, String upperBound, String value) { this.lowerBound = lowerBound; this.upperBound = upperBound; this.value = value; } - + public void init() { try { // Empty value is equal to minimal possible value - if (Utils.isEmpty(this.lowerBound)) - this.lowerBoundValue = -Double.MAX_VALUE; - else - this.lowerBoundValue = Double.valueOf(lowerBound); + if (Utils.isEmpty(this.lowerBound)) this.lowerBoundValue = -Double.MAX_VALUE; + else this.lowerBoundValue = Double.valueOf(lowerBound); // Empty value is equal to maximal possible value - if (Utils.isEmpty(this.upperBound)) - this.upperBoundValue = Double.MAX_VALUE; - else - this.upperBoundValue = Double.valueOf(upperBound); + if (Utils.isEmpty(this.upperBound)) this.upperBoundValue = Double.MAX_VALUE; + else this.upperBoundValue = Double.valueOf(upperBound); } catch (NumberFormatException e) { - throw new IllegalArgumentException("Bounds of this rule are not numeric: lowerBound=" - + lowerBound + ", upperBound=" + upperBound + ", value=" + value, e); + throw new IllegalArgumentException( + "Bounds of this rule are not numeric: lowerBound=" + + lowerBound + + ", upperBound=" + + upperBound + + ", value=" + + value, + e); } } - + /** * Evaluates if the current value is within the range. If so, it returns the value. Otherwise it * returns null. @@ -86,15 +94,16 @@ public String evaluate(double compareValue) { public void setLowerBound(String value) { this.lowerBound = value; } - + public String getLowerBound() { return lowerBound; } public void setUpperBound(String value) { - this.upperBound = value;; + this.upperBound = value; + ; } - + public String getUpperBound() { return upperBound; } @@ -102,7 +111,7 @@ public String getUpperBound() { public void setValue(String value) { this.value = value; } - + public String getValue() { return value; } diff --git a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeSet.java b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeSet.java index 1453dfa4882..dad4167cb47 100644 --- a/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeSet.java +++ b/plugins/transforms/numberrange/src/main/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeSet.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.numberrange; -import org.apache.hop.core.exception.HopException; - import java.util.List; +import org.apache.hop.core.exception.HopException; /** This class assigns numbers into ranges */ public class NumberRangeSet { @@ -64,7 +63,6 @@ public static String getMultiValueSeparator() { return MULTI_VALUE_SEPARATOR; } - /** Evaluates a value against all rules. Return empty value if input is not numeric. */ public String evaluate(Double value) throws HopException { if (value != null) { diff --git a/plugins/transforms/numberrange/src/test/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMetaTest.java b/plugins/transforms/numberrange/src/test/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMetaTest.java index d16442c0aa8..465516f87eb 100644 --- a/plugins/transforms/numberrange/src/test/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMetaTest.java +++ b/plugins/transforms/numberrange/src/test/java/org/apache/hop/pipeline/transforms/numberrange/NumberRangeMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.numberrange; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -25,13 +31,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class NumberRangeMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -71,7 +70,9 @@ public class NumberRangeRuleFieldLoadSaveValidator @Override public NumberRangeRule getTestObject() { return new NumberRangeRule( - String.valueOf(new Random().nextDouble()), String.valueOf(new Random().nextDouble()), UUID.randomUUID().toString()); + String.valueOf(new Random().nextDouble()), + String.valueOf(new Random().nextDouble()), + UUID.randomUUID().toString()); } @Override diff --git a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkDataOutput.java b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkDataOutput.java index c367d334463..e6484974302 100644 --- a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkDataOutput.java +++ b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkDataOutput.java @@ -17,15 +17,6 @@ package org.apache.hop.pipeline.transforms.orabulkloader; import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopFileException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.util.Utils; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.core.vfs.HopVfs; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; @@ -37,10 +28,19 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopFileException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.IValueMeta; +import org.apache.hop.core.util.Utils; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.core.vfs.HopVfs; /** - * Does the opening of the output "stream". It's either a file or inter process communication which is transparent to - * users of this class. + * Does the opening of the output "stream". It's either a file or inter process communication which + * is transparent to users of this class. */ public class OraBulkDataOutput { private OraBulkLoaderMeta meta; @@ -53,42 +53,42 @@ public class OraBulkDataOutput { private SimpleDateFormat sdfDateTime = null; private String recTerm; - public OraBulkDataOutput( OraBulkLoaderMeta meta, String recTerm ) { + public OraBulkDataOutput(OraBulkLoaderMeta meta, String recTerm) { this.meta = meta; this.recTerm = recTerm; } - public void open( IVariables variables, Process sqlldrProcess ) throws HopException { + public void open(IVariables variables, Process sqlldrProcess) throws HopException { String loadMethod = meta.getLoadMethod(); try { OutputStream os; - if ( OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals( loadMethod ) ) { + if (OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals(loadMethod)) { os = sqlldrProcess.getOutputStream(); } else { // Else open the data file filled in. - String dataFilePath = getFilename( getFileObject( meta.getDataFile(), variables ) ); - File dataFile = new File( dataFilePath ); + String dataFilePath = getFilename(getFileObject(meta.getDataFile(), variables)); + File dataFile = new File(dataFilePath); // Make sure the parent directory exists dataFile.getParentFile().mkdirs(); - os = new FileOutputStream( dataFile, false ); + os = new FileOutputStream(dataFile, false); } String encoding = meta.getEncoding(); - if ( Utils.isEmpty( encoding ) ) { + if (Utils.isEmpty(encoding)) { // Use the default encoding. - output = new BufferedWriter( new OutputStreamWriter( os ) ); + output = new BufferedWriter(new OutputStreamWriter(os)); } else { // Use the specified encoding - output = new BufferedWriter( new OutputStreamWriter( os, encoding ) ); + output = new BufferedWriter(new OutputStreamWriter(os, encoding)); } - } catch ( IOException e ) { - throw new HopException( "IO exception occured: " + e.getMessage(), e ); + } catch (IOException e) { + throw new HopException("IO exception occured: " + e.getMessage(), e); } } public void close() throws IOException { - if ( output != null ) { + if (output != null) { output.close(); } } @@ -97,15 +97,15 @@ Writer getOutput() { return output; } - private String createEscapedString( String orig, String enclosure ) { - StringBuilder buf = new StringBuilder( orig ); + private String createEscapedString(String orig, String enclosure) { + StringBuilder buf = new StringBuilder(orig); - Const.repl( buf, enclosure, enclosure + enclosure ); + Const.repl(buf, enclosure, enclosure + enclosure); return buf.toString(); } - public void writeLine( IRowMeta rowMeta, Object[] row ) throws HopException { - if ( first ) { + public void writeLine(IRowMeta rowMeta, Object[] row) throws HopException { + if (first) { first = false; enclosure = meta.getEnclosure(); @@ -113,131 +113,132 @@ public void writeLine( IRowMeta rowMeta, Object[] row ) throws HopException { // Setup up the fields we need to take for each of the rows // as this speeds up processing. fieldNumbers = new int[meta.getMappings().size()]; - for ( int i = 0; i < fieldNumbers.length; i++ ) { - fieldNumbers[i] = rowMeta.indexOfValue( meta.getMappings().get(i).getFieldStream() ); - if ( fieldNumbers[i] < 0 ) { - throw new HopException( "Could not find field " + meta.getMappings().get(i).getFieldStream() + " in stream" ); + for (int i = 0; i < fieldNumbers.length; i++) { + fieldNumbers[i] = rowMeta.indexOfValue(meta.getMappings().get(i).getFieldStream()); + if (fieldNumbers[i] < 0) { + throw new HopException( + "Could not find field " + meta.getMappings().get(i).getFieldStream() + " in stream"); } } - sdfDate = new SimpleDateFormat( "yyyy-MM-dd" ); - sdfDateTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS" ); + sdfDate = new SimpleDateFormat("yyyy-MM-dd"); + sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); outbuf = new StringBuilder(); } - outbuf.setLength( 0 ); + outbuf.setLength(0); // Write the data to the output IValueMeta valueMeta; int number; - for ( int i = 0; i < fieldNumbers.length; i++ ) { - if ( i != 0 ) { - outbuf.append( ',' ); + for (int i = 0; i < fieldNumbers.length; i++) { + if (i != 0) { + outbuf.append(','); } number = fieldNumbers[i]; - valueMeta = rowMeta.getValueMeta( number ); - if ( row[number] == null ) { + valueMeta = rowMeta.getValueMeta(number); + if (row[number] == null) { // TODO (SB): special check for null in case of Strings. - outbuf.append( enclosure ); - outbuf.append( enclosure ); + outbuf.append(enclosure); + outbuf.append(enclosure); } else { - switch ( valueMeta.getType() ) { + switch (valueMeta.getType()) { case IValueMeta.TYPE_STRING: - String s = rowMeta.getString( row, number ); - outbuf.append( enclosure ); - if ( null != s ) { - if ( s.contains( enclosure ) ) { - s = createEscapedString( s, enclosure ); + String s = rowMeta.getString(row, number); + outbuf.append(enclosure); + if (null != s) { + if (s.contains(enclosure)) { + s = createEscapedString(s, enclosure); } - outbuf.append( s ); + outbuf.append(s); } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; case IValueMeta.TYPE_INTEGER: - Long l = rowMeta.getInteger( row, number ); - outbuf.append( enclosure ); - if ( null != l ) { - outbuf.append( l ); + Long l = rowMeta.getInteger(row, number); + outbuf.append(enclosure); + if (null != l) { + outbuf.append(l); } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; case IValueMeta.TYPE_NUMBER: - Double d = rowMeta.getNumber( row, number ); - outbuf.append( enclosure ); - if ( null != d ) { - outbuf.append( d ); + Double d = rowMeta.getNumber(row, number); + outbuf.append(enclosure); + if (null != d) { + outbuf.append(d); } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; case IValueMeta.TYPE_BIGNUMBER: - BigDecimal bd = rowMeta.getBigNumber( row, number ); - outbuf.append( enclosure ); - if ( null != bd ) { - outbuf.append( bd ); + BigDecimal bd = rowMeta.getBigNumber(row, number); + outbuf.append(enclosure); + if (null != bd) { + outbuf.append(bd); } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; case IValueMeta.TYPE_DATE: - Date dt = rowMeta.getDate( row, number ); - outbuf.append( enclosure ); - if ( null != dt ) { + Date dt = rowMeta.getDate(row, number); + outbuf.append(enclosure); + if (null != dt) { String mask = meta.getMappings().get(i).getDateMask(); - if ( OraBulkLoaderMeta.DATE_MASK_DATETIME.equals( mask ) ) { - outbuf.append( sdfDateTime.format( dt ) ); + if (OraBulkLoaderMeta.DATE_MASK_DATETIME.equals(mask)) { + outbuf.append(sdfDateTime.format(dt)); } else { // Default is date format - outbuf.append( sdfDate.format( dt ) ); + outbuf.append(sdfDate.format(dt)); } } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; case IValueMeta.TYPE_BOOLEAN: - Boolean b = rowMeta.getBoolean( row, number ); - outbuf.append( enclosure ); - if ( null != b ) { - if ( b ) { - outbuf.append( 'Y' ); + Boolean b = rowMeta.getBoolean(row, number); + outbuf.append(enclosure); + if (null != b) { + if (b) { + outbuf.append('Y'); } else { - outbuf.append( 'N' ); + outbuf.append('N'); } } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; case IValueMeta.TYPE_BINARY: - byte[] byt = rowMeta.getBinary( row, number ); - outbuf.append( "" ); + byte[] byt = rowMeta.getBinary(row, number); + outbuf.append(""); // TODO REVIEW - implicit .toString - outbuf.append( byt ); - outbuf.append( "" ); + outbuf.append(byt); + outbuf.append(""); break; case IValueMeta.TYPE_TIMESTAMP: - Timestamp timestamp = (Timestamp) rowMeta.getDate( row, number ); - outbuf.append( enclosure ); - if ( null != timestamp ) { - outbuf.append( timestamp.toString() ); + Timestamp timestamp = (Timestamp) rowMeta.getDate(row, number); + outbuf.append(enclosure); + if (null != timestamp) { + outbuf.append(timestamp.toString()); } - outbuf.append( enclosure ); + outbuf.append(enclosure); break; default: - throw new HopException( "Unsupported type" ); + throw new HopException("Unsupported type"); } } } - outbuf.append( recTerm ); + outbuf.append(recTerm); try { - output.append( outbuf ); - } catch ( IOException e ) { - throw new HopException( "IO exception occured: " + e.getMessage(), e ); + output.append(outbuf); + } catch (IOException e) { + throw new HopException("IO exception occured: " + e.getMessage(), e); } } @VisibleForTesting - String getFilename( FileObject fileObject ) { - return HopVfs.getFilename( fileObject ); + String getFilename(FileObject fileObject) { + return HopVfs.getFilename(fileObject); } @VisibleForTesting - FileObject getFileObject( String fileName, IVariables variables ) throws HopFileException { - return HopVfs.getFileObject( variables.resolve(fileName) ); + FileObject getFileObject(String fileName, IVariables variables) throws HopFileException { + return HopVfs.getFileObject(variables.resolve(fileName)); } } diff --git a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderData.java b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderData.java index 3123351e783..609d693f88d 100644 --- a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderData.java +++ b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderData.java @@ -20,9 +20,7 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -/** - * Stores data for the OraBulkLoader transformation. - */ +/** Stores data for the OraBulkLoader transformation. */ public class OraBulkLoaderData extends BaseTransformData implements ITransformData { public Database db; diff --git a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMappingMeta.java b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMappingMeta.java index ccd72591559..7ac021e9344 100644 --- a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMappingMeta.java +++ b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMappingMeta.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.orabulkloader; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class OraBulkLoaderMappingMeta { @@ -64,7 +63,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OraBulkLoaderMappingMeta that = (OraBulkLoaderMappingMeta) o; - return Objects.equals(fieldTable, that.fieldTable) && Objects.equals(fieldStream, that.fieldStream) && Objects.equals(dateMask, that.dateMask); + return Objects.equals(fieldTable, that.fieldTable) + && Objects.equals(fieldStream, that.fieldStream) + && Objects.equals(dateMask, that.dateMask); } public String getFieldTable() { diff --git a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMeta.java b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMeta.java index 006150e0639..116f977e423 100644 --- a/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMeta.java +++ b/plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderMeta.java @@ -16,6 +16,8 @@ */ package org.apache.hop.pipeline.transforms.orabulkloader; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,8 +40,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; @Transform( id = "OraBulkLoader", @@ -49,9 +49,10 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Bulk", keywords = "i18n::OraBulkLoader.Keywords", documentationUrl = "/pipeline/transforms/orabulkloader.html") -public class OraBulkLoaderMeta extends BaseTransformMeta implements -IProvidesDatabaseConnectionInformation { - private static final Class PKG = OraBulkLoaderMeta.class; // for i18n purposes, needed by Translator2!! +public class OraBulkLoaderMeta extends BaseTransformMeta + implements IProvidesDatabaseConnectionInformation { + private static final Class PKG = + OraBulkLoaderMeta.class; // for i18n purposes, needed by Translator2!! private static final int DEFAULT_COMMIT_SIZE = 100000; // The bigger the better for Oracle private static final int DEFAULT_BIND_SIZE = 0; @@ -170,7 +171,7 @@ public class OraBulkLoaderMeta extends BaseTransformMeta mappings; - + /* * Do not translate following values!!! They are will end up in the job export. */ @@ -251,10 +252,10 @@ public OraBulkLoaderMeta() { super(); } - public int getCommitSizeAsInt( IVariables variables ) { + public int getCommitSizeAsInt(IVariables variables) { try { - return Integer.valueOf( variables.resolve( getCommitSize() ) ); - } catch ( NumberFormatException ex ) { + return Integer.valueOf(variables.resolve(getCommitSize())); + } catch (NumberFormatException ex) { return DEFAULT_COMMIT_SIZE; } } @@ -267,10 +268,9 @@ public String getCommitSize() { } /** - * @param commitSize - * The commitSize to set. + * @param commitSize The commitSize to set. */ - public void setCommitSize( String commitSize ) { + public void setCommitSize(String commitSize) { this.commitSize = commitSize; } @@ -282,10 +282,9 @@ public DatabaseMeta getDatabaseMeta() { } /** - * @param database - * The database to set. + * @param database The database to set. */ - public void setDatabaseMeta( DatabaseMeta database ) { + public void setDatabaseMeta(DatabaseMeta database) { this.databaseMeta = database; } @@ -297,10 +296,9 @@ public String getTableName() { } /** - * @param tableName - * The tableName to set. + * @param tableName The tableName to set. */ - public void setTableName( String tableName ) { + public void setTableName(String tableName) { this.tableName = tableName; } @@ -308,7 +306,7 @@ public String getSqlldr() { return sqlldr; } - public void setSqlldr( String sqlldr ) { + public void setSqlldr(String sqlldr) { this.sqlldr = sqlldr; } @@ -324,7 +322,7 @@ public boolean isFailOnWarning() { return failOnWarning; } - public void setFailOnWarning( boolean failOnWarning ) { + public void setFailOnWarning(boolean failOnWarning) { this.failOnWarning = failOnWarning; } @@ -332,7 +330,7 @@ public boolean isFailOnError() { return failOnError; } - public void setFailOnError( boolean failOnError ) { + public void setFailOnError(boolean failOnError) { this.failOnError = failOnError; } @@ -340,7 +338,7 @@ public String getCharacterSetName() { return characterSetName; } - public void setCharacterSetName( String characterSetName ) { + public void setCharacterSetName(String characterSetName) { this.characterSetName = characterSetName; } @@ -348,20 +346,19 @@ public String getAltRecordTerm() { return altRecordTerm; } - public void setAltRecordTerm( String altRecordTerm ) { + public void setAltRecordTerm(String altRecordTerm) { this.altRecordTerm = altRecordTerm; } - @Override public void setDefault() { databaseMeta = null; - commitSize = Integer.toString( DEFAULT_COMMIT_SIZE ); - bindSize = Integer.toString( DEFAULT_BIND_SIZE ); // Use platform default - readSize = Integer.toString( DEFAULT_READ_SIZE ); // Use platform default - maxErrors = Integer.toString( DEFAULT_MAX_ERRORS ); + commitSize = Integer.toString(DEFAULT_COMMIT_SIZE); + bindSize = Integer.toString(DEFAULT_BIND_SIZE); // Use platform default + readSize = Integer.toString(DEFAULT_READ_SIZE); // Use platform default + maxErrors = Integer.toString(DEFAULT_MAX_ERRORS); schemaName = ""; - tableName = BaseMessages.getString( PKG, "OraBulkLoaderMeta.DefaultTableName" ); + tableName = BaseMessages.getString(PKG, "OraBulkLoaderMeta.DefaultTableName"); loadMethod = METHOD_AUTO_END; loadAction = ACTION_APPEND; sqlldr = "sqlldr"; @@ -381,7 +378,6 @@ public void setDefault() { mappings = new ArrayList<>(); } - @Override public void check( List remarks, @@ -396,16 +392,18 @@ public void check( CheckResult cr; String errorMessage = ""; - if ( databaseMeta != null ) { - Database db = new Database( loggingObject, variables, databaseMeta ); + if (databaseMeta != null) { + Database db = new Database(loggingObject, variables, databaseMeta); try { db.connect(); - if ( !Utils.isEmpty( tableName ) ) { + if (!Utils.isEmpty(tableName)) { cr = - new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.TableNameOK" ), transformMeta ); - remarks.add( cr ); + new CheckResult( + ICheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.TableNameOK"), + transformMeta); + remarks.add(cr); boolean first = true; boolean errorFound = false; @@ -413,13 +411,15 @@ public void check( // Check fields in table String schemaTable = - databaseMeta.getQuotedSchemaTableCombination(variables, schemaName, tableName ); - IRowMeta rowMeta = db.getTableFields( schemaTable ); - if ( rowMeta != null ) { + databaseMeta.getQuotedSchemaTableCombination(variables, schemaName, tableName); + IRowMeta rowMeta = db.getTableFields(schemaTable); + if (rowMeta != null) { cr = - new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.TableExists" ), transformMeta ); - remarks.add( cr ); + new CheckResult( + ICheckResult.TYPE_RESULT_OK, + BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.TableExists"), + transformMeta); + remarks.add(cr); // How about the fields to insert/dateMask in the table? first = true; @@ -429,40 +429,49 @@ public void check( for (int i = 0; i < mappings.size(); i++) { String field = mappings.get(i).getFieldTable(); - IValueMeta v = rowMeta.searchValueMeta( field ); - if ( v == null ) { - if ( first ) { + IValueMeta v = rowMeta.searchValueMeta(field); + if (v == null) { + if (first) { first = false; errorMessage += - BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.MissingFieldsToLoadInTargetTable" ) - + Const.CR; + BaseMessages.getString( + PKG, "OraBulkLoaderMeta.CheckResult.MissingFieldsToLoadInTargetTable") + + Const.CR; } errorFound = true; errorMessage += "\t\t" + field + Const.CR; } } - if ( errorFound ) { - cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta ); + if (errorFound) { + cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); } else { cr = - new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.AllFieldsFoundInTargetTable" ), transformMeta ); + new CheckResult( + ICheckResult.TYPE_RESULT_OK, + BaseMessages.getString( + PKG, "OraBulkLoaderMeta.CheckResult.AllFieldsFoundInTargetTable"), + transformMeta); } - remarks.add( cr ); + remarks.add(cr); } else { - errorMessage = BaseMessages.getString( PKG, "OraBulkLoaderMeta.CheckResult.CouldNotReadTableInfo" ); - cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta ); - remarks.add( cr ); + errorMessage = + BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.CouldNotReadTableInfo"); + cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); + remarks.add(cr); } } // Look up fields in the input stream - if ( prev != null && prev.size() > 0 ) { + if (prev != null && prev.size() > 0) { cr = - new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.TransformReceivingDatas", prev.size() + "" ), transformMeta ); - remarks.add( cr ); + new CheckResult( + ICheckResult.TYPE_RESULT_OK, + BaseMessages.getString( + PKG, + "OraBulkLoaderMeta.CheckResult.TransformReceivingDatas", + prev.size() + ""), + transformMeta); + remarks.add(cr); boolean first = true; errorMessage = ""; @@ -470,55 +479,67 @@ public void check( for (int i = 0; i < mappings.size(); i++) { IValueMeta valueMeta = prev.searchValueMeta(mappings.get(i).getFieldStream()); - if ( valueMeta == null ) { - if ( first ) { + if (valueMeta == null) { + if (first) { first = false; errorMessage += - BaseMessages.getString( PKG, "OraBulkLoaderMeta.CheckResult.MissingFieldsInInput" ) + Const.CR; + BaseMessages.getString( + PKG, "OraBulkLoaderMeta.CheckResult.MissingFieldsInInput") + + Const.CR; } errorFound = true; errorMessage += "\t\t" + mappings.get(i).getFieldStream() + Const.CR; } } - if ( errorFound ) { - cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta ); + if (errorFound) { + cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); } else { cr = - new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.AllFieldsFoundInInput" ), transformMeta ); + new CheckResult( + ICheckResult.TYPE_RESULT_OK, + BaseMessages.getString( + PKG, "OraBulkLoaderMeta.CheckResult.AllFieldsFoundInInput"), + transformMeta); } - remarks.add( cr ); + remarks.add(cr); } else { errorMessage = - BaseMessages.getString( PKG, "OraBulkLoaderMeta.CheckResult.MissingFieldsInInput3" ) + Const.CR; - cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta ); - remarks.add( cr ); + BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.MissingFieldsInInput3") + + Const.CR; + cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); + remarks.add(cr); } - } catch ( HopException e ) { + } catch (HopException e) { errorMessage = - BaseMessages.getString( PKG, "OraBulkLoaderMeta.CheckResult.DatabaseErrorOccurred" ) + e.getMessage(); - cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta ); - remarks.add( cr ); + BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.DatabaseErrorOccurred") + + e.getMessage(); + cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); + remarks.add(cr); } finally { db.disconnect(); } } else { - errorMessage = BaseMessages.getString( PKG, "OraBulkLoaderMeta.CheckResult.InvalidConnection" ); - cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta ); - remarks.add( cr ); + errorMessage = BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.InvalidConnection"); + cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta); + remarks.add(cr); } // See if we have input streams leading to this transform! - if ( input.length > 0 ) { + if (input.length > 0) { cr = - new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.TransformReceivingInfoFromOtherTransforms" ), transformMeta ); - remarks.add( cr ); + new CheckResult( + ICheckResult.TYPE_RESULT_OK, + BaseMessages.getString( + PKG, "OraBulkLoaderMeta.CheckResult.TransformReceivingInfoFromOtherTransforms"), + transformMeta); + remarks.add(cr); } else { cr = - new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( - PKG, "OraBulkLoaderMeta.CheckResult.NoInputError" ), transformMeta ); - remarks.add( cr ); + new CheckResult( + ICheckResult.TYPE_RESULT_ERROR, + BaseMessages.getString(PKG, "OraBulkLoaderMeta.CheckResult.NoInputError"), + transformMeta); + remarks.add(cr); } } @@ -530,60 +551,72 @@ public SqlStatement getSqlStatements( IRowMeta prev, IHopMetadataProvider metadataProvider) throws HopTransformException { - SqlStatement retval = new SqlStatement( transformMeta.getName(), databaseMeta, null ); // default: nothing to do! + SqlStatement retval = + new SqlStatement(transformMeta.getName(), databaseMeta, null); // default: nothing to do! - if ( databaseMeta != null ) { - if ( prev != null && prev.size() > 0 ) { + if (databaseMeta != null) { + if (prev != null && prev.size() > 0) { // Copy the row IRowMeta tableFields = new RowMeta(); // Now change the field names for (int i = 0; i < mappings.size(); i++) { IValueMeta v = prev.searchValueMeta(mappings.get(i).getFieldStream()); - if ( v != null ) { + if (v != null) { IValueMeta tableField = v.clone(); - tableField.setName( mappings.get(i).getFieldTable() ); - tableFields.addValueMeta( tableField ); + tableField.setName(mappings.get(i).getFieldTable()); + tableFields.addValueMeta(tableField); } else { - throw new HopTransformException( "Unable to find field [" + mappings.get(i).getFieldTable() + "] in the input rows" ); + throw new HopTransformException( + "Unable to find field [" + mappings.get(i).getFieldTable() + "] in the input rows"); } } - if ( !Utils.isEmpty( tableName ) ) { - Database db = new Database( loggingObject, variables, databaseMeta ); + if (!Utils.isEmpty(tableName)) { + Database db = new Database(loggingObject, variables, databaseMeta); try { db.connect(); String schemaTable = - databaseMeta.getQuotedSchemaTableCombination(variables, schemaName, tableName); - String sql = db.getDDL( schemaTable, tableFields, null, false, null, true ); + databaseMeta.getQuotedSchemaTableCombination(variables, schemaName, tableName); + String sql = db.getDDL(schemaTable, tableFields, null, false, null, true); - if ( sql.length() == 0 ) { - retval.setSql( null ); + if (sql.length() == 0) { + retval.setSql(null); } else { - retval.setSql( sql ); + retval.setSql(sql); } - } catch (HopException e ) { - retval.setError( BaseMessages.getString( PKG, "OraBulkLoaderMeta.GetSQL.ErrorOccurred" ) - + e.getMessage() ); + } catch (HopException e) { + retval.setError( + BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.ErrorOccurred") + + e.getMessage()); } } else { - retval.setError( BaseMessages.getString( PKG, "OraBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection" ) ); + retval.setError( + BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection")); } } else { - retval.setError( BaseMessages.getString( PKG, "OraBulkLoaderMeta.GetSQL.NotReceivingAnyFields" ) ); + retval.setError( + BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.NotReceivingAnyFields")); } } else { - retval.setError( BaseMessages.getString( PKG, "OraBulkLoaderMeta.GetSQL.NoConnectionDefined" ) ); + retval.setError(BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.NoConnectionDefined")); } return retval; } - + @Override - public void analyseImpact(IVariables variables, List impact, - PipelineMeta pipelineMeta, TransformMeta transformMeta, IRowMeta prev, String[] input, - String[] output, IRowMeta info, IHopMetadataProvider metadataProvider) + public void analyseImpact( + IVariables variables, + List impact, + PipelineMeta pipelineMeta, + TransformMeta transformMeta, + IRowMeta prev, + String[] input, + String[] output, + IRowMeta info, + IHopMetadataProvider metadataProvider) throws HopTransformException { if (prev != null) { @@ -592,11 +625,18 @@ public void analyseImpact(IVariables variables, List impact, for (int i = 0; i < mappings.size(); i++) { IValueMeta valueMeta = prev.searchValueMeta(mappings.get(i).getFieldStream()); - DatabaseImpact ii = new DatabaseImpact(DatabaseImpact.TYPE_IMPACT_READ_WRITE, - pipelineMeta.getName(), transformMeta.getName(), databaseMeta.getDatabaseName(), - variables.resolve(tableName), mappings.get(i).getFieldTable(), - mappings.get(i).getFieldStream(), valueMeta != null ? valueMeta.getOrigin() : "?", "", - "Type = " + valueMeta.toStringMeta()); + DatabaseImpact ii = + new DatabaseImpact( + DatabaseImpact.TYPE_IMPACT_READ_WRITE, + pipelineMeta.getName(), + transformMeta.getName(), + databaseMeta.getDatabaseName(), + variables.resolve(tableName), + mappings.get(i).getFieldTable(), + mappings.get(i).getFieldStream(), + valueMeta != null ? valueMeta.getOrigin() : "?", + "", + "Type = " + valueMeta.toStringMeta()); impact.add(ii); } } @@ -610,44 +650,47 @@ public boolean isDirectPath() { } /** - * @param directPath - * do we want direct path + * @param directPath do we want direct path */ - public void setDirectPath( boolean directPath ) { + public void setDirectPath(boolean directPath) { this.directPath = directPath; } @Override - public IRowMeta getRequiredFields( IVariables variables ) throws HopException { - String realTableName = variables.resolve( tableName ); - String realSchemaName = variables.resolve( schemaName ); + public IRowMeta getRequiredFields(IVariables variables) throws HopException { + String realTableName = variables.resolve(tableName); + String realSchemaName = variables.resolve(schemaName); - if ( databaseMeta != null ) { + if (databaseMeta != null) { Database database = new Database(loggingObject, variables, databaseMeta); try { database.connect(); - if ( !Utils.isEmpty( realTableName ) ) { - String schemaTable = databaseMeta.getQuotedSchemaTableCombination( - variables, realSchemaName, realTableName); + if (!Utils.isEmpty(realTableName)) { + String schemaTable = + databaseMeta.getQuotedSchemaTableCombination( + variables, realSchemaName, realTableName); // Check if this table exists... - if ( database.checkTableExists( realSchemaName, realTableName ) ) { - return database.getTableFields( schemaTable ); + if (database.checkTableExists(realSchemaName, realTableName)) { + return database.getTableFields(schemaTable); } else { - throw new HopException( BaseMessages.getString( PKG, "OraBulkLoaderMeta.Exception.TableNotFound" ) ); + throw new HopException( + BaseMessages.getString(PKG, "OraBulkLoaderMeta.Exception.TableNotFound")); } } else { - throw new HopException( BaseMessages.getString( PKG, "OraBulkLoaderMeta.Exception.TableNotSpecified" ) ); + throw new HopException( + BaseMessages.getString(PKG, "OraBulkLoaderMeta.Exception.TableNotSpecified")); } - } catch ( Exception e ) { + } catch (Exception e) { throw new HopException( - BaseMessages.getString( PKG, "OraBulkLoaderMeta.Exception.ErrorGettingFields" ), e ); + BaseMessages.getString(PKG, "OraBulkLoaderMeta.Exception.ErrorGettingFields"), e); } finally { database.disconnect(); } } else { - throw new HopException( BaseMessages.getString( PKG, "OraBulkLoaderMeta.Exception.ConnectionNotDefined" ) ); + throw new HopException( + BaseMessages.getString(PKG, "OraBulkLoaderMeta.Exception.ConnectionNotDefined")); } } @@ -659,10 +702,9 @@ public String getSchemaName() { } /** - * @param schemaName - * the schemaName to set + * @param schemaName the schemaName to set */ - public void setSchemaName( String schemaName ) { + public void setSchemaName(String schemaName) { this.schemaName = schemaName; } @@ -670,7 +712,7 @@ public String getBadFile() { return badFile; } - public void setBadFile( String badFile ) { + public void setBadFile(String badFile) { this.badFile = badFile; } @@ -678,7 +720,7 @@ public String getControlFile() { return controlFile; } - public void setControlFile( String controlFile ) { + public void setControlFile(String controlFile) { this.controlFile = controlFile; } @@ -686,7 +728,7 @@ public String getDataFile() { return dataFile; } - public void setDataFile( String dataFile ) { + public void setDataFile(String dataFile) { this.dataFile = dataFile; } @@ -694,7 +736,7 @@ public String getDiscardFile() { return discardFile; } - public void setDiscardFile( String discardFile ) { + public void setDiscardFile(String discardFile) { this.discardFile = discardFile; } @@ -702,11 +744,11 @@ public String getLogFile() { return logFile; } - public void setLogFile( String logFile ) { + public void setLogFile(String logFile) { this.logFile = logFile; } - public void setLoadAction( String action ) { + public void setLoadAction(String action) { this.loadAction = action; } @@ -714,7 +756,7 @@ public String getLoadAction() { return this.loadAction; } - public void setLoadMethod( String method ) { + public void setLoadMethod(String method) { this.loadMethod = method; } @@ -726,7 +768,7 @@ public String getEncoding() { return encoding; } - public void setEncoding( String encoding ) { + public void setEncoding(String encoding) { this.encoding = encoding; } @@ -742,14 +784,14 @@ public boolean isEraseFiles() { return eraseFiles; } - public void setEraseFiles( boolean eraseFiles ) { + public void setEraseFiles(boolean eraseFiles) { this.eraseFiles = eraseFiles; } - public int getBindSizeAsInt( IVariables variables ) { + public int getBindSizeAsInt(IVariables variables) { try { - return Integer.valueOf( variables.resolve( getBindSize() ) ); - } catch ( NumberFormatException ex ) { + return Integer.valueOf(variables.resolve(getBindSize())); + } catch (NumberFormatException ex) { return DEFAULT_BIND_SIZE; } } @@ -758,14 +800,14 @@ public String getBindSize() { return bindSize; } - public void setBindSize( String bindSize ) { + public void setBindSize(String bindSize) { this.bindSize = bindSize; } - public int getMaxErrorsAsInt( IVariables variables ) { + public int getMaxErrorsAsInt(IVariables variables) { try { - return Integer.valueOf( variables.resolve( getMaxErrors() ) ); - } catch ( NumberFormatException ex ) { + return Integer.valueOf(variables.resolve(getMaxErrors())); + } catch (NumberFormatException ex) { return DEFAULT_MAX_ERRORS; } } @@ -774,14 +816,14 @@ public String getMaxErrors() { return maxErrors; } - public void setMaxErrors( String maxErrors ) { + public void setMaxErrors(String maxErrors) { this.maxErrors = maxErrors; } - public int getReadSizeAsInt( IVariables variables ) { + public int getReadSizeAsInt(IVariables variables) { try { - return Integer.valueOf( variables.resolve( getReadSize() ) ); - } catch ( NumberFormatException ex ) { + return Integer.valueOf(variables.resolve(getReadSize())); + } catch (NumberFormatException ex) { return DEFAULT_READ_SIZE; } } @@ -790,7 +832,7 @@ public String getReadSize() { return readSize; } - public void setReadSize( String readSize ) { + public void setReadSize(String readSize) { this.readSize = readSize; } @@ -802,13 +844,12 @@ public boolean isParallel() { } /** - * @param parallel - * the parallel to set + * @param parallel the parallel to set */ - public void setParallel( boolean parallel ) { + public void setParallel(boolean parallel) { this.parallel = parallel; } - + @Override public String getMissingDatabaseConnectionInformationMessage() { return null; diff --git a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoader.java b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoader.java index 547bdeda44a..9886de4f875 100644 --- a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoader.java +++ b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoader.java @@ -26,6 +26,13 @@ // import com.google.common.annotations.VisibleForTesting; +import java.math.BigDecimal; +import java.nio.charset.Charset; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -42,14 +49,6 @@ import org.postgresql.PGConnection; import org.postgresql.copy.PGCopyOutputStream; -import java.math.BigDecimal; -import java.nio.charset.Charset; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.List; - /** Performs a bulk load to a postgres table. */ public class PGBulkLoader extends BaseTransform { diff --git a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderData.java b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderData.java index d5135e8ee78..d607b713352 100644 --- a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderData.java +++ b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderData.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.pgbulkloader; +import java.io.OutputStream; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaDate; @@ -25,8 +26,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.postgresql.PGConnection; -import java.io.OutputStream; - /** Stores data for the GPBulkLoader transform. */ public class PGBulkLoaderData extends BaseTransformData implements ITransformData { public Database db; diff --git a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java index aa37995b375..a3a9f0d7e66 100644 --- a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java +++ b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.pgbulkloader; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -66,9 +68,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class PGBulkLoaderDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = PGBulkLoaderMeta.class; // For Translator @@ -858,7 +857,7 @@ private void setTableFieldCombo() { } if (!Utils.isEmpty(tableName)) { DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); - if (databaseMeta != null) { + if (databaseMeta != null) { try (Database db = new Database(loggingObject, variables, databaseMeta)) { db.connect(); @@ -879,7 +878,7 @@ private void setTableFieldCombo() { colInfo.setComboValues(new String[] {}); } // ignore any errors here. drop downs will not be - // filled, but no problem for the user + // filled, but no problem for the user } } } diff --git a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMappingMeta.java b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMappingMeta.java index 54fb9cbcca0..747fda72804 100644 --- a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMappingMeta.java +++ b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMappingMeta.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.pgbulkloader; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class PGBulkLoaderMappingMeta { private static final Class PKG = PGBulkLoaderMeta.class; // For Translator @@ -65,7 +64,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PGBulkLoaderMappingMeta that = (PGBulkLoaderMappingMeta) o; - return Objects.equals(fieldTable, that.fieldTable) && Objects.equals(fieldStream, that.fieldStream) && Objects.equals(dateMask, that.dateMask); + return Objects.equals(fieldTable, that.fieldTable) + && Objects.equals(fieldStream, that.fieldStream) + && Objects.equals(dateMask, that.dateMask); } public String getFieldTable() { diff --git a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMeta.java b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMeta.java index 1dfb5f179cf..1749e1849ea 100644 --- a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMeta.java +++ b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.pgbulkloader; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -40,9 +42,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "PGBulkLoader", image = "PGBulkLoader.svg", @@ -53,8 +52,8 @@ documentationUrl = "/pipeline/transforms/postgresbulkloader.html", classLoaderGroup = "postgres-db", isIncludeJdbcDrivers = true) -public class PGBulkLoaderMeta extends BaseTransformMeta implements - IProvidesDatabaseConnectionInformation { +public class PGBulkLoaderMeta extends BaseTransformMeta + implements IProvidesDatabaseConnectionInformation { private static final Class PKG = PGBulkLoaderMeta.class; // For Translator @@ -462,13 +461,17 @@ public IRowMeta getRequiredFields(IVariables variables) throws HopException { } } - /** @return the schemaName */ + /** + * @return the schemaName + */ @Override public String getSchemaName() { return schemaName; } - /** @param schemaName the schemaName to set */ + /** + * @param schemaName the schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } @@ -522,24 +525,32 @@ public void setStopOnError(boolean value) { this.stopOnError = value; } - /** @return Returns the database. */ + /** + * @return Returns the database. + */ @Override public DatabaseMeta getDatabaseMeta() { return databaseMeta; } - /** @param database The database to set. */ + /** + * @param database The database to set. + */ public void setDatabaseMeta(DatabaseMeta database) { this.databaseMeta = database; } - /** @return Returns the tableName. */ + /** + * @return Returns the tableName. + */ @Override public String getTableName() { return tableName; } - /** @param tableName The tableName to set. */ + /** + * @param tableName The tableName to set. + */ public void setTableName(String tableName) { this.tableName = tableName; } diff --git a/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMetaTest.java b/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMetaTest.java index b3abae6ecf6..ceb939614a4 100644 --- a/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMetaTest.java +++ b/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderMetaTest.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.pgbulkloader; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.core.plugins.TransformPluginType; @@ -35,8 +36,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.UUID; - public class PGBulkLoaderMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderTest.java b/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderTest.java index 5cc17952c53..31074e39d55 100644 --- a/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderTest.java +++ b/plugins/transforms/pgbulkloader/src/test/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.pgbulkloader; +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 static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -35,21 +49,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; - -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 static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class PGBulkLoaderTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMeta.java b/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMeta.java index 9ff010ff2db..39d741719f3 100644 --- a/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMeta.java +++ b/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.pgpdecryptstream; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "PGPDecryptStream", image = "pgpdecryptstream.svg", @@ -47,7 +46,8 @@ "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Cryptography", keywords = "i18n::PGPDecryptStreamMeta.keyword", documentationUrl = "/pipeline/transforms/pgpdecryptstream.html") -public class PGPDecryptStreamMeta extends BaseTransformMeta { +public class PGPDecryptStreamMeta + extends BaseTransformMeta { private static final Class PKG = PGPDecryptStreamMeta.class; // For Translator /** GPG location */ @@ -80,52 +80,72 @@ public String getGPGLocation() { return gpgLocation; } - /** @return Returns the streamfield. */ + /** + * @return Returns the streamfield. + */ public String getStreamField() { return streamfield; } - /** @param streamfield The streamfield to set. */ + /** + * @param streamfield The streamfield to set. + */ public void setStreamField(String streamfield) { this.streamfield = streamfield; } - /** @return Returns the passphraseFieldName. */ + /** + * @return Returns the passphraseFieldName. + */ public String getPassphraseFieldName() { return passphraseFieldName; } - /** @param passphraseFieldName The passphraseFieldName to set. */ + /** + * @param passphraseFieldName The passphraseFieldName to set. + */ public void setPassphraseFieldName(String passphraseFieldName) { this.passphraseFieldName = passphraseFieldName; } - /** @return Returns the passphraseFromField. */ + /** + * @return Returns the passphraseFromField. + */ public boolean isPassphraseFromField() { return passphraseFromField; } - /** @param passphraseFromField The passphraseFromField to set. */ + /** + * @param passphraseFromField The passphraseFromField to set. + */ public void setPassphraseFromField(boolean passphraseFromField) { this.passphraseFromField = passphraseFromField; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getResultFieldName() { return resultfieldname; } - /** @param resultfieldname The resultFieldName to set */ + /** + * @param resultfieldname The resultFieldName to set + */ public void setResultFieldName(String resultfieldname) { this.resultfieldname = resultfieldname; } - /** @return Returns the passhrase. */ + /** + * @return Returns the passhrase. + */ public String getPassphrase() { return passhrase; } - /** @param passhrase The passhrase to set. */ + /** + * @param passhrase The passhrase to set. + */ public void setPassphrase(String passhrase) { this.passhrase = passhrase; } diff --git a/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMeta.java b/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMeta.java index 47f7559af3f..b5de50fd7d5 100644 --- a/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMeta.java +++ b/plugins/transforms/pgp/src/main/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.pgpencryptstream; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transforms.pgpdecryptstream.PGPDecryptStream; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "PGPEncryptStream", image = "pgpencryptstream.svg", @@ -47,7 +46,8 @@ "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Cryptography", keywords = "i18n::PGPEncryptStreamMeta.keyword", documentationUrl = "/pipeline/transforms/pgpdecryptstream.html") -public class PGPEncryptStreamMeta extends BaseTransformMeta { +public class PGPEncryptStreamMeta + extends BaseTransformMeta { private static final Class PKG = PGPEncryptStreamMeta.class; // For Translator /** GPG location */ @@ -80,52 +80,72 @@ public String getGPGLocation() { return gpgLocation; } - /** @return Returns the streamfield. */ + /** + * @return Returns the streamfield. + */ public String getStreamField() { return streamfield; } - /** @param streamfield The streamfield to set. */ + /** + * @param streamfield The streamfield to set. + */ public void setStreamField(String streamfield) { this.streamfield = streamfield; } - /** @return Returns the keynameFieldName. */ + /** + * @return Returns the keynameFieldName. + */ public String getKeynameFieldName() { return keynameFieldName; } - /** @param keynameFieldName The keynameFieldName to set. */ + /** + * @param keynameFieldName The keynameFieldName to set. + */ public void setKeynameFieldName(String keynameFieldName) { this.keynameFieldName = keynameFieldName; } - /** @return Returns the keynameInField. */ + /** + * @return Returns the keynameInField. + */ public boolean isKeynameInField() { return keynameInField; } - /** @param keynameInField The keynameInField to set. */ + /** + * @param keynameInField The keynameInField to set. + */ public void setKeynameInField(boolean keynameInField) { this.keynameInField = keynameInField; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getResultFieldName() { return resultFieldName; } - /** @param resultFieldName The resultfieldname to set. */ + /** + * @param resultFieldName The resultfieldname to set. + */ public void setResultFieldName(String resultFieldName) { this.resultFieldName = resultFieldName; } - /** @return Returns the keyname. */ + /** + * @return Returns the keyname. + */ public String getKeyName() { return keyname; } - /** @param keyname The keyname to set. */ + /** + * @param keyname The keyname to set. + */ public void setKeyName(String keyname) { this.keyname = keyname; } diff --git a/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMetaTest.java b/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMetaTest.java index 19541d3baa1..b4ead91941e 100644 --- a/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMetaTest.java +++ b/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpdecryptstream/PGPDecryptStreamMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.pgpdecryptstream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class PGPDecryptStreamMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMetaTest.java b/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMetaTest.java index 008540bbe19..a3cb6985705 100644 --- a/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMetaTest.java +++ b/plugins/transforms/pgp/src/test/java/org/apache/hop/pipeline/transforms/pgpencryptstream/PGPEncryptStreamMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.pgpencryptstream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class PGPEncryptStreamMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutor.java b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutor.java index 05b8c870459..662253664ec 100644 --- a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutor.java +++ b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutor.java @@ -18,6 +18,12 @@ package org.apache.hop.pipeline.transforms.pipelineexecutor; import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.IRowSet; import org.apache.hop.core.Result; @@ -39,25 +45,18 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - /** Execute a pipeline for every input row, set parameters. */ public class PipelineExecutor extends BaseTransform { private static final Class PKG = PipelineExecutorMeta.class; // For Translator public PipelineExecutor( - TransformMeta transformMeta, - PipelineExecutorMeta meta, - PipelineExecutorData data, - int copyNr, - PipelineMeta pipelineMeta, - Pipeline pipeline) { + TransformMeta transformMeta, + PipelineExecutorMeta meta, + PipelineExecutorData data, + int copyNr, + PipelineMeta pipelineMeta, + Pipeline pipeline) { super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline); } @@ -101,7 +100,7 @@ public boolean processRow() throws HopException { int pos = rowMeta.indexOfValue(meta.getFilenameField()); String filename = (String) row[pos]; if (pipelineExecutorData.prevFilename == null - || !pipelineExecutorData.prevFilename.equals(filename)) { + || !pipelineExecutorData.prevFilename.equals(filename)) { logDetailed("Identified a new pipeline to execute: '" + filename + "'"); meta.setFilename(filename); pipelineExecutorData.prevFilename = filename; @@ -111,13 +110,13 @@ public boolean processRow() throws HopException { } IRowSet executorTransformOutputRowSet = - pipelineExecutorData.getExecutorTransformOutputRowSet(); + pipelineExecutorData.getExecutorTransformOutputRowSet(); if (pipelineExecutorData.getExecutorTransformOutputRowMeta() != null - && executorTransformOutputRowSet != null) { + && executorTransformOutputRowSet != null) { putRowTo( - pipelineExecutorData.getExecutorTransformOutputRowMeta(), - row, - executorTransformOutputRowSet); + pipelineExecutorData.getExecutorTransformOutputRowMeta(), + row, + executorTransformOutputRowSet); } // Grouping by field and execution time works ONLY if grouping by size is disabled. @@ -127,7 +126,7 @@ public boolean processRow() throws HopException { if (pipelineExecutorData.prevGroupFieldData != null) { if (pipelineExecutorData.groupFieldMeta.compare( pipelineExecutorData.prevGroupFieldData, groupFieldData) - != 0) { + != 0) { executePipeline(getLastIncomingFieldValues()); } } @@ -143,7 +142,7 @@ public boolean processRow() throws HopException { // Add next value AFTER pipeline execution, in case we are grouping by field, // and BEFORE checking size of a group, in case we are grouping by size. pipelineExecutorData.groupBuffer.add( - new RowMetaAndData(getInputRowMeta(), row)); // should we clone for safety? + new RowMetaAndData(getInputRowMeta(), row)); // should we clone for safety? // Grouping by size. // If group buffer size exceeds specified limit, then execute pipeline and flush group buffer. @@ -168,49 +167,49 @@ private void initOnFirstProcessingIteration() throws HopException { pipelineExecutorData.setExecutionResultsOutputRowMeta(new RowMeta()); if (meta.getExecutionResultTargetTransformMeta() != null) { meta.prepareExecutionResultsFields( - pipelineExecutorData.getExecutionResultsOutputRowMeta(), - meta.getExecutionResultTargetTransformMeta()); + pipelineExecutorData.getExecutionResultsOutputRowMeta(), + meta.getExecutionResultTargetTransformMeta()); pipelineExecutorData.setExecutionResultRowSet( - findOutputRowSet(meta.getExecutionResultTargetTransformMeta().getName())); + findOutputRowSet(meta.getExecutionResultTargetTransformMeta().getName())); } // internal pipeline's execution result's file pipelineExecutorData.setResultFilesOutputRowMeta(new RowMeta()); if (meta.getResultFilesTargetTransformMeta() != null) { meta.prepareExecutionResultsFileFields( - pipelineExecutorData.getResultFilesOutputRowMeta(), - meta.getResultFilesTargetTransformMeta()); + pipelineExecutorData.getResultFilesOutputRowMeta(), + meta.getResultFilesTargetTransformMeta()); pipelineExecutorData.setResultFilesRowSet( - findOutputRowSet(meta.getResultFilesTargetTransformMeta().getName())); + findOutputRowSet(meta.getResultFilesTargetTransformMeta().getName())); } // internal pipeline's execution output pipelineExecutorData.setResultRowsOutputRowMeta(new RowMeta()); if (meta.getOutputRowsSourceTransformMeta() != null) { meta.prepareResultsRowsFields(pipelineExecutorData.getResultRowsOutputRowMeta()); pipelineExecutorData.setResultRowsRowSet( - findOutputRowSet(meta.getOutputRowsSourceTransformMeta().getName())); + findOutputRowSet(meta.getOutputRowsSourceTransformMeta().getName())); } // executor's self output is exactly its input if (meta.getExecutorsOutputTransformMeta() != null) { pipelineExecutorData.setExecutorTransformOutputRowMeta(getInputRowMeta().clone()); pipelineExecutorData.setExecutorTransformOutputRowSet( - findOutputRowSet(meta.getExecutorsOutputTransformMeta().getName())); + findOutputRowSet(meta.getExecutorsOutputTransformMeta().getName())); } // Remember which column to group on, if any... pipelineExecutorData.groupFieldIndex = -1; if (!Utils.isEmpty(pipelineExecutorData.groupField)) { pipelineExecutorData.groupFieldIndex = - getInputRowMeta().indexOfValue(pipelineExecutorData.groupField); + getInputRowMeta().indexOfValue(pipelineExecutorData.groupField); if (pipelineExecutorData.groupFieldIndex < 0) { throw new HopException( - BaseMessages.getString( - PKG, - "PipelineExecutor.Exception.GroupFieldNotFound", - pipelineExecutorData.groupField)); + BaseMessages.getString( + PKG, + "PipelineExecutor.Exception.GroupFieldNotFound", + pipelineExecutorData.groupField)); } pipelineExecutorData.groupFieldMeta = - getInputRowMeta().getValueMeta(pipelineExecutorData.groupFieldIndex); + getInputRowMeta().getValueMeta(pipelineExecutorData.groupFieldIndex); } } @@ -238,9 +237,9 @@ private void executePipeline(List incomingFieldValues) throws HopExcepti // exists // If not still pass the null parameter values passParametersToPipeline( - lastIncomingFieldValues != null && !lastIncomingFieldValues.isEmpty() - ? lastIncomingFieldValues - : incomingFieldValues); + lastIncomingFieldValues != null && !lastIncomingFieldValues.isEmpty() + ? lastIncomingFieldValues + : incomingFieldValues); } // keep track for drill down in HopGui... @@ -289,8 +288,8 @@ IPipelineEngine createInternalPipeline() throws HopException { String runConfigurationName = resolve(meta.getRunConfigurationName()); IPipelineEngine executorPipeline = - PipelineEngineFactory.createPipelineEngine( - this, runConfigurationName, metadataProvider, getData().getExecutorPipelineMeta()); + PipelineEngineFactory.createPipelineEngine( + this, runConfigurationName, metadataProvider, getData().getExecutorPipelineMeta()); executorPipeline.setParentPipeline(getPipeline()); executorPipeline.setParent(this); executorPipeline.setLogLevel(getLogLevel()); @@ -336,18 +335,18 @@ void passParametersToPipeline(List incomingFieldValues) throws HopExcept for (int i = 0; i < parameters.getVariable().length; i++) { String currentVariableToUpdate = (String) resolvingValuesMap.keySet().toArray()[i]; boolean hasIncomingFieldValues = - incomingFieldValues != null && !incomingFieldValues.isEmpty(); + incomingFieldValues != null && !incomingFieldValues.isEmpty(); try { if (i < fieldsToUse.size() - && incomingFields.contains(fieldsToUse.get(i)) - && hasIncomingFieldValues - && (!Utils.isEmpty( + && incomingFields.contains(fieldsToUse.get(i)) + && hasIncomingFieldValues + && (!Utils.isEmpty( Const.trim(incomingFieldValues.get(incomingFields.indexOf(fieldsToUse.get(i))))))) { // if field to use is defined on previous transforms ( incomingFields ) and is not empty - // put that value resolvingValuesMap.put( - currentVariableToUpdate, - incomingFieldValues.get(incomingFields.indexOf(fieldsToUse.get(i)))); + currentVariableToUpdate, + incomingFieldValues.get(incomingFields.indexOf(fieldsToUse.get(i)))); } else { if (i < staticInputs.size() && !Utils.isEmpty(Const.trim(staticInputs.get(i)))) { // if we do not have a field to use then check for static input values - if not empty - @@ -363,21 +362,21 @@ void passParametersToPipeline(List incomingFieldValues) throws HopExcept // this variable resolvingValuesMap.put(currentVariableToUpdate, ""); this.setVariable( - parameters.getVariable()[i], resolvingValuesMap.get(parameters.getVariable()[i])); + parameters.getVariable()[i], resolvingValuesMap.get(parameters.getVariable()[i])); } else { if (!Utils.isEmpty(Const.trim(this.getVariable(parameters.getVariable()[i]))) - && meta.getParameters().isInheritingAllVariables()) { + && meta.getParameters().isInheritingAllVariables()) { // if everything is empty, then check for last option - parent variables if // isInheriting is checked - if exists - put that value resolvingValuesMap.put( - currentVariableToUpdate, this.getVariable(parameters.getVariable()[i])); + currentVariableToUpdate, this.getVariable(parameters.getVariable()[i])); } else { // last case - if no variables defined - put "" value ( not null) // and also set pipelineExecutor variable - to force create this variable resolvingValuesMap.put(currentVariableToUpdate, ""); this.setVariable( - parameters.getVariable()[i], - resolvingValuesMap.get(parameters.getVariable()[i])); + parameters.getVariable()[i], + resolvingValuesMap.get(parameters.getVariable()[i])); } } } @@ -386,7 +385,7 @@ void passParametersToPipeline(List incomingFieldValues) throws HopExcept // Set the value to the first parameter in the resolvingValuesMap. resolvingValuesMap.put((String) resolvingValuesMap.keySet().toArray()[i], ""); this.setVariable( - parameters.getVariable()[i], resolvingValuesMap.get(parameters.getVariable()[i])); + parameters.getVariable()[i], resolvingValuesMap.get(parameters.getVariable()[i])); } } ///////////////////////////////////////////// @@ -400,13 +399,13 @@ void passParametersToPipeline(List incomingFieldValues) throws HopExcept IPipelineEngine pipeline = getExecutorPipeline(); TransformWithMappingMeta.activateParams( - pipeline, - pipeline, - this, - pipeline.listParameters(), - parameters.getVariable(), - inputFieldValues, - meta.getParameters().isInheritingAllVariables()); + pipeline, + pipeline, + this, + pipeline.listParameters(), + parameters.getVariable(), + inputFieldValues, + meta.getParameters().isInheritingAllVariables()); } @VisibleForTesting @@ -424,7 +423,7 @@ void collectExecutionResults(Result result) throws HopException { IRowSet executionResultsRowSet = getData().getExecutionResultRowSet(); if (meta.getExecutionResultTargetTransformMeta() != null && executionResultsRowSet != null) { Object[] outputRow = - RowDataUtil.allocateRowData(getData().getExecutionResultsOutputRowMeta().size()); + RowDataUtil.allocateRowData(getData().getExecutionResultsOutputRowMeta().size()); int idx = 0; if (!Utils.isEmpty(meta.getExecutionTimeField())) { @@ -480,11 +479,11 @@ void collectExecutionResults(Result result) throws HopException { void collectExecutionResultFiles(Result result) throws HopException { IRowSet resultFilesRowSet = getData().getResultFilesRowSet(); if (meta.getResultFilesTargetTransformMeta() != null - && result.getResultFilesList() != null - && resultFilesRowSet != null) { + && result.getResultFilesList() != null + && resultFilesRowSet != null) { for (ResultFile resultFile : result.getResultFilesList()) { Object[] targetRow = - RowDataUtil.allocateRowData(getData().getResultFilesOutputRowMeta().size()); + RowDataUtil.allocateRowData(getData().getResultFilesOutputRowMeta().size()); int idx = 0; targetRow[idx++] = resultFile.getFile().getName().toString(); @@ -528,7 +527,7 @@ public boolean init() { // First we need to load the mapping (pipeline) try { if ((!meta.isFilenameInField() && Utils.isEmpty(meta.getFilename())) - || (meta.isFilenameInField() && Utils.isEmpty(meta.getFilenameField()))) { + || (meta.isFilenameInField() && Utils.isEmpty(meta.getFilenameField()))) { logError("No pipeline filename given either in path or in a field!"); transformSuccessfullyInitialized = false; } else { @@ -606,8 +605,8 @@ protected List getLastIncomingFieldValues() { int lastIncomingFieldIndex = pipelineExecutorData.groupBuffer.size() - 1; ArrayList lastGroupBufferData = - new ArrayList( - Arrays.asList(pipelineExecutorData.groupBuffer.get(lastIncomingFieldIndex).getData())); + new ArrayList( + Arrays.asList(pipelineExecutorData.groupBuffer.get(lastIncomingFieldIndex).getData())); lastGroupBufferData.removeAll(Collections.singleton(null)); for (int i = 0; i < lastGroupBufferData.size(); i++) { diff --git a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorData.java b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorData.java index 3b1e4659084..1b91c9f3439 100644 --- a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorData.java +++ b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorData.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.pipelineexecutor; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; @@ -26,8 +27,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class PipelineExecutorData extends BaseTransformData implements ITransformData { private IPipelineEngine executorPipeline; private PipelineMeta executorPipelineMeta; @@ -68,7 +67,9 @@ public IPipelineEngine getExecutorPipeline() { return executorPipeline; } - /** @param executorPipeline The executorPipeline to set */ + /** + * @param executorPipeline The executorPipeline to set + */ public void setExecutorPipeline(IPipelineEngine executorPipeline) { this.executorPipeline = executorPipeline; } diff --git a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorDialog.java b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorDialog.java index a26958771bc..25301fce6e2 100644 --- a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorDialog.java +++ b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.pipelineexecutor; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -73,10 +76,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class PipelineExecutorDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = PipelineExecutorDialog.class; // For Translator @@ -862,7 +861,7 @@ private void addRowGroupTab() { PropsUi.setLook(wGroupTime); FormData fdGroupTime = new FormData(); fdGroupTime.right = new FormAttachment(100); - fdGroupTime.top = new FormAttachment(wlGroupTime, 0, SWT.CENTER); + fdGroupTime.top = new FormAttachment(wlGroupTime, 0, SWT.CENTER); fdGroupTime.left = new FormAttachment(wlGroupTime, margin); wGroupTime.setLayoutData(fdGroupTime); @@ -1333,7 +1332,6 @@ private void collectInformation() { pipelineExecutorMeta.setOutputRowsLength(new int[nrFields]); pipelineExecutorMeta.setOutputRowsPrecision(new int[nrFields]); - for (int i = 0; i < nrFields; i++) { TableItem item = wOutputFields.getNonEmpty(i); pipelineExecutorMeta.getOutputRowsField()[i] = item.getText(1); diff --git a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorMeta.java b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorMeta.java index 1c376461d80..517daf3fdf0 100644 --- a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorMeta.java +++ b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.pipelineexecutor; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -51,9 +53,6 @@ import org.apache.hop.resource.ResourceReference; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - /** Meta-data for the Pipeline Executor transform. */ @Transform( id = "PipelineExecutor", @@ -353,7 +352,7 @@ public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider) runConfigurationName = XmlHandler.getTagValue(transformNode, "run_configuration"); filename = XmlHandler.getTagValue(transformNode, "filename"); filenameInField = - "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformNode, "filenameInField")); + "Y".equalsIgnoreCase(XmlHandler.getTagValue(transformNode, "filenameInField")); filenameField = XmlHandler.getTagValue(transformNode, "filenameField"); groupSize = XmlHandler.getTagValue(transformNode, "group_size"); @@ -701,192 +700,268 @@ public PipelineType[] getSupportedPipelineTypes() { }; } - /** @return the mappingParameters */ + /** + * @return the mappingParameters + */ public PipelineExecutorParameters getMappingParameters() { return parameters; } - /** @param mappingParameters the mappingParameters to set */ + /** + * @param mappingParameters the mappingParameters to set + */ public void setMappingParameters(PipelineExecutorParameters mappingParameters) { this.parameters = mappingParameters; } - /** @return the parameters */ + /** + * @return the parameters + */ public PipelineExecutorParameters getParameters() { return parameters; } - /** @param parameters the parameters to set */ + /** + * @param parameters the parameters to set + */ public void setParameters(PipelineExecutorParameters parameters) { this.parameters = parameters; } - /** @return the executionTimeField */ + /** + * @return the executionTimeField + */ public String getExecutionTimeField() { return executionTimeField; } - /** @param executionTimeField the executionTimeField to set */ + /** + * @param executionTimeField the executionTimeField to set + */ public void setExecutionTimeField(String executionTimeField) { this.executionTimeField = executionTimeField; } - /** @return the executionResultField */ + /** + * @return the executionResultField + */ public String getExecutionResultField() { return executionResultField; } - /** @param executionResultField the executionResultField to set */ + /** + * @param executionResultField the executionResultField to set + */ public void setExecutionResultField(String executionResultField) { this.executionResultField = executionResultField; } - /** @return the executionNrErrorsField */ + /** + * @return the executionNrErrorsField + */ public String getExecutionNrErrorsField() { return executionNrErrorsField; } - /** @param executionNrErrorsField the executionNrErrorsField to set */ + /** + * @param executionNrErrorsField the executionNrErrorsField to set + */ public void setExecutionNrErrorsField(String executionNrErrorsField) { this.executionNrErrorsField = executionNrErrorsField; } - /** @return the executionLinesReadField */ + /** + * @return the executionLinesReadField + */ public String getExecutionLinesReadField() { return executionLinesReadField; } - /** @param executionLinesReadField the executionLinesReadField to set */ + /** + * @param executionLinesReadField the executionLinesReadField to set + */ public void setExecutionLinesReadField(String executionLinesReadField) { this.executionLinesReadField = executionLinesReadField; } - /** @return the executionLinesWrittenField */ + /** + * @return the executionLinesWrittenField + */ public String getExecutionLinesWrittenField() { return executionLinesWrittenField; } - /** @param executionLinesWrittenField the executionLinesWrittenField to set */ + /** + * @param executionLinesWrittenField the executionLinesWrittenField to set + */ public void setExecutionLinesWrittenField(String executionLinesWrittenField) { this.executionLinesWrittenField = executionLinesWrittenField; } - /** @return the executionLinesInputField */ + /** + * @return the executionLinesInputField + */ public String getExecutionLinesInputField() { return executionLinesInputField; } - /** @param executionLinesInputField the executionLinesInputField to set */ + /** + * @param executionLinesInputField the executionLinesInputField to set + */ public void setExecutionLinesInputField(String executionLinesInputField) { this.executionLinesInputField = executionLinesInputField; } - /** @return the executionLinesOutputField */ + /** + * @return the executionLinesOutputField + */ public String getExecutionLinesOutputField() { return executionLinesOutputField; } - /** @param executionLinesOutputField the executionLinesOutputField to set */ + /** + * @param executionLinesOutputField the executionLinesOutputField to set + */ public void setExecutionLinesOutputField(String executionLinesOutputField) { this.executionLinesOutputField = executionLinesOutputField; } - /** @return the executionLinesRejectedField */ + /** + * @return the executionLinesRejectedField + */ public String getExecutionLinesRejectedField() { return executionLinesRejectedField; } - /** @param executionLinesRejectedField the executionLinesRejectedField to set */ + /** + * @param executionLinesRejectedField the executionLinesRejectedField to set + */ public void setExecutionLinesRejectedField(String executionLinesRejectedField) { this.executionLinesRejectedField = executionLinesRejectedField; } - /** @return the executionLinesUpdatedField */ + /** + * @return the executionLinesUpdatedField + */ public String getExecutionLinesUpdatedField() { return executionLinesUpdatedField; } - /** @param executionLinesUpdatedField the executionLinesUpdatedField to set */ + /** + * @param executionLinesUpdatedField the executionLinesUpdatedField to set + */ public void setExecutionLinesUpdatedField(String executionLinesUpdatedField) { this.executionLinesUpdatedField = executionLinesUpdatedField; } - /** @return the executionLinesDeletedField */ + /** + * @return the executionLinesDeletedField + */ public String getExecutionLinesDeletedField() { return executionLinesDeletedField; } - /** @param executionLinesDeletedField the executionLinesDeletedField to set */ + /** + * @param executionLinesDeletedField the executionLinesDeletedField to set + */ public void setExecutionLinesDeletedField(String executionLinesDeletedField) { this.executionLinesDeletedField = executionLinesDeletedField; } - /** @return the executionFilesRetrievedField */ + /** + * @return the executionFilesRetrievedField + */ public String getExecutionFilesRetrievedField() { return executionFilesRetrievedField; } - /** @param executionFilesRetrievedField the executionFilesRetrievedField to set */ + /** + * @param executionFilesRetrievedField the executionFilesRetrievedField to set + */ public void setExecutionFilesRetrievedField(String executionFilesRetrievedField) { this.executionFilesRetrievedField = executionFilesRetrievedField; } - /** @return the executionExitStatusField */ + /** + * @return the executionExitStatusField + */ public String getExecutionExitStatusField() { return executionExitStatusField; } - /** @param executionExitStatusField the executionExitStatusField to set */ + /** + * @param executionExitStatusField the executionExitStatusField to set + */ public void setExecutionExitStatusField(String executionExitStatusField) { this.executionExitStatusField = executionExitStatusField; } - /** @return the executionLogTextField */ + /** + * @return the executionLogTextField + */ public String getExecutionLogTextField() { return executionLogTextField; } - /** @param executionLogTextField the executionLogTextField to set */ + /** + * @param executionLogTextField the executionLogTextField to set + */ public void setExecutionLogTextField(String executionLogTextField) { this.executionLogTextField = executionLogTextField; } - /** @return the executionLogChannelIdField */ + /** + * @return the executionLogChannelIdField + */ public String getExecutionLogChannelIdField() { return executionLogChannelIdField; } - /** @param executionLogChannelIdField the executionLogChannelIdField to set */ + /** + * @param executionLogChannelIdField the executionLogChannelIdField to set + */ public void setExecutionLogChannelIdField(String executionLogChannelIdField) { this.executionLogChannelIdField = executionLogChannelIdField; } - /** @return the groupSize */ + /** + * @return the groupSize + */ public String getGroupSize() { return groupSize; } - /** @param groupSize the groupSize to set */ + /** + * @param groupSize the groupSize to set + */ public void setGroupSize(String groupSize) { this.groupSize = groupSize; } - /** @return the groupField */ + /** + * @return the groupField + */ public String getGroupField() { return groupField; } - /** @param groupField the groupField to set */ + /** + * @param groupField the groupField to set + */ public void setGroupField(String groupField) { this.groupField = groupField; } - /** @return the groupTime */ + /** + * @return the groupTime + */ public String getGroupTime() { return groupTime; } - /** @param groupTime the groupTime to set */ + /** + * @param groupTime the groupTime to set + */ public void setGroupTime(String groupTime) { this.groupTime = groupTime; } @@ -896,38 +971,52 @@ public boolean excludeFromCopyDistributeVerification() { return true; } - /** @return the executionResultTargetTransform */ + /** + * @return the executionResultTargetTransform + */ public String getExecutionResultTargetTransform() { return executionResultTargetTransform; } - /** @param executionResultTargetTransform the executionResultTargetTransform to set */ + /** + * @param executionResultTargetTransform the executionResultTargetTransform to set + */ public void setExecutionResultTargetTransform(String executionResultTargetTransform) { this.executionResultTargetTransform = executionResultTargetTransform; } - /** @return the executionResultTargetTransformMeta */ + /** + * @return the executionResultTargetTransformMeta + */ public TransformMeta getExecutionResultTargetTransformMeta() { return executionResultTargetTransformMeta; } - /** @param executionResultTargetTransformMeta the executionResultTargetTransformMeta to set */ + /** + * @param executionResultTargetTransformMeta the executionResultTargetTransformMeta to set + */ public void setExecutionResultTargetTransformMeta( TransformMeta executionResultTargetTransformMeta) { this.executionResultTargetTransformMeta = executionResultTargetTransformMeta; } - /** @return the resultFilesFileNameField */ + /** + * @return the resultFilesFileNameField + */ public String getResultFilesFileNameField() { return resultFilesFileNameField; } - /** @param resultFilesFileNameField the resultFilesFileNameField to set */ + /** + * @param resultFilesFileNameField the resultFilesFileNameField to set + */ public void setResultFilesFileNameField(String resultFilesFileNameField) { this.resultFilesFileNameField = resultFilesFileNameField; } - /** @return The objects referenced in the transform, like a mapping, a pipeline, ... */ + /** + * @return The objects referenced in the transform, like a mapping, a pipeline, ... + */ @Override public String[] getReferencedObjectDescriptions() { return new String[] { @@ -1096,12 +1185,13 @@ public String getRunConfigurationName() { return runConfigurationName; } - /** @param runConfigurationName The runConfigurationName to set */ + /** + * @param runConfigurationName The runConfigurationName to set + */ public void setRunConfigurationName(String runConfigurationName) { this.runConfigurationName = runConfigurationName; } - public boolean isFilenameInField() { return filenameInField; } @@ -1117,5 +1207,4 @@ public String getFilenameField() { public void setFilenameField(String filenameField) { this.filenameField = filenameField; } - } diff --git a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorParameters.java b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorParameters.java index a2176bd52e6..51c3c0c2001 100644 --- a/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorParameters.java +++ b/plugins/transforms/pipelineexecutor/src/main/java/org/apache/hop/pipeline/transforms/pipelineexecutor/PipelineExecutorParameters.java @@ -108,42 +108,58 @@ public String getXml() { return xml.toString(); } - /** @return the field name to use */ + /** + * @return the field name to use + */ public String[] getField() { return field; } - /** @param field the input field name to set */ + /** + * @param field the input field name to set + */ public void setField(String[] field) { this.field = field; } - /** @return the variable */ + /** + * @return the variable + */ public String[] getVariable() { return variable; } - /** @param variable the variable to set */ + /** + * @param variable the variable to set + */ public void setVariable(String[] variable) { this.variable = variable; } - /** @return the inheritingAllVariables */ + /** + * @return the inheritingAllVariables + */ public boolean isInheritingAllVariables() { return inheritingAllVariables; } - /** @param inheritingAllVariables the inheritingAllVariables to set */ + /** + * @param inheritingAllVariables the inheritingAllVariables to set + */ public void setInheritingAllVariables(boolean inheritingAllVariables) { this.inheritingAllVariables = inheritingAllVariables; } - /** @return the input */ + /** + * @return the input + */ public String[] getInput() { return input; } - /** @param input the input to set */ + /** + * @param input the input to set + */ public void setInput(String[] input) { this.input = input; } diff --git a/plugins/transforms/processfiles/src/main/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMeta.java b/plugins/transforms/processfiles/src/main/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMeta.java index 4a841f77ae5..7e247785942 100644 --- a/plugins/transforms/processfiles/src/main/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMeta.java +++ b/plugins/transforms/processfiles/src/main/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.processfiles; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -30,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "ProcessFiles", image = "processfiles.svg", @@ -131,22 +130,30 @@ public static String getOperationTypeDesc(int i) { return operationTypeDesc[i]; } - /** @return Returns the sourcefilenamefield. */ + /** + * @return Returns the sourcefilenamefield. + */ public String getSourceFilenameField() { return sourceFilenameField; } - /** @param sourceFilenameFieldield The sourcefilenamefield to set. */ + /** + * @param sourceFilenameFieldield The sourcefilenamefield to set. + */ public void setSourceFilenameField(String sourceFilenameFieldield) { this.sourceFilenameField = sourceFilenameFieldield; } - /** @return Returns the targetfilenamefield. */ + /** + * @return Returns the targetfilenamefield. + */ public String getTargetFilenameField() { return targetFilenameField; } - /** @param targetFilenameField The targetFilenameField to set. */ + /** + * @param targetFilenameField The targetFilenameField to set. + */ public void setTargetFilenameField(String targetFilenameField) { this.targetFilenameField = targetFilenameField; } diff --git a/plugins/transforms/processfiles/src/test/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMetaTest.java b/plugins/transforms/processfiles/src/test/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMetaTest.java index 68160771da5..d08723b501b 100644 --- a/plugins/transforms/processfiles/src/test/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMetaTest.java +++ b/plugins/transforms/processfiles/src/test/java/org/apache/hop/pipeline/transforms/processfiles/ProcessFilesMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.processfiles; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -25,11 +29,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ProcessFilesMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputData.java b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputData.java index deb5cc31ccf..611993de25e 100644 --- a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputData.java +++ b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputData.java @@ -17,14 +17,6 @@ package org.apache.hop.pipeline.transforms.propertyinput; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.fileinput.FileInputList; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; -import org.ini4j.Profile.Section; -import org.ini4j.Wini; - import java.io.BufferedInputStream; import java.io.FileInputStream; import java.text.DateFormatSymbols; @@ -36,6 +28,13 @@ import java.util.Iterator; import java.util.Map; import java.util.Properties; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.fileinput.FileInputList; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; +import org.ini4j.Profile.Section; +import org.ini4j.Wini; public class PropertyInputData extends BaseTransformData implements ITransformData { public String currentLine; diff --git a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java index 64ec21121e6..42904984c5f 100644 --- a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java +++ b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java @@ -20,7 +20,6 @@ import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Iterator; - import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -1325,28 +1324,28 @@ public void getData(PropertyInputMeta in) { wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth(true); - if(!StringUtils.isEmpty(in.getShortFileFieldName())){ + if (!StringUtils.isEmpty(in.getShortFileFieldName())) { wShortFileFieldName.setText(in.getShortFileFieldName()); } - if(!StringUtils.isEmpty(in.getPathFieldName())){ + if (!StringUtils.isEmpty(in.getPathFieldName())) { wPathFieldName.setText(in.getPathFieldName()); } - if(!StringUtils.isEmpty(in.getHiddenFieldName())){ + if (!StringUtils.isEmpty(in.getHiddenFieldName())) { wIsHiddenName.setText(in.getHiddenFieldName()); } - if(!StringUtils.isEmpty(in.getLastModificationTimeFieldName())){ + if (!StringUtils.isEmpty(in.getLastModificationTimeFieldName())) { wLastModificationTimeName.setText(in.getLastModificationTimeFieldName()); } - if(!StringUtils.isEmpty(in.getUriNameFieldName())){ + if (!StringUtils.isEmpty(in.getUriNameFieldName())) { wUriName.setText(in.getUriNameFieldName()); } - if(!StringUtils.isEmpty(in.getRootUriNameFieldName())){ + if (!StringUtils.isEmpty(in.getRootUriNameFieldName())) { wRootUriName.setText(in.getRootUriNameFieldName()); } - if(!StringUtils.isEmpty(in.getExtensionFieldName())){ + if (!StringUtils.isEmpty(in.getExtensionFieldName())) { wExtensionFieldName.setText(in.getExtensionFieldName()); } - if(!StringUtils.isEmpty(in.getSizeFieldName())){ + if (!StringUtils.isEmpty(in.getSizeFieldName())) { wSizeFieldName.setText(in.getSizeFieldName()); } diff --git a/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/BaseParsingTest.java b/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/BaseParsingTest.java index 83a69975eee..34b40e13eaa 100644 --- a/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/BaseParsingTest.java +++ b/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/BaseParsingTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.propertyinput; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -39,15 +47,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** Base class for all tests for BaseFileInput transforms. */ @Ignore("No tests in abstract base class") public abstract class BaseParsingTest< diff --git a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutput.java b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutput.java index 42160e37792..40f218fd2af 100644 --- a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutput.java +++ b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutput.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.propertyoutput; +import java.io.OutputStream; +import java.util.Properties; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.ResultFile; import org.apache.hop.core.exception.HopException; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.OutputStream; -import java.util.Properties; - /** Output rows to Properties file and create a file. */ public class PropertyOutput extends BaseTransform { diff --git a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputData.java b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputData.java index d45d0eb4680..a7213f7f411 100644 --- a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputData.java +++ b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.propertyoutput; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.HashSet; import java.util.Properties; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; /** Output rows to Properties file and create a file. */ public class PropertyOutputData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMeta.java b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMeta.java index 60870d4b15b..cfa91c2482e 100644 --- a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMeta.java +++ b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.propertyoutput; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -39,11 +43,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - @Transform( id = "PropertyOutput", image = "propertyoutput.svg", @@ -106,72 +105,100 @@ public Object clone() { return retval; } - /** @return Returns the extension. */ + /** + * @return Returns the extension. + */ public String getExtension() { return extension; } - /** @param extension The extension to set. */ + /** + * @param extension The extension to set. + */ public void setExtension(String extension) { this.extension = extension; } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String getFileName() { return fileName; } - /** @return Is the file name coded in a field? */ + /** + * @return Is the file name coded in a field? + */ public boolean isFileNameInField() { return fileNameInField; } - /** @param fileNameInField Is the file name coded in a field? */ + /** + * @param fileNameInField Is the file name coded in a field? + */ public void setFileNameInField(boolean fileNameInField) { this.fileNameInField = fileNameInField; } - /** @return The field name that contains the output file name. */ + /** + * @return The field name that contains the output file name. + */ public String getFileNameField() { return fileNameField; } - /** @param fileNameField Name of the field that contains the file name */ + /** + * @param fileNameField Name of the field that contains the file name + */ public void setFileNameField(String fileNameField) { this.fileNameField = fileNameField; } - /** @return Returns the transformNrInFilename. */ + /** + * @return Returns the transformNrInFilename. + */ public boolean isTransformNrInFilename() { return transformNrInFilename; } - /** @param transformNrInFilename The transformNrInFilename to set. */ + /** + * @param transformNrInFilename The transformNrInFilename to set. + */ public void setTransformNrInFilename(boolean transformNrInFilename) { this.transformNrInFilename = transformNrInFilename; } - /** @return Returns the timeInFilename. */ + /** + * @return Returns the timeInFilename. + */ public boolean isTimeInFilename() { return timeInFilename; } - /** @return Returns the dateInFilename. */ + /** + * @return Returns the dateInFilename. + */ public boolean isDateInFilename() { return dateInFilename; } - /** @param dateInFilename The dateInFilename to set. */ + /** + * @param dateInFilename The dateInFilename to set. + */ public void setDateInFilename(boolean dateInFilename) { this.dateInFilename = dateInFilename; } - /** @param timeInFilename The timeInFilename to set. */ + /** + * @param timeInFilename The timeInFilename to set. + */ public void setTimeInFilename(boolean timeInFilename) { this.timeInFilename = timeInFilename; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String fileName) { this.fileName = fileName; } @@ -180,27 +207,37 @@ public boolean isAddToResult() { return addToResult; } - /** @param addToResult The Add file to result to set. */ + /** + * @param addToResult The Add file to result to set. + */ public void setAddToResult(boolean addToResult) { this.addToResult = addToResult; } - /** @return Returns the create parent folder flag. */ + /** + * @return Returns the create parent folder flag. + */ public boolean isCreateParentFolder() { return createparentfolder; } - /** @param createparentfolder The create parent folder flag to set. */ + /** + * @param createparentfolder The create parent folder flag to set. + */ public void setCreateParentFolder(boolean createparentfolder) { this.createparentfolder = createparentfolder; } - /** @return Returns the append flag. */ + /** + * @return Returns the append flag. + */ public boolean isAppend() { return append; } - /** @param append The append to set. */ + /** + * @param append The append to set. + */ public void setAppend(boolean append) { this.append = append; } @@ -455,22 +492,30 @@ public void check( } } - /** @return the keyfield */ + /** + * @return the keyfield + */ public String getKeyField() { return keyfield; } - /** @return the valuefield */ + /** + * @return the valuefield + */ public String getValueField() { return valuefield; } - /** @param keyField the keyfield to set */ + /** + * @param keyField the keyfield to set + */ public void setKeyField(String keyField) { this.keyfield = keyField; } - /** @param valuefield the valuefield to set */ + /** + * @param valuefield the valuefield to set + */ public void setValueField(String valuefield) { this.valuefield = valuefield; } diff --git a/plugins/transforms/propertyoutput/src/test/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMetaTest.java b/plugins/transforms/propertyoutput/src/test/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMetaTest.java index 74d7f1ac9b0..cc1804ead46 100644 --- a/plugins/transforms/propertyoutput/src/test/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMetaTest.java +++ b/plugins/transforms/propertyoutput/src/test/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputMetaTest.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.propertyoutput; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class PropertyOutputMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/randomvalue/src/main/java/org/apache/hop/pipeline/transforms/randomvalue/RandomValueData.java b/plugins/transforms/randomvalue/src/main/java/org/apache/hop/pipeline/transforms/randomvalue/RandomValueData.java index 42081c9ff35..d76486fe23d 100644 --- a/plugins/transforms/randomvalue/src/main/java/org/apache/hop/pipeline/transforms/randomvalue/RandomValueData.java +++ b/plugins/transforms/randomvalue/src/main/java/org/apache/hop/pipeline/transforms/randomvalue/RandomValueData.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.randomvalue; +import java.util.Random; +import javax.crypto.KeyGenerator; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.util.Uuid4Util; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import javax.crypto.KeyGenerator; -import java.util.Random; - public class RandomValueData extends BaseTransformData implements ITransformData { boolean readsRows; diff --git a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval.java b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval.java index cd76a16e6f5..c03e5cad0e9 100644 --- a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval.java +++ b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.regexeval; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -28,9 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class RegexEval extends BaseTransform { private static final Class PKG = RegexEvalMeta.class; // For Translator diff --git a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalData.java b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalData.java index 18c35c40819..df4c8e48e6f 100644 --- a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalData.java +++ b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.regexeval; +import java.util.regex.Pattern; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.regex.Pattern; - /** Runtime data for the RegexEval transform. */ public class RegexEvalData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalDialog.java b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalDialog.java index b79e2fac8d2..74a572dd3b8 100644 --- a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalDialog.java +++ b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalDialog.java @@ -447,8 +447,10 @@ public void widgetSelected(SelectionEvent e) { fdFields.right = new FormAttachment(100, 0); fdFields.bottom = new FormAttachment(100, 0); wFields.setLayoutData(fdFields); - wFields.getTable().addListener(SWT.Resize, new ColumnsResizer(2, 20, 10, 5, 5, 10, 8, 8, 8, 8, 8, 8)); - + wFields + .getTable() + .addListener(SWT.Resize, new ColumnsResizer(2, 20, 10, 5, 5, 10, 8, 8, 8, 8, 8, 8)); + FormData fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(0, 0); @@ -794,7 +796,6 @@ private void ok() { input.allocate(nrFields); - for (int i = 0; i < input.getFieldName().length; i++) { TableItem ti = wFields.getNonEmpty(i); input.getFieldName()[i] = ti.getText(1); diff --git a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalHelperDialog.java b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalHelperDialog.java index 2c5b5249250..f8cb09f75fb 100644 --- a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalHelperDialog.java +++ b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalHelperDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.regexeval; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.util.Utils; @@ -41,8 +43,6 @@ import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** Dialog to test a regular expression */ public class RegexEvalHelperDialog extends Dialog { @@ -140,20 +140,17 @@ public String open() { wRegExScript = new StyledTextComp( - variables, - shell, - SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + variables, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); PropsUi.setLook(wRegExScript); FormData fdRegExScript = new FormData(); fdRegExScript.left = new FormAttachment(0, 0); fdRegExScript.top = new FormAttachment(wlRegExScript, 2 * margin); fdRegExScript.right = new FormAttachment(100, -margin); - fdRegExScript.bottom = new FormAttachment(40, -2*margin); + fdRegExScript.bottom = new FormAttachment(40, -2 * margin); wRegExScript.setLayoutData(fdRegExScript); wRegExScript.setFont(GuiResource.getInstance().getFontFixed()); - - wRegExScriptCompile = - new Text(shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL); + + wRegExScriptCompile = new Text(shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL); PropsUi.setLook(wRegExScriptCompile, Props.WIDGET_STYLE_FIXED); FormData fdRegExScriptCompile = new FormData(); fdRegExScriptCompile.left = new FormAttachment(0, 0); @@ -185,15 +182,15 @@ public String open() { fdlValue1.top = new FormAttachment(wRegExScriptCompile, margin); fdlValue1.right = new FormAttachment(middle, -margin); wlValue1.setLayoutData(fdlValue1); - + wIconValue1 = new Label(wValuesGroup, SWT.RIGHT); wIconValue1.setImage(GuiResource.getInstance().getImageEdit()); PropsUi.setLook(wIconValue1); - FormData fdlIconValue1 = new FormData(); + FormData fdlIconValue1 = new FormData(); fdlIconValue1.top = new FormAttachment(wRegExScriptCompile, margin); fdlIconValue1.right = new FormAttachment(100, 0); wIconValue1.setLayoutData(fdlIconValue1); - + wValue1 = new Text(wValuesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); PropsUi.setLook(wValue1); FormData fdValue1 = new FormData(); @@ -211,15 +208,15 @@ public String open() { fdlValue2.top = new FormAttachment(wValue1, margin); fdlValue2.right = new FormAttachment(middle, -margin); wlValue2.setLayoutData(fdlValue2); - + wIconValue2 = new Label(wValuesGroup, SWT.RIGHT); wIconValue2.setImage(GuiResource.getInstance().getImageEdit()); PropsUi.setLook(wIconValue2); - FormData fdlIconValue2 = new FormData(); + FormData fdlIconValue2 = new FormData(); fdlIconValue2.top = new FormAttachment(wValue1, margin); fdlIconValue2.right = new FormAttachment(100, 0); wIconValue2.setLayoutData(fdlIconValue2); - + wValue2 = new Text(wValuesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); PropsUi.setLook(wValue2); FormData fdValue2 = new FormData(); @@ -237,15 +234,15 @@ public String open() { fdlValue3.top = new FormAttachment(wValue2, margin); fdlValue3.right = new FormAttachment(middle, -margin); wlValue3.setLayoutData(fdlValue3); - + wIconValue3 = new Label(wValuesGroup, SWT.RIGHT); wIconValue3.setImage(GuiResource.getInstance().getImageEdit()); PropsUi.setLook(wIconValue3); - FormData fdlIconValue3 = new FormData(); + FormData fdlIconValue3 = new FormData(); fdlIconValue3.top = new FormAttachment(wValue2, margin); fdlIconValue3.right = new FormAttachment(100, 0); wIconValue3.setLayoutData(fdlIconValue3); - + wValue3 = new Text(wValuesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); PropsUi.setLook(wValue3); FormData fdValue3 = new FormData(); @@ -253,7 +250,7 @@ public String open() { fdValue3.top = new FormAttachment(wValue2, margin); fdValue3.right = new FormAttachment(wIconValue3, -margin); wValue3.setLayoutData(fdValue3); - + FormData fdValuesGroup = new FormData(); fdValuesGroup.left = new FormAttachment(0, 0); fdValuesGroup.top = new FormAttachment(wRegExScriptCompile, margin); @@ -277,7 +274,7 @@ public String open() { // ValueGroup Label wlValueGroup = new Label(wCaptureGroups, SWT.RIGHT); - wlValueGroup.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.ValueGroup.Label")); + wlValueGroup.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.ValueGroup.Label")); PropsUi.setLook(wlValueGroup); FormData fdlValueGroup = new FormData(); fdlValueGroup.left = new FormAttachment(0, 0); @@ -288,7 +285,7 @@ public String open() { wIconValueGroup = new Label(wCaptureGroups, SWT.RIGHT); wIconValueGroup.setImage(GuiResource.getInstance().getImageEdit()); PropsUi.setLook(wIconValueGroup); - FormData fdlIconValueGroup = new FormData(); + FormData fdlIconValueGroup = new FormData(); fdlIconValueGroup.top = new FormAttachment(wValuesGroup, margin); fdlIconValueGroup.right = new FormAttachment(100, 0); wIconValueGroup.setLayoutData(fdlIconValueGroup); @@ -315,7 +312,7 @@ public String open() { FormData fdGroups = new FormData(); fdGroups.left = new FormAttachment(middle, margin); fdGroups.top = new FormAttachment(wValueGroup, margin); - fdGroups.right = new FormAttachment(100, -2*margin-ConstUi.SMALL_ICON_SIZE); + fdGroups.right = new FormAttachment(100, -2 * margin - ConstUi.SMALL_ICON_SIZE); fdGroups.bottom = new FormAttachment(100, -margin); wGroups.setLayoutData(fdGroups); @@ -325,7 +322,7 @@ public String open() { fdCaptureGroups.right = new FormAttachment(100, 0); fdCaptureGroups.bottom = new FormAttachment(wOk, -2 * margin); wCaptureGroups.setLayoutData(fdCaptureGroups); - + // /////////////////////////////////////////////////////////// // / END OF VALUES GROUP // /////////////////////////////////////////////////////////// @@ -370,7 +367,7 @@ private void testValue(int index, boolean testRegEx, String regExString) { mb.open(); } return; - } + } String realValue; Label control; @@ -402,14 +399,13 @@ private void testValue(int index, boolean testRegEx, String regExString) { } else { p = Pattern.compile(regexOptions + realScript); } - + Matcher m = p.matcher(Const.NVL(realValue, "")); boolean isMatch = m.matches(); - if ( Utils.isEmpty(realValue) ) { + if (Utils.isEmpty(realValue)) { control.setImage(GuiResource.getInstance().getImageEdit()); - } - else if (isMatch) { + } else if (isMatch) { control.setImage(GuiResource.getInstance().getImageTrue()); } else { control.setImage(GuiResource.getInstance().getImageFalse()); diff --git a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMeta.java b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMeta.java index a217696ada6..61b870113a4 100644 --- a/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMeta.java +++ b/plugins/transforms/regexeval/src/main/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.regexeval; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,8 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "RegexEval", image = "regexeval.svg", diff --git a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMetaTest.java b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMetaTest.java index d1450011b31..b1ebddabb7f 100644 --- a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMetaTest.java +++ b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalMetaTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.regexeval; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -41,17 +51,6 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class RegexEvalMetaTest implements IInitializer { IRowMeta mockInputRowMeta; IVariables mockVariableSpace; diff --git a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalUnitTest.java b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalUnitTest.java index 252f46323a9..0ee6f0871e1 100644 --- a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalUnitTest.java +++ b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEvalUnitTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.regexeval; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.regex.Pattern; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -26,13 +32,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.regex.Pattern; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class RegexEvalUnitTest { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval_EmptyStringVsNull_Test.java b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval_EmptyStringVsNull_Test.java index 9dfdbc41a23..182e7e3994f 100644 --- a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval_EmptyStringVsNull_Test.java +++ b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/RegexEval_EmptyStringVsNull_Test.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.regexeval; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; +import java.util.regex.Pattern; import org.apache.hop.core.Const; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.row.IValueMeta; @@ -32,14 +39,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Pattern; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class RegexEval_EmptyStringVsNull_Test { private TransformMockHelper helper; @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/TransformMockUtil.java b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/TransformMockUtil.java index 93c299a968a..6987df6abd5 100644 --- a/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/TransformMockUtil.java +++ b/plugins/transforms/regexeval/src/test/java/org/apache/hop/pipeline/transforms/regexeval/TransformMockUtil.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.regexeval; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -26,12 +31,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -57,8 +56,12 @@ TransformMockHelper getTransformMockHelper(Class meta, Str public static T getTransform(Class klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor kons = klass.getConstructor( TransformMeta.class, @@ -74,8 +77,12 @@ T getTransform(Class klass, TransformMockHelper mock) public static T getTransform( Class transformClass, Class transformMetaClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper(transformMetaClass, transformName)); diff --git a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceString.java b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceString.java index 4b198b0b29c..78723689f4e 100644 --- a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceString.java +++ b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceString.java @@ -18,6 +18,10 @@ package org.apache.hop.pipeline.transforms.replacestring; import com.google.common.annotations.VisibleForTesting; +import java.util.HashSet; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -33,11 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashSet; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** Search and replace in string. */ public class ReplaceString extends BaseTransform { @@ -116,10 +115,10 @@ private String getResolvedReplaceByString(int index, Object[] row) throws HopExc } String str = getInputRowMeta().getString(row, data.replaceFieldIndex[index]); - - // Escape the regex pattern backslash - if ( str!=null ) { - str = str.replace("\\","\\\\"); + + // Escape the regex pattern backslash + if (str != null) { + str = str.replace("\\", "\\\\"); } return str; } @@ -215,8 +214,9 @@ public boolean processRow() throws HopException { } } else { data.replaceFieldIndex[i] = -1; - // Escape the regex pattern backslash - data.replaceByString[i] = Const.NVL(resolve(field.getReplaceByString()), "").replace("\\","\\\\"); + // Escape the regex pattern backslash + data.replaceByString[i] = + Const.NVL(resolve(field.getReplaceByString()), "").replace("\\", "\\\\"); } data.setEmptyString[i] = field.isSettingEmptyString(); } diff --git a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringData.java b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringData.java index 877d5a4b807..651a516200e 100644 --- a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringData.java +++ b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.replacestring; +import java.util.regex.Pattern; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.regex.Pattern; - public class ReplaceStringData extends BaseTransformData implements ITransformData { public int[] inStreamNrs; diff --git a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringDialog.java b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringDialog.java index c941ec83dbe..c4ee1d89692 100644 --- a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringDialog.java +++ b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.replacestring; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -46,9 +48,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - /** Search and replace in string. */ public class ReplaceStringDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = ReplaceStringMeta.class; // For Translator diff --git a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMeta.java b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMeta.java index 3525ca65d7e..af23f190bce 100644 --- a/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMeta.java +++ b/plugins/transforms/replacestring/src/main/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMeta.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.replacestring; +import static org.apache.hop.core.ICheckResult.TYPE_RESULT_ERROR; +import static org.apache.hop.core.ICheckResult.TYPE_RESULT_OK; + +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,12 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - -import static org.apache.hop.core.ICheckResult.TYPE_RESULT_ERROR; -import static org.apache.hop.core.ICheckResult.TYPE_RESULT_OK; - @Transform( id = "ReplaceString", image = "replaceinstring.svg", diff --git a/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMetaTest.java b/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMetaTest.java index 744b7bf3383..b4d7786e637 100644 --- a/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMetaTest.java +++ b/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringMetaTest.java @@ -22,16 +22,16 @@ import org.junit.Test; public class ReplaceStringMetaTest { - @Test - public void testSerialization() throws Exception { - ReplaceStringMeta meta = TransformSerializationTestUtil.testSerialization("/replace-in-string-transform.xml", - ReplaceStringMeta.class); - - Assert.assertEquals(6, meta.getFields().size()); - ReplaceStringMeta.RSField field = meta.getFields().get(5); - Assert.assertEquals("strD", field.getFieldInStream()); - Assert.assertTrue(field.isUsingRegEx()); - Assert.assertEquals("[CIOKSX]", field.getReplaceString()); - } + @Test + public void testSerialization() throws Exception { + ReplaceStringMeta meta = + TransformSerializationTestUtil.testSerialization( + "/replace-in-string-transform.xml", ReplaceStringMeta.class); + Assert.assertEquals(6, meta.getFields().size()); + ReplaceStringMeta.RSField field = meta.getFields().get(5); + Assert.assertEquals("strD", field.getFieldInStream()); + Assert.assertTrue(field.isUsingRegEx()); + Assert.assertEquals("[CIOKSX]", field.getReplaceString()); + } } diff --git a/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringTest.java b/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringTest.java index 733bea641eb..0f3c51e969e 100644 --- a/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringTest.java +++ b/plugins/transforms/replacestring/src/test/java/org/apache/hop/pipeline/transforms/replacestring/ReplaceStringTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.replacestring; +import static org.junit.Assert.assertArrayEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.hop.core.logging.ILoggingObject; @@ -26,15 +34,8 @@ import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.junit.After; import org.junit.Assert; -import static org.junit.Assert.assertArrayEquals; import org.junit.Before; import org.junit.Test; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; /** User: Dzmitry Stsiapanau Date: 1/31/14 Time: 11:19 AM */ public class ReplaceStringTest { diff --git a/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSampling.java b/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSampling.java index 9d8ad3e98a4..133b0a2191b 100644 --- a/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSampling.java +++ b/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSampling.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.reservoirsampling; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.pipeline.Pipeline; @@ -25,9 +27,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.reservoirsampling.ReservoirSamplingData.PROC_MODE; -import java.util.Arrays; -import java.util.List; - public class ReservoirSampling extends BaseTransform { /** diff --git a/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingData.java b/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingData.java index edbb0fb7ea7..774b028e3e4 100644 --- a/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingData.java +++ b/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.reservoirsampling; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.util.ArrayList; import java.util.List; import java.util.Random; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; /** * Holds temporary data (i.e. sampled rows). Implements the reservoir sampling algorithm "R" by @@ -66,7 +65,7 @@ public enum PROC_MODE { public ReservoirSamplingData() { super(); } - + /** * Set the meta data for the output format * diff --git a/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingMeta.java b/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingMeta.java index 296c01f3b25..885a61e32f3 100644 --- a/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingMeta.java +++ b/plugins/transforms/reservoirsampling/src/main/java/org/apache/hop/pipeline/transforms/reservoirsampling/ReservoirSamplingMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.reservoirsampling; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -29,8 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "ReservoirSampling", image = "reservoirsampling.svg", @@ -40,7 +39,7 @@ "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Statistics", keywords = "i18n::ReservoirSamplingMeta.keyword", documentationUrl = "/pipeline/transforms/reservoirsampling.html") -@HopMetadataWrapper(tag="reservoir_sampling") +@HopMetadataWrapper(tag = "reservoir_sampling") public class ReservoirSamplingMeta extends BaseTransformMeta { diff --git a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java index f225df839a7..86afd314249 100644 --- a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java +++ b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java @@ -17,6 +17,25 @@ package org.apache.hop.pipeline.transforms.rest; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.util.List; +import javax.net.ssl.SSLContext; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.exception.HopException; @@ -37,26 +56,6 @@ import org.glassfish.jersey.uri.UriComponent; import org.json.simple.JSONObject; -import javax.net.ssl.SSLContext; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.List; - public class Rest extends BaseTransform { private static final Class PKG = RestMeta.class; // For Translator @@ -294,10 +293,12 @@ private void setConfig() throws HopException { // Use ApacheHttpClient for supporting proxy authentication. data.config = new ClientConfig(); data.config.connectorProvider(new ApacheConnectorProvider()); - data.config.property(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.BUFFERED); + data.config.property( + ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.BUFFERED); if (!Utils.isEmpty(data.realProxyHost)) { // PROXY CONFIGURATION - data.config.property(ClientProperties.PROXY_URI,"http://"+ data.realProxyHost + ":" + data.realProxyPort); + data.config.property( + ClientProperties.PROXY_URI, "http://" + data.realProxyHost + ":" + data.realProxyPort); if (!Utils.isEmpty(data.realHttpLogin) && !Utils.isEmpty(data.realHttpPassword)) { data.config.property(ClientProperties.PROXY_USERNAME, data.realHttpLogin); data.config.property(ClientProperties.PROXY_PASSWORD, data.realHttpPassword); diff --git a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestData.java b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestData.java index 37d56631a5f..34b4664e367 100644 --- a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestData.java +++ b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.rest; +import javax.net.ssl.SSLContext; +import javax.ws.rs.core.MediaType; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; -import javax.net.ssl.SSLContext; -import javax.ws.rs.core.MediaType; - public class RestData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public IRowMeta inputRowMeta; @@ -34,12 +33,15 @@ public class RestData extends BaseTransformData implements ITransformData { public int indexOfUrlField; public String realUrl; + /** Method */ public String method; + /** Index of method */ public int indexOfMethod; public int nrheader; + /** Headers */ public int[] indexOfHeaderFields; diff --git a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestDialog.java b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestDialog.java index a2647ff3214..2b10e912644 100644 --- a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestDialog.java +++ b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestDialog.java @@ -17,12 +17,12 @@ package org.apache.hop.pipeline.transforms.rest; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; -import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; @@ -30,7 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.ITransformDialog; import org.apache.hop.pipeline.transform.TransformMeta; -import org.apache.hop.ui.core.ConstUi; import org.apache.hop.ui.core.PropsUi; import org.apache.hop.ui.core.dialog.BaseDialog; import org.apache.hop.ui.core.dialog.ErrorDialog; @@ -58,8 +57,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; public class RestDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = RestMeta.class; // For Translator @@ -428,7 +425,11 @@ public String open() { return transformName; } - private void setupMatrixParamTabContent(ModifyListener lsMod, int margin, CTabItem wMatrixParametersTab, Composite wMatrixParametersComp) { + private void setupMatrixParamTabContent( + ModifyListener lsMod, + int margin, + CTabItem wMatrixParametersTab, + Composite wMatrixParametersComp) { wlMatrixParameters = new Label(wMatrixParametersComp, SWT.NONE); wlMatrixParameters.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Label")); PropsUi.setLook(wlMatrixParameters); @@ -492,7 +493,8 @@ private void setupMatrixParamTabContent(ModifyListener lsMod, int margin, CTabIt // END of Matrix Parameters Tab } - private void setupParameterTabContent(ModifyListener lsMod, int margin, Composite wParametersComp) { + private void setupParameterTabContent( + ModifyListener lsMod, int margin, Composite wParametersComp) { wlParameters = new Label(wParametersComp, SWT.NONE); wlParameters.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Label")); PropsUi.setLook(wlParameters); @@ -543,7 +545,8 @@ private void setupParameterTabContent(ModifyListener lsMod, int margin, Composit wGet.addListener(SWT.Selection, e -> getParametersFields(wParameters)); } - private Button setupHeaderTabContent(ModifyListener lsMod, int margin, Composite wAdditionalComp) { + private Button setupHeaderTabContent( + ModifyListener lsMod, int margin, Composite wAdditionalComp) { Label wlFields = new Label(wAdditionalComp, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "RestDialog.Headers.Label")); PropsUi.setLook(wlFields); @@ -624,13 +627,14 @@ public void widgetSelected(SelectionEvent e) { }); } - private void activateTrustoreFields(){ + private void activateTrustoreFields() { wTrustStoreFile.setEnabled(!wIgnoreSsl.getSelection()); wbTrustStoreFile.setEnabled(!wIgnoreSsl.getSelection()); wTrustStorePassword.setEnabled(!wIgnoreSsl.getSelection()); } - private void setupTrustorePwdLine(ModifyListener lsMod, int middle, int margin, Group gSSLTrustStore, Button wbTrustStoreFile) { + private void setupTrustorePwdLine( + ModifyListener lsMod, int middle, int margin, Group gSSLTrustStore, Button wbTrustStoreFile) { // TrustStorePassword line Label wlTrustStorePassword = new Label(gSSLTrustStore, SWT.RIGHT); wlTrustStorePassword.setText( @@ -652,7 +656,8 @@ private void setupTrustorePwdLine(ModifyListener lsMod, int middle, int margin, wTrustStorePassword.setLayoutData(fdTrustStorePassword); } - private Button setupTrustoreFileLine(ModifyListener lsMod, int middle, int margin, Group gSSLTrustStore) { + private Button setupTrustoreFileLine( + ModifyListener lsMod, int middle, int margin, Group gSSLTrustStore) { // TrustStoreFile line Label wlTrustStoreFile = new Label(gSSLTrustStore, SWT.RIGHT); wlTrustStoreFile.setText(BaseMessages.getString(PKG, "RestDialog.TrustStoreFile.Label")); @@ -836,7 +841,8 @@ private Group setupAuthGroup(Composite wAuthComp) { return gHttpAuth; } - private void setupResponseHeaderLine(ModifyListener lsMod, int middle, int margin, Group gSettings, Group gOutputFields) { + private void setupResponseHeaderLine( + ModifyListener lsMod, int middle, int margin, Group gSettings, Group gOutputFields) { // Response header line... Label wlResponseHeader = new Label(gOutputFields, SWT.RIGHT); wlResponseHeader.setText(BaseMessages.getString(PKG, "RestDialog.ResponseHeader.Label")); @@ -862,7 +868,8 @@ private void setupResponseHeaderLine(ModifyListener lsMod, int middle, int margi gOutputFields.setLayoutData(fdOutputFields); } - private void setupResponseTimeLine(ModifyListener lsMod, int middle, int margin, Group gOutputFields) { + private void setupResponseTimeLine( + ModifyListener lsMod, int middle, int margin, Group gOutputFields) { // Response time line... Label wlResponseTime = new Label(gOutputFields, SWT.RIGHT); wlResponseTime.setText(BaseMessages.getString(PKG, "RestDialog.ResponseTime.Label")); @@ -882,7 +889,8 @@ private void setupResponseTimeLine(ModifyListener lsMod, int middle, int margin, wResponseTime.setLayoutData(fdResponseTime); } - private void setupStatusCodeLine(ModifyListener lsMod, int middle, int margin, Group gOutputFields) { + private void setupStatusCodeLine( + ModifyListener lsMod, int middle, int margin, Group gOutputFields) { // Resultcode line... Label wlResultCode = new Label(gOutputFields, SWT.RIGHT); wlResultCode.setText(BaseMessages.getString(PKG, "RestDialog.ResultCode.Label")); @@ -902,7 +910,8 @@ private void setupStatusCodeLine(ModifyListener lsMod, int middle, int margin, G wResultCode.setLayoutData(fdResultCode); } - private void setupResultLine(ModifyListener lsMod, int middle, int margin, Group gSettings, Group gOutputFields) { + private void setupResultLine( + ModifyListener lsMod, int middle, int margin, Group gSettings, Group gOutputFields) { // Result line... Label wlResult = new Label(gOutputFields, SWT.RIGHT); wlResult.setText(BaseMessages.getString(PKG, "RestDialog.Result.Label")); @@ -1066,7 +1075,8 @@ public void widgetSelected(SelectionEvent e) { }); } - private void setupUrlFieldNameLine(ModifyListener lsMod, int middle, int margin, Group gSettings) { + private void setupUrlFieldNameLine( + ModifyListener lsMod, int middle, int margin, Group gSettings) { // UrlField Line wlUrlField = new Label(gSettings, SWT.RIGHT); wlUrlField.setText(BaseMessages.getString(PKG, "RestDialog.UrlField.Label")); @@ -1115,7 +1125,8 @@ public void widgetSelected(SelectionEvent e) { }); } - private void setupUrlLine(ModifyListener lsMod, int middle, int margin, Composite wGeneralComp, Group gSettings) { + private void setupUrlLine( + ModifyListener lsMod, int middle, int margin, Composite wGeneralComp, Group gSettings) { wlUrl = new Label(gSettings, SWT.RIGHT); wlUrl.setText(BaseMessages.getString(PKG, "RestDialog.URL.Label")); PropsUi.setLook(wlUrl); @@ -1193,37 +1204,39 @@ protected void setMethod() { wMatrixParameters.setEnabled(activateParams); wMatrixGet.setEnabled(activateParams); } - + // // Search the fields in the background // protected void setComboBoxes() { - final Runnable runnable = new Runnable() { - @Override - public void run() { - TransformMeta transformMeta = pipelineMeta.findTransform(transformName); - if (transformMeta != null) { - try { - IRowMeta rowMeta = pipelineMeta.getPrevTransformFields(variables, transformMeta); - - // Remember these fields... - for (int i = 0; i < rowMeta.size(); i++) { - inputFields.add(rowMeta.getValueMeta(i).getName()); + final Runnable runnable = + new Runnable() { + @Override + public void run() { + TransformMeta transformMeta = pipelineMeta.findTransform(transformName); + if (transformMeta != null) { + try { + IRowMeta rowMeta = pipelineMeta.getPrevTransformFields(variables, transformMeta); + + // Remember these fields... + for (int i = 0; i < rowMeta.size(); i++) { + inputFields.add(rowMeta.getValueMeta(i).getName()); + } + + String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); + colinfoparams[0].setComboValues(fieldNames); + colinf[0].setComboValues(fieldNames); + wUrlField.setItems(fieldNames); + wBody.setItems(fieldNames); + wMethodField.setItems(fieldNames); + } catch (HopException e) { + log.logError( + toString(), + BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); + } } - - String[] fieldNames = Const.sortStrings(rowMeta.getFieldNames()); - colinfoparams[0].setComboValues(fieldNames); - colinf[0].setComboValues(fieldNames); - wUrlField.setItems(fieldNames); - wBody.setItems(fieldNames); - wMethodField.setItems(fieldNames); - } catch (HopException e) { - log.logError(toString(), - BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); } - } - } - }; + }; shell.getDisplay().asyncExec(runnable); } diff --git a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestMeta.java b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestMeta.java index 39bac5af8fc..58ebf43bcdc 100644 --- a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestMeta.java +++ b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/RestMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.rest; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,8 +39,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "Rest", image = "rest.svg", @@ -142,152 +141,212 @@ public RestMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the method. */ + /** + * @return Returns the method. + */ public String getMethod() { return method; } - /** @param value The method to set. */ + /** + * @param value The method to set. + */ public void setMethod(String value) { this.method = value; } - /** @return Returns the bodyField. */ + /** + * @return Returns the bodyField. + */ public String getBodyField() { return bodyField; } - /** @param value The bodyField to set. */ + /** + * @param value The bodyField to set. + */ public void setBodyField(String value) { this.bodyField = value; } - /** @return Returns the headerName. */ + /** + * @return Returns the headerName. + */ public String[] getHeaderName() { return headerName; } - /** @param value The headerName to set. */ + /** + * @param value The headerName to set. + */ public void setHeaderName(String[] value) { this.headerName = value; } - /** @return Returns the parameterField. */ + /** + * @return Returns the parameterField. + */ public String[] getParameterField() { return parameterField; } - /** @param value The parameterField to set. */ + /** + * @param value The parameterField to set. + */ public void setParameterField(String[] value) { this.parameterField = value; } - /** @return Returns the parameterName. */ + /** + * @return Returns the parameterName. + */ public String[] getParameterName() { return parameterName; } - /** @param value The parameterName to set. */ + /** + * @param value The parameterName to set. + */ public void setParameterName(String[] value) { this.parameterName = value; } - /** @return Returns the matrixParameterField. */ + /** + * @return Returns the matrixParameterField. + */ public String[] getMatrixParameterField() { return matrixParameterField; } - /** @param value The matrixParameterField to set. */ + /** + * @param value The matrixParameterField to set. + */ public void setMatrixParameterField(String[] value) { this.matrixParameterField = value; } - /** @return Returns the matrixParameterName. */ + /** + * @return Returns the matrixParameterName. + */ public String[] getMatrixParameterName() { return matrixParameterName; } - /** @param value The matrixParameterName to set. */ + /** + * @param value The matrixParameterName to set. + */ public void setMatrixParameterName(String[] value) { this.matrixParameterName = value; } - /** @return Returns the headerField. */ + /** + * @return Returns the headerField. + */ public String[] getHeaderField() { return headerField; } - /** @param value The headerField to set. */ + /** + * @param value The headerField to set. + */ public void setHeaderField(String[] value) { this.headerField = value; } - /** @return Returns the procedure. */ + /** + * @return Returns the procedure. + */ public String getUrl() { return url; } - /** @param procedure The procedure to set. */ + /** + * @param procedure The procedure to set. + */ public void setUrl(String procedure) { this.url = procedure; } - /** @return Is the url coded in a field? */ + /** + * @return Is the url coded in a field? + */ public boolean isUrlInField() { return urlInField; } - /** @param urlInField Is the url coded in a field? */ + /** + * @param urlInField Is the url coded in a field? + */ public void setUrlInField(boolean urlInField) { this.urlInField = urlInField; } - /** @return Is preemptive? */ + /** + * @return Is preemptive? + */ public boolean isPreemptive() { return preemptive; } - /** @param preemptive Ispreemptive? */ + /** + * @param preemptive Ispreemptive? + */ public void setPreemptive(boolean preemptive) { this.preemptive = preemptive; } - /** @return Is the method defined in a field? */ + /** + * @return Is the method defined in a field? + */ public boolean isDynamicMethod() { return dynamicMethod; } - /** @param dynamicMethod If the method is defined in a field? */ + /** + * @param dynamicMethod If the method is defined in a field? + */ public void setDynamicMethod(boolean dynamicMethod) { this.dynamicMethod = dynamicMethod; } - /** @return methodFieldName */ + /** + * @return methodFieldName + */ public String getMethodFieldName() { return methodFieldName; } - /** @param methodFieldName */ + /** + * @param methodFieldName + */ public void setMethodFieldName(String methodFieldName) { this.methodFieldName = methodFieldName; } - /** @return The field name that contains the url. */ + /** + * @return The field name that contains the url. + */ public String getUrlField() { return urlField; } - /** @param urlField name of the field that contains the url */ + /** + * @param urlField name of the field that contains the url + */ public void setUrlField(String urlField) { this.urlField = urlField; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getFieldName() { return fieldName; } - /** @param resultName The resultName to set. */ + /** + * @param resultName The resultName to set. + */ public void setFieldName(String resultName) { this.fieldName = resultName; } @@ -622,12 +681,16 @@ public boolean supportsErrorHandling() { return true; } - /** @return the resultCodeFieldName */ + /** + * @return the resultCodeFieldName + */ public String getResultCodeFieldName() { return resultCodeFieldName; } - /** @param resultCodeFieldName the resultCodeFieldName to set */ + /** + * @param resultCodeFieldName the resultCodeFieldName to set + */ public void setResultCodeFieldName(String resultCodeFieldName) { this.resultCodeFieldName = resultCodeFieldName; } @@ -713,7 +776,9 @@ public void setHttpPassword(String httpPassword) { this.httpPassword = httpPassword; } - /** @return */ + /** + * @return + */ public String getHttpPassword() { return httpPassword; } @@ -727,7 +792,9 @@ public void setTrustStoreFile(String trustStoreFile) { this.trustStoreFile = trustStoreFile; } - /** @return trustStoreFile */ + /** + * @return trustStoreFile + */ public String getTrustStoreFile() { return trustStoreFile; } @@ -741,7 +808,9 @@ public void setTrustStorePassword(String trustStorePassword) { this.trustStorePassword = trustStorePassword; } - /** @return trustStorePassword */ + /** + * @return trustStorePassword + */ public String getTrustStorePassword() { return trustStorePassword; } diff --git a/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestMetaTest.java b/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestMetaTest.java index 23db7a97d72..76f86cf1826 100644 --- a/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestMetaTest.java +++ b/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestMetaTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.rest; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -41,16 +50,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class RestMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestTest.java b/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestTest.java index 0dafd550cff..5b6b8ed0f0e 100644 --- a/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestTest.java +++ b/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestTest.java @@ -17,26 +17,6 @@ package org.apache.hop.pipeline.transforms.rest; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; -import org.apache.hop.pipeline.transform.TransformMeta; -import org.glassfish.jersey.client.ClientResponse; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Answers; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -50,6 +30,25 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.powermock.reflect.Whitebox.setInternalState; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; +import org.apache.hop.pipeline.transform.TransformMeta; +import org.glassfish.jersey.client.ClientResponse; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Answers; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + @RunWith(PowerMockRunner.class) @PrepareForTest(Client.class) public class RestTest { diff --git a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/GeneratorField.java b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/GeneratorField.java index faa6d71374e..004df3d6afd 100644 --- a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/GeneratorField.java +++ b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/GeneratorField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.rowgenerator; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class GeneratorField { @@ -122,7 +121,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -136,7 +137,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -150,7 +153,9 @@ public String getFormat() { return format; } - /** @param format The format to set */ + /** + * @param format The format to set + */ public void setFormat(String format) { this.format = format; } @@ -164,7 +169,9 @@ public int getLength() { return length; } - /** @param length The length to set */ + /** + * @param length The length to set + */ public void setLength(int length) { this.length = length; } @@ -178,7 +185,9 @@ public int getPrecision() { return precision; } - /** @param precision The precision to set */ + /** + * @param precision The precision to set + */ public void setPrecision(int precision) { this.precision = precision; } @@ -192,7 +201,9 @@ public String getCurrency() { return currency; } - /** @param currency The currency to set */ + /** + * @param currency The currency to set + */ public void setCurrency(String currency) { this.currency = currency; } @@ -206,7 +217,9 @@ public String getDecimal() { return decimal; } - /** @param decimal The decimal to set */ + /** + * @param decimal The decimal to set + */ public void setDecimal(String decimal) { this.decimal = decimal; } @@ -220,7 +233,9 @@ public String getGroup() { return group; } - /** @param group The group to set */ + /** + * @param group The group to set + */ public void setGroup(String group) { this.group = group; } @@ -234,7 +249,9 @@ public String getValue() { return value; } - /** @param value The value to set */ + /** + * @param value The value to set + */ public void setValue(String value) { this.value = value; } @@ -248,7 +265,9 @@ public boolean isSetEmptyString() { return setEmptyString; } - /** @param setEmptyString The setEmptyString to set */ + /** + * @param setEmptyString The setEmptyString to set + */ public void setSetEmptyString(boolean setEmptyString) { this.setEmptyString = setEmptyString; } diff --git a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGenerator.java b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGenerator.java index f6d04793e68..619d56bf3da 100644 --- a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGenerator.java +++ b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGenerator.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.rowgenerator; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -39,10 +42,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** Generates a number of (empty or the same) rows */ public class RowGenerator extends BaseTransform { diff --git a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorData.java b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorData.java index 87bda9c75d1..7b4372ca0bb 100644 --- a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorData.java +++ b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.rowgenerator; +import java.util.Date; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Date; - public class RowGeneratorData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public Object[] outputRowData; diff --git a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorDialog.java b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorDialog.java index 9f7ee2442c4..24d1a18787f 100644 --- a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorDialog.java +++ b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorDialog.java @@ -273,8 +273,8 @@ public void widgetSelected(SelectionEvent e) { new ColumnInfo( BaseMessages.getString(PKG, "System.Column.SetEmptyString"), ColumnInfo.COLUMN_TYPE_CCOMBO, - BaseMessages.getString(PKG, "System.Combo.Yes"), - BaseMessages.getString(PKG, "System.Combo.No")) + BaseMessages.getString(PKG, "System.Combo.Yes"), + BaseMessages.getString(PKG, "System.Combo.No")) }; wFields = @@ -411,7 +411,6 @@ private void getInfo(RowGeneratorMeta meta) throws HopException { meta.getFields().clear(); - for (TableItem item : wFields.getNonEmptyItems()) { GeneratorField field = new GeneratorField(); field.setName(item.getText(1)); diff --git a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMeta.java b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMeta.java index 090ea280927..968aab60c6a 100644 --- a/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMeta.java +++ b/plugins/transforms/rowgenerator/src/main/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.rowgenerator; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,9 +37,6 @@ import org.apache.hop.pipeline.transform.TransformIOMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "RowGenerator", image = "rowgenerator.svg", @@ -223,7 +222,9 @@ public boolean isNeverEnding() { return neverEnding; } - /** @param neverEnding The neverEnding to set */ + /** + * @param neverEnding The neverEnding to set + */ public void setNeverEnding(boolean neverEnding) { this.neverEnding = neverEnding; } @@ -237,7 +238,9 @@ public String getIntervalInMs() { return intervalInMs; } - /** @param intervalInMs The intervalInMs to set */ + /** + * @param intervalInMs The intervalInMs to set + */ public void setIntervalInMs(String intervalInMs) { this.intervalInMs = intervalInMs; } @@ -251,7 +254,9 @@ public String getRowTimeField() { return rowTimeField; } - /** @param rowTimeField The rowTimeField to set */ + /** + * @param rowTimeField The rowTimeField to set + */ public void setRowTimeField(String rowTimeField) { this.rowTimeField = rowTimeField; } @@ -265,7 +270,9 @@ public String getLastTimeField() { return lastTimeField; } - /** @param lastTimeField The lastTimeField to set */ + /** + * @param lastTimeField The lastTimeField to set + */ public void setLastTimeField(String lastTimeField) { this.lastTimeField = lastTimeField; } @@ -279,7 +286,9 @@ public String getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set */ + /** + * @param rowLimit The rowLimit to set + */ public void setRowLimit(String rowLimit) { this.rowLimit = rowLimit; } @@ -293,7 +302,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMetaTest.java b/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMetaTest.java index 3b493dfdcd3..ddd6e566c0a 100644 --- a/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMetaTest.java +++ b/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.rowgenerator; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -32,13 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class RowGeneratorMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorUnitTest.java b/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorUnitTest.java index 6fd0c745f47..4277c0ccebe 100644 --- a/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorUnitTest.java +++ b/plugins/transforms/rowgenerator/src/test/java/org/apache/hop/pipeline/transforms/rowgenerator/RowGeneratorUnitTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.rowgenerator; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -29,10 +33,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class RowGeneratorUnitTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -40,7 +40,9 @@ public class RowGeneratorUnitTest { @Before public void setup() { - transformMockHelper = new TransformMockHelper("RowGenerator TEST", RowGeneratorMeta.class,RowGeneratorData.class); + transformMockHelper = + new TransformMockHelper( + "RowGenerator TEST", RowGeneratorMeta.class, RowGeneratorData.class); when(transformMockHelper.logChannelFactory.create(any(), any(ILoggingObject.class))) .thenReturn(transformMockHelper.iLogChannel); when(transformMockHelper.pipeline.isRunning()).thenReturn(true); @@ -50,7 +52,7 @@ public void setup() { public void tearDown() { transformMockHelper.cleanUp(); } - + @BeforeClass public static void initEnvironment() throws Exception { HopEnvironment.init(); @@ -66,14 +68,14 @@ public void testReadRowLimitAsPipelineVar() throws HopException { 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline); - + // add variable to pipeline variable variables Variables variables = new Variables(); variables.setVariable("ROW_LIMIT", "1440"); - transformMockHelper.pipeline.setVariables(variables); - + transformMockHelper.pipeline.setVariables(variables); + when(transformMockHelper.iTransformMeta.getRowLimit()).thenReturn("${ROW_LIMIT}"); - + rowGenerator.initializeFrom(transformMockHelper.pipeline); rowGenerator.init(); diff --git a/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/recordsfromstream/RecordsFromStreamMeta.java b/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/recordsfromstream/RecordsFromStreamMeta.java index ea4520b8e10..28aa1621ea3 100644 --- a/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/recordsfromstream/RecordsFromStreamMeta.java +++ b/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/recordsfromstream/RecordsFromStreamMeta.java @@ -40,7 +40,7 @@ public class RecordsFromStreamMeta extends RowsFromResultMeta { public RecordsFromStreamMeta() { - super(); + super(); } @Override @@ -50,11 +50,12 @@ public ITransform createTransform( int copyNr, PipelineMeta pipelineMeta, Pipeline pipeline) { - return new RecordsFromStream(transformMeta, this, (RecordsFromStreamData) data, copyNr, pipelineMeta, pipeline); + return new RecordsFromStream( + transformMeta, this, (RecordsFromStreamData) data, copyNr, pipelineMeta, pipeline); } - + @Override public ITransformData createTransformData() { return new RecordsFromStreamData(); } -} \ No newline at end of file +} diff --git a/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/rowsfromresult/RowsFromResultMeta.java b/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/rowsfromresult/RowsFromResultMeta.java index 0a5187752ef..6e0042a2a04 100644 --- a/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/rowsfromresult/RowsFromResultMeta.java +++ b/plugins/transforms/rowsfromresult/src/main/java/org/apache/hop/pipeline/transforms/rowsfromresult/RowsFromResultMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.rowsfromresult; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "RowsFromResult", image = "rowsfromresult.svg", @@ -54,42 +53,58 @@ public class RowsFromResultMeta extends BaseTransformMeta { LoadSaveTester loadSaveTester; Class testMetaClass = RowsFromResultMeta.class; diff --git a/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultData.java b/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultData.java index 3592195bf1e..2d425296195 100644 --- a/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultData.java +++ b/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.rowstoresult; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.ArrayList; -import java.util.List; - public class RowsToResultData extends BaseTransformData implements ITransformData { public List rows; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultMeta.java b/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultMeta.java index 825c2b0e699..12892114da1 100644 --- a/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultMeta.java +++ b/plugins/transforms/rowstoresult/src/main/java/org/apache/hop/pipeline/transforms/rowstoresult/RowsToResultMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.rowstoresult; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,8 +32,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "RowsToResult", image = "rowstoresult.svg", diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnection.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnection.java index cfcb25263e7..7f394f3e8c4 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnection.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnection.java @@ -39,6 +39,17 @@ import com.sforce.ws.ConnectorConfig; import com.sforce.ws.bind.XmlObject; import com.sforce.ws.wsdl.Constants; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; @@ -50,24 +61,11 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import javax.xml.namespace.QName; -import javax.xml.soap.SOAPException; -import java.io.IOException; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - public class SalesforceConnection { private static final FieldType ID_FIELD_TYPE = FieldType.id; private static final FieldType REFERENCE_FIELD_TYPE = FieldType.reference; - private static final - Class PKG = SalesforceConnection.class; // For Translator + private static final Class PKG = SalesforceConnection.class; // For Translator private String url; private String username; diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValue.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValue.java index cd39930d6bb..6214886799e 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValue.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValue.java @@ -18,7 +18,6 @@ package org.apache.hop.pipeline.transforms.salesforce; import com.sforce.soap.partner.sobject.SObject; - import java.util.Date; /** Store a record from Salesforce extraction. */ diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransform.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransform.java index 7bbd20bc222..499c45672d9 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransform.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransform.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.salesforce; import com.google.common.primitives.Ints; +import java.util.Calendar; +import java.util.TimeZone; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -29,10 +31,9 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Calendar; -import java.util.TimeZone; - -public abstract class SalesforceTransform extends BaseTransform { +public abstract class SalesforceTransform< + Meta extends SalesforceTransformMeta, Data extends SalesforceTransformData> + extends BaseTransform { public static Class PKG = SalesforceTransform.class; // For Translator diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformMeta.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformMeta.java index 7e23b543bc6..88ba240e932 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformMeta.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.salesforce; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -33,10 +34,9 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - -public abstract class SalesforceTransformMeta
- extends BaseTransformMeta { +public abstract class SalesforceTransformMeta< + Main extends SalesforceTransform, Data extends SalesforceTransformData> + extends BaseTransformMeta { private static final Class PKG = SalesforceTransformMeta.class; // For Translator @@ -170,42 +170,58 @@ public void check( remarks.add(cr); } - /** @return Returns the Target URL. */ + /** + * @return Returns the Target URL. + */ public String getTargetUrl() { return targetUrl; } - /** @param targetUrl The Target URL to set. */ + /** + * @param targetUrl The Target URL to set. + */ public void setTargetUrl(String targetUrl) { this.targetUrl = targetUrl; } - /** @return Returns the UserName. */ + /** + * @return Returns the UserName. + */ public String getUsername() { return username; } - /** @param username The Username to set. */ + /** + * @param username The Username to set. + */ public void setUsername(String username) { this.username = username; } - /** @return Returns the Password. */ + /** + * @return Returns the Password. + */ public String getPassword() { return password; } - /** @param password The password to set. */ + /** + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; } - /** @return Returns the connection timeout. */ + /** + * @return Returns the connection timeout. + */ public String getTimeout() { return timeout; } - /** @param timeout The connection timeout to set. */ + /** + * @param timeout The connection timeout to set. + */ public void setTimeout(String timeout) { this.timeout = timeout; } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMeta.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMeta.java index d190ba146d3..90d58f731f0 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMeta.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.salesforcedelete; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "SalesforceDelete", name = "i18n::SalesforceDelete.TypeLongDesc.SalesforceDelete", @@ -59,32 +58,44 @@ public SalesforceDeleteMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the rollbackAllChangesOnError. */ + /** + * @return Returns the rollbackAllChangesOnError. + */ public boolean isRollbackAllChangesOnError() { return rollbackAllChangesOnError; } - /** @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. */ + /** + * @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. + */ public void setRollbackAllChangesOnError(boolean rollbackAllChangesOnError) { this.rollbackAllChangesOnError = rollbackAllChangesOnError; } - /** @param deleteField The DeleteField to set. */ + /** + * @param deleteField The DeleteField to set. + */ public void setDeleteField(String deleteField) { this.deleteField = deleteField; } - /** @return Returns the DeleteField. */ + /** + * @return Returns the DeleteField. + */ public String getDeleteField() { return this.deleteField; } - /** @param batchSize */ + /** + * @param batchSize + */ public void setBatchSize(String batchSize) { this.batchSize = batchSize; } - /** @return Returns the batchSize. */ + /** + * @return Returns the batchSize. + */ public String getBatchSize() { return this.batchSize; } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInput.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInput.java index dfa3fb6e669..ddc4e04dfee 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInput.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInput.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.salesforceinput; import com.sforce.ws.util.Base64; +import java.text.SimpleDateFormat; +import java.util.GregorianCalendar; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -34,9 +36,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceRecordValue; import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransform; -import java.text.SimpleDateFormat; -import java.util.GregorianCalendar; - /** * Read data from Salesforce module, convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputData.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputData.java index 2fd77c0aee9..1ca3a61ed73 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputData.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputData.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.salesforceinput; +import java.util.GregorianCalendar; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformData; -import java.util.GregorianCalendar; - public class SalesforceInputData extends SalesforceTransformData { public int nr_repeats; public long rownr; diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDialog.java index 8b34dd936e6..042d57607ae 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDialog.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDialog.java @@ -1423,8 +1423,11 @@ private void get() { } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING); mb.setMessage( - BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.SOQL.NoRecords.DialogMessage")); - mb.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.SOQL.NoRecords.DialogTitle")); + BaseMessages.getString( + PKG, "SalesforceInputDialog.GetFields.SOQL.NoRecords.DialogMessage")); + mb.setText( + BaseMessages.getString( + PKG, "SalesforceInputDialog.GetFields.SOQL.NoRecords.DialogTitle")); mb.open(); } } else { @@ -1437,11 +1440,14 @@ private void get() { fieldsName[i] = field.getName(); addField(field); } - } else { + } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING); mb.setMessage( - BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.Condition.NoRecords.DialogMessage")); - mb.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.Condition.NoRecords.DialogTitle")); + BaseMessages.getString( + PKG, "SalesforceInputDialog.GetFields.Condition.NoRecords.DialogMessage")); + mb.setText( + BaseMessages.getString( + PKG, "SalesforceInputDialog.GetFields.Condition.NoRecords.DialogTitle")); mb.open(); } } @@ -1818,7 +1824,6 @@ protected void getInfo(SalesforceTransformMeta in) throws HopException { field.setRepeated( BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(12))); - meta.getInputFields()[i] = field; } } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMeta.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMeta.java index 6be9fb732d1..0f5ea36e673 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMeta.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.salesforceinput; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -43,8 +44,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "SalesforceInput", name = "i18n::SalesforceInput.TypeLongDesc.SalesforceInput", @@ -148,72 +147,100 @@ public SalesforceInputMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the input fields. */ + /** + * @return Returns the input fields. + */ public SalesforceInputField[] getInputFields() { return inputFields; } - /** @param inputFields The input fields to set. */ + /** + * @param inputFields The input fields to set. + */ public void setInputFields(SalesforceInputField[] inputFields) { this.inputFields = inputFields; } - /** @return Returns the query. */ + /** + * @return Returns the query. + */ public String getQuery() { return query; } - /** @param query The query to set. */ + /** + * @param query The query to set. + */ public void setQuery(String query) { this.query = query; } - /** @return Returns the specifyQuery. */ + /** + * @return Returns the specifyQuery. + */ public boolean isSpecifyQuery() { return specifyQuery; } - /** @param specifyQuery The specifyQuery to set. */ + /** + * @param specifyQuery The specifyQuery to set. + */ public void setSpecifyQuery(boolean specifyQuery) { this.specifyQuery = specifyQuery; } - /** @return Returns the queryAll. */ + /** + * @return Returns the queryAll. + */ public boolean isQueryAll() { return queryAll; } - /** @param queryAll The queryAll to set. */ + /** + * @param queryAll The queryAll to set. + */ public void setQueryAll(boolean queryAll) { this.queryAll = queryAll; } - /** @return Returns the condition. */ + /** + * @return Returns the condition. + */ public String getCondition() { return condition; } - /** @param condition The condition to set. */ + /** + * @param condition The condition to set. + */ public void setCondition(String condition) { this.condition = condition; } - /** @param targetURLField The targetURLField to set. */ + /** + * @param targetURLField The targetURLField to set. + */ public void setTargetURLField(String targetURLField) { this.targetURLField = targetURLField; } - /** @param sqlField The sqlField to set. */ + /** + * @param sqlField The sqlField to set. + */ public void setSQLField(String sqlField) { this.sqlField = sqlField; } - /** @param timestampField The timestampField to set. */ + /** + * @param timestampField The timestampField to set. + */ public void setTimestampField(String timestampField) { this.timestampField = timestampField; } - /** @param moduleField The moduleField to set. */ + /** + * @param moduleField The moduleField to set. + */ public void setModuleField(String moduleField) { this.moduleField = moduleField; } @@ -231,132 +258,184 @@ public void setRecordsFilterDesc(String recordsFilterDesc) { this.recordsFilter = SalesforceConnectionUtils.getRecordsFilterByDesc(recordsFilterDesc); } - /** @return Returns the includeTargetURL. */ + /** + * @return Returns the includeTargetURL. + */ public boolean includeTargetURL() { return includeTargetURL; } - /** @return Returns the includeSQL. */ + /** + * @return Returns the includeSQL. + */ public boolean includeSQL() { return includeSQL; } - /** @param includeSQL to set. */ + /** + * @param includeSQL to set. + */ public void setIncludeSQL(boolean includeSQL) { this.includeSQL = includeSQL; } - /** @return Returns the includeTimestamp. */ + /** + * @return Returns the includeTimestamp. + */ public boolean includeTimestamp() { return includeTimestamp; } - /** @param includeTimestamp to set. */ + /** + * @param includeTimestamp to set. + */ public void setIncludeTimestamp(boolean includeTimestamp) { this.includeTimestamp = includeTimestamp; } - /** @return Returns the includeModule. */ + /** + * @return Returns the includeModule. + */ public boolean includeModule() { return includeModule; } - /** @param includeTargetURL The includeTargetURL to set. */ + /** + * @param includeTargetURL The includeTargetURL to set. + */ public void setIncludeTargetURL(boolean includeTargetURL) { this.includeTargetURL = includeTargetURL; } - /** @param includeModule The includeModule to set. */ + /** + * @param includeModule The includeModule to set. + */ public void setIncludeModule(boolean includeModule) { this.includeModule = includeModule; } - /** @return Returns the includeRowNumber. */ + /** + * @return Returns the includeRowNumber. + */ public boolean includeRowNumber() { return includeRowNumber; } - /** @param includeRowNumber The includeRowNumber to set. */ + /** + * @param includeRowNumber The includeRowNumber to set. + */ public void setIncludeRowNumber(boolean includeRowNumber) { this.includeRowNumber = includeRowNumber; } - /** @return Returns the includeDeletionDate. */ + /** + * @return Returns the includeDeletionDate. + */ public boolean includeDeletionDate() { return includeDeletionDate; } - /** @param includeDeletionDate The includeDeletionDate to set. */ + /** + * @param includeDeletionDate The includeDeletionDate to set. + */ public void setIncludeDeletionDate(boolean includeDeletionDate) { this.includeDeletionDate = includeDeletionDate; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public String getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(String rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the rowNumberField. */ + /** + * @return Returns the rowNumberField. + */ public String getRowNumberField() { return rowNumberField; } - /** @return Returns the deletionDateField. */ + /** + * @return Returns the deletionDateField. + */ public String getDeletionDateField() { return deletionDateField; } - /** @param value the deletionDateField to set. */ + /** + * @param value the deletionDateField to set. + */ public void setDeletionDateField(String value) { this.deletionDateField = value; } - /** @return Returns the targetURLField. */ + /** + * @return Returns the targetURLField. + */ public String getTargetURLField() { return targetURLField; } - /** @return Returns the readFrom. */ + /** + * @return Returns the readFrom. + */ public String getReadFrom() { return readFrom; } - /** @param readFrom the readFrom to set. */ + /** + * @param readFrom the readFrom to set. + */ public void setReadFrom(String readFrom) { this.readFrom = readFrom; } - /** @return Returns the readTo. */ + /** + * @return Returns the readTo. + */ public String getReadTo() { return readTo; } - /** @param readTo the readTo to set. */ + /** + * @param readTo the readTo to set. + */ public void setReadTo(String readTo) { this.readTo = readTo; } - /** @return Returns the sqlField. */ + /** + * @return Returns the sqlField. + */ public String getSQLField() { return sqlField; } - /** @return Returns the timestampField. */ + /** + * @return Returns the timestampField. + */ public String getTimestampField() { return timestampField; } - /** @return Returns the moduleField. */ + /** + * @return Returns the moduleField. + */ public String getModuleField() { return moduleField; } - /** @param rowNumberField The rowNumberField to set. */ + /** + * @param rowNumberField The rowNumberField to set. + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsert.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsert.java index ab75e6d831e..0d355a40467 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsert.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsert.java @@ -20,6 +20,7 @@ import com.google.common.annotations.VisibleForTesting; import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; +import java.util.ArrayList; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransform; import org.apache.hop.pipeline.transforms.salesforceutils.SalesforceUtils; -import java.util.ArrayList; - /** * Read data from Salesforce module, convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java index 0edf962eb34..b7e734ff666 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java @@ -19,6 +19,11 @@ import com.sforce.soap.partner.Field; import com.sforce.soap.partner.FieldType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -72,12 +77,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class SalesforceInsertDialog extends SalesforceTransformDialog { private static final Class PKG = SalesforceInsertMeta.class; // For Translator @@ -548,7 +547,8 @@ public void focusGained(org.eclipse.swt.events.FocusEvent e) { setComboBoxes(); // Dislay in red missing field names - HopGui.getInstance().getDisplay() + HopGui.getInstance() + .getDisplay() .asyncExec( () -> { if (!wReturn.isDisposed()) { @@ -713,7 +713,6 @@ protected void getInfo(SalesforceTransformMeta in) throws HopException { meta.allocate(nrFields); - for (int i = 0; i < nrFields; i++) { TableItem item = wReturn.getNonEmpty(i); meta.getUpdateLookup()[i] = item.getText(1); diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMeta.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMeta.java index 486d945df6c..d8275c98ee2 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMeta.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.salesforceinsert; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "SalesforceInsert", name = "i18n::SalesforceInsert.TypeLongDesc.SalesforceInsert", @@ -70,52 +69,72 @@ public SalesforceInsertMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the rollbackAllChangesOnError. */ + /** + * @return Returns the rollbackAllChangesOnError. + */ public boolean isRollbackAllChangesOnError() { return rollbackAllChangesOnError; } - /** @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. */ + /** + * @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. + */ public void setRollbackAllChangesOnError(boolean rollbackAllChangesOnError) { this.rollbackAllChangesOnError = rollbackAllChangesOnError; } - /** @return Returns the updateLookup. */ + /** + * @return Returns the updateLookup. + */ public String[] getUpdateLookup() { return updateLookup; } - /** @param updateLookup The updateLookup to set. */ + /** + * @param updateLookup The updateLookup to set. + */ public void setUpdateLookup(String[] updateLookup) { this.updateLookup = updateLookup; } - /** @return Returns the updateStream. */ + /** + * @return Returns the updateStream. + */ public String[] getUpdateStream() { return updateStream; } - /** @param updateStream The updateStream to set. */ + /** + * @param updateStream The updateStream to set. + */ public void setUpdateStream(String[] updateStream) { this.updateStream = updateStream; } - /** @return Returns the useExternalId. */ + /** + * @return Returns the useExternalId. + */ public Boolean[] getUseExternalId() { return useExternalId; } - /** @param useExternalId The useExternalId to set. */ + /** + * @param useExternalId The useExternalId to set. + */ public void setUseExternalId(Boolean[] useExternalId) { this.useExternalId = useExternalId; } - /** @param batchSize */ + /** + * @param batchSize + */ public void setBatchSize(String batchSize) { this.batchSize = batchSize; } - /** @return Returns the batchSize. */ + /** + * @return Returns the batchSize. + */ public String getBatchSize() { return this.batchSize; } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdate.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdate.java index 879026170be..4f7b1ab6cce 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdate.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdate.java @@ -20,6 +20,7 @@ import com.google.common.annotations.VisibleForTesting; import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; +import java.util.ArrayList; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -32,8 +33,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransform; import org.apache.hop.pipeline.transforms.salesforceutils.SalesforceUtils; -import java.util.ArrayList; - /** * Read data from Salesforce module, convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java index 2c9a42e3a6b..c188d56f609 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.salesforceupdate; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -70,9 +72,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class SalesforceUpdateDialog extends SalesforceTransformDialog { private static final Class PKG = SalesforceUpdateMeta.class; // For Translator @@ -494,7 +493,8 @@ public void focusGained(org.eclipse.swt.events.FocusEvent e) { setComboBoxes(); // Dislay in red missing field names - HopGui.getInstance().getDisplay() + HopGui.getInstance() + .getDisplay() .asyncExec( () -> { if (!wReturn.isDisposed()) { @@ -656,7 +656,6 @@ protected void getInfo(SalesforceTransformMeta in) throws HopException { meta.allocate(nrFields); - for (int i = 0; i < nrFields; i++) { TableItem item = wReturn.getNonEmpty(i); meta.getUpdateLookup()[i] = item.getText(1); diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMeta.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMeta.java index dc6a0f0489a..a241399f344 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMeta.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.salesforceupdate; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "SalesforceUpdate", name = "i18n::SalesforceUpdate.TypeLongDesc.SalesforceUpdate", @@ -65,52 +64,72 @@ public SalesforceUpdateMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the rollbackAllChangesOnError. */ + /** + * @return Returns the rollbackAllChangesOnError. + */ public boolean isRollbackAllChangesOnError() { return rollbackAllChangesOnError; } - /** @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. */ + /** + * @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. + */ public void setRollbackAllChangesOnError(boolean rollbackAllChangesOnError) { this.rollbackAllChangesOnError = rollbackAllChangesOnError; } - /** @return Returns the updateLookup. */ + /** + * @return Returns the updateLookup. + */ public String[] getUpdateLookup() { return updateLookup; } - /** @param updateLookup The updateLookup to set. */ + /** + * @param updateLookup The updateLookup to set. + */ public void setUpdateLookup(String[] updateLookup) { this.updateLookup = updateLookup; } - /** @return Returns the useExternalId. */ + /** + * @return Returns the useExternalId. + */ public Boolean[] getUseExternalId() { return useExternalId; } - /** @param useExternalId The useExternalId to set. */ + /** + * @param useExternalId The useExternalId to set. + */ public void setUseExternalId(Boolean[] useExternalId) { this.useExternalId = useExternalId; } - /** @return Returns the updateStream. */ + /** + * @return Returns the updateStream. + */ public String[] getUpdateStream() { return updateStream; } - /** @param updateStream The updateStream to set. */ + /** + * @param updateStream The updateStream to set. + */ public void setUpdateStream(String[] updateStream) { this.updateStream = updateStream; } - /** @param batchSize */ + /** + * @param batchSize + */ public void setBatchSize(String batchSize) { this.batchSize = batchSize; } - /** @return Returns the batchSize. */ + /** + * @return Returns the batchSize. + */ public String getBatchSize() { return this.batchSize; } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsert.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsert.java index bb9b3a49f59..3145597ee66 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsert.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsert.java @@ -21,6 +21,11 @@ import com.sforce.soap.partner.Field; import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import javax.xml.namespace.QName; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -34,12 +39,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransform; import org.apache.hop.pipeline.transforms.salesforceutils.SalesforceUtils; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - /** * Read data from Salesforce module, convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertData.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertData.java index 86f9d7512f7..4afcd1d15d3 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertData.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertData.java @@ -19,11 +19,10 @@ import com.sforce.soap.partner.UpsertResult; import com.sforce.soap.partner.sobject.SObject; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformData; - import java.util.HashMap; import java.util.Map; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformData; public class SalesforceUpsertData extends SalesforceTransformData { public IRowMeta inputRowMeta; diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java index a4efffc1a7e..ad43b966460 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforceupsert; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -70,12 +75,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class SalesforceUpsertDialog extends SalesforceTransformDialog { private static final Class PKG = SalesforceUpsertMeta.class; // For Translator @@ -587,7 +586,8 @@ public void focusLost(FocusEvent e) {} setComboBoxes(); // Dislay in red missing field names - HopGui.getInstance().getDisplay() + HopGui.getInstance() + .getDisplay() .asyncExec( () -> { if (!wReturn.isDisposed()) { @@ -770,7 +770,6 @@ protected void getInfo(SalesforceTransformMeta in) throws HopException { meta.allocate(nrFields); - for (int i = 0; i < nrFields; i++) { TableItem item = wReturn.getNonEmpty(i); meta.getUpdateLookup()[i] = item.getText(1); @@ -1015,7 +1014,7 @@ protected void setComboBoxes() { List entries = new ArrayList<>(keySet); String[] fieldNames = entries.toArray(new String[entries.size()]); - if ( PropsUi.getInstance().isSortFieldByName() ) { + if (PropsUi.getInstance().isSortFieldByName()) { Const.sortStrings(fieldNames); } // return fields diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMeta.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMeta.java index 10478c369c6..c644f72275f 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMeta.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.salesforceupsert; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transforms.salesforce.SalesforceTransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "SalesforceUpsert", name = "i18n::SalesforceUpsert.TypeLongDesc.SalesforceUpsert", @@ -73,62 +72,86 @@ public SalesforceUpsertMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the rollbackAllChangesOnError. */ + /** + * @return Returns the rollbackAllChangesOnError. + */ public boolean isRollbackAllChangesOnError() { return rollbackAllChangesOnError; } - /** @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. */ + /** + * @param rollbackAllChangesOnError The rollbackAllChangesOnError to set. + */ public void setRollbackAllChangesOnError(boolean rollbackAllChangesOnError) { this.rollbackAllChangesOnError = rollbackAllChangesOnError; } - /** @return Returns the updateLookup. */ + /** + * @return Returns the updateLookup. + */ public String[] getUpdateLookup() { return updateLookup; } - /** @param updateLookup The updateLookup to set. */ + /** + * @param updateLookup The updateLookup to set. + */ public void setUpdateLookup(String[] updateLookup) { this.updateLookup = updateLookup; } - /** @return Returns the updateStream. */ + /** + * @return Returns the updateStream. + */ public String[] getUpdateStream() { return updateStream; } - /** @param updateStream The updateStream to set. */ + /** + * @param updateStream The updateStream to set. + */ public void setUpdateStream(String[] updateStream) { this.updateStream = updateStream; } - /** @return Returns the useExternalId. */ + /** + * @return Returns the useExternalId. + */ public Boolean[] getUseExternalId() { return useExternalId; } - /** @param useExternalId The useExternalId to set. */ + /** + * @param useExternalId The useExternalId to set. + */ public void setUseExternalId(Boolean[] useExternalId) { this.useExternalId = useExternalId; } - /** @param upsertField The upsert field to set. */ + /** + * @param upsertField The upsert field to set. + */ public void setUpsertField(String upsertField) { this.UpsertField = upsertField; } - /** @return Returns the upsertfield. */ + /** + * @return Returns the upsertfield. + */ public String getUpsertField() { return this.UpsertField; } - /** @param batchSize */ + /** + * @param batchSize + */ public void setBatchSize(String batchSize) { this.batchSize = batchSize; } - /** @return Returns the batchSize. */ + /** + * @return Returns the batchSize. + */ public String getBatchSize() { return this.batchSize; } diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtils.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtils.java index 42cc6f218b6..db3f12e6f31 100644 --- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtils.java +++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtils.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.salesforceutils; +import java.util.regex.Pattern; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.i18n.BaseMessages; -import java.util.regex.Pattern; - /** Utility class to process salesforce specific features. */ public class SalesforceUtils { diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionTest.java index 12988814f78..bc48d3f2e3f 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.salesforce; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; + import com.sforce.soap.partner.Connector; import com.sforce.soap.partner.Field; import com.sforce.soap.partner.PartnerConnection; @@ -25,6 +33,10 @@ import com.sforce.ws.ConnectorConfig; import com.sforce.ws.bind.XmlObject; import com.sforce.ws.wsdl.Constants; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Random; +import javax.xml.namespace.QName; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -40,19 +52,6 @@ import org.junit.Test; import org.mockito.Mockito; -import javax.xml.namespace.QName; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.Random; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; - public class SalesforceConnectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionUtilsTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionUtilsTest.java index bf811f28d5f..405867d4c62 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionUtilsTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceConnectionUtilsTest.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.salesforce; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.UUID; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class SalesforceConnectionUtilsTest { diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceMetaTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceMetaTest.java index ae8a6e92154..c646df79e2d 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceMetaTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceMetaTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.salesforce; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -31,14 +38,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - public class SalesforceMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValueTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValueTest.java index a9f21b0e294..2ed55ddc3b3 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValueTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceRecordValueTest.java @@ -17,11 +17,6 @@ package org.apache.hop.pipeline.transforms.salesforce; -import com.sforce.soap.partner.sobject.SObject; -import org.junit.Test; - -import java.util.Date; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -29,6 +24,10 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; +import com.sforce.soap.partner.sobject.SObject; +import java.util.Date; +import org.junit.Test; + public class SalesforceRecordValueTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformDataTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformDataTest.java index 4b089ea111b..33e2dcf6d56 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformDataTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformDataTest.java @@ -17,10 +17,10 @@ package org.apache.hop.pipeline.transforms.salesforce; -import org.junit.Test; - import static org.junit.Assert.assertNull; +import org.junit.Test; + public class SalesforceTransformDataTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformTest.java index d6a6b540534..3c5fafd7cac 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforce/SalesforceTransformTest.java @@ -17,6 +17,21 @@ package org.apache.hop.pipeline.transforms.salesforce; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -35,22 +50,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class SalesforceTransformTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteDataTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteDataTest.java index 26f99ca476c..b1c7f6fcfff 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteDataTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteDataTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforcedelete; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.Test; + public class SalesforceDeleteDataTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMetaTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMetaTest.java index 6486bd3f799..61113a2e519 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMetaTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforcedelete/SalesforceDeleteMetaTest.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.salesforcedelete; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -43,18 +54,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class SalesforceDeleteMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -147,7 +146,7 @@ public void testLoadSave() throws HopException { TransformLoadSaveTester transformLoadSaveTester = new TransformLoadSaveTester( SalesforceDeleteMeta.class, - attributes, + attributes, getterMap, setterMap, fieldLoadSaveValidators, diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDataTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDataTest.java index 79ec7e6a391..50471ba31ae 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDataTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputDataTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforceinput; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.Test; + public class SalesforceInputDataTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputFieldTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputFieldTest.java index 2f524adef20..5afb17277b5 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputFieldTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputFieldTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforceinput; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import org.junit.Test; + public class SalesforceInputFieldTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMetaTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMetaTest.java index 31a377e7f0f..c36eeedab09 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMetaTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinput/SalesforceInputMetaTest.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.salesforceinput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -42,18 +53,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SalesforceInputMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -121,7 +120,7 @@ public void testSalesforceInputMeta() throws HopException { TransformLoadSaveTester transformLoadSaveTester = new TransformLoadSaveTester( SalesforceInputMeta.class, - attributes, + attributes, getterMap, setterMap, fieldLoadSaveValidators, diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesForceDateFieldTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesForceDateFieldTest.java index 54d1de34112..f784e809949 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesForceDateFieldTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesForceDateFieldTest.java @@ -17,8 +17,18 @@ package org.apache.hop.pipeline.transforms.salesforceinsert; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; +import java.lang.reflect.Method; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.TimeZone; +import java.util.UUID; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -39,17 +49,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.lang.reflect.Method; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.TimeZone; -import java.util.UUID; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - /** * Tests for SalesforceInsert transform * diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDataTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDataTest.java index f0a719428af..46b765a236f 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDataTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDataTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforceinsert; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.Test; + public class SalesforceInsertDataTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMetaTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMetaTest.java index c78431b493b..b869ce59e24 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMetaTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertMetaTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.salesforceinsert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -41,16 +50,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SalesforceInsertMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -156,7 +155,7 @@ public void testSalesforceInsertMeta() throws HopException { TransformLoadSaveTester transformLoadSaveTester = new TransformLoadSaveTester( SalesforceInsertMeta.class, - attributes, + attributes, getterMap, setterMap, fieldLoadSaveValidators, diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertTest.java index dbfd64a8e56..830b01ae55e 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertTest.java @@ -17,9 +17,20 @@ package org.apache.hop.pipeline.transforms.salesforceinsert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; import com.sforce.ws.wsdl.Constants; +import java.util.UUID; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -41,18 +52,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SalesforceInsertTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDataTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDataTest.java index f92a71ca36a..8627fa1414f 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDataTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDataTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforceupdate; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.Test; + public class SalesforceUpdateDataTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMetaTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMetaTest.java index 1145d66f05d..1ecf5ce0873 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMetaTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateMetaTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.salesforceupdate; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -43,16 +52,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SalesforceUpdateMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -157,7 +156,7 @@ public void testSalesforceUpdateMeta() throws HopException { TransformLoadSaveTester transformLoadSaveTester = new TransformLoadSaveTester( SalesforceUpdateMeta.class, - attributes, + attributes, getterMap, setterMap, fieldLoadSaveValidators, diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateTest.java index ca801cbe90e..02b4a390efd 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateTest.java @@ -17,9 +17,21 @@ package org.apache.hop.pipeline.transforms.salesforceupdate; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; import com.sforce.ws.wsdl.Constants; +import java.util.UUID; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -39,19 +51,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SalesforceUpdateTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDataTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDataTest.java index 781fb1403f0..2b58ce4d09c 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDataTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDataTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.salesforceupsert; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.Test; + public class SalesforceUpsertDataTest { @Test diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMetaTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMetaTest.java index 4fc0c1771d8..9b7f5736beb 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMetaTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertMetaTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.salesforceupsert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.encryption.Encr; @@ -41,16 +50,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class SalesforceUpsertMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -157,7 +156,7 @@ public void testSalesforceUpsertMeta() throws HopException { TransformLoadSaveTester transformLoadSaveTester = new TransformLoadSaveTester( SalesforceUpsertMeta.class, - attributes, + attributes, getterMap, setterMap, fieldLoadSaveValidators, diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertTest.java index 335431f122b..41c15702e5f 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertTest.java @@ -17,9 +17,21 @@ package org.apache.hop.pipeline.transforms.salesforceupsert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.sforce.soap.partner.sobject.SObject; import com.sforce.ws.bind.XmlObject; import com.sforce.ws.wsdl.Constants; +import java.util.UUID; +import javax.xml.namespace.QName; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -41,19 +53,6 @@ import org.junit.ClassRule; import org.junit.Test; -import javax.xml.namespace.QName; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SalesforceUpsertTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtilsTest.java b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtilsTest.java index 14d9e4b2f37..d888f4ac176 100644 --- a/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtilsTest.java +++ b/plugins/transforms/salesforce/src/test/java/org/apache/hop/pipeline/transforms/salesforceutils/SalesforceUtilsTest.java @@ -17,12 +17,6 @@ package org.apache.hop.pipeline.transforms.salesforceutils; -import org.apache.hop.core.logging.ILogChannel; -import org.junit.Before; -import org.junit.Test; - -import java.lang.reflect.Constructor; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.mockito.Matchers.anyString; @@ -31,6 +25,11 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.lang.reflect.Constructor; +import org.apache.hop.core.logging.ILogChannel; +import org.junit.Before; +import org.junit.Test; + public class SalesforceUtilsTest { private static ILogChannel logMock; diff --git a/plugins/transforms/samplerows/src/main/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMeta.java b/plugins/transforms/samplerows/src/main/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMeta.java index 724d3e10604..bbf23f365b7 100644 --- a/plugins/transforms/samplerows/src/main/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMeta.java +++ b/plugins/transforms/samplerows/src/main/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.samplerows; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "SampleRows", image = "samplerows.svg", diff --git a/plugins/transforms/samplerows/src/test/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMetaTest.java b/plugins/transforms/samplerows/src/test/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMetaTest.java index 566d53b6bce..032a51b8123 100644 --- a/plugins/transforms/samplerows/src/test/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMetaTest.java +++ b/plugins/transforms/samplerows/src/test/java/org/apache/hop/pipeline/transforms/samplerows/SampleRowsMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.samplerows; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -25,11 +29,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SampleRowsMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = SampleRowsMeta.class; diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInput.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInput.java index fb5c8e2d490..a1442bb02f6 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInput.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInput.java @@ -21,6 +21,10 @@ import com.epam.parso.ColumnFormat; import com.epam.parso.SasFileProperties; import com.epam.parso.impl.SasFileReaderImpl; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; import org.apache.hop.core.exception.HopException; @@ -38,11 +42,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** Reads data from a SAS file in SAS7BAT format. */ public class SasInput extends BaseTransform { private static final Class PKG = SasInputMeta.class; // for Translator diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputDialog.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputDialog.java index b7ea8aa7e4a..11bbf052043 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputDialog.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputDialog.java @@ -21,6 +21,8 @@ import com.epam.parso.ColumnFormat; import com.epam.parso.SasFileProperties; import com.epam.parso.impl.SasFileReaderImpl; +import java.io.InputStream; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -55,9 +57,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.InputStream; -import java.util.List; - public class SasInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SasInputMeta.class; // for Translator diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputField.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputField.java index b09c3bf45e7..4f5deeeec68 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputField.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputField.java @@ -109,92 +109,128 @@ public SasInputField(Node node) throws HopXmlException { trimType = ValueMetaString.getTrimTypeByCode(XmlHandler.getTagValue(node, "trim_type")); } - /** @return the name */ + /** + * @return the name + */ public String getName() { return name; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setName(String name) { this.name = name; } - /** @return the rename */ + /** + * @return the rename + */ public String getRename() { return rename; } - /** @param rename the rename to set */ + /** + * @param rename the rename to set + */ public void setRename(String rename) { this.rename = rename; } - /** @return the type */ + /** + * @return the type + */ public int getType() { return type; } - /** @param type the type to set */ + /** + * @param type the type to set + */ public void setType(int type) { this.type = type; } - /** @return the conversionMask */ + /** + * @return the conversionMask + */ public String getConversionMask() { return conversionMask; } - /** @param conversionMask the conversionMask to set */ + /** + * @param conversionMask the conversionMask to set + */ public void setConversionMask(String conversionMask) { this.conversionMask = conversionMask; } - /** @return the decimalSymbol */ + /** + * @return the decimalSymbol + */ public String getDecimalSymbol() { return decimalSymbol; } - /** @param decimalSymbol the decimalSymbol to set */ + /** + * @param decimalSymbol the decimalSymbol to set + */ public void setDecimalSymbol(String decimalSymbol) { this.decimalSymbol = decimalSymbol; } - /** @return the groupingSymbol */ + /** + * @return the groupingSymbol + */ public String getGroupingSymbol() { return groupingSymbol; } - /** @param groupingSymbol the groupingSymbol to set */ + /** + * @param groupingSymbol the groupingSymbol to set + */ public void setGroupingSymbol(String groupingSymbol) { this.groupingSymbol = groupingSymbol; } - /** @return the trimType */ + /** + * @return the trimType + */ public int getTrimType() { return trimType; } - /** @param trimType the trimType to set */ + /** + * @param trimType the trimType to set + */ public void setTrimType(int trimType) { this.trimType = trimType; } - /** @return the precision */ + /** + * @return the precision + */ public int getPrecision() { return precision; } - /** @param precision the precision to set */ + /** + * @param precision the precision to set + */ public void setPrecision(int precision) { this.precision = precision; } - /** @return the length */ + /** + * @return the length + */ public int getLength() { return length; } - /** @param length the length to set */ + /** + * @param length the length to set + */ public void setLength(int length) { this.length = length; } diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMeta.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMeta.java index fa1a3382ea0..82cefa80db8 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMeta.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.sasinput; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -35,9 +37,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "SASInput", image = "sasinput.svg", @@ -159,22 +158,30 @@ public void check( } } - /** @return Returns the acceptingField. */ + /** + * @return Returns the acceptingField. + */ public String getAcceptingField() { return acceptingField; } - /** @param acceptingField The acceptingField to set. */ + /** + * @param acceptingField The acceptingField to set. + */ public void setAcceptingField(String acceptingField) { this.acceptingField = acceptingField; } - /** @return the outputFields */ + /** + * @return the outputFields + */ public List getOutputFields() { return outputFields; } - /** @param outputFields the outputFields to set */ + /** + * @param outputFields the outputFields to set + */ public void setOutputFields(List outputFields) { this.outputFields = outputFields; } diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasUtil.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasUtil.java index e81d79bc857..ae68c43179e 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasUtil.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/SasUtil.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.sasinput; +import java.util.Date; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; -import java.util.Date; - public class SasUtil { public static int getHopDataType(Class type) { if (type.equals(java.lang.Number.class)) { diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileType.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileType.java index 6775113c04c..f6fea2295d5 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileType.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileType.java @@ -45,7 +45,8 @@ public SasExplorerFileType() { ".sas7bdat", new String[] {"*.sas7bdat"}, new String[] {"SAS 7 BDAT files"}, - FileTypeCapabilities.getCapabilities(IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY)); + FileTypeCapabilities.getCapabilities( + IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY)); } @Override diff --git a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileTypeHandler.java b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileTypeHandler.java index 9e307f86143..f041e876ca2 100644 --- a/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileTypeHandler.java +++ b/plugins/transforms/sasinput/src/main/java/org/apache/hop/pipeline/transforms/sasinput/types/SasExplorerFileTypeHandler.java @@ -21,6 +21,8 @@ import com.epam.parso.Column; import com.epam.parso.ColumnFormat; import com.epam.parso.impl.SasFileReaderImpl; +import java.io.InputStream; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -38,9 +40,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; -import java.io.InputStream; -import java.util.List; - /** How do we handle an SVG file in file explorer perspective? */ public class SasExplorerFileTypeHandler extends BaseExplorerFileTypeHandler implements IExplorerFileTypeHandler { diff --git a/plugins/transforms/sasinput/src/test/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMetaTest.java b/plugins/transforms/sasinput/src/test/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMetaTest.java index 860767bd256..07b9419183a 100644 --- a/plugins/transforms/sasinput/src/test/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMetaTest.java +++ b/plugins/transforms/sasinput/src/test/java/org/apache/hop/pipeline/transforms/sasinput/SasInputMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.sasinput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -29,13 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class SasInputMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = SasInputMeta.class; diff --git a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMapping.java b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMapping.java index f21bedf9ea3..82e365f0c0c 100644 --- a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMapping.java +++ b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMapping.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.schemamapping; -import com.google.common.annotations.VisibleForTesting; +import java.util.HashMap; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.util.Utils; @@ -30,8 +29,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashMap; - /** Sample rows. Filter rows based on line number */ public class SchemaMapping extends BaseTransform { @@ -74,7 +71,9 @@ public boolean processRow() throws HopException { IValueMeta sourceValueMeta = data.inputRowMeta.getValueMeta(data.inputRowMeta.indexOfValue(f.getFieldStream())); - IValueMeta targetValueMeta = data.outputRowMeta.getValueMeta(data.outputRowMeta.indexOfValue(f.getFieldSchemaDefinition())); + IValueMeta targetValueMeta = + data.outputRowMeta.getValueMeta( + data.outputRowMeta.indexOfValue(f.getFieldSchemaDefinition())); alterSourceMetadata(sourceValueMeta, targetValueMeta); } } // end if first diff --git a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingData.java b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingData.java index 1eeb00ef709..4fc65082b2e 100644 --- a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingData.java +++ b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingData.java @@ -17,14 +17,11 @@ package org.apache.hop.pipeline.transforms.schemamapping; -import com.google.common.collect.ImmutableRangeSet; -import com.google.common.collect.RangeSet; +import java.util.HashMap; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashMap; - public class SchemaMappingData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingDialog.java b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingDialog.java index ef1241511c1..c8c3dacb6ee 100644 --- a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingDialog.java +++ b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingDialog.java @@ -213,7 +213,7 @@ private void fillStaticSchemaFieldset() { if (!Utils.isEmpty(schemaName)) { try { SchemaDefinition schemaDefinition = - (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); + (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); if (schemaDefinition != null) { List fieldDefinitions = schemaDefinition.getFieldDefinitions(); @@ -234,7 +234,6 @@ private void fillStaticSchemaFieldset() { } } - private void buildMappingTable(ModifyListener lsMod, int margin) { Label wlFields = new Label(shell, SWT.NONE); @@ -516,8 +515,10 @@ private void generateMappings() { } else { MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); mb.setMessage( - BaseMessages.getString(PKG, "SchemaMappingDialog.DoMapping.SchemaNameNotProvided.Message")); - mb.setText(BaseMessages.getString(PKG, "SchemaMappingDialog.DoMapping.SchemaNameNotProvided.Title")); + BaseMessages.getString( + PKG, "SchemaMappingDialog.DoMapping.SchemaNameNotProvided.Message")); + mb.setText( + BaseMessages.getString(PKG, "SchemaMappingDialog.DoMapping.SchemaNameNotProvided.Title")); mb.open(); } } @@ -575,7 +576,8 @@ private void getInfo() { (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); if (input.getMappingFieldset() != null) input.getMappingFieldset().clear(); - ArrayList staticFieldset = (ArrayList) schemaDefinition.getFieldDefinitions(); + ArrayList staticFieldset = + (ArrayList) schemaDefinition.getFieldDefinitions(); for (int i = 0; i < staticFieldset.size(); i++) { SchemaFieldDefinition sfItem = staticFieldset.get(i); if (smfMap.get(sfItem.getName()) != null) diff --git a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingMeta.java b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingMeta.java index fd448165233..ca6fb7e3ac0 100644 --- a/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingMeta.java +++ b/plugins/transforms/schemamapping/src/main/java/org/apache/hop/pipeline/transforms/schemamapping/SchemaMappingMeta.java @@ -32,7 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.staticschema.metadata.SchemaDefinition; -import org.apache.hop.staticschema.metadata.SchemaFieldDefinition; import org.apache.hop.staticschema.util.SchemaDefinitionUtil; @Transform( @@ -98,7 +97,7 @@ public void getFields( try { IRowMeta selectedSchemaRowMeta = new RowMeta(); - for (int i=0; i> languageFactoryMap = new ConcurrentSkipListMap<>(); + private static final Map> languageFactoryMap = + new ConcurrentSkipListMap<>(); private static List engineFactories = null; - private ScriptUtils(){ + private ScriptUtils() { scriptEngineManager = getScriptEngineManager(); List scriptLanguageNames = getScriptLanguageNames(); - for(String scriptLanguageName : scriptLanguageNames){ + for (String scriptLanguageName : scriptLanguageNames) { createNewScriptEngine(scriptLanguageName); } populateEngineFactoryMap(); } - public static ScriptUtils getInstance(){ - if(instance == null){ + public static ScriptUtils getInstance() { + if (instance == null) { instance = new ScriptUtils(); } return instance; @@ -134,7 +135,7 @@ private static void populateEngineFactoryMap() { } } - public ScriptEngine getScriptEngineByName(String scriptLanguegeName){ + public ScriptEngine getScriptEngineByName(String scriptLanguegeName) { return scriptEngineManager.getEngineByName(scriptLanguegeName); } } diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectMetadataChange.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectMetadataChange.java index 12ebda024b9..d87d8ddcc52 100644 --- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectMetadataChange.java +++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectMetadataChange.java @@ -32,22 +32,29 @@ public class SelectMetadataChange implements Cloneable { /** Fields of which we want to change the meta data */ @Injection(name = "META_NAME", group = "METAS") private String name; + /** Meta: new name of field */ @Injection(name = "META_RENAME", group = "METAS") private String rename; + /** Meta: new Value type for this field or TYPE_NONE if no change needed! */ private int type; + /** Meta: new length of field */ @Injection(name = "META_LENGTH", group = "METAS") private int length = -1; + /** Meta: new precision of field (for numbers) */ @Injection(name = "META_PRECISION", group = "METAS") private int precision = -1; + /** Meta: the storage type, NORMAL or BINARY_STRING */ private int storageType; + /** The conversion metadata if any conversion needs to take place */ @Injection(name = "META_CONVERSION_MASK", group = "METAS") private String conversionMask; + /** Treat the date format as lenient */ @Injection(name = "META_DATE_FORMAT_LENIENT", group = "METAS") private boolean dateFormatLenient; @@ -63,15 +70,19 @@ public class SelectMetadataChange implements Cloneable { /** Treat string to number format as lenient */ @Injection(name = "META_LENIENT_STRING_TO_NUMBER", group = "METAS") private boolean lenientStringToNumber; + /** The decimal symbol for number conversions */ @Injection(name = "META_DECIMAL", group = "METAS") private String decimalSymbol; + /** The grouping symbol for number conversions */ @Injection(name = "META_GROUPING", group = "METAS") private String groupingSymbol; + /** The currency symbol for number conversions */ @Injection(name = "META_CURRENCY", group = "METAS") private String currencySymbol; + /** The encoding to use when decoding binary data to Strings */ @Injection(name = "META_ENCODING", group = "METAS") private String encoding; @@ -171,32 +182,44 @@ public SelectMetadataChange clone() { } } - /** @return the name */ + /** + * @return the name + */ public String getName() { return name; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setName(String name) { this.name = name; } - /** @return the rename */ + /** + * @return the rename + */ public String getRename() { return rename; } - /** @param rename the rename to set */ + /** + * @param rename the rename to set + */ public void setRename(String rename) { this.rename = rename; } - /** @return the type */ + /** + * @return the type + */ public int getType() { return type; } - /** @param type the type to set */ + /** + * @param type the type to set + */ public void setType(int type) { this.type = type; } @@ -206,32 +229,44 @@ public void setType(String value) { type = ValueMetaFactory.getIdForValueMeta(value); } - /** @return the length */ + /** + * @return the length + */ public int getLength() { return length; } - /** @param length the length to set */ + /** + * @param length the length to set + */ public void setLength(int length) { this.length = length; } - /** @return the precision */ + /** + * @return the precision + */ public int getPrecision() { return precision; } - /** @param precision the precision to set */ + /** + * @param precision the precision to set + */ public void setPrecision(int precision) { this.precision = precision; } - /** @return the storageType */ + /** + * @return the storageType + */ public int getStorageType() { return storageType; } - /** @param storageType the storageType to set */ + /** + * @param storageType the storageType to set + */ public void setStorageType(int storageType) { this.storageType = storageType; } @@ -241,92 +276,128 @@ public void setStorageType(String storageType) { this.storageType = ValueMetaBase.getStorageType(storageType); } - /** @return the conversionMask */ + /** + * @return the conversionMask + */ public String getConversionMask() { return conversionMask; } - /** @param conversionMask the conversionMask to set */ + /** + * @param conversionMask the conversionMask to set + */ public void setConversionMask(String conversionMask) { this.conversionMask = conversionMask; } - /** @return whether date conversion from string is lenient or not */ + /** + * @return whether date conversion from string is lenient or not + */ public boolean isDateFormatLenient() { return dateFormatLenient; } - /** @param dateFormatLenient whether date conversion from string is lenient or not */ + /** + * @param dateFormatLenient whether date conversion from string is lenient or not + */ public void setDateFormatLenient(boolean dateFormatLenient) { this.dateFormatLenient = dateFormatLenient; } - /** @return the decimalSymbol */ + /** + * @return the decimalSymbol + */ public String getDecimalSymbol() { return decimalSymbol; } - /** @param decimalSymbol the decimalSymbol to set */ + /** + * @param decimalSymbol the decimalSymbol to set + */ public void setDecimalSymbol(String decimalSymbol) { this.decimalSymbol = decimalSymbol; } - /** @return the groupingSymbol */ + /** + * @return the groupingSymbol + */ public String getGroupingSymbol() { return groupingSymbol; } - /** @param groupingSymbol the groupingSymbol to set */ + /** + * @param groupingSymbol the groupingSymbol to set + */ public void setGroupingSymbol(String groupingSymbol) { this.groupingSymbol = groupingSymbol; } - /** @return the currencySymbol */ + /** + * @return the currencySymbol + */ public String getCurrencySymbol() { return currencySymbol; } - /** @param currencySymbol the currencySymbol to set */ + /** + * @param currencySymbol the currencySymbol to set + */ public void setCurrencySymbol(String currencySymbol) { this.currencySymbol = currencySymbol; } - /** @return the encoding to use when decoding binary data to strings */ + /** + * @return the encoding to use when decoding binary data to strings + */ public String getEncoding() { return encoding; } - /** @param encoding the encoding to use when decoding binary data to strings */ + /** + * @param encoding the encoding to use when decoding binary data to strings + */ public void setEncoding(String encoding) { this.encoding = encoding; } - /** @return the lenientStringToNumber */ + /** + * @return the lenientStringToNumber + */ public boolean isLenientStringToNumber() { return lenientStringToNumber; } - /** @param lenientStringToNumber the lenientStringToNumber to set */ + /** + * @param lenientStringToNumber the lenientStringToNumber to set + */ public void setLenientStringToNumber(boolean lenientStringToNumber) { this.lenientStringToNumber = lenientStringToNumber; } - /** @return the dateFormatLocale */ + /** + * @return the dateFormatLocale + */ public String getDateFormatLocale() { return dateFormatLocale; } - /** @param dateFormatLocale the dateFormatLocale to set */ + /** + * @param dateFormatLocale the dateFormatLocale to set + */ public void setDateFormatLocale(String dateFormatLocale) { this.dateFormatLocale = dateFormatLocale; } - /** @return the dateFormatTimeZone */ + /** + * @return the dateFormatTimeZone + */ public String getDateFormatTimeZone() { return dateFormatTimeZone; } - /** @param dateFormatTimeZone the dateFormatTimeZone to set */ + /** + * @param dateFormatTimeZone the dateFormatTimeZone to set + */ public void setDateFormatTimeZone(String dateFormatTimeZone) { this.dateFormatTimeZone = dateFormatTimeZone; } diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues.java index aa0ec475c16..895482eea0d 100644 --- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues.java +++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues.java @@ -18,6 +18,10 @@ package org.apache.hop.pipeline.transforms.selectvalues; import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopConversionException; import org.apache.hop.core.exception.HopException; @@ -33,11 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - /** Select, re-order, remove or change the meta-data of the fields in the inputstreams. */ public class SelectValues extends BaseTransform { diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesAttr.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesAttr.java index a207d3c94ba..095f36e850d 100644 --- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesAttr.java +++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesAttr.java @@ -117,30 +117,40 @@ public String getKey() { return repCode; } - /** @return the xmlCode */ + /** + * @return the xmlCode + */ @Override public String getXmlCode() { return xmlCode; } - /** @return the repCode */ + /** + * @return the repCode + */ public String getRepCode() { return repCode; } - /** @return the description */ + /** + * @return the description + */ @Override public String getDescription() { return description; } - /** @return the tooltip */ + /** + * @return the tooltip + */ @Override public String getTooltip() { return tooltip; } - /** @return the type */ + /** + * @return the type + */ @Override public int getType() { return type; diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesData.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesData.java index 9deee213408..c289a332015 100644 --- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesData.java +++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesData.java @@ -42,7 +42,7 @@ public class SelectValuesData extends BaseTransformData implements ITransformDat public boolean select; // "normal" selection of fields. public boolean deselect; // de-select mode public boolean metadata; // change meta-data (rename & change length/precision) - + public SelectValuesData() { super(); } diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java index 3c64057b48a..84f4daef96e 100644 --- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java +++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -59,15 +67,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class SelectValuesDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SelectValuesMeta.class; // For Translator @@ -707,7 +706,6 @@ private void ok() { input.allocate(nrFields, nrremove, nrmeta); - for (int i = 0; i < nrFields; i++) { TableItem item = wFields.getNonEmpty(i); input.getSelectFields()[i].setName(item.getText(1)); @@ -961,7 +959,7 @@ protected void setComboBoxes() { String[] fieldNames = entries.toArray(new String[entries.size()]); - if ( PropsUi.getInstance().isSortFieldByName() ) { + if (PropsUi.getInstance().isSortFieldByName()) { Const.sortStrings(fieldNames); } diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMeta.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMeta.java index 3de5674ff03..7b5f3b0551b 100644 --- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMeta.java +++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -44,18 +48,11 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - @Transform( id = "SelectValues", image = "selectvalues.svg", - name = - "i18n:org.apache.hop.pipeline.transforms.selectvalues:SelectValues.Name", - description = - "i18n:org.apache.hop.pipeline.transforms.selectvalues:SelectValues.Description", + name = "i18n:org.apache.hop.pipeline.transforms.selectvalues:SelectValues.Name", + description = "i18n:org.apache.hop.pipeline.transforms.selectvalues:SelectValues.Description", categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::SelectValuesMeta.keyword", documentationUrl = "/pipeline/transforms/selectvalues.html") @@ -89,17 +86,23 @@ public SelectValuesMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the deleteName. */ + /** + * @return Returns the deleteName. + */ public String[] getDeleteName() { return deleteName; } - /** @param deleteName The deleteName to set. */ + /** + * @param deleteName The deleteName to set. + */ public void setDeleteName(String[] deleteName) { this.deleteName = deleteName == null ? new String[0] : deleteName; } - /** @param selectName The selectName to set. */ + /** + * @param selectName The selectName to set. + */ public void setSelectName(String[] selectName) { resizeSelectFields(selectName.length); for (int i = 0; i < selectFields.length; i++) { @@ -115,7 +118,9 @@ public String[] getSelectName() { return selectName; } - /** @param selectRename The selectRename to set. */ + /** + * @param selectRename The selectRename to set. + */ public void setSelectRename(String[] selectRename) { if (selectRename.length > selectFields.length) { resizeSelectFields(selectRename.length); @@ -137,7 +142,9 @@ public String[] getSelectRename() { return selectRename; } - /** @param selectLength The selectLength to set. */ + /** + * @param selectLength The selectLength to set. + */ public void setSelectLength(int[] selectLength) { if (selectLength.length > selectFields.length) { resizeSelectFields(selectLength.length); @@ -159,7 +166,9 @@ public int[] getSelectLength() { return selectLength; } - /** @param selectPrecision The selectPrecision to set. */ + /** + * @param selectPrecision The selectPrecision to set. + */ public void setSelectPrecision(int[] selectPrecision) { if (selectPrecision.length > selectFields.length) { resizeSelectFields(selectPrecision.length); @@ -710,23 +719,31 @@ public void check( } } - /** @return the selectingAndSortingUnspecifiedFields */ + /** + * @return the selectingAndSortingUnspecifiedFields + */ public boolean isSelectingAndSortingUnspecifiedFields() { return selectingAndSortingUnspecifiedFields; } - /** @param selectingAndSortingUnspecifiedFields the selectingAndSortingUnspecifiedFields to set */ + /** + * @param selectingAndSortingUnspecifiedFields the selectingAndSortingUnspecifiedFields to set + */ public void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields) { this.selectingAndSortingUnspecifiedFields = selectingAndSortingUnspecifiedFields; } - /** @return the meta */ + /** + * @return the meta + */ public SelectMetadataChange[] getMeta() { return meta; } - /** @param meta the meta to set */ + /** + * @param meta the meta to set + */ public void setMeta(SelectMetadataChange[] meta) { this.meta = meta == null ? new SelectMetadataChange[0] : meta; } diff --git a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaInjectionTest.java b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaInjectionTest.java index 9bd678483e5..d0500f8d3e0 100644 --- a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaInjectionTest.java +++ b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaInjectionTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaString; @@ -25,8 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class SelectValuesMetaInjectionTest extends BaseMetadataInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaTest.java b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaTest.java index af28e4d5929..002804f7968 100644 --- a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaTest.java +++ b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -29,15 +37,6 @@ import org.junit.Ignore; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class SelectValuesMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesTest.java b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesTest.java index d8650d01f6a..80140093b98 100644 --- a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesTest.java +++ b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesTest.java @@ -17,6 +17,19 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.math.BigDecimal; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopConversionException; @@ -40,20 +53,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.math.BigDecimal; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SelectValuesTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues_LocaleHandling_Test.java b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues_LocaleHandling_Test.java index 527cd1fe12e..1709181df18 100644 --- a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues_LocaleHandling_Test.java +++ b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValues_LocaleHandling_Test.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.Calendar; +import java.util.Collections; +import java.util.List; +import java.util.Locale; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; @@ -33,15 +41,6 @@ import org.junit.Ignore; import org.junit.Test; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - /** Note: In Europe (e.g. in UK), week starts on Monday. In USA, it starts on Sunday. */ public class SelectValues_LocaleHandling_Test { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/TransformMockUtil.java b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/TransformMockUtil.java index 852407455de..d253f5310dc 100644 --- a/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/TransformMockUtil.java +++ b/plugins/transforms/selectvalues/src/test/java/org/apache/hop/pipeline/transforms/selectvalues/TransformMockUtil.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.selectvalues; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -27,11 +31,6 @@ import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.mockito.ArgumentMatchers; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -62,8 +61,12 @@ TransformMockHelper getTransformMockHelper( public static T getTransform(Class klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor kons = klass.getConstructor( TransformMeta.class, @@ -83,8 +86,12 @@ T getTransform( Class transformMetaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper(transformMetaClass, dataClass, transformName)); diff --git a/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusData.java b/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusData.java index 8cad62cab89..4182c4fee65 100644 --- a/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusData.java +++ b/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusData.java @@ -23,7 +23,8 @@ public class GetServerStatusData extends BaseTransformData { public IRowMeta outputRowMeta; public int serverFieldIndex; + public GetServerStatusData() { - super(); + super(); } } diff --git a/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusMeta.java b/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusMeta.java index b708dba53db..88ac5d482e3 100644 --- a/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusMeta.java +++ b/plugins/transforms/serverstatus/src/main/java/org/apache/hop/pipeline/transforms/serverstatus/GetServerStatusMeta.java @@ -189,7 +189,9 @@ public String getServerField() { return serverField; } - /** @param serverField The serverField to set */ + /** + * @param serverField The serverField to set + */ public void setServerField(String serverField) { this.serverField = serverField; } @@ -203,7 +205,9 @@ public String getErrorMessageField() { return errorMessageField; } - /** @param errorMessageField The errorMessageField to set */ + /** + * @param errorMessageField The errorMessageField to set + */ public void setErrorMessageField(String errorMessageField) { this.errorMessageField = errorMessageField; } @@ -217,7 +221,9 @@ public String getStatusDescriptionField() { return statusDescriptionField; } - /** @param statusDescriptionField The statusDescriptionField to set */ + /** + * @param statusDescriptionField The statusDescriptionField to set + */ public void setStatusDescriptionField(String statusDescriptionField) { this.statusDescriptionField = statusDescriptionField; } @@ -231,7 +237,9 @@ public String getServerLoadField() { return serverLoadField; } - /** @param serverLoadField The serverLoadField to set */ + /** + * @param serverLoadField The serverLoadField to set + */ public void setServerLoadField(String serverLoadField) { this.serverLoadField = serverLoadField; } @@ -245,7 +253,9 @@ public String getMemoryFreeField() { return memoryFreeField; } - /** @param memoryFreeField The memoryFreeField to set */ + /** + * @param memoryFreeField The memoryFreeField to set + */ public void setMemoryFreeField(String memoryFreeField) { this.memoryFreeField = memoryFreeField; } @@ -259,7 +269,9 @@ public String getMemoryTotalField() { return memoryTotalField; } - /** @param memoryTotalField The memoryTotalField to set */ + /** + * @param memoryTotalField The memoryTotalField to set + */ public void setMemoryTotalField(String memoryTotalField) { this.memoryTotalField = memoryTotalField; } @@ -273,7 +285,9 @@ public String getCpuCoresField() { return cpuCoresField; } - /** @param cpuCoresField The cpuCoresField to set */ + /** + * @param cpuCoresField The cpuCoresField to set + */ public void setCpuCoresField(String cpuCoresField) { this.cpuCoresField = cpuCoresField; } @@ -287,7 +301,9 @@ public String getCpuProcessTimeField() { return cpuProcessTimeField; } - /** @param cpuProcessTimeField The cpuProcessTimeField to set */ + /** + * @param cpuProcessTimeField The cpuProcessTimeField to set + */ public void setCpuProcessTimeField(String cpuProcessTimeField) { this.cpuProcessTimeField = cpuProcessTimeField; } @@ -301,7 +317,9 @@ public String getOsNameField() { return osNameField; } - /** @param osNameField The osNameField to set */ + /** + * @param osNameField The osNameField to set + */ public void setOsNameField(String osNameField) { this.osNameField = osNameField; } @@ -315,7 +333,9 @@ public String getOsVersionField() { return osVersionField; } - /** @param osVersionField The osVersionField to set */ + /** + * @param osVersionField The osVersionField to set + */ public void setOsVersionField(String osVersionField) { this.osVersionField = osVersionField; } @@ -329,7 +349,9 @@ public String getOsArchitectureField() { return osArchitectureField; } - /** @param osArchitectureField The osArchitectureField to set */ + /** + * @param osArchitectureField The osArchitectureField to set + */ public void setOsArchitectureField(String osArchitectureField) { this.osArchitectureField = osArchitectureField; } @@ -343,7 +365,9 @@ public String getActivePipelinesField() { return activePipelinesField; } - /** @param activePipelinesField The activePipelinesField to set */ + /** + * @param activePipelinesField The activePipelinesField to set + */ public void setActivePipelinesField(String activePipelinesField) { this.activePipelinesField = activePipelinesField; } @@ -357,7 +381,9 @@ public String getActiveWorkflowsField() { return activeWorkflowsField; } - /** @param activeWorkflowsField The activeWorkflowsField to set */ + /** + * @param activeWorkflowsField The activeWorkflowsField to set + */ public void setActiveWorkflowsField(String activeWorkflowsField) { this.activeWorkflowsField = activeWorkflowsField; } @@ -371,7 +397,9 @@ public String getAvailableField() { return availableField; } - /** @param availableField The availableField to set */ + /** + * @param availableField The availableField to set + */ public void setAvailableField(String availableField) { this.availableField = availableField; } @@ -385,7 +413,9 @@ public String getResponseNsField() { return responseNsField; } - /** @param responseNsField The responseNsField to set */ + /** + * @param responseNsField The responseNsField to set + */ public void setResponseNsField(String responseNsField) { this.responseNsField = responseNsField; } diff --git a/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstant.java b/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstant.java index 12f5e5abdca..5b6dde0b06b 100644 --- a/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstant.java +++ b/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstant.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.setvalueconstant; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.StringUtil; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** Replace Field value by a constant value. */ public class SetValueConstant extends BaseTransform { diff --git a/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantDialog.java b/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantDialog.java index eba166d54e7..3fdfbb807bf 100644 --- a/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantDialog.java +++ b/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.setvalueconstant; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -47,9 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class SetValueConstantDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SetValueConstantMeta.class; // For Translator @@ -302,7 +301,6 @@ private void ok() { int count = wFields.nrNonEmpty(); List fields = new ArrayList<>(); - for (int i = 0; i < count; i++) { TableItem ti = wFields.getNonEmpty(i); SetValueConstantMeta.Field field = new SetValueConstantMeta.Field(); diff --git a/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMeta.java b/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMeta.java index 926b6860b58..1fb4ff52c49 100644 --- a/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMeta.java +++ b/plugins/transforms/setvalueconstant/src/main/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.setvalueconstant; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - @InjectionSupported( localizationPrefix = "SetValueConstant.Injection.", groups = {"FIELDS", "OPTIONS"}) @@ -50,7 +49,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::SetValueConstantMeta.keyword", documentationUrl = "/pipeline/transforms/setvalueconstant.html") -public class SetValueConstantMeta extends BaseTransformMeta { +public class SetValueConstantMeta + extends BaseTransformMeta { private static final Class PKG = SetValueConstantMeta.class; // For Translator @InjectionDeep private List fields = new ArrayList<>(); diff --git a/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMetaTest.java b/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMetaTest.java index 88f14fca6d5..c78defabab9 100644 --- a/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMetaTest.java +++ b/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantMetaTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.setvalueconstant; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -29,13 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class SetValueConstantMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); LoadSaveTester loadSaveTester; diff --git a/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantTest.java b/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantTest.java index 8d2bc74cfda..aaf84514603 100644 --- a/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantTest.java +++ b/plugins/transforms/setvalueconstant/src/test/java/org/apache/hop/pipeline/transforms/setvalueconstant/SetValueConstantTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.setvalueconstant; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.Collections; import junit.framework.Assert; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.core.row.IValueMeta; @@ -27,13 +33,6 @@ import org.junit.Before; import org.junit.Test; -import java.lang.reflect.Method; -import java.util.Collections; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - /** * Tests for "Set field value to a constant" transform * diff --git a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetField.java b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetField.java index e8eb8cc84f5..72f2b81b0f9 100644 --- a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetField.java +++ b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetField.java @@ -33,8 +33,7 @@ public class SetField implements Cloneable { injectionKeyDescription = "SetValueField.Injection.SetField.ReplaceByField") private String replaceByField; - public SetField() { - } + public SetField() {} public SetField(SetField cloned) { this.fieldName = cloned.fieldName; @@ -45,7 +44,7 @@ public SetField(String name, String replaceBy) { this.fieldName = name; this.replaceByField = replaceBy; } - + @Override public Object clone() { return new SetField(this); @@ -66,4 +65,4 @@ public String getReplaceByField() { public void setReplaceByField(final String field) { this.replaceByField = field; } -} \ No newline at end of file +} diff --git a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueField.java b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueField.java index f395a18f0f2..7c101cf59bb 100644 --- a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueField.java +++ b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueField.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.setvaluefield; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** Set value field with another value field. */ public class SetValueField extends BaseTransform { private static final Class PKG = SetValueFieldMeta.class; // For Translator diff --git a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldDialog.java b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldDialog.java index 3a64c8508d1..0b753bcf0c0 100644 --- a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldDialog.java +++ b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldDialog.java @@ -238,7 +238,6 @@ private void ok() { int count = wFields.nrNonEmpty(); - List fields = new ArrayList<>(count); for (int i = 0; i < count; i++) { TableItem item = wFields.getNonEmpty(i); @@ -248,7 +247,7 @@ private void ok() { fields.add(field); } input.setFields(fields); - + dispose(); } diff --git a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMeta.java b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMeta.java index 83c90a9689e..9670d5730a9 100644 --- a/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMeta.java +++ b/plugins/transforms/setvaluefield/src/main/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.setvaluefield; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -30,9 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "SetValueField", image = "setvaluefield.svg", @@ -43,13 +42,13 @@ documentationUrl = "/pipeline/transforms/setvaluefield.html") public class SetValueFieldMeta extends BaseTransformMeta { private static final Class PKG = SetValueFieldMeta.class; // For Translator - + @HopMetadataProperty( key = "field", groupKey = "fields", injectionGroupDescription = "SetValueField.Injection.SetFields") private List fields = new ArrayList<>(); - + public SetValueFieldMeta() { super(); } @@ -60,7 +59,7 @@ public SetValueFieldMeta(SetValueFieldMeta clone) { fields.add(new SetField(field)); } } - + public List getFields() { return fields; } @@ -126,7 +125,7 @@ public void check( } remarks.add(cr); - if (fields==null || fields.isEmpty()) { + if (fields == null || fields.isEmpty()) { cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, @@ -135,7 +134,7 @@ public void check( remarks.add(cr); } else { int i = 1; - for (SetField field:fields) { + for (SetField field : fields) { if (Utils.isEmpty(field.getReplaceByField())) { cr = new CheckResult( diff --git a/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetFieldLoadSaveValidator.java b/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetFieldLoadSaveValidator.java index b6ac3fe6d46..a492fdd7f64 100644 --- a/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetFieldLoadSaveValidator.java +++ b/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetFieldLoadSaveValidator.java @@ -16,19 +16,17 @@ */ package org.apache.hop.pipeline.transforms.setvaluefield; -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; - import java.util.Random; import java.util.UUID; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; -public class SetFieldLoadSaveValidator implements IFieldLoadSaveValidator { +public class SetFieldLoadSaveValidator implements IFieldLoadSaveValidator { final Random rand = new Random(); @Override public SetField getTestObject() { - SetField field = - new SetField(UUID.randomUUID().toString(), UUID.randomUUID().toString()); + SetField field = new SetField(UUID.randomUUID().toString(), UUID.randomUUID().toString()); return field; } diff --git a/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMetaTest.java b/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMetaTest.java index 0c1b7707a6c..b8c501f88d0 100644 --- a/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMetaTest.java +++ b/plugins/transforms/setvaluefield/src/test/java/org/apache/hop/pipeline/transforms/setvaluefield/SetValueFieldMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.setvaluefield; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -29,11 +33,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SetValueFieldMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = SetValueFieldMeta.class; @@ -49,7 +48,7 @@ public void setUpLoadSave() throws Exception { Map setterMap = new HashMap<>(); Map> attrValidatorMap = new HashMap<>(); attrValidatorMap.put("fields", new ListLoadSaveValidator<>(new SetFieldLoadSaveValidator(), 5)); - + Map> typeValidatorMap = new HashMap<>(); loadSaveTester = diff --git a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariable.java b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariable.java index bd8250b2254..e4ae6953ac9 100644 --- a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariable.java +++ b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariable.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.setvariable; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IValueMeta; @@ -31,8 +32,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.List; - /** Convert Values in a certain fields to other values */ public class SetVariable extends BaseTransform { diff --git a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableDialog.java b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableDialog.java index 119ef3a8a23..55066fcf077 100644 --- a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableDialog.java +++ b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.setvariable; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -47,9 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class SetVariableDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SetVariableMeta.class; // For Translator @@ -282,7 +281,6 @@ private void ok() { int count = wFields.nrNonEmpty(); - input.getVariables().clear(); for (int i = 0; i < count; i++) { TableItem item = wFields.getNonEmpty(i); diff --git a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableMeta.java b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableMeta.java index e8314eceb7f..80d79467ded 100644 --- a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableMeta.java +++ b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariableMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.setvariable; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /** Sets environment variables based on content in certain fields of a single input row. */ @Transform( id = "SetVariable", diff --git a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/VariableItem.java b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/VariableItem.java index 84433463d29..16d940b591e 100644 --- a/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/VariableItem.java +++ b/plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/VariableItem.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.setvariable; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.Objects; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.metadata.api.HopMetadataProperty; public class VariableItem { @@ -33,7 +32,10 @@ public class VariableItem { public static final String VARIABLE_TYPE_JVM = "JVM"; private static final String[] variableTypeCodes = { - VARIABLE_TYPE_JVM, VARIABLE_TYPE_PARENT_WORKFLOW, VARIABLE_TYPE_GRAND_PARENT_WORKFLOW, VARIABLE_TYPE_ROOT_WORKFLOW, + VARIABLE_TYPE_JVM, + VARIABLE_TYPE_PARENT_WORKFLOW, + VARIABLE_TYPE_GRAND_PARENT_WORKFLOW, + VARIABLE_TYPE_ROOT_WORKFLOW, }; private static final String[] variableTypeDescriptions = { diff --git a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoader.java b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoader.java index 06d96712300..51476ee54dd 100644 --- a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoader.java +++ b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoader.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.snowflake.bulkloader; +import java.io.BufferedOutputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -41,15 +49,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedOutputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - /** Bulk loads data to Snowflake */ public class SnowflakeBulkLoader extends BaseTransform { @@ -188,7 +187,8 @@ private void getDbFields() throws HopException { sql += resolve(meta.getTargetTable()); logDetailed("Executing SQL " + sql); try { - try (ResultSet resultSet = data.db.openQuery(sql, null, null, ResultSet.FETCH_FORWARD, false)) { + try (ResultSet resultSet = + data.db.openQuery(sql, null, null, ResultSet.FETCH_FORWARD, false)) { IRowMeta rowMeta = data.db.getReturnRowMeta(); int nameField = rowMeta.indexOfValue("NAME"); @@ -239,33 +239,35 @@ private void loadDatabase() throws HopDatabaseException, HopFileException, HopVa + ";"; logDebug("Executing SQL " + sql); - try (ResultSet putResultSet = data.db.openQuery(sql, null, null, ResultSet.FETCH_FORWARD, false)) { - IRowMeta putRowMeta = data.db.getReturnRowMeta(); - Object[] putRow = data.db.getRow(putResultSet); - logDebug("=========================Put File Results======================"); - int fileNum = 0; - while (putRow != null) { - logDebug("------------------------ File " + fileNum + "--------------------------"); - for (int i = 0; i < putRowMeta.getFieldNames().length; i++) { - logDebug(putRowMeta.getFieldNames()[i] + " = " + putRowMeta.getString(putRow, i)); - if (putRowMeta.getFieldNames()[i].equalsIgnoreCase("status") - && putRowMeta.getString(putRow, i).equalsIgnoreCase("ERROR")) { - throw new HopDatabaseException( - "Error putting file to Snowflake stage \n" - + putRowMeta.getString(putRow, "message", "")); - } + try (ResultSet putResultSet = + data.db.openQuery(sql, null, null, ResultSet.FETCH_FORWARD, false)) { + IRowMeta putRowMeta = data.db.getReturnRowMeta(); + Object[] putRow = data.db.getRow(putResultSet); + logDebug("=========================Put File Results======================"); + int fileNum = 0; + while (putRow != null) { + logDebug("------------------------ File " + fileNum + "--------------------------"); + for (int i = 0; i < putRowMeta.getFieldNames().length; i++) { + logDebug(putRowMeta.getFieldNames()[i] + " = " + putRowMeta.getString(putRow, i)); + if (putRowMeta.getFieldNames()[i].equalsIgnoreCase("status") + && putRowMeta.getString(putRow, i).equalsIgnoreCase("ERROR")) { + throw new HopDatabaseException( + "Error putting file to Snowflake stage \n" + + putRowMeta.getString(putRow, "message", "")); } - fileNum++; + } + fileNum++; - putRow = data.db.getRow(putResultSet); + putRow = data.db.getRow(putResultSet); } data.db.closeQuery(putResultSet); - } catch(SQLException exception) { + } catch (SQLException exception) { throw new HopDatabaseException(exception); } String copySQL = meta.getCopyStatement(this, data.getPreviouslyOpenedFiles()); logDebug("Executing SQL " + copySQL); - try (ResultSet resultSet = data.db.openQuery(copySQL, null, null, ResultSet.FETCH_FORWARD, false)) { + try (ResultSet resultSet = + data.db.openQuery(copySQL, null, null, ResultSet.FETCH_FORWARD, false)) { IRowMeta rowMeta = data.db.getReturnRowMeta(); Object[] row = data.db.getRow(resultSet); @@ -295,7 +297,7 @@ private void loadDatabase() throws HopDatabaseException, HopFileException, HopVa data.db.closeQuery(resultSet); setLinesOutput(rowsLoaded); setLinesRejected(rowsError); - } catch(SQLException exception) { + } catch (SQLException exception) { throw new HopDatabaseException(exception); } data.db.execStatement("commit"); @@ -773,7 +775,8 @@ public void dispose() { setErrors(1); } - if (meta.isRemoveFiles() || !Boolean.parseBoolean(resolve(SnowflakeBulkLoaderMeta.DEBUG_MODE_VAR))) { + if (meta.isRemoveFiles() + || !Boolean.parseBoolean(resolve(SnowflakeBulkLoaderMeta.DEBUG_MODE_VAR))) { for (String filename : data.previouslyOpenedFiles) { try { HopVfs.getFileObject(filename).delete(); diff --git a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderData.java b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderData.java index 52b5d727adf..3c541e4f428 100644 --- a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderData.java +++ b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderData.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.snowflake.bulkloader; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.hop.core.compress.CompressionOutputStream; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -24,11 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - public class SnowflakeBulkLoaderData extends BaseTransformData implements ITransformData { // When the meta.splitSize is exceeded the file being written is closed and a new file is created. diff --git a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderDialog.java b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderDialog.java index 4930264db30..1a9f80a34b7 100644 --- a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderDialog.java +++ b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderDialog.java @@ -258,7 +258,7 @@ public String open() { display = parent.getDisplay(); int margin = PropsUi.getMargin(); - + shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); PropsUi.setLook(shell); setShellImage(shell, input); @@ -486,7 +486,8 @@ public void focusGained(FocusEvent focusEvent) { sql += " in " + variables.resolve(wSchema.getText()); } - try (ResultSet resultSet = db.openQuery(sql, null, null, ResultSet.FETCH_FORWARD, false)) { + try (ResultSet resultSet = + db.openQuery(sql, null, null, ResultSet.FETCH_FORWARD, false)) { IRowMeta rowMeta = db.getReturnRowMeta(); Object[] row = db.getRow(resultSet); int nameField = rowMeta.indexOfValue("NAME"); @@ -542,9 +543,11 @@ public void focusGained(FocusEvent focusEvent) { fdWorkDirectory.top = new FormAttachment(wStageName, margin); fdWorkDirectory.right = new FormAttachment(wbWorkDirectory, -margin); wWorkDirectory.setLayoutData(fdWorkDirectory); - wbWorkDirectory.addListener(SWT.Selection, e-> { - BaseDialog.presentDirectoryDialog(shell, wWorkDirectory, variables); - }); + wbWorkDirectory.addListener( + SWT.Selection, + e -> { + BaseDialog.presentDirectoryDialog(shell, wWorkDirectory, variables); + }); // Whenever something changes, set the tooltip to the expanded version: wWorkDirectory.addModifyListener( @@ -1095,7 +1098,7 @@ public void focusGained(FocusEvent focusEvent) { fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(wCancel, -2 * margin); wTabFolder.setLayoutData(fdTabFolder); - + wbTable.addListener(SWT.Selection, e -> getTableName()); wbSchema.addListener(SWT.Selection, e -> getSchemaNames()); @@ -1564,7 +1567,7 @@ private void setTableFieldCombo() { if (!StringUtils.isEmpty(tableName)) { DatabaseMeta databaseMeta = pipelineMeta.findDatabase(connectionName, variables); if (databaseMeta != null) { - try ( Database db = new Database(loggingObject, variables, databaseMeta)) { + try (Database db = new Database(loggingObject, variables, databaseMeta)) { db.connect(); String schemaTable = diff --git a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderMeta.java b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderMeta.java index 68f928d4567..0ed9ebc13b4 100644 --- a/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderMeta.java +++ b/plugins/transforms/snowflake/src/main/java/org/apache/hop/pipeline/transforms/snowflake/bulkloader/SnowflakeBulkLoaderMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.snowflake.bulkloader; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -41,11 +45,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - @Transform( id = "SnowflakeBulkLoader", image = "snowflake.svg", diff --git a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRows.java b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRows.java index 463b22d78f0..1f1639ae70a 100644 --- a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRows.java +++ b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRows.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.sort; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -33,21 +47,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.SocketTimeoutException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - /** Sort the rows in the input-streams based on certain criteria */ public class SortRows extends BaseTransform { @@ -633,8 +632,7 @@ void quickSort(List elements) { } @Override - public void startBundle() throws HopException { - } + public void startBundle() throws HopException {} /** * Calling this method will alert the transform that we finished passing records to the transform. diff --git a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsData.java b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsData.java index eb4b8d534f8..d505bc26628 100644 --- a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsData.java +++ b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsData.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.sort; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.DataInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.zip.GZIPInputStream; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class SortRowsData extends BaseTransformData implements ITransformData { public List files; @@ -51,7 +50,7 @@ public class SortRowsData extends BaseTransformData implements ITransformData { public int[] convertKeysToNative; public boolean convertAnyKeysToNative; - Comparator comparator; + Comparator comparator; Comparator rowComparator; public int freeCounter; diff --git a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsDialog.java b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsDialog.java index d96b4cbfad1..670feabb063 100644 --- a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsDialog.java +++ b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.sort; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -53,9 +55,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class SortRowsDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SortRowsMeta.class; // For Translator @@ -473,7 +472,6 @@ private void ok() { input.allocate(nrFields); - for (int i = 0; i < nrFields; i++) { TableItem ti = wFields.getNonEmpty(i); input.getFieldName()[i] = ti.getText(1); diff --git a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsMeta.java b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsMeta.java index 43fb50b8e06..cf2f672db48 100644 --- a/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsMeta.java +++ b/plugins/transforms/sort/src/main/java/org/apache/hop/pipeline/transforms/sort/SortRowsMeta.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.sort; +import java.io.File; +import java.io.Serializable; +import java.text.Collator; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,13 +44,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.io.File; -import java.io.Serializable; -import java.text.Collator; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - @InjectionSupported( localizationPrefix = "SortRows.Injection.", groups = {"FIELDS"}) @@ -56,7 +55,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::SortRowsMeta.keyword", documentationUrl = "/pipeline/transforms/sort.html") -public class SortRowsMeta extends BaseTransformMeta implements Serializable { +public class SortRowsMeta extends BaseTransformMeta + implements Serializable { private static final long serialVersionUID = -9075883720765645655L; private static final Class PKG = SortRowsMeta.class; // For Translator @@ -120,42 +120,58 @@ public SortRowsMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the ascending. */ + /** + * @return Returns the ascending. + */ public boolean[] getAscending() { return ascending; } - /** @param ascending The ascending to set. */ + /** + * @param ascending The ascending to set. + */ public void setAscending(boolean[] ascending) { this.ascending = ascending; } - /** @return Returns the directory. */ + /** + * @return Returns the directory. + */ public String getDirectory() { return directory; } - /** @param directory The directory to set. */ + /** + * @param directory The directory to set. + */ public void setDirectory(String directory) { this.directory = directory; } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String[] getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String[] fieldName) { this.fieldName = fieldName; } - /** @return Returns the prefix. */ + /** + * @return Returns the prefix. + */ public String getPrefix() { return prefix; } - /** @param prefix The prefix to set. */ + /** + * @param prefix The prefix to set. + */ public void setPrefix(String prefix) { this.prefix = prefix; } @@ -463,92 +479,128 @@ public void check( } } - /** @return Returns the sortSize. */ + /** + * @return Returns the sortSize. + */ public String getSortSize() { return sortSize; } - /** @param sortSize The sortSize to set. */ + /** + * @param sortSize The sortSize to set. + */ public void setSortSize(String sortSize) { this.sortSize = sortSize; } - /** @return Returns whether temporary files should be compressed */ + /** + * @return Returns whether temporary files should be compressed + */ public boolean getCompressFiles() { return compressFiles; } - /** @param compressFiles Whether to compress temporary files created during sorting */ + /** + * @param compressFiles Whether to compress temporary files created during sorting + */ public void setCompressFiles(boolean compressFiles) { this.compressFiles = compressFiles; } - /** @return the onlyPassingUniqueRows */ + /** + * @return the onlyPassingUniqueRows + */ public boolean isOnlyPassingUniqueRows() { return onlyPassingUniqueRows; } - /** @param onlyPassingUniqueRows the onlyPassingUniqueRows to set */ + /** + * @param onlyPassingUniqueRows the onlyPassingUniqueRows to set + */ public void setOnlyPassingUniqueRows(boolean onlyPassingUniqueRows) { this.onlyPassingUniqueRows = onlyPassingUniqueRows; } - /** @return the compressFilesVariable */ + /** + * @return the compressFilesVariable + */ public String getCompressFilesVariable() { return compressFilesVariable; } - /** @param compressFilesVariable the compressFilesVariable to set */ + /** + * @param compressFilesVariable the compressFilesVariable to set + */ public void setCompressFilesVariable(String compressFilesVariable) { this.compressFilesVariable = compressFilesVariable; } - /** @return the caseSensitive */ + /** + * @return the caseSensitive + */ public boolean[] getCaseSensitive() { return caseSensitive; } - /** @param caseSensitive the caseSensitive to set */ + /** + * @param caseSensitive the caseSensitive to set + */ public void setCaseSensitive(boolean[] caseSensitive) { this.caseSensitive = caseSensitive; } - /** @return the collatorEnabled */ + /** + * @return the collatorEnabled + */ public boolean[] getCollatorEnabled() { return collatorEnabled; } - /** @param collatorEnabled the collatorEnabled to set */ + /** + * @param collatorEnabled the collatorEnabled to set + */ public void setCollatorEnabled(boolean[] collatorEnabled) { this.collatorEnabled = collatorEnabled; } - /** @return the collatorStrength */ + /** + * @return the collatorStrength + */ public int[] getCollatorStrength() { return collatorStrength; } - /** @param collatorStrength the collatorStrength to set */ + /** + * @param collatorStrength the collatorStrength to set + */ public void setCollatorStrength(int[] collatorStrength) { this.collatorStrength = collatorStrength; } - /** @return the freeMemoryLimit */ + /** + * @return the freeMemoryLimit + */ public String getFreeMemoryLimit() { return freeMemoryLimit; } - /** @param freeMemoryLimit the freeMemoryLimit to set */ + /** + * @param freeMemoryLimit the freeMemoryLimit to set + */ public void setFreeMemoryLimit(String freeMemoryLimit) { this.freeMemoryLimit = freeMemoryLimit; } - /** @return the preSortedField */ + /** + * @return the preSortedField + */ public boolean[] getPreSortedField() { return preSortedField; } - /** @param preSorted the preSorteField to set */ + /** + * @param preSorted the preSorteField to set + */ public void setPreSortedField(boolean[] preSorted) { preSortedField = preSorted; } diff --git a/plugins/transforms/sort/src/test/java/org/apache/hop/pipeline/transforms/sort/SortRowsMetaTest.java b/plugins/transforms/sort/src/test/java/org/apache/hop/pipeline/transforms/sort/SortRowsMetaTest.java index 19710d0e53e..04a7e21e9de 100644 --- a/plugins/transforms/sort/src/test/java/org/apache/hop/pipeline/transforms/sort/SortRowsMetaTest.java +++ b/plugins/transforms/sort/src/test/java/org/apache/hop/pipeline/transforms/sort/SortRowsMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.sort; +import static org.junit.Assert.assertEquals; + +import java.text.Collator; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -32,19 +40,12 @@ import org.junit.Test; import org.mockito.Mockito; -import java.text.Collator; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - public class SortRowsMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - /** @throws HopException */ + /** + * @throws HopException + */ @Test public void testRoundTrips() throws HopException { List attributes = diff --git a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/RowSetRow.java b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/RowSetRow.java index 3d05a6bd1c5..b9b2413391c 100644 --- a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/RowSetRow.java +++ b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/RowSetRow.java @@ -36,32 +36,44 @@ public RowSetRow(IRowSet rowSet, IRowMeta rowMeta, Object[] rowData) { this.rowData = rowData; } - /** @return the rowSet */ + /** + * @return the rowSet + */ public IRowSet getRowSet() { return rowSet; } - /** @param rowSet the rowSet to set */ + /** + * @param rowSet the rowSet to set + */ public void setRowSet(IRowSet rowSet) { this.rowSet = rowSet; } - /** @return the rowData */ + /** + * @return the rowData + */ public Object[] getRowData() { return rowData; } - /** @param rowData the rowData to set */ + /** + * @param rowData the rowData to set + */ public void setRowData(Object[] rowData) { this.rowData = rowData; } - /** @return the rowMeta */ + /** + * @return the rowMeta + */ public IRowMeta getRowMeta() { return rowMeta; } - /** @param rowMeta the rowMeta to set */ + /** + * @param rowMeta the rowMeta to set + */ public void setRowMeta(IRowMeta rowMeta) { this.rowMeta = rowMeta; } diff --git a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMerge.java b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMerge.java index 181dd0bca0b..5a1cd621f2e 100644 --- a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMerge.java +++ b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMerge.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.sortedmerge; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -27,12 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - - - /** Do nothing. Pass all input data to the next transforms. */ public class SortedMerge extends BaseTransform { private static final Class PKG = SortedMergeMeta.class; // For Translator diff --git a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeData.java b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeData.java index a5b8ecc5782..0f30a59dca0 100644 --- a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeData.java +++ b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.sortedmerge; +import java.util.Comparator; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Comparator; -import java.util.List; - public class SortedMergeData extends BaseTransformData implements ITransformData { public int[] fieldIndices; public IRowMeta rowMeta; diff --git a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeDialog.java b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeDialog.java index bcd9f2ca82b..f25b7644ca0 100644 --- a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeDialog.java +++ b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.sortedmerge; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -47,9 +49,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class SortedMergeDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SortedMergeMeta.class; // For Translator @@ -246,7 +245,6 @@ private void ok() { input.allocate(nrFields); - for (int i = 0; i < nrFields; i++) { TableItem ti = wFields.getNonEmpty(i); input.getFieldName()[i] = ti.getText(1); diff --git a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeMeta.java b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeMeta.java index eebed156ed8..10c0bd49d33 100644 --- a/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeMeta.java +++ b/plugins/transforms/sortedmerge/src/main/java/org/apache/hop/pipeline/transforms/sortedmerge/SortedMergeMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.sortedmerge; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,8 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @InjectionSupported( localizationPrefix = "SortedMerge.Injection.", groups = {"FIELDS"}) @@ -58,6 +57,7 @@ public class SortedMergeMeta extends BaseTransformMeta { private static final Class PKG = SplitFieldToRowsMeta.class; // For Translator diff --git a/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsData.java b/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsData.java index c56ee033756..8550068ad33 100644 --- a/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsData.java +++ b/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.splitfieldtorows; +import java.util.regex.Pattern; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.regex.Pattern; - public class SplitFieldToRowsData extends BaseTransformData implements ITransformData { public int fieldnr; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMeta.java b/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMeta.java index 7f3191e6b60..0d527d321dc 100644 --- a/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMeta.java +++ b/plugins/transforms/splitfieldtorows/src/main/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.splitfieldtorows; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "SplitFieldToRows3", name = "i18n::SplitFieldToRows.Name", @@ -45,7 +44,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::SplitFieldToRowsMeta.keyword", documentationUrl = "/pipeline/transforms/splitfieldtorows.html") -public class SplitFieldToRowsMeta extends BaseTransformMeta { +public class SplitFieldToRowsMeta + extends BaseTransformMeta { private static final Class PKG = SplitFieldToRowsMeta.class; // For Translator /** Field to split */ @@ -108,22 +108,30 @@ public SplitFieldToRowsMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the delimiter. */ + /** + * @return Returns the delimiter. + */ public String getDelimiter() { return delimiter; } - /** @param delimiter The delimiter to set. */ + /** + * @param delimiter The delimiter to set. + */ public void setDelimiter(String delimiter) { this.delimiter = delimiter; } - /** @return Returns the splitField. */ + /** + * @return Returns the splitField. + */ public String getSplitField() { return splitField; } - /** @param splitField The splitField to set. */ + /** + * @param splitField The splitField to set. + */ public void setSplitField(String splitField) { this.splitField = splitField; } @@ -263,42 +271,58 @@ public void check( } } - /** @return the newFieldname */ + /** + * @return the newFieldname + */ public String getNewFieldname() { return newFieldname; } - /** @param newFieldname the newFieldname to set */ + /** + * @param newFieldname the newFieldname to set + */ public void setNewFieldname(String newFieldname) { this.newFieldname = newFieldname; } - /** @return Returns the rowNumberField. */ + /** + * @return Returns the rowNumberField. + */ public String getRowNumberField() { return rowNumberField; } - /** @param rowNumberField The rowNumberField to set. */ + /** + * @param rowNumberField The rowNumberField to set. + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } - /** @return Returns the resetRowNumber. */ + /** + * @return Returns the resetRowNumber. + */ public boolean isResetRowNumber() { return resetRowNumber; } - /** @param resetRowNumber The resetRowNumber to set. */ + /** + * @param resetRowNumber The resetRowNumber to set. + */ public void setResetRowNumber(boolean resetRowNumber) { this.resetRowNumber = resetRowNumber; } - /** @param includeRowNumber The includeRowNumber to set. */ + /** + * @param includeRowNumber The includeRowNumber to set. + */ public void setIncludeRowNumber(boolean includeRowNumber) { this.includeRowNumber = includeRowNumber; } - /** @return Returns the includeRowNumber. */ + /** + * @return Returns the includeRowNumber. + */ public boolean isIncludeRowNumber() { return includeRowNumber; } diff --git a/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMetaTest.java b/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMetaTest.java index d9447a99d59..21875ededf9 100644 --- a/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMetaTest.java +++ b/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.splitfieldtorows; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SplitFieldToRowsMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsTest.java b/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsTest.java index 7854b6bb2f0..02aa52b51df 100644 --- a/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsTest.java +++ b/plugins/transforms/splitfieldtorows/src/test/java/org/apache/hop/pipeline/transforms/splitfieldtorows/SplitFieldToRowsTest.java @@ -17,16 +17,16 @@ package org.apache.hop.pipeline.transforms.splitfieldtorows; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class SplitFieldToRowsTest { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java index 76cae72e6b0..a5218ed4d46 100644 --- a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java +++ b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java @@ -18,9 +18,8 @@ package org.apache.hop.pipeline.transforms.splunkinput; -import org.apache.hop.core.injection.Injection; - import java.util.Objects; +import org.apache.hop.core.injection.Injection; public class ReturnValue { @@ -78,7 +77,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -92,7 +93,9 @@ public String getSplunkName() { return splunkName; } - /** @param splunkName The splunkName to set */ + /** + * @param splunkName The splunkName to set + */ public void setSplunkName(String splunkName) { this.splunkName = splunkName; } @@ -106,7 +109,9 @@ public String getType() { return type; } - /** @param type The type to set */ + /** + * @param type The type to set + */ public void setType(String type) { this.type = type; } @@ -120,7 +125,9 @@ public int getLength() { return length; } - /** @param length The length to set */ + /** + * @param length The length to set + */ public void setLength(int length) { this.length = length; } @@ -134,7 +141,9 @@ public String getFormat() { return format; } - /** @param format The format to set */ + /** + * @param format The format to set + */ public void setFormat(String format) { this.format = format; } diff --git a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInput.java b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInput.java index 9aa15830dfb..ef0ac0545f1 100644 --- a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInput.java +++ b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInput.java @@ -21,6 +21,9 @@ import com.splunk.JobResultsArgs; import com.splunk.ResultsReaderXml; import com.splunk.Service; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; @@ -32,10 +35,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.splunk.SplunkConnection; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; - public class SplunkInput extends BaseTransform { public SplunkInput( diff --git a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputData.java b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputData.java index 5daf7eba0bd..b301d1a0642 100644 --- a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputData.java +++ b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputData.java @@ -20,13 +20,12 @@ import com.splunk.Service; import com.splunk.ServiceArgs; +import java.io.InputStream; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.splunk.SplunkConnection; -import java.io.InputStream; - public class SplunkInputData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputDialog.java b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputDialog.java index 8313ed658b1..a2af3334b47 100644 --- a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputDialog.java +++ b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputDialog.java @@ -21,6 +21,13 @@ import com.splunk.JobArgs; import com.splunk.ResultsReaderXml; import com.splunk.Service; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.row.value.ValueMetaFactory; @@ -60,14 +67,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - public class SplunkInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = diff --git a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java index 92d2e8e2223..121b0388380 100644 --- a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java +++ b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java @@ -18,6 +18,8 @@ package org.apache.hop.pipeline.transforms.splunkinput; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopPluginException; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "SplunkInput", name = "Splunk Input", @@ -158,7 +157,9 @@ public String getConnectionName() { return connectionName; } - /** @param connectionName The connectionName to set */ + /** + * @param connectionName The connectionName to set + */ public void setConnectionName(String connectionName) { this.connectionName = connectionName; } @@ -172,7 +173,9 @@ public String getQuery() { return query; } - /** @param query The query to set */ + /** + * @param query The query to set + */ public void setQuery(String query) { this.query = query; } @@ -186,7 +189,9 @@ public List getReturnValues() { return returnValues; } - /** @param returnValues The returnValues to set */ + /** + * @param returnValues The returnValues to set + */ public void setReturnValues(List returnValues) { this.returnValues = returnValues; } diff --git a/plugins/transforms/splunk/src/main/java/org/apache/hop/splunk/SplunkConnection.java b/plugins/transforms/splunk/src/main/java/org/apache/hop/splunk/SplunkConnection.java index 5077dcc6d39..668bc0c1f6c 100644 --- a/plugins/transforms/splunk/src/main/java/org/apache/hop/splunk/SplunkConnection.java +++ b/plugins/transforms/splunk/src/main/java/org/apache/hop/splunk/SplunkConnection.java @@ -124,7 +124,9 @@ public String getHostname() { return hostname; } - /** @param hostname The hostname to set */ + /** + * @param hostname The hostname to set + */ public void setHostname(String hostname) { this.hostname = hostname; } @@ -138,7 +140,9 @@ public String getPort() { return port; } - /** @param port The port to set */ + /** + * @param port The port to set + */ public void setPort(String port) { this.port = port; } @@ -152,7 +156,9 @@ public String getUsername() { return username; } - /** @param username The username to set */ + /** + * @param username The username to set + */ public void setUsername(String username) { this.username = username; } @@ -166,7 +172,9 @@ public String getPassword() { return password; } - /** @param password The password to set */ + /** + * @param password The password to set + */ public void setPassword(String password) { this.password = password; } diff --git a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSql.java b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSql.java index 679c1831ddf..7567dd949d3 100644 --- a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSql.java +++ b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSql.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.sql; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.RowMetaAndData; @@ -34,8 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; - /** Execute one or more SQL statements in a script, one time or parameterised (for every row) */ public class ExecSql extends BaseTransform { diff --git a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlArgumentItem.java b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlArgumentItem.java index 0aad1ab6e7a..eb7546a03d4 100644 --- a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlArgumentItem.java +++ b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlArgumentItem.java @@ -17,9 +17,8 @@ * limitations under the License. */ -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class ExecSqlArgumentItem { diff --git a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlData.java b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlData.java index 2007f0c19a4..64d415d9bb2 100644 --- a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlData.java +++ b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.sql; +import java.util.List; import org.apache.hop.core.Result; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class ExecSqlData extends BaseTransformData implements ITransformData { public Database db; public Result result; diff --git a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMeta.java b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMeta.java index 6599b3da9ad..e04c3f95085 100644 --- a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMeta.java +++ b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.sql; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -37,9 +39,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /* * Contains meta-data to execute arbitrary SQL, optionally each row again. */ @@ -128,82 +127,114 @@ public ExecSqlMeta() { arguments = new ArrayList(); } - /** @return Returns the true if we have to set params. */ + /** + * @return Returns the true if we have to set params. + */ public boolean isParams() { return this.params; } - /** @param value set true if we have to set params. */ + /** + * @param value set true if we have to set params. + */ public void setParams(boolean value) { this.params = value; } - /** @return Returns the sql. */ + /** + * @return Returns the sql. + */ public String getSql() { return sql; } - /** @param sql The sql to set. */ + /** + * @param sql The sql to set. + */ public void setSql(String sql) { this.sql = sql; } - /** @return Returns the arguments. */ + /** + * @return Returns the arguments. + */ public List getArguments() { return arguments; } - /** @param arguments The arguments to set. */ + /** + * @param arguments The arguments to set. + */ public void setArguments(List arguments) { this.arguments = arguments; } - /** @return Returns the executedEachInputRow. */ + /** + * @return Returns the executedEachInputRow. + */ public boolean isExecutedEachInputRow() { return executedEachInputRow; } - /** @param executedEachInputRow The executedEachInputRow to set. */ + /** + * @param executedEachInputRow The executedEachInputRow to set. + */ public void setExecutedEachInputRow(boolean executedEachInputRow) { this.executedEachInputRow = executedEachInputRow; } - /** @return Returns the deleteField. */ + /** + * @return Returns the deleteField. + */ public String getDeleteField() { return deleteField; } - /** @param deleteField The deleteField to set. */ + /** + * @param deleteField The deleteField to set. + */ public void setDeleteField(String deleteField) { this.deleteField = deleteField; } - /** @return Returns the insertField. */ + /** + * @return Returns the insertField. + */ public String getInsertField() { return insertField; } - /** @param insertField The insertField to set. */ + /** + * @param insertField The insertField to set. + */ public void setInsertField(String insertField) { this.insertField = insertField; } - /** @return Returns the readField. */ + /** + * @return Returns the readField. + */ public String getReadField() { return readField; } - /** @param readField The readField to set. */ + /** + * @param readField The readField to set. + */ public void setReadField(String readField) { this.readField = readField; } - /** @return Returns the updateField. */ + /** + * @return Returns the updateField. + */ public String getUpdateField() { return updateField; } - /** @param updateField The updateField to set. */ + /** + * @param updateField The updateField to set. + */ public void setUpdateField(String updateField) { this.updateField = updateField; } @@ -393,12 +424,16 @@ public void analyseImpact( } } - /** @return Returns the variableReplacementActive. */ + /** + * @return Returns the variableReplacementActive. + */ public boolean isReplaceVariables() { return replaceVariables; } - /** @param replaceVariables The variableReplacement to set. */ + /** + * @param replaceVariables The variableReplacement to set. + */ public void setReplaceVariables(boolean replaceVariables) { this.replaceVariables = replaceVariables; } @@ -424,12 +459,16 @@ public boolean supportsErrorHandling() { return true; } - /** @return the singleStatement */ + /** + * @return the singleStatement + */ public boolean isSingleStatement() { return singleStatement; } - /** @param singleStatement the singleStatement to set */ + /** + * @param singleStatement the singleStatement to set + */ public void setSingleStatement(boolean singleStatement) { this.singleStatement = singleStatement; } diff --git a/plugins/transforms/sql/src/test/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMetaTest.java b/plugins/transforms/sql/src/test/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMetaTest.java index a0e96922466..6d556ce4bfa 100644 --- a/plugins/transforms/sql/src/test/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMetaTest.java +++ b/plugins/transforms/sql/src/test/java/org/apache/hop/pipeline/transforms/sql/ExecSqlMetaTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.sql; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -32,13 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class ExecSqlMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = ExecSqlMeta.class; @@ -112,40 +111,38 @@ public void setUpLoadSave() throws Exception { this); IFieldLoadSaveValidatorFactory validatorFactory = - loadSaveTester.getFieldLoadSaveValidatorFactory(); + loadSaveTester.getFieldLoadSaveValidatorFactory(); validatorFactory.registerValidator( - validatorFactory.getName(ExecSqlArgumentItem.class), - new ObjectValidator<>( - validatorFactory, - ExecSqlArgumentItem.class, - Arrays.asList("name"), - new HashMap() { - { - put("name", "getName"); - } - }, - new HashMap() { - { - put("name", "setName"); - } - })); + validatorFactory.getName(ExecSqlArgumentItem.class), + new ObjectValidator<>( + validatorFactory, + ExecSqlArgumentItem.class, + Arrays.asList("name"), + new HashMap() { + { + put("name", "getName"); + } + }, + new HashMap() { + { + put("name", "setName"); + } + })); validatorFactory.registerValidator( - validatorFactory.getName(List.class, ExecSqlArgumentItem.class), - new ListLoadSaveValidator<>(new ExecSqlArgumentItemFieldLoadSaveValidator())); + validatorFactory.getName(List.class, ExecSqlArgumentItem.class), + new ListLoadSaveValidator<>(new ExecSqlArgumentItemFieldLoadSaveValidator())); } public class ExecSqlArgumentItemFieldLoadSaveValidator - implements IFieldLoadSaveValidator { + implements IFieldLoadSaveValidator { final Random rand = new Random(); @Override public ExecSqlArgumentItem getTestObject() { - ExecSqlArgumentItem field = - new ExecSqlArgumentItem( - UUID.randomUUID().toString()); + ExecSqlArgumentItem field = new ExecSqlArgumentItem(UUID.randomUUID().toString()); return field; } @@ -156,8 +153,7 @@ public boolean validateTestObject(ExecSqlArgumentItem testObject, Object actual) return false; } ExecSqlArgumentItem another = (ExecSqlArgumentItem) actual; - return new EqualsBuilder() - .append(testObject.getName(), another.getName()).isEquals(); + return new EqualsBuilder().append(testObject.getName(), another.getName()).isEquals(); } } diff --git a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutput.java b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutput.java index c24e3dc3ee6..ecd5d2ac3cd 100644 --- a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutput.java +++ b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutput.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.sqlfileoutput; +import java.io.BufferedOutputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; @@ -31,10 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedOutputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; - public class SQLFileOutput extends BaseTransform { private static final Class PKG = SQLFileOutputMeta.class; // For Translator diff --git a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputData.java b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputData.java index d624d5cdafe..e8acc7b1a11 100644 --- a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputData.java +++ b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.sqlfileoutput; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.text.SimpleDateFormat; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.text.SimpleDateFormat; - public class SQLFileOutputData extends BaseTransformData implements ITransformData { public int splitnr; diff --git a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputDialog.java b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputDialog.java index c7635f7b648..1af0db1f5ce 100644 --- a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputDialog.java +++ b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.sqlfileoutput; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -61,10 +64,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class SQLFileOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SQLFileOutputMeta.class; // For Translator diff --git a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMeta.java b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMeta.java index 3c6e97d6d2a..a7e7e5cdf14 100644 --- a/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMeta.java +++ b/plugins/transforms/sqlfileoutput/src/main/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMeta.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.sqlfileoutput; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -44,11 +48,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - @Transform( id = "SQLFileOutput", image = "sqlfileoutput.svg", @@ -123,82 +122,114 @@ public Object clone() { return retval; } - /** @return Returns the database. */ + /** + * @return Returns the database. + */ public DatabaseMeta getDatabaseMeta() { return databaseMeta; } - /** @param database The database to set. */ + /** + * @param database The database to set. + */ public void setDatabaseMeta(DatabaseMeta database) { this.databaseMeta = database; } - /** @return Returns the extension. */ + /** + * @return Returns the extension. + */ public String getExtension() { return extension; } - /** @param extension The extension to set. */ + /** + * @param extension The extension to set. + */ public void setExtension(String extension) { this.extension = extension; } - /** @return Returns the fileAppended. */ + /** + * @return Returns the fileAppended. + */ public boolean isFileAppended() { return fileAppended; } - /** @param fileAppended The fileAppended to set. */ + /** + * @param fileAppended The fileAppended to set. + */ public void setFileAppended(boolean fileAppended) { this.fileAppended = fileAppended; } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String getFileName() { return fileName; } - /** @return Returns the splitEvery. */ + /** + * @return Returns the splitEvery. + */ public int getSplitEvery() { return splitEvery; } - /** @param splitEvery The splitEvery to set. */ + /** + * @param splitEvery The splitEvery to set. + */ public void setSplitEvery(int splitEvery) { this.splitEvery = splitEvery; } - /** @return Returns the transformNrInFilename. */ + /** + * @return Returns the transformNrInFilename. + */ public boolean isTransformNrInFilename() { return transformNrInFilename; } - /** @param transformNrInFilename The transformNrInFilename to set. */ + /** + * @param transformNrInFilename The transformNrInFilename to set. + */ public void setTransformNrInFilename(boolean transformNrInFilename) { this.transformNrInFilename = transformNrInFilename; } - /** @return Returns the timeInFilename. */ + /** + * @return Returns the timeInFilename. + */ public boolean isTimeInFilename() { return timeInFilename; } - /** @return Returns the dateInFilename. */ + /** + * @return Returns the dateInFilename. + */ public boolean isDateInFilename() { return dateInFilename; } - /** @param dateInFilename The dateInFilename to set. */ + /** + * @param dateInFilename The dateInFilename to set. + */ public void setDateInFilename(boolean dateInFilename) { this.dateInFilename = dateInFilename; } - /** @param timeInFilename The timeInFilename to set. */ + /** + * @param timeInFilename The timeInFilename to set. + */ public void setTimeInFilename(boolean timeInFilename) { this.timeInFilename = timeInFilename; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String fileName) { this.fileName = fileName; } @@ -211,7 +242,9 @@ public String getEncoding() { return encoding; } - /** @return The desired date format. */ + /** + * @return The desired date format. + */ public String getDateFormat() { return dateformat; } @@ -224,32 +257,44 @@ public void setEncoding(String encoding) { this.encoding = encoding; } - /** @param dateFormat The desired date format of output field date used. */ + /** + * @param dateFormat The desired date format of output field date used. + */ public void setDateFormat(String dateFormat) { this.dateformat = dateFormat; } - /** @return Returns the table name. */ + /** + * @return Returns the table name. + */ public String getTablename() { return tableName; } - /** @param tableName The table name to set. */ + /** + * @param tableName The table name to set. + */ public void setTablename(String tableName) { this.tableName = tableName; } - /** @return Returns the truncate table flag. */ + /** + * @return Returns the truncate table flag. + */ public boolean truncateTable() { return truncateTable; } - /** @return Returns the Add to result filesname flag. */ + /** + * @return Returns the Add to result filesname flag. + */ public boolean AddToResult() { return addToResult; } - /** @return Returns the Start new line flag. */ + /** + * @return Returns the Start new line flag. + */ public boolean StartNewLine() { return startNewLine; } @@ -262,37 +307,51 @@ public void setDoNotOpenNewFileInit(boolean doNotOpenNewFileInit) { this.doNotOpenNewFileInit = doNotOpenNewFileInit; } - /** @return Returns the create table flag. */ + /** + * @return Returns the create table flag. + */ public boolean createTable() { return createTable; } - /** @param truncateTable The truncate table flag to set. */ + /** + * @param truncateTable The truncate table flag to set. + */ public void setTruncateTable(boolean truncateTable) { this.truncateTable = truncateTable; } - /** @param addToResult The Add file to result to set. */ + /** + * @param addToResult The Add file to result to set. + */ public void setAddToResult(boolean addToResult) { this.addToResult = addToResult; } - /** @param startNewLine The Start NEw Line to set. */ + /** + * @param startNewLine The Start NEw Line to set. + */ public void setStartNewLine(boolean startNewLine) { this.startNewLine = startNewLine; } - /** @param createTable The create table flag to set. */ + /** + * @param createTable The create table flag to set. + */ public void setCreateTable(boolean createTable) { this.createTable = createTable; } - /** @return Returns the create parent folder flag. */ + /** + * @return Returns the create parent folder flag. + */ public boolean isCreateParentFolder() { return createparentfolder; } - /** @param createparentfolder The create parent folder flag to set. */ + /** + * @param createparentfolder The create parent folder flag to set. + */ public void setCreateParentFolder(boolean createparentfolder) { this.createparentfolder = createparentfolder; } @@ -779,12 +838,16 @@ public IRowMeta getRequiredFields(IVariables variables) throws HopException { } } - /** @return the schemaName */ + /** + * @return the schemaName + */ public String getSchemaName() { return schemaName; } - /** @param schemaName the schemaName to set */ + /** + * @param schemaName the schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } diff --git a/plugins/transforms/sqlfileoutput/src/test/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMetaTest.java b/plugins/transforms/sqlfileoutput/src/test/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMetaTest.java index af578f2bd03..4c99f59b078 100644 --- a/plugins/transforms/sqlfileoutput/src/test/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMetaTest.java +++ b/plugins/transforms/sqlfileoutput/src/test/java/org/apache/hop/pipeline/transforms/sqlfileoutput/SQLFileOutputMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.sqlfileoutput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SQLFileOutputMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = SQLFileOutputMeta.class; diff --git a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SessionResult.java b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SessionResult.java index 2ee2f5419a6..7777b0b60d0 100644 --- a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SessionResult.java +++ b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SessionResult.java @@ -18,12 +18,11 @@ package org.apache.hop.pipeline.transforms.ssh; import com.trilead.ssh2.Session; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.util.Utils; - import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.util.Utils; public class SessionResult { diff --git a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/Ssh.java b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/Ssh.java index 35cdee12ea2..1d8f46cc8cc 100644 --- a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/Ssh.java +++ b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/Ssh.java @@ -134,7 +134,7 @@ public boolean processRow() throws HopException { logDebug( BaseMessages.getString( PKG, - "SSH.Log.ExecutedSshCommand", + "SSH.Log.ExecutedSshCommand", data.commands, sessionresult.getStdOut(), sessionresult.getStdErr())); diff --git a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshData.java b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshData.java index 544a2c3ea89..f2299959042 100644 --- a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshData.java +++ b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshData.java @@ -19,6 +19,9 @@ import com.trilead.ssh2.Connection; import com.trilead.ssh2.HTTPProxyData; +import java.io.CharArrayWriter; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileContent; @@ -34,10 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.io.CharArrayWriter; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - public class SshData extends BaseTransformData implements ITransformData { public int indexOfCommand; public Connection conn; diff --git a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshDialog.java b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshDialog.java index 59bb94ef737..60a4a51402f 100644 --- a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshDialog.java +++ b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshDialog.java @@ -304,16 +304,17 @@ public void widgetSelected(SelectionEvent e) { wbFilename.addListener( SWT.Selection, - e -> BaseDialog.presentFileDialog( - shell, - wPrivateKey, - variables, - new String[] {"*.pem", "*"}, - new String[] { - BaseMessages.getString(PKG, "System.FileType.PEMFiles"), - BaseMessages.getString(PKG, "System.FileType.AllFiles") - }, - true)); + e -> + BaseDialog.presentFileDialog( + shell, + wPrivateKey, + variables, + new String[] {"*.pem", "*"}, + new String[] { + BaseMessages.getString(PKG, "System.FileType.PEMFiles"), + BaseMessages.getString(PKG, "System.FileType.AllFiles") + }, + true)); // Private key Label wlPrivateKey = new Label(wSettingsGroup, SWT.RIGHT | SWT.SINGLE); diff --git a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshMeta.java b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshMeta.java index cfcb6d46f45..e93d94b9c9c 100644 --- a/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshMeta.java +++ b/plugins/transforms/ssh/src/main/java/org/apache/hop/pipeline/transforms/ssh/SshMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.ssh; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -35,8 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "SSH", image = "ssh.svg", diff --git a/plugins/transforms/ssh/src/test/java/org/apache/hop/pipeline/transforms/ssh/SshMetaTest.java b/plugins/transforms/ssh/src/test/java/org/apache/hop/pipeline/transforms/ssh/SshMetaTest.java index f87540f0112..ed055486112 100644 --- a/plugins/transforms/ssh/src/test/java/org/apache/hop/pipeline/transforms/ssh/SshMetaTest.java +++ b/plugins/transforms/ssh/src/test/java/org/apache/hop/pipeline/transforms/ssh/SshMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.ssh; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.core.encryption.Encr; import org.apache.hop.core.encryption.TwoWayPasswordEncoderPluginType; @@ -31,13 +37,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - public class SshMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java index ee04ce6af69..403e5ce5378 100644 --- a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java +++ b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java @@ -21,6 +21,8 @@ import com.google.i18n.phonenumbers.PhoneNumberUtil; import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat; import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber; +import java.util.Arrays; +import java.util.Set; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.util.Utils; @@ -30,9 +32,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Arrays; -import java.util.Set; - public class StandardizePhoneNumber extends BaseTransform { private static final Class PKG = StandardizePhoneNumber.class; // For Translator diff --git a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java index 98a7667bc9d..943d6d02390 100644 --- a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java +++ b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java @@ -16,6 +16,8 @@ package org.apache.hop.pipeline.transforms.standardizephonenumber; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -46,9 +48,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class StandardizePhoneNumberDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = StandardizePhoneNumberMeta.class; // for i18n @@ -133,7 +132,11 @@ public String open() { wTransformName.setText(transformName); wTransformName.addListener(SWT.Modify, e -> input.setChanged()); wTransformName.setLayoutData( - new FormDataBuilder().left(wlTransformName, margin).top(wlTransformName, 0, SWT.CENTER).right().result()); + new FormDataBuilder() + .left(wlTransformName, margin) + .top(wlTransformName, 0, SWT.CENTER) + .right() + .result()); PropsUi.setLook(wTransformName); // Table with fields @@ -253,7 +256,8 @@ public String open() { } // Display in red missing field names - HopGui.getInstance().getDisplay() + HopGui.getInstance() + .getDisplay() .asyncExec( new Runnable() { public void run() { diff --git a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMeta.java b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMeta.java index 0504788a70d..19f7be5060b 100644 --- a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMeta.java +++ b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMeta.java @@ -19,6 +19,11 @@ import com.google.i18n.phonenumbers.PhoneNumberUtil; import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.Set; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,12 +41,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; -import java.util.Set; - @Transform( id = "StandardizePhoneNumber", image = "standardizephonenumber.svg", @@ -50,7 +49,9 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.DataQuality", documentationUrl = "/pipeline/transforms/standardizephonenumber.html") -public class StandardizePhoneNumberMeta extends BaseTransformMeta implements Serializable { +public class StandardizePhoneNumberMeta + extends BaseTransformMeta + implements Serializable { private static final Class PKG = StandardizePhoneNumberMeta.class; // For Translator diff --git a/plugins/transforms/standardizephonenumber/src/test/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMetaTest.java b/plugins/transforms/standardizephonenumber/src/test/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMetaTest.java index 953c526b07c..7713958e45d 100644 --- a/plugins/transforms/standardizephonenumber/src/test/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMetaTest.java +++ b/plugins/transforms/standardizephonenumber/src/test/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberMetaTest.java @@ -17,21 +17,22 @@ package org.apache.hop.pipeline.transforms.standardizephonenumber; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class StandardizePhoneNumberMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); - /** @throws HopException */ + /** + * @throws HopException + */ public void test() throws HopException { List attributes = Arrays.asList("fields"); diff --git a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookup.java b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookup.java index 64254ddc871..3cbbe87668e 100644 --- a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookup.java +++ b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookup.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.streamlookup; +import java.math.BigDecimal; +import java.text.DateFormat; +import java.util.Collections; import org.apache.hop.core.IRowSet; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; @@ -35,10 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.math.BigDecimal; -import java.text.DateFormat; -import java.util.Collections; - /** * Looks up information by first reading data into a hash table (in memory) * @@ -63,7 +62,7 @@ private void handleNullIf() { for (int i = 0; i < meta.getValue().length; i++) { if (meta.getValueDefaultType()[i] < 0) { - + meta.getValueDefaultType()[i] = IValueMeta.TYPE_STRING; } data.nullIf[i] = null; diff --git a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupData.java b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupData.java index abd777e4416..3f64b9eb4cd 100644 --- a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupData.java +++ b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupData.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.streamlookup; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.hash.ByteArrayHashIndex; @@ -26,12 +31,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class StreamLookupData extends BaseTransformData implements ITransformData { /** used to store values in used to look up things */ public Map look; diff --git a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupDialog.java b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupDialog.java index d1db160d2be..002fa74e5e3 100644 --- a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupDialog.java +++ b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.streamlookup; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -40,8 +41,6 @@ import org.apache.hop.ui.pipeline.transform.BaseTransformDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; @@ -52,8 +51,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class StreamLookupDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = StreamLookupMeta.class; // For Translator @@ -158,10 +155,12 @@ public String open() { } wTransform.addModifyListener(lsMod); - wTransform.addListener(SWT.Selection, e -> { - input.setChanged(); - updateComboFields(); - }); + wTransform.addListener( + SWT.Selection, + e -> { + input.setChanged(); + updateComboFields(); + }); FormData fdTransform = new FormData(); fdTransform.left = new FormAttachment(middle, 0); @@ -264,7 +263,7 @@ public String open() { fdPreserveMemory.right = new FormAttachment(100, 0); wPreserveMemory.setLayoutData(fdPreserveMemory); wPreserveMemory.addListener(SWT.Selection, e -> input.setChanged()); - + // preserve memory should be enabled to have this options on. wPreserveMemory.addListener( SWT.Selection, @@ -328,7 +327,6 @@ public String open() { getData(); - updateComboFields(); input.setChanged(changed); @@ -337,29 +335,28 @@ public String open() { return transformName; } - /** - /* Search the input and lookup fields in the background - **/ + /** /* Search the input and lookup fields in the background */ protected void updateComboFields() { final Runnable runnable = () -> { - String lookupTransformName = wTransform.getText(); - + // Input fields // TransformMeta transformMeta = pipelineMeta.findTransform(transformName); if (transformMeta != null) { try { - IRowMeta rowMeta = new RowMeta(); - for (String prevTransformName: pipelineMeta.getPrevTransformNames(transformName)) { - if ( !prevTransformName.equalsIgnoreCase(lookupTransformName) ) { - IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta, prevTransformName, null); + IRowMeta rowMeta = new RowMeta(); + for (String prevTransformName : pipelineMeta.getPrevTransformNames(transformName)) { + if (!prevTransformName.equalsIgnoreCase(lookupTransformName)) { + IRowMeta row = + pipelineMeta.getPrevTransformFields( + variables, transformMeta, prevTransformName, null); // See if the add fields are not already in the row for (int i = 0; i < row.size(); i++) { - IValueMeta valueMeta = row.getValueMeta(i); + IValueMeta valueMeta = row.getValueMeta(i); if (rowMeta.searchValueMeta(valueMeta.getName()) == null) { rowMeta.addValueMeta(valueMeta); } @@ -375,7 +372,7 @@ protected void updateComboFields() { logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); } } - + // Lookup fields // TransformMeta lookupTransformMeta = pipelineMeta.findTransform(lookupTransformName); @@ -395,9 +392,8 @@ protected void updateComboFields() { + "]!"); } } - }; - shell.getDisplay().asyncExec(runnable); + shell.getDisplay().asyncExec(runnable); } /** Copy information from the meta-data input to the dialog fields. */ diff --git a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMeta.java b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMeta.java index eb383a11ad2..805bc4f39d3 100644 --- a/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMeta.java +++ b/plugins/transforms/streamlookup/src/main/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.streamlookup; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -44,8 +45,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.w3c.dom.Node; -import java.util.List; - @InjectionSupported(localizationPrefix = "StreamLookupMeta.Injection.") @Transform( id = "StreamLookup", @@ -173,14 +172,14 @@ private void readData(Node transformNode) throws HopXmlException { for (int i = 0; i < nrkeys; i++) { Node knode = XmlHandler.getSubNodeByNr(lookup, "key", i); - + getKeystream()[i] = XmlHandler.getTagValue(knode, "name"); getKeylookup()[i] = XmlHandler.getTagValue(knode, "field"); } for (int i = 0; i < nrvalues; i++) { Node vnode = XmlHandler.getSubNodeByNr(lookup, "value", i); - + getValue()[i] = XmlHandler.getTagValue(vnode, "name"); getValueName()[i] = XmlHandler.getTagValue(vnode, "rename"); if (getValueName()[i] == null) { @@ -530,72 +529,100 @@ public void resetTransformIoMeta() { // Do nothing, don't reset as there is no need to do this. } - /** @return Returns the inputSorted. */ + /** + * @return Returns the inputSorted. + */ public boolean isInputSorted() { return inputSorted; } - /** @param inputSorted The inputSorted to set. */ + /** + * @param inputSorted The inputSorted to set. + */ public void setInputSorted(boolean inputSorted) { this.inputSorted = inputSorted; } - /** @return Returns the keylookup. */ + /** + * @return Returns the keylookup. + */ public String[] getKeylookup() { return keylookup; } - /** @param keylookup The keylookup to set. */ + /** + * @param keylookup The keylookup to set. + */ public void setKeylookup(String[] keylookup) { this.keylookup = keylookup; } - /** @return Returns the keystream. */ + /** + * @return Returns the keystream. + */ public String[] getKeystream() { return keystream; } - /** @param keystream The keystream to set. */ + /** + * @param keystream The keystream to set. + */ public void setKeystream(String[] keystream) { this.keystream = keystream; } - /** @return Returns the value. */ + /** + * @return Returns the value. + */ public String[] getValue() { return value; } - /** @param value The value to set. */ + /** + * @param value The value to set. + */ public void setValue(String[] value) { this.value = value; } - /** @return Returns the valueDefault. */ + /** + * @return Returns the valueDefault. + */ public String[] getValueDefault() { return valueDefault; } - /** @param valueDefault The valueDefault to set. */ + /** + * @param valueDefault The valueDefault to set. + */ public void setValueDefault(String[] valueDefault) { this.valueDefault = valueDefault; } - /** @return Returns the valueDefaultType. */ + /** + * @return Returns the valueDefaultType. + */ public int[] getValueDefaultType() { return valueDefaultType; } - /** @param valueDefaultType The valueDefaultType to set. */ + /** + * @param valueDefaultType The valueDefaultType to set. + */ public void setValueDefaultType(int[] valueDefaultType) { this.valueDefaultType = valueDefaultType; } - /** @return Returns the valueName. */ + /** + * @return Returns the valueName. + */ public String[] getValueName() { return valueName; } - /** @param valueName The valueName to set. */ + /** + * @param valueName The valueName to set. + */ public void setValueName(String[] valueName) { this.valueName = valueName; } @@ -616,12 +643,16 @@ public void setUsingSortedList(boolean usingSortedList) { this.usingSortedList = usingSortedList; } - /** @return the usingIntegerPair */ + /** + * @return the usingIntegerPair + */ public boolean isUsingIntegerPair() { return usingIntegerPair; } - /** @param usingIntegerPair the usingIntegerPair to set */ + /** + * @param usingIntegerPair the usingIntegerPair to set + */ public void setUsingIntegerPair(boolean usingIntegerPair) { this.usingIntegerPair = usingIntegerPair; } diff --git a/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMetaTest.java b/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMetaTest.java index 8afb2bfcf5d..2a632644e5b 100644 --- a/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMetaTest.java +++ b/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupMetaTest.java @@ -16,6 +16,16 @@ */ package org.apache.hop.pipeline.transforms.streamlookup; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -34,17 +44,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class StreamLookupMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = StreamLookupMeta.class; diff --git a/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupTest.java b/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupTest.java index ae94e5f1666..6751791423a 100644 --- a/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupTest.java +++ b/plugins/transforms/streamlookup/src/test/java/org/apache/hop/pipeline/transforms/streamlookup/StreamLookupTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.streamlookup; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.nullable; +import static org.mockito.Mockito.when; + import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; import org.apache.hop.core.exception.HopException; @@ -39,14 +47,6 @@ import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.nullable; -import static org.mockito.Mockito.when; - /** * Test for StreamLookup transform * diff --git a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/SchemaMapper.java b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/SchemaMapper.java index a22b9053c8a..ed496bd178d 100644 --- a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/SchemaMapper.java +++ b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/SchemaMapper.java @@ -16,14 +16,13 @@ */ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.util.Collections; +import java.util.HashSet; import org.apache.hop.core.exception.HopPluginException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaFactory; -import java.util.Collections; -import java.util.HashSet; - /** * Takes in RowMetas and find the union of them. Then maps the field of each row to its final * destination diff --git a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchema.java b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchema.java index 658eb6f285f..bf900b83bdf 100644 --- a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchema.java +++ b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchema.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -27,9 +29,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.ArrayList; -import java.util.List; - /** * Merge streams from multiple different transforms into a single stream. Unlike most other * transforms, this transform does NOT require the incoming rows to have the same RowMeta. Instead, diff --git a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaData.java b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaData.java index 10c1a521dc7..9fca121f1b4 100644 --- a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaData.java +++ b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.stream.IStream; -import java.util.List; - /** Holds data objects used in StreamSchema */ public class StreamSchemaData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaDialog.java b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaDialog.java index a1cd4a9538c..0fdb63e1626 100644 --- a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaDialog.java +++ b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.util.List; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.pipeline.PipelineMeta; @@ -43,8 +44,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.List; - public class StreamSchemaDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = StreamSchemaMeta.class; // For Translator diff --git a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaMeta.java b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaMeta.java index 0615e1fa3a5..1ed6ebccd71 100644 --- a/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaMeta.java +++ b/plugins/transforms/streamschemamerge/src/main/java/org/apache/hop/pipeline/transforms/streamschemamerge/StreamSchemaMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,10 +41,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - @Transform( id = "StreamSchema", image = "streamschemamerge.svg", @@ -308,7 +307,6 @@ public void resetTransformIoMeta() { // Do nothing, don't reset as there is no need to do this. } - /** Has original function of resetTransformIoMeta, but we only want to call it when appropriate */ /* public void wipeTransformIoMeta() { diff --git a/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/RowTransformCollector.java b/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/RowTransformCollector.java index 869d4a5ea66..b6a1a534385 100644 --- a/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/RowTransformCollector.java +++ b/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/RowTransformCollector.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.ArrayList; -import java.util.List; - /** * Helper class for testcases. You can add an instance of this class to a transform to read all of * the Rows the transform read or wrote. diff --git a/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/TestUtilities.java b/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/TestUtilities.java index db2fa85faf3..42292e88037 100755 --- a/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/TestUtilities.java +++ b/plugins/transforms/streamschemamerge/src/test/java/org/apache/hop/pipeline/transforms/streamschemamerge/TestUtilities.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.streamschemamerge; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.plugins.PluginRegistry; @@ -31,18 +42,6 @@ import org.apache.hop.pipeline.transforms.injector.InjectorMeta; import org.apache.hop.pipeline.transforms.sort.SortRowsMeta; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - public class TestUtilities { private static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; diff --git a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutData.java b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutData.java index 26b7cc36547..3975d19b0fe 100644 --- a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutData.java +++ b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.stringcut; +import java.util.List; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.List; - public class StringCutData extends BaseTransformData implements ITransformData { public int[] inStreamNrs; diff --git a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutDialog.java b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutDialog.java index fbe64ba032b..50a7d1c05d9 100644 --- a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutDialog.java +++ b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutDialog.java @@ -258,7 +258,6 @@ private void getInfo(StringCutMeta inf) { BaseMessages.getString(PKG, "StringCutDialog.Log.FoundFields", String.valueOf(nrkeys))); } - for (int i = 0; i < nrkeys; i++) { TableItem item = wFields.getNonEmpty(i); StringCutField scf = diff --git a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutField.java b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutField.java index 7632ec03851..4b59306cb01 100644 --- a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutField.java +++ b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.stringcut; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class StringCutField { diff --git a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMeta.java b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMeta.java index 098de967739..f0505c1a650 100644 --- a/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMeta.java +++ b/plugins/transforms/stringcut/src/main/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.stringcut; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -34,9 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "StringCut", image = "stringcut.svg", @@ -82,7 +81,9 @@ public List getFields() { return fields; } - /** @param fields The fields to set */ + /** + * @param fields The fields to set + */ public void setFields(List fields) { this.fields = fields; } diff --git a/plugins/transforms/stringcut/src/test/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMetaTest.java b/plugins/transforms/stringcut/src/test/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMetaTest.java index 1e4efa282b8..40c2de89c82 100644 --- a/plugins/transforms/stringcut/src/test/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMetaTest.java +++ b/plugins/transforms/stringcut/src/test/java/org/apache/hop/pipeline/transforms/stringcut/StringCutMetaTest.java @@ -16,6 +16,13 @@ */ package org.apache.hop.pipeline.transforms.stringcut; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -31,14 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class StringCutMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = StringCutMeta.class; diff --git a/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java b/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java index f34f3160809..c483a47af83 100644 --- a/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java +++ b/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java @@ -48,7 +48,8 @@ keywords = "i18n::StringOperationsMeta.keyword", documentationUrl = "/pipeline/transforms/stringoperations.html") @InjectionSupported(localizationPrefix = "StringOperationsDialog.Injection.") -public class StringOperationsMeta extends BaseTransformMeta { +public class StringOperationsMeta + extends BaseTransformMeta { private static final Class PKG = StringOperationsMeta.class; // For Translator @@ -226,22 +227,30 @@ public StringOperationsMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the fieldInStream. */ + /** + * @return Returns the fieldInStream. + */ public String[] getFieldInStream() { return fieldInStream; } - /** @param keyStream The fieldInStream to set. */ + /** + * @param keyStream The fieldInStream to set. + */ public void setFieldInStream(String[] keyStream) { this.fieldInStream = keyStream; } - /** @return Returns the fieldOutStream. */ + /** + * @return Returns the fieldOutStream. + */ public String[] getFieldOutStream() { return fieldOutStream; } - /** @param keyStream The fieldOutStream to set. */ + /** + * @param keyStream The fieldOutStream to set. + */ public void setFieldOutStream(String[] keyStream) { this.fieldOutStream = keyStream; } @@ -418,32 +427,87 @@ public String getXml() { retval.append(" ").append(XmlHandler.addTagValue("in_stream_name", fieldInStream[i])); retval - .append(" ") - .append(XmlHandler.addTagValue("out_stream_name", (fieldOutStream == null || fieldOutStream.length == 0 || fieldOutStream.length <= i) ? "" : !Utils.isEmpty(fieldOutStream[i]) ? fieldOutStream[i] : "")); + .append(" ") + .append( + XmlHandler.addTagValue( + "out_stream_name", + (fieldOutStream == null + || fieldOutStream.length == 0 + || fieldOutStream.length <= i) + ? "" + : !Utils.isEmpty(fieldOutStream[i]) ? fieldOutStream[i] : "")); retval .append(" ") - .append(XmlHandler.addTagValue("trim_type", (trimType == null || trimType.length == 0 || trimType.length <= i) ? "" : getTrimTypeCode(trimType[i]))); + .append( + XmlHandler.addTagValue( + "trim_type", + (trimType == null || trimType.length == 0 || trimType.length <= i) + ? "" + : getTrimTypeCode(trimType[i]))); retval .append(" ") - .append(XmlHandler.addTagValue("lower_upper", (lowerUpper == null || lowerUpper.length == 0 || lowerUpper.length <= i) ? "" : getLowerUpperCode(lowerUpper[i]))); + .append( + XmlHandler.addTagValue( + "lower_upper", + (lowerUpper == null || lowerUpper.length == 0 || lowerUpper.length <= i) + ? "" + : getLowerUpperCode(lowerUpper[i]))); retval .append(" ") - .append(XmlHandler.addTagValue("padding_type", (paddingType == null || paddingType.length == 0 || paddingType.length <= i) ? "" : getPaddingCode(paddingType[i]))); - retval.append(" ").append(XmlHandler.addTagValue("pad_char", (padChar == null || padChar.length == 0 || padChar.length <= i) ? "" : padChar[i])); - retval.append(" ").append(XmlHandler.addTagValue("pad_len", (padLen == null || padLen.length == 0 || padLen.length <= i) ? "" : padLen[i])); + .append( + XmlHandler.addTagValue( + "padding_type", + (paddingType == null || paddingType.length == 0 || paddingType.length <= i) + ? "" + : getPaddingCode(paddingType[i]))); retval .append(" ") - .append(XmlHandler.addTagValue("init_cap", (initCap == null || initCap.length == 0 || initCap.length <= i) ? "" : getInitCapCode(initCap[i]))); + .append( + XmlHandler.addTagValue( + "pad_char", + (padChar == null || padChar.length == 0 || padChar.length <= i) + ? "" + : padChar[i])); retval .append(" ") - .append(XmlHandler.addTagValue("mask_xml", (maskXML == null || maskXML.length == 0 || maskXML.length <= i) ? "" : getMaskXMLCode(maskXML[i]))); - retval.append(" ").append(XmlHandler.addTagValue("digits", (digits == null || digits.length == 0 || digits.length <= i) ? "" : getDigitsCode(digits[i]))); + .append( + XmlHandler.addTagValue( + "pad_len", + (padLen == null || padLen.length == 0 || padLen.length <= i) ? "" : padLen[i])); + retval + .append(" ") + .append( + XmlHandler.addTagValue( + "init_cap", + (initCap == null || initCap.length == 0 || initCap.length <= i) + ? "" + : getInitCapCode(initCap[i]))); + retval + .append(" ") + .append( + XmlHandler.addTagValue( + "mask_xml", + (maskXML == null || maskXML.length == 0 || maskXML.length <= i) + ? "" + : getMaskXMLCode(maskXML[i]))); + retval + .append(" ") + .append( + XmlHandler.addTagValue( + "digits", + (digits == null || digits.length == 0 || digits.length <= i) + ? "" + : getDigitsCode(digits[i]))); retval .append(" ") .append( XmlHandler.addTagValue( "remove_special_characters", - (remove_special_characters == null || remove_special_characters.length == 0 || remove_special_characters.length <= i) ? "" : getRemoveSpecialCharactersCode(remove_special_characters[i]))); + (remove_special_characters == null + || remove_special_characters.length == 0 + || remove_special_characters.length <= i) + ? "" + : getRemoveSpecialCharactersCode(remove_special_characters[i]))); retval.append(" ").append(Const.CR); } diff --git a/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMetaTest.java b/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMetaTest.java index da1469d04b1..85e4d7d27a9 100644 --- a/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMetaTest.java +++ b/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMetaTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.stringoperations; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -38,14 +45,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - /** User: Dzmitry Stsiapanau Date: 2/3/14 Time: 5:41 PM */ public class StringOperationsMetaTest implements IInitializer { LoadSaveTester loadSaveTester; diff --git a/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsTest.java b/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsTest.java index e234990a4df..394fe10d4ad 100644 --- a/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsTest.java +++ b/plugins/transforms/stringoperations/src/test/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.stringoperations; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import junit.framework.Assert; import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; @@ -32,11 +37,6 @@ import org.junit.Ignore; import org.junit.Test; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** * Tests for StringOperations transform * diff --git a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/ContainsKeyToRowSetMap.java b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/ContainsKeyToRowSetMap.java index fb2bc1eaadd..74d799501d2 100644 --- a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/ContainsKeyToRowSetMap.java +++ b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/ContainsKeyToRowSetMap.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.switchcase; -import org.apache.hop.core.IRowSet; - import java.util.ArrayList; import java.util.Set; +import org.apache.hop.core.IRowSet; public class ContainsKeyToRowSetMap extends KeyToRowSetMap { protected ArrayList list = new ArrayList<>(); diff --git a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/KeyToRowSetMap.java b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/KeyToRowSetMap.java index 0d4b713b344..297924d4c88 100644 --- a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/KeyToRowSetMap.java +++ b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/KeyToRowSetMap.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.switchcase; -import org.apache.hop.core.IRowSet; - import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import org.apache.hop.core.IRowSet; public class KeyToRowSetMap { diff --git a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCase.java b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCase.java index 4c20af5f9cc..a07fa7b7ee5 100644 --- a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCase.java +++ b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCase.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.switchcase; +import java.util.Arrays; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; @@ -29,9 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Arrays; -import java.util.Set; - /** Filters input rows base on conditions. */ public class SwitchCase extends BaseTransform { private static final Class PKG = SwitchCaseMeta.class; // For Translator diff --git a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseData.java b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseData.java index e3b0b786993..22065f7dbee 100644 --- a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseData.java +++ b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.switchcase; +import java.util.HashSet; +import java.util.Set; import org.apache.hop.core.IRowSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashSet; -import java.util.Set; - public class SwitchCaseData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMeta.java b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMeta.java index a5877f5b724..31d3264a456 100644 --- a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMeta.java +++ b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.switchcase; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -39,9 +41,6 @@ import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; -import java.util.ArrayList; -import java.util.List; - @Transform( id = "SwitchCase", image = "switchcase.svg", @@ -205,62 +204,86 @@ public void check( } } - /** @return the fieldname */ + /** + * @return the fieldname + */ public String getFieldName() { return fieldName; } - /** @param fieldName the fieldname to set */ + /** + * @param fieldName the fieldname to set + */ public void setFieldName(String fieldName) { this.fieldName = fieldName; } - /** @return the caseValueFormat */ + /** + * @return the caseValueFormat + */ public String getCaseValueFormat() { return caseValueFormat; } - /** @param caseValueFormat the caseValueFormat to set */ + /** + * @param caseValueFormat the caseValueFormat to set + */ public void setCaseValueFormat(String caseValueFormat) { this.caseValueFormat = caseValueFormat; } - /** @return the caseValueDecimal */ + /** + * @return the caseValueDecimal + */ public String getCaseValueDecimal() { return caseValueDecimal; } - /** @param caseValueDecimal the caseValueDecimal to set */ + /** + * @param caseValueDecimal the caseValueDecimal to set + */ public void setCaseValueDecimal(String caseValueDecimal) { this.caseValueDecimal = caseValueDecimal; } - /** @return the caseValueGroup */ + /** + * @return the caseValueGroup + */ public String getCaseValueGroup() { return caseValueGroup; } - /** @param caseValueGroup the caseValueGroup to set */ + /** + * @param caseValueGroup the caseValueGroup to set + */ public void setCaseValueGroup(String caseValueGroup) { this.caseValueGroup = caseValueGroup; } - /** @return the caseValueType */ + /** + * @return the caseValueType + */ public String getCaseValueType() { return caseValueType; } - /** @param caseValueType the caseValueType to set */ + /** + * @param caseValueType the caseValueType to set + */ public void setCaseValueType(String caseValueType) { this.caseValueType = caseValueType; } - /** @return the defaultTargetTransformName */ + /** + * @return the defaultTargetTransformName + */ public String getDefaultTargetTransformName() { return defaultTargetTransformName; } - /** @param defaultTargetTransformName the defaultTargetTransformName to set */ + /** + * @param defaultTargetTransformName the defaultTargetTransformName to set + */ public void setDefaultTargetTransformName(String defaultTargetTransformName) { this.defaultTargetTransformName = defaultTargetTransformName; } @@ -414,12 +437,16 @@ public void handleStreamSelection(IStream stream) { } } - /** @return the caseTargets */ + /** + * @return the caseTargets + */ public List getCaseTargets() { return caseTargets; } - /** @param caseTargets the caseTargets to set */ + /** + * @param caseTargets the caseTargets to set + */ public void setCaseTargets(List caseTargets) { this.caseTargets = caseTargets; } diff --git a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTarget.java b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTarget.java index d12fc026c8e..eaf9d1ef2ea 100644 --- a/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTarget.java +++ b/plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTarget.java @@ -35,7 +35,8 @@ public class SwitchCaseTarget implements Cloneable { @HopMetadataProperty( key = "target_transform", injectionKey = "SWITCH_CASE_TARGET.CASE_TARGET_TRANSFORM_NAME", - injectionKeyDescription = "SwitchCaseMeta.Injection.SWITCH_CASE_TARGET.CASE_TARGET_TRANSFORM_NAME") + injectionKeyDescription = + "SwitchCaseMeta.Injection.SWITCH_CASE_TARGET.CASE_TARGET_TRANSFORM_NAME") private String caseTargetTransformName; public SwitchCaseTarget() {} @@ -59,7 +60,9 @@ public String getCaseValue() { return caseValue; } - /** @param caseValue The caseValue to set */ + /** + * @param caseValue The caseValue to set + */ public void setCaseValue(String caseValue) { this.caseValue = caseValue; } @@ -73,7 +76,9 @@ public String getCaseTargetTransformName() { return caseTargetTransformName; } - /** @param caseTargetTransformName The caseTargetTransformName to set */ + /** + * @param caseTargetTransformName The caseTargetTransformName to set + */ public void setCaseTargetTransformName(String caseTargetTransformName) { this.caseTargetTransformName = caseTargetTransformName; } diff --git a/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMetaTest.java b/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMetaTest.java index 177ccb6a1ec..3de531a7d5a 100644 --- a/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMetaTest.java +++ b/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseMetaTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.switchcase; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -25,12 +30,6 @@ import org.apache.hop.pipeline.transforms.loadsave.validator.ListLoadSaveValidator; import org.junit.ClassRule; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - public class SwitchCaseMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTest.java b/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTest.java index 1d645df4757..36eb5c101aa 100644 --- a/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTest.java +++ b/plugins/transforms/switchcase/src/test/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCaseTest.java @@ -17,6 +17,25 @@ package org.apache.hop.pipeline.transforms.switchcase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.Queue; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -35,26 +54,6 @@ import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; -import java.util.Queue; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class SwitchCaseTest { private TransformMockHelper mockHelper; @@ -174,7 +173,6 @@ private static class SwitchCaseCustom extends SwitchCase { Mockito.anyString(), Mockito.anyInt())) .thenAnswer( - invocation -> { Object[] objArr = invocation.getArguments(); return (objArr != null && objArr.length > 1) ? objArr[0] : null; diff --git a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMerge.java b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMerge.java index 9c52bda2975..2850b15105e 100644 --- a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMerge.java +++ b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMerge.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -34,11 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.List; - public class SynchronizeAfterMerge extends BaseTransform { diff --git a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeData.java b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeData.java index db53444fe4d..fbf565f7293 100644 --- a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeData.java +++ b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeData.java @@ -17,12 +17,6 @@ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.sql.PreparedStatement; import java.sql.Savepoint; import java.util.ArrayList; @@ -30,6 +24,11 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; /** Performs an insert/update/delete depending on the value of a field. */ public class SynchronizeAfterMergeData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java index c7392d1b744..078035e3d47 100644 --- a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java +++ b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -74,9 +76,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class SynchronizeAfterMergeDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = SynchronizeAfterMergeMeta.class; // For Translator @@ -949,7 +948,7 @@ private void setTableFieldCombo() { colInfo.setComboValues(new String[] {}); } // ignore any errors here. drop downs will not be - // filled, but no problem for the user + // filled, but no problem for the user } } } diff --git a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMeta.java b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMeta.java index 116ed3a3986..3757fb278ac 100644 --- a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMeta.java +++ b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -44,8 +45,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @InjectionSupported( localizationPrefix = "SynchronizeAfterMerge.Injection.", groups = {"KEYS_TO_LOOKUP", "UPDATE_FIELDS"}) @@ -57,7 +56,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Output", keywords = "i18n::SynchronizeAfterMergeMeta.keyword", documentationUrl = "/pipeline/transforms/synchronizeaftermerge.html") -public class SynchronizeAfterMergeMeta extends BaseTransformMeta { +public class SynchronizeAfterMergeMeta + extends BaseTransformMeta { private static final Class PKG = SynchronizeAfterMergeMeta.class; // For Translator /** what's the lookup schema? */ @@ -142,22 +142,30 @@ public void setConnection(String connectionName) { } } - /** @param useBatchUpdate The useBatchUpdate flag to set. */ + /** + * @param useBatchUpdate The useBatchUpdate flag to set. + */ public void setUseBatchUpdate(boolean useBatchUpdate) { this.useBatchUpdate = useBatchUpdate; } - /** @return Returns the useBatchUpdate flag. */ + /** + * @return Returns the useBatchUpdate flag. + */ public boolean useBatchUpdate() { return useBatchUpdate; } - /** @param performLookup The performLookup flag to set. */ + /** + * @param performLookup The performLookup flag to set. + */ public void setPerformLookup(boolean performLookup) { this.performLookup = performLookup; } - /** @return Returns the performLookup flag. */ + /** + * @return Returns the performLookup flag. + */ public boolean isPerformLookup() { return performLookup; } @@ -210,97 +218,135 @@ public void settablenameField(String tablenamefield) { this.tablenameField = tablenamefield; } - /** @return Returns the commitSize. */ + /** + * @return Returns the commitSize. + */ public String getCommitSize() { return commitSize; } - /** @param commitSize The commitSize to set. */ + /** + * @param commitSize The commitSize to set. + */ public void setCommitSize(int commitSize) { this.commitSize = Integer.toString(commitSize); } - /** @param commitSize The commitSize to set. */ + /** + * @param commitSize The commitSize to set. + */ public void setCommitSize(String commitSize) { this.commitSize = commitSize; } - /** @return Returns the database. */ + /** + * @return Returns the database. + */ public DatabaseMeta getDatabaseMeta() { return databaseMeta; } - /** @param database The database to set. */ + /** + * @param database The database to set. + */ public void setDatabaseMeta(DatabaseMeta database) { this.databaseMeta = database; } - /** @return Returns the keyCondition. */ + /** + * @return Returns the keyCondition. + */ public String[] getKeyCondition() { return keyCondition; } - /** @param keyCondition The keyCondition to set. */ + /** + * @param keyCondition The keyCondition to set. + */ public void setKeyCondition(String[] keyCondition) { this.keyCondition = keyCondition; } - /** @return Returns the keyLookup. */ + /** + * @return Returns the keyLookup. + */ public String[] getKeyLookup() { return keyLookup; } - /** @param keyLookup The keyLookup to set. */ + /** + * @param keyLookup The keyLookup to set. + */ public void setKeyLookup(String[] keyLookup) { this.keyLookup = keyLookup; } - /** @return Returns the keyStream. */ + /** + * @return Returns the keyStream. + */ public String[] getKeyStream() { return keyStream; } - /** @param keyStream The keyStream to set. */ + /** + * @param keyStream The keyStream to set. + */ public void setKeyStream(String[] keyStream) { this.keyStream = keyStream; } - /** @return Returns the keyStream2. */ + /** + * @return Returns the keyStream2. + */ public String[] getKeyStream2() { return keyStream2; } - /** @param keyStream2 The keyStream2 to set. */ + /** + * @param keyStream2 The keyStream2 to set. + */ public void setKeyStream2(String[] keyStream2) { this.keyStream2 = keyStream2; } - /** @return Returns the tableName. */ + /** + * @return Returns the tableName. + */ public String getTableName() { return tableName; } - /** @param tableName The tableName to set. */ + /** + * @param tableName The tableName to set. + */ public void setTableName(String tableName) { this.tableName = tableName; } - /** @return Returns the updateLookup. */ + /** + * @return Returns the updateLookup. + */ public String[] getUpdateLookup() { return updateLookup; } - /** @param updateLookup The updateLookup to set. */ + /** + * @param updateLookup The updateLookup to set. + */ public void setUpdateLookup(String[] updateLookup) { this.updateLookup = updateLookup; } - /** @return Returns the updateStream. */ + /** + * @return Returns the updateStream. + */ public String[] getUpdateStream() { return updateStream; } - /** @param updateStream The updateStream to set. */ + /** + * @param updateStream The updateStream to set. + */ public void setUpdateStream(String[] updateStream) { this.updateStream = updateStream; } @@ -1040,12 +1086,16 @@ public IRowMeta getRequiredFields(IVariables variables) throws HopException { } } - /** @return the schemaName */ + /** + * @return the schemaName + */ public String getSchemaName() { return schemaName; } - /** @param schemaName the schemaName to set */ + /** + * @param schemaName the schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } diff --git a/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaInjectionTest.java b/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaInjectionTest.java index 043cb4c16e4..4bdc6f4e7b4 100644 --- a/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaInjectionTest.java +++ b/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaInjectionTest.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -24,9 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class SynchronizeAfterMergeMetaInjectionTest extends BaseMetadataInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaTest.java b/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaTest.java index 6471d9f60eb..2555a1de0b0 100644 --- a/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaTest.java +++ b/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -31,11 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SynchronizeAfterMergeMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = SynchronizeAfterMergeMeta.class; diff --git a/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeTest.java b/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeTest.java index 24826df64fa..23df739d4c9 100644 --- a/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeTest.java +++ b/plugins/transforms/synchronizeaftermerge/src/test/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.synchronizeaftermerge; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.database.NoneDatabaseMeta; import org.apache.hop.core.variables.IVariables; @@ -25,12 +31,6 @@ import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - public class SynchronizeAfterMergeTest { private static final String TRANSFORM_NAME = "Sync"; diff --git a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java index 134b414c3a9..32ed2108ac5 100644 --- a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java +++ b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java @@ -18,11 +18,10 @@ package org.apache.hop.pipeline.transforms.systemdata; import com.sun.management.OperatingSystemMXBean; -import org.apache.hop.core.Const; - import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.lang.management.ThreadMXBean; +import org.apache.hop.core.Const; public class Management { private static RuntimeMXBean mx = null; @@ -31,7 +30,9 @@ public class Management { /** Return infos like current PID, JVM memory, ... */ - /** @return Process CPU time in nanoseconds */ + /** + * @return Process CPU time in nanoseconds + */ public static long getPID() { String pid = null; if (mx == null) { @@ -46,31 +47,41 @@ public static long getPID() { return Const.toInt(pid, -1); } - /** @return JVM CPU time in nanoseconds */ + /** + * @return JVM CPU time in nanoseconds + */ public static long getJVMCpuTime() { setOperatingSystemMXBean(); return bean.getProcessCpuTime(); } - /** @return the amount of free physical memory in bytes */ + /** + * @return the amount of free physical memory in bytes + */ public static long getFreePhysicalMemorySize() { setOperatingSystemMXBean(); return bean.getFreePhysicalMemorySize(); } - /** @return the amount of free swap space in bytes */ + /** + * @return the amount of free swap space in bytes + */ public static long getFreeSwapSpaceSize() { setOperatingSystemMXBean(); return bean.getFreeSwapSpaceSize(); } - /** @return the total amount of physical memory in bytes */ + /** + * @return the total amount of physical memory in bytes + */ public static long getTotalPhysicalMemorySize() { setOperatingSystemMXBean(); return bean.getTotalPhysicalMemorySize(); } - /** @return the total amount of swap space in bytes. */ + /** + * @return the total amount of swap space in bytes. + */ public static long getTotalSwapSpaceSize() { setOperatingSystemMXBean(); return bean.getTotalSwapSpaceSize(); @@ -85,7 +96,9 @@ public static long getCommittedVirtualMemorySize() { return bean.getCommittedVirtualMemorySize(); } - /** @return CPU time in nanoseconds. */ + /** + * @return CPU time in nanoseconds. + */ public static long getCpuTime(long id) { setThreadMXBean(); if (!tbean.isThreadCpuTimeSupported()) { diff --git a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java index 3c9e48ce7b3..ff48b348d7b 100644 --- a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java +++ b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.systemdata; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.Locale; import org.apache.hop.core.Const; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; @@ -32,12 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.List; -import java.util.Locale; - /** Get information from the System or the supervising pipeline. */ public class SystemData extends BaseTransform { @@ -690,7 +689,8 @@ private Date calculateStartRange(String locationName, ExecutionType executionTyp // Execution execution = iLocation.findPreviousSuccessfulExecution(executionType, name); if (execution == null) { - // We can go back millions of years but that would probably confuse a lot of 3rd party systems. + // We can go back millions of years but that would probably confuse a lot of 3rd party + // systems. // return new GregorianCalendar(1900, Calendar.JANUARY, 1).getTime(); } else { diff --git a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java index 4c9fb26ebaa..33edfc954eb 100644 --- a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java +++ b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java @@ -246,7 +246,6 @@ private void getInfo(SystemDataMeta in) throws HopException { int count = wFields.nrNonEmpty(); in.allocate(count); - for (int i = 0; i < count; i++) { TableItem item = wFields.getNonEmpty(i); in.getFieldName()[i] = item.getText(1); diff --git a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java index ebb90c9bbea..e7ad8a5f7b4 100644 --- a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java +++ b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.systemdata; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -41,9 +43,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.List; - @InjectionSupported(localizationPrefix = "SystemDataMeta.Injection.") @Transform( id = "SystemInfo", @@ -66,22 +65,30 @@ public SystemDataMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String[] getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String[] fieldName) { this.fieldName = fieldName; } - /** @return Returns the fieldType. */ + /** + * @return Returns the fieldType. + */ public SystemDataTypes[] getFieldType() { return fieldType; } - /** @param fieldType The fieldType to set. */ + /** + * @param fieldType The fieldType to set. + */ public void setFieldType(SystemDataTypes[] fieldType) { this.fieldType = fieldType; } diff --git a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java index efc0edbfad9..70b49c84afb 100644 --- a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java +++ b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java @@ -34,32 +34,44 @@ public SystemDataMetaFunction(int type, String code, String description) { this.description = description; } - /** @return the code */ + /** + * @return the code + */ public String getCode() { return code; } - /** @param code the code to set */ + /** + * @param code the code to set + */ public void setCode(String code) { this.code = code; } - /** @return the description */ + /** + * @return the description + */ public String getDescription() { return description; } - /** @param description the description to set */ + /** + * @param description the description to set + */ public void setDescription(String description) { this.description = description; } - /** @return the type */ + /** + * @return the type + */ public int getType() { return type; } - /** @param type the type to set */ + /** + * @param type the type to set + */ public void setType(int type) { this.type = type; } diff --git a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java index dbd618b4866..5cf969d1d1d 100644 --- a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java +++ b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.systemdata; +import static org.junit.Assert.assertEquals; + +import java.io.StringReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -34,17 +44,6 @@ import org.w3c.dom.Node; import org.xml.sax.InputSource; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.StringReader; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import static org.junit.Assert.assertEquals; - /** User: Dzmitry Stsiapanau Date: 1/20/14 Time: 3:04 PM */ public class SystemDataMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java index f4ba85d6de6..f74362d83c7 100644 --- a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java +++ b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.systemdata; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertFalse; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -31,14 +39,6 @@ import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertFalse; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** User: Dzmitry Stsiapanau Date: 1/20/14 Time: 12:12 PM */ public class SystemDataTest { private class SystemDataHandler extends SystemData { diff --git a/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompare.java b/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompare.java index 59e09fc7884..8aaf6f0e1ef 100644 --- a/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompare.java +++ b/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompare.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.tablecompare; +import java.sql.ResultSet; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; @@ -32,8 +33,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.ResultSet; - public class TableCompare extends BaseTransform { private static final Class PKG = TableCompare.class; // For Translator @@ -231,7 +230,6 @@ private Object[] compareTables( Object[] result = new Object[6]; - if (Utils.isEmpty(referenceTable)) { Object[] errorRowData = constructErrorRow(rowMeta, r, null, null, null); putError( @@ -256,12 +254,16 @@ private Object[] compareTables( nrErrors++; } - DatabaseMeta refConnectionDatabaseMeta = getPipelineMeta().findDatabase(meta.getReferenceConnection(), variables); + DatabaseMeta refConnectionDatabaseMeta = + getPipelineMeta().findDatabase(meta.getReferenceConnection(), variables); String refSchemaTable = - refConnectionDatabaseMeta.getQuotedSchemaTableCombination(this, referenceSchema, referenceTable); - DatabaseMeta compConnectionDatabaseMeta = getPipelineMeta().findDatabase(meta.getReferenceConnection(), variables); + refConnectionDatabaseMeta.getQuotedSchemaTableCombination( + this, referenceSchema, referenceTable); + DatabaseMeta compConnectionDatabaseMeta = + getPipelineMeta().findDatabase(meta.getReferenceConnection(), variables); String cmpSchemaTable = - compConnectionDatabaseMeta.getQuotedSchemaTableCombination(this, compareSchema, compareTable); + compConnectionDatabaseMeta.getQuotedSchemaTableCombination( + this, compareSchema, compareTable); if (Utils.isEmpty(keyFields)) { Object[] errorRowData = constructErrorRow(rowMeta, r, null, null, null); @@ -686,15 +688,15 @@ public boolean init() { if (super.init()) { try { - DatabaseMeta refConnectionDatabaseMeta = getPipelineMeta().findDatabase(meta.getReferenceConnection(), variables); + DatabaseMeta refConnectionDatabaseMeta = + getPipelineMeta().findDatabase(meta.getReferenceConnection(), variables); if (refConnectionDatabaseMeta == null) { logError( - BaseMessages.getString( - PKG, "TableCompare.RefConnection.ConnectionMissing", getTransformName())); + BaseMessages.getString( + PKG, "TableCompare.RefConnection.ConnectionMissing", getTransformName())); return false; } - data.referenceDb = new Database(this, this, refConnectionDatabaseMeta); data.referenceDb.connect(); @@ -703,21 +705,21 @@ public boolean init() { BaseMessages.getString( PKG, "TableCompare.Exception.UnexpectedErrorConnectingToReferenceDatabase", - meta.getReferenceConnection()), + meta.getReferenceConnection()), e); return false; } try { - DatabaseMeta compConnectionDatabaseMeta = getPipelineMeta().findDatabase(meta.getCompareConnection(), variables); + DatabaseMeta compConnectionDatabaseMeta = + getPipelineMeta().findDatabase(meta.getCompareConnection(), variables); if (compConnectionDatabaseMeta == null) { logError( - BaseMessages.getString( - PKG, "TableCompare.CompConnection.ConnectionMissing", getTransformName())); + BaseMessages.getString( + PKG, "TableCompare.CompConnection.ConnectionMissing", getTransformName())); return false; } - data.compareDb = new Database(this, this, compConnectionDatabaseMeta); data.compareDb.connect(); @@ -726,7 +728,7 @@ public boolean init() { BaseMessages.getString( PKG, "TableCompare.Exception.UnexpectedErrorConnectingToCompareDatabase", - meta.getCompareConnection()), + meta.getCompareConnection()), e); return false; } diff --git a/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareDialog.java b/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareDialog.java index 70e5ce34c17..ed71a18bc4f 100644 --- a/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareDialog.java +++ b/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.tablecompare; +import java.util.Arrays; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.database.DatabaseMeta; @@ -53,8 +54,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.Arrays; - public class TableCompareDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = TableCompare.class; // For Translator @@ -116,7 +115,6 @@ public void widgetSelected(SelectionEvent e) { int middle = props.getMiddlePct(); int margin = props.getMargin(); - wOk = new Button(shell, SWT.PUSH); wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); @@ -171,7 +169,6 @@ public void widgetSelected(SelectionEvent e) { PropsUi.setLook(wReferenceComp); wReferenceComp.setLayout(referenceLayout); - // Reference DB + schema + table DatabaseMeta refDatabaseMeta = pipelineMeta.findDatabase(input.getReferenceConnection(), variables); @@ -412,7 +409,7 @@ public void widgetSelected(SelectionEvent e) { // wNrErrors = new LabelText( - wAdditionalFieldsComp, + wAdditionalFieldsComp, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsField.Tooltip")); PropsUi.setLook(wNrErrors); @@ -427,7 +424,7 @@ public void widgetSelected(SelectionEvent e) { // wNrRecordsReference = new LabelText( - wAdditionalFieldsComp, + wAdditionalFieldsComp, BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsReferenceField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsReferenceField.Tooltip")); PropsUi.setLook(wNrRecordsReference); @@ -442,7 +439,7 @@ public void widgetSelected(SelectionEvent e) { // wNrRecordsCompare = new LabelText( - wAdditionalFieldsComp, + wAdditionalFieldsComp, BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsCompareField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrRecordsCompareField.Tooltip")); PropsUi.setLook(wNrRecordsCompare); @@ -457,7 +454,7 @@ public void widgetSelected(SelectionEvent e) { // wNrErrorsLeftJoin = new LabelText( - wAdditionalFieldsComp, + wAdditionalFieldsComp, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsLeftJoinField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsLeftJoinField.Tooltip")); PropsUi.setLook(wNrErrorsLeftJoin); @@ -472,7 +469,7 @@ public void widgetSelected(SelectionEvent e) { // wNrErrorsInnerJoin = new LabelText( - wAdditionalFieldsComp, + wAdditionalFieldsComp, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsInnerJoinField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsInnerJoinField.Tooltip")); PropsUi.setLook(wNrErrorsInnerJoin); @@ -487,7 +484,7 @@ public void widgetSelected(SelectionEvent e) { // wNrErrorsRightJoin = new LabelText( - wAdditionalFieldsComp, + wAdditionalFieldsComp, BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsRightJoinField.Label"), BaseMessages.getString(PKG, "TableCompareDialog.NrErrorsRightJoinField.Tooltip")); PropsUi.setLook(wNrErrorsRightJoin); diff --git a/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMeta.java b/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMeta.java index 3287d36f0fd..0b3937c2ffa 100644 --- a/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMeta.java +++ b/plugins/transforms/tablecompare/src/main/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.tablecompare; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "TableCompare", image = "tablecompare.svg", diff --git a/plugins/transforms/tablecompare/src/test/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMetaTest.java b/plugins/transforms/tablecompare/src/test/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMetaTest.java index 29771b90803..076832baa7d 100644 --- a/plugins/transforms/tablecompare/src/test/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMetaTest.java +++ b/plugins/transforms/tablecompare/src/test/java/org/apache/hop/pipeline/transforms/tablecompare/TableCompareMetaTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.tablecompare; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class TableCompareMetaTest { LoadSaveTester loadSaveTester; Class testMetaClass = TableCompareMeta.class; diff --git a/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsDialog.java b/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsDialog.java index f47d4ee495d..47f7de701ef 100644 --- a/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsDialog.java +++ b/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsDialog.java @@ -262,7 +262,7 @@ private void ok() { if (Utils.isEmpty(wConnection.getText())) { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage( - BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogMessage")); + BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogMessage")); mb.setText(BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogTitle")); mb.open(); } diff --git a/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMeta.java b/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMeta.java index 42d0a515c9a..edb8ee27f99 100644 --- a/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMeta.java +++ b/plugins/transforms/tableexists/src/main/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.tableexists; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "TableExists", image = "tableexists.svg", diff --git a/plugins/transforms/tableexists/src/test/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMetaTest.java b/plugins/transforms/tableexists/src/test/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMetaTest.java index c28213b2605..2ddd76aafb8 100644 --- a/plugins/transforms/tableexists/src/test/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMetaTest.java +++ b/plugins/transforms/tableexists/src/test/java/org/apache/hop/pipeline/transforms/tableexists/TableExistsMetaTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.tableexists; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -25,9 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class TableExistsMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInput.java b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInput.java index bfd5ae70288..f918ac29395 100644 --- a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInput.java +++ b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInput.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.tableinput; +import java.sql.ResultSet; +import java.sql.SQLException; import org.apache.hop.core.Const; import org.apache.hop.core.IRowSet; import org.apache.hop.core.RowMetaAndData; @@ -35,9 +37,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.ResultSet; -import java.sql.SQLException; - /** Reads information from a database table by using freehand SQL */ public class TableInput extends BaseTransform { diff --git a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputData.java b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputData.java index bd62f1bb879..55c47c0a280 100644 --- a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputData.java +++ b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputData.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.tableinput; +import java.sql.ResultSet; import org.apache.hop.core.IRowSet; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; @@ -24,8 +25,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.stream.IStream; -import java.sql.ResultSet; - public class TableInputData extends BaseTransformData implements ITransformData { public Object[] nextrow; public Object[] thisrow; diff --git a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java index 63ecb6b6df3..5ffeab9216b 100644 --- a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java +++ b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java @@ -134,7 +134,6 @@ public String open() { fdTransformName.right = new FormAttachment(100, 0); wTransformName.setLayoutData(fdTransformName); - wConnection = addConnectionLine(shell, wTransformName, input.getConnection(), lsMod); // Some buttons diff --git a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputMeta.java b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputMeta.java index 8922c5a9e9f..ce56373e0b6 100644 --- a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputMeta.java +++ b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.tableinput; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -48,8 +49,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "TableInput", image = "tableinput.svg", @@ -60,7 +59,6 @@ keywords = "i18n::TableInputMeta.keyword") public class TableInputMeta extends BaseTransformMeta { - private static final Class PKG = TableInputMeta.class; // For Translator @HopMetadataProperty(key = "sql", injectionKey = "SQL") @@ -85,32 +83,44 @@ public TableInputMeta() { super(); } - /** @return Returns true if the transform should be run per row */ + /** + * @return Returns true if the transform should be run per row + */ public boolean isExecuteEachInputRow() { return executeEachInputRow; } - /** @param oncePerRow true if the transform should be run per row */ + /** + * @param oncePerRow true if the transform should be run per row + */ public void setExecuteEachInputRow(boolean oncePerRow) { this.executeEachInputRow = oncePerRow; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public String getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(String rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the sql. */ + /** + * @return Returns the sql. + */ public String getSql() { return sql; } - /** @param sql The sql to set. */ + /** + * @param sql The sql to set. + */ public void setSql(String sql) { this.sql = sql; } @@ -412,13 +422,14 @@ public void check( } } - /** @param transforms optionally search the info transform in a list of transforms */ + /** + * @param transforms optionally search the info transform in a list of transforms + */ @Override public void searchInfoAndTargetTransforms(List transforms) { List infoStreams = getTransformIOMeta().getInfoStreams(); for (IStream stream : infoStreams) { - stream.setTransformMeta( - TransformMeta.findTransform(transforms, stream.getSubject())); + stream.setTransformMeta(TransformMeta.findTransform(transforms, stream.getSubject())); } } @@ -470,12 +481,16 @@ public void analyseImpact( } } - /** @return Returns the variableReplacementActive. */ + /** + * @return Returns the variableReplacementActive. + */ public boolean isVariableReplacementActive() { return variableReplacementActive; } - /** @param variableReplacementActive The variableReplacementActive to set. */ + /** + * @param variableReplacementActive The variableReplacementActive to set. + */ public void setVariableReplacementActive(boolean variableReplacementActive) { this.variableReplacementActive = variableReplacementActive; } diff --git a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutput.java b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutput.java index dd4c058b8c8..ff48c95aa53 100644 --- a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutput.java +++ b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutput.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.tableoutput; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.database.Database; @@ -36,12 +41,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - /** Writes rows to a database table. */ public class TableOutput extends BaseTransform { diff --git a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputData.java b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputData.java index 687b68c0a87..7c7ab42fb31 100644 --- a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputData.java +++ b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputData.java @@ -17,12 +17,6 @@ package org.apache.hop.pipeline.transforms.tableoutput; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.sql.PreparedStatement; import java.sql.Savepoint; import java.text.SimpleDateFormat; @@ -31,6 +25,11 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; /** Storage class for table output transform. */ public class TableOutputData extends BaseTransformData implements ITransformData { diff --git a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java index a2900ff6050..db1b0455b85 100644 --- a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java +++ b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.tableoutput; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -75,10 +78,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class TableOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = TableOutputMeta.class; // For Translator diff --git a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputField.java b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputField.java index 09fbcb19b3e..0d93a747409 100644 --- a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputField.java +++ b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.tableoutput; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class TableOutputField { @@ -49,7 +48,9 @@ public TableOutputField(TableOutputField obj) { injectionKeyDescription = "TableOutputMeta.Injection.FieldDatabase.Field") private String fieldDatabase; - /** @return Fields containing the values in the input stream to insert. */ + /** + * @return Fields containing the values in the input stream to insert. + */ public String getFieldStream() { return fieldStream; } @@ -61,12 +62,16 @@ public void setFieldStream(String fieldStream) { this.fieldStream = fieldStream; } - /** @return Fields containing the fieldnames in the database insert. */ + /** + * @return Fields containing the fieldnames in the database insert. + */ public String getFieldDatabase() { return fieldDatabase; } - /** @param fieldDatabase The fields containing the names of the fields to insert. */ + /** + * @param fieldDatabase The fields containing the names of the fields to insert. + */ public void setFieldDatabase(String fieldDatabase) { this.fieldDatabase = fieldDatabase; } diff --git a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMeta.java b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMeta.java index a713aaa2dbc..3e9014739a7 100644 --- a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMeta.java +++ b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.tableoutput; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -43,10 +46,6 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - @Transform( id = "TableOutput", image = "tableoutput.svg", diff --git a/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMetaTest.java b/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMetaTest.java index c30edf3bfb0..fa30fdf4e32 100644 --- a/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMetaTest.java +++ b/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputMetaTest.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.tableoutput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.database.DatabaseMeta; @@ -34,19 +46,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.List; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class TableOutputMetaTest { private IVariables variables; diff --git a/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputTest.java b/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputTest.java index 10398d30d13..3c1a4d6c5d8 100644 --- a/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputTest.java +++ b/plugins/transforms/tableoutput/src/test/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputTest.java @@ -17,22 +17,6 @@ package org.apache.hop.pipeline.transforms.tableoutput; -import org.apache.hop.core.database.Database; -import org.apache.hop.core.database.DatabaseMeta; -import org.apache.hop.core.database.IDatabase; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.variables.IVariables; -import org.apache.hop.pipeline.PipelineMeta; -import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; -import org.apache.hop.pipeline.transform.TransformMeta; -import org.apache.hop.pipeline.transform.TransformPartitioningMeta; -import org.junit.Before; -import org.junit.Test; - -import java.sql.Connection; -import java.util.Map; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyString; @@ -47,6 +31,21 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.sql.Connection; +import java.util.Map; +import org.apache.hop.core.database.Database; +import org.apache.hop.core.database.DatabaseMeta; +import org.apache.hop.core.database.IDatabase; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.variables.IVariables; +import org.apache.hop.pipeline.PipelineMeta; +import org.apache.hop.pipeline.engines.local.LocalPipelineEngine; +import org.apache.hop.pipeline.transform.TransformMeta; +import org.apache.hop.pipeline.transform.TransformPartitioningMeta; +import org.junit.Before; +import org.junit.Test; + public class TableOutputTest { private DatabaseMeta databaseMeta; diff --git a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/FastloadControlBuilder.java b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/FastloadControlBuilder.java index 7b9cb5b43d5..ad08d4ac74f 100644 --- a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/FastloadControlBuilder.java +++ b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/FastloadControlBuilder.java @@ -207,7 +207,9 @@ public FastloadControlBuilder show() { return line("SHOW"); } - /** @return this */ + /** + * @return this + */ public FastloadControlBuilder endLoading() { return line("END LOADING"); } diff --git a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFast.java b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFast.java index bf609c03cc1..d01c13ba5b6 100644 --- a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFast.java +++ b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFast.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.terafast; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; @@ -36,17 +46,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - public class TeraFast extends AbstractTransform { private static final Class PKG = TeraFastMeta.class; // For Translator diff --git a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastDialog.java b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastDialog.java index fb4360e37d0..47a367955bd 100644 --- a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastDialog.java +++ b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.terafast; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.SourceToTargetMapping; import org.apache.hop.core.database.DatabaseMeta; @@ -60,8 +62,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.ArrayList; -import java.util.List; public class TeraFastDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = TeraFastMeta.class; // For Translator @@ -487,7 +487,9 @@ public void widgetSelected(final SelectionEvent event) { this.wReturn.addModifyListener(lsMod); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildControlFileLine(final PluginWidgetFactory factory) { final Control topControl = this.wUseControlFile; @@ -510,7 +512,9 @@ protected void buildControlFileLine(final PluginWidgetFactory factory) { this.wControlFile.setLayoutData(formData); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildFastloadLine(final PluginWidgetFactory factory) { final Control topControl = this.wVariableSubstitution; @@ -533,7 +537,9 @@ protected void buildFastloadLine(final PluginWidgetFactory factory) { this.wFastLoadPath.setLayoutData(formData); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildUseControlFileLine(final PluginWidgetFactory factory) { final Control topControl = this.wTransformName; @@ -556,7 +562,9 @@ public void widgetSelected(final SelectionEvent event) { }); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildVariableSubstitutionLine(final PluginWidgetFactory factory) { final Control topControl = this.wControlFile; @@ -572,7 +580,9 @@ protected void buildVariableSubstitutionLine(final PluginWidgetFactory factory) factory.createButtonLayoutData(wlVariableSubstitution)); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildLogFileLine(final PluginWidgetFactory factory) { final Control topControl = this.wFastLoadPath; @@ -613,7 +623,9 @@ protected void buildTransformNameLine(final PluginWidgetFactory factory) { this.wTransformName.setLayoutData(this.fdTransformName); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildTableLine(final PluginWidgetFactory factory) { final Control topControl = this.wConnection; @@ -635,7 +647,9 @@ public void focusLost(final FocusEvent event) { }); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildTruncateTableLine(final PluginWidgetFactory factory) { final Control topControl = this.wTable; @@ -649,7 +663,9 @@ protected void buildTruncateTableLine(final PluginWidgetFactory factory) { this.wbTruncateTable.setLayoutData(factory.createButtonLayoutData(wlTruncateTable)); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildDataFileLine(final PluginWidgetFactory factory) { final Control topControl = this.wbTruncateTable; @@ -672,7 +688,9 @@ protected void buildDataFileLine(final PluginWidgetFactory factory) { this.wDataFile.setLayoutData(formData); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildSessionsLine(final PluginWidgetFactory factory) { final Control topControl = this.wDataFile; @@ -686,7 +704,9 @@ protected void buildSessionsLine(final PluginWidgetFactory factory) { this.wSessions.setLayoutData(factory.createControlLayoutData(topControl)); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildErrorLimitLine(final PluginWidgetFactory factory) { final Control topControl = this.wSessions; @@ -700,7 +720,9 @@ protected void buildErrorLimitLine(final PluginWidgetFactory factory) { this.wErrLimit.setLayoutData(factory.createControlLayoutData(topControl)); } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildAscLink(final PluginWidgetFactory factory) { final Control topControl = this.wReturn; @@ -708,7 +730,9 @@ protected void buildAscLink(final PluginWidgetFactory factory) { formData.right = null; } - /** @param factory factory to use. */ + /** + * @param factory factory to use. + */ protected void buildFieldTable(final PluginWidgetFactory factory) { final Control topControl = this.wErrLimit; @@ -802,7 +826,9 @@ private void clearColInfo() { } } - /** @return the meta */ + /** + * @return the meta + */ public TeraFastMeta getMeta() { return this.meta; } diff --git a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastMeta.java b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastMeta.java index 5cc0f97d053..f2002824599 100644 --- a/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastMeta.java +++ b/plugins/transforms/terafast/src/main/java/org/apache/hop/pipeline/transforms/terafast/TeraFastMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.terafast; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -41,8 +42,6 @@ import org.apache.hop.pipeline.transform.ITransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "TeraFast", image = "terafast.svg", @@ -304,122 +303,170 @@ public Object clone() { return super.clone(); } - /** @return the fastloadPath */ + /** + * @return the fastloadPath + */ public StringPluginProperty getFastloadPath() { return this.fastloadPath; } - /** @param fastloadPath the fastloadPath to set */ + /** + * @param fastloadPath the fastloadPath to set + */ public void setFastloadPath(final StringPluginProperty fastloadPath) { this.fastloadPath = fastloadPath; } - /** @return the controlFile */ + /** + * @return the controlFile + */ public StringPluginProperty getControlFile() { return this.controlFile; } - /** @param controlFile the controlFile to set */ + /** + * @param controlFile the controlFile to set + */ public void setControlFile(final StringPluginProperty controlFile) { this.controlFile = controlFile; } - /** @return the dataFile */ + /** + * @return the dataFile + */ public StringPluginProperty getDataFile() { return this.dataFile; } - /** @param dataFile the dataFile to set */ + /** + * @param dataFile the dataFile to set + */ public void setDataFile(final StringPluginProperty dataFile) { this.dataFile = dataFile; } - /** @return the logFile */ + /** + * @return the logFile + */ public StringPluginProperty getLogFile() { return this.logFile; } - /** @param logFile the logFile to set */ + /** + * @param logFile the logFile to set + */ public void setLogFile(final StringPluginProperty logFile) { this.logFile = logFile; } - /** @return the sessions */ + /** + * @return the sessions + */ public IntegerPluginProperty getSessions() { return this.sessions; } - /** @param sessions the sessions to set */ + /** + * @param sessions the sessions to set + */ public void setSessions(final IntegerPluginProperty sessions) { this.sessions = sessions; } - /** @return the errorLimit */ + /** + * @return the errorLimit + */ public IntegerPluginProperty getErrorLimit() { return this.errorLimit; } - /** @param errorLimit the errorLimit to set */ + /** + * @param errorLimit the errorLimit to set + */ public void setErrorLimit(final IntegerPluginProperty errorLimit) { this.errorLimit = errorLimit; } - /** @return the useControlFile */ + /** + * @return the useControlFile + */ public BooleanPluginProperty getUseControlFile() { return this.useControlFile; } - /** @param useControlFile the useControlFile to set */ + /** + * @param useControlFile the useControlFile to set + */ public void setUseControlFile(final BooleanPluginProperty useControlFile) { this.useControlFile = useControlFile; } - /** @return the targetTable */ + /** + * @return the targetTable + */ public StringPluginProperty getTargetTable() { return this.targetTable; } - /** @param targetTable the targetTable to set */ + /** + * @param targetTable the targetTable to set + */ public void setTargetTable(final StringPluginProperty targetTable) { this.targetTable = targetTable; } - /** @return the truncateTable */ + /** + * @return the truncateTable + */ public BooleanPluginProperty getTruncateTable() { return this.truncateTable; } - /** @param truncateTable the truncateTable to set */ + /** + * @param truncateTable the truncateTable to set + */ public void setTruncateTable(final BooleanPluginProperty truncateTable) { this.truncateTable = truncateTable; } - /** @return the tableFieldList */ + /** + * @return the tableFieldList + */ public StringListPluginProperty getTableFieldList() { return this.tableFieldList; } - /** @param tableFieldList the tableFieldList to set */ + /** + * @param tableFieldList the tableFieldList to set + */ public void setTableFieldList(final StringListPluginProperty tableFieldList) { this.tableFieldList = tableFieldList; } - /** @return the streamFieldList */ + /** + * @return the streamFieldList + */ public StringListPluginProperty getStreamFieldList() { return this.streamFieldList; } - /** @param streamFieldList the streamFieldList to set */ + /** + * @param streamFieldList the streamFieldList to set + */ public void setStreamFieldList(final StringListPluginProperty streamFieldList) { this.streamFieldList = streamFieldList; } - /** @return the variableSubstitution */ + /** + * @return the variableSubstitution + */ public BooleanPluginProperty getVariableSubstitution() { return this.variableSubstitution; } - /** @param variableSubstitution the variableSubstitution to set */ + /** + * @param variableSubstitution the variableSubstitution to set + */ public void setVariableSubstitution(BooleanPluginProperty variableSubstitution) { this.variableSubstitution = variableSubstitution; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInput.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInput.java index 6759ec5a03b..440a8a9c1ba 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInput.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInput.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.io.ByteOrderMark; import org.apache.commons.io.input.BOMInputStream; import org.apache.commons.vfs2.FileObject; @@ -43,15 +51,6 @@ import org.apache.hop.pipeline.transforms.fileinput.text.BOMDetector; import org.apache.hop.ui.pipeline.transform.common.TextFileLineUtil; -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; - /** Read a simple CSV file Just output Strings found in the file... */ public class CsvInput extends BaseTransform { diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputData.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputData.java index edd4adcf5ab..0b41a366753 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputData.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputData.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.csvinput; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.file.EncodingType; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.FileInputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.List; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.file.EncodingType; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class CsvInputData extends BaseTransformData implements ITransformData { public FileChannel fc; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDialog.java index 620cf70d9b6..5f35fd8ff6b 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDialog.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDialog.java @@ -130,7 +130,6 @@ public class CsvInputDialog extends BaseTransformDialog private MetaSelectionLine wSchemaDefinition; - public CsvInputDialog( Shell parent, IVariables variables, Object in, PipelineMeta tr, String sname) { super(parent, variables, (BaseTransformMeta) in, tr, sname); @@ -153,13 +152,13 @@ public String open() { previewBusy = new AtomicBoolean(false); SelectionListener lsSelection = - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - fillFieldsLayoutFromSchema(); - inputMeta.setChanged(); - } - }; + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + fillFieldsLayoutFromSchema(); + inputMeta.setChanged(); + } + }; FormLayout formLayout = new FormLayout(); formLayout.marginWidth = PropsUi.getFormMargin(); @@ -518,14 +517,14 @@ public void focusGained(FocusEvent e) { // Add schema definition line wSchemaDefinition = - new MetaSelectionLine<>( - variables, - metadataProvider, - SchemaDefinition.class, - shell, - SWT.NONE, - BaseMessages.getString(PKG, "CsvInputDialog.SchemaDefinition.Label"), - BaseMessages.getString(PKG, "CsvInputDialog.SchemaDefinition.Tooltip")); + new MetaSelectionLine<>( + variables, + metadataProvider, + SchemaDefinition.class, + shell, + SWT.NONE, + BaseMessages.getString(PKG, "CsvInputDialog.SchemaDefinition.Label"), + BaseMessages.getString(PKG, "CsvInputDialog.SchemaDefinition.Tooltip")); PropsUi.setLook(wSchemaDefinition); FormData fdSchemaDefinition = new FormData(); @@ -654,27 +653,35 @@ public void widgetSelected(SelectionEvent se) { inputMeta.setChanged(changed); initializing = false; - shell.getDisplay().asyncExec(() -> { - // Show more information about the transform and its alternatives - // - if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_INFO_PARAMETER, "Y"))) { - MessageDialogWithToggle md = - new MessageDialogWithToggle( + shell + .getDisplay() + .asyncExec( + () -> { + // Show more information about the transform and its alternatives + // + if ("Y" + .equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_INFO_PARAMETER, "Y"))) { + MessageDialogWithToggle md = + new MessageDialogWithToggle( shell, BaseMessages.getString(PKG, "CsvInputDialog.UsageInfoDialog.DialogTitle"), BaseMessages.getString( PKG, "CsvInputDialog.UsageInfoDialog.DialogMessage", Const.CR) - + Const.CR, + + Const.CR, SWT.ICON_INFORMATION, new String[] { - BaseMessages.getString(PKG, "CsvInputDialog.UsageInfoDialog.Close") + BaseMessages.getString(PKG, "CsvInputDialog.UsageInfoDialog.Close") }, - BaseMessages.getString(PKG, "CsvInputDialog.UsageInfoDialog.DoNotShowAgain"), - "N".equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_INFO_PARAMETER, "Y"))); - md.open(); - props.setCustomParameter(STRING_USAGE_INFO_PARAMETER, md.getToggleState() ? "N" : "Y"); - } - }); + BaseMessages.getString( + PKG, "CsvInputDialog.UsageInfoDialog.DoNotShowAgain"), + "N" + .equalsIgnoreCase( + props.getCustomParameter(STRING_USAGE_INFO_PARAMETER, "Y"))); + md.open(); + props.setCustomParameter( + STRING_USAGE_INFO_PARAMETER, md.getToggleState() ? "N" : "Y"); + } + }); BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel()); @@ -688,7 +695,7 @@ private void fillFieldsLayoutFromSchema() { MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); mb.setMessage( - BaseMessages.getString(PKG, "CsvInputDialog.Load.SchemaDefinition.Message", schemaName)); + BaseMessages.getString(PKG, "CsvInputDialog.Load.SchemaDefinition.Message", schemaName)); mb.setText(BaseMessages.getString(PKG, "CsvInputDialog.Load.SchemaDefinition.Title")); int answer = mb.open(); @@ -721,8 +728,9 @@ private void fillFieldsLayoutFromSchema() { item.setText(colnr++, Const.NVL(valueMeta.getCurrencySymbol(), "")); item.setText(colnr++, Const.NVL(valueMeta.getDecimalSymbol(), "")); item.setText(colnr++, Const.NVL(valueMeta.getGroupingSymbol(), "")); - item.setText(colnr++, Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); - + item.setText( + colnr++, + Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); } } } @@ -817,10 +825,7 @@ public void getData( wEncoding.setText(Const.NVL(inputMeta.getEncoding(), "")); wSchemaDefinition.setText(Const.NVL(inputMeta.getSchemaDefinition(), "")); - final List fieldName = - newFieldNames == null - ? new ArrayList() - : newFieldNames; + final List fieldName = newFieldNames == null ? new ArrayList() : newFieldNames; for (int i = 0; i < inputMeta.getInputFields().length; i++) { TextFileInputField field = inputMeta.getInputFields()[i]; final TableItem item = getTableItem(field.getName(), true); diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMeta.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMeta.java index 9dc1000045d..63fbb506394 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMeta.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -54,10 +57,6 @@ import org.apache.hop.resource.ResourceReference; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @InjectionSupported( localizationPrefix = "CsvInputMeta.Injection.", groups = {"INPUT_FIELDS"}) @@ -69,9 +68,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", keywords = "i18n::CsvInputMeta.keyword", documentationUrl = "/pipeline/transforms/csvinput.html") -public class CsvInputMeta extends BaseTransformMeta implements - IInputFileMeta, - ICsvInputAwareMeta { +public class CsvInputMeta extends BaseTransformMeta + implements IInputFileMeta, ICsvInputAwareMeta { private static final Class PKG = CsvInput.class; // For Translator @@ -385,33 +383,45 @@ public void check( } } - /** @return the delimiter */ + /** + * @return the delimiter + */ @Override public String getDelimiter() { return delimiter; } - /** @param delimiter the delimiter to set */ + /** + * @param delimiter the delimiter to set + */ public void setDelimiter(String delimiter) { this.delimiter = delimiter; } - /** @return the filename */ + /** + * @return the filename + */ public String getFilename() { return filename; } - /** @param filename the filename to set */ + /** + * @param filename the filename to set + */ public void setFilename(String filename) { this.filename = filename; } - /** @return the bufferSize */ + /** + * @return the bufferSize + */ public String getBufferSize() { return bufferSize; } - /** @param bufferSize the bufferSize to set */ + /** + * @param bufferSize the bufferSize to set + */ public void setBufferSize(String bufferSize) { this.bufferSize = bufferSize; } @@ -432,23 +442,31 @@ public void setLazyConversionActive(boolean lazyConversionActive) { this.lazyConversionActive = lazyConversionActive; } - /** @return the headerPresent */ + /** + * @return the headerPresent + */ public boolean isHeaderPresent() { return headerPresent; } - /** @param headerPresent the headerPresent to set */ + /** + * @param headerPresent the headerPresent to set + */ public void setHeaderPresent(boolean headerPresent) { this.headerPresent = headerPresent; } - /** @return the enclosure */ + /** + * @return the enclosure + */ @Override public String getEnclosure() { return enclosure; } - /** @param enclosure the enclosure to set */ + /** + * @param enclosure the enclosure to set + */ public void setEnclosure(String enclosure) { this.enclosure = enclosure; } @@ -470,13 +488,17 @@ public List getResourceDependencies( return references; } - /** @return the inputFields */ + /** + * @return the inputFields + */ @Override public TextFileInputField[] getInputFields() { return inputFields; } - /** @param inputFields the inputFields to set */ + /** + * @param inputFields the inputFields to set + */ public void setInputFields(TextFileInputField[] inputFields) { this.inputFields = inputFields; } @@ -553,63 +575,87 @@ public boolean isErrorLineSkipped() { return false; } - /** @return the filenameField */ + /** + * @return the filenameField + */ public String getFilenameField() { return filenameField; } - /** @param filenameField the filenameField to set */ + /** + * @param filenameField the filenameField to set + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } - /** @return the includingFilename */ + /** + * @return the includingFilename + */ public boolean isIncludingFilename() { return includingFilename; } - /** @param includingFilename the includingFilename to set */ + /** + * @param includingFilename the includingFilename to set + */ public void setIncludingFilename(boolean includingFilename) { this.includingFilename = includingFilename; } - /** @return the rowNumField */ + /** + * @return the rowNumField + */ public String getRowNumField() { return rowNumField; } - /** @param rowNumField the rowNumField to set */ + /** + * @param rowNumField the rowNumField to set + */ public void setRowNumField(String rowNumField) { this.rowNumField = rowNumField; } - /** @param isaddresult The isaddresult to set. */ + /** + * @param isaddresult The isaddresult to set. + */ public void setAddResultFile(boolean isaddresult) { this.isaddresult = isaddresult; } - /** @return Returns isaddresult. */ + /** + * @return Returns isaddresult. + */ public boolean isAddResultFile() { return isaddresult; } - /** @return the runningInParallel */ + /** + * @return the runningInParallel + */ public boolean isRunningInParallel() { return runningInParallel; } - /** @param runningInParallel the runningInParallel to set */ + /** + * @param runningInParallel the runningInParallel to set + */ public void setRunningInParallel(boolean runningInParallel) { this.runningInParallel = runningInParallel; } - /** @return the encoding */ + /** + * @return the encoding + */ @Override public String getEncoding() { return encoding; } - /** @param encoding the encoding to set */ + /** + * @param encoding the encoding to set + */ public void setEncoding(String encoding) { this.encoding = encoding; } @@ -660,12 +706,16 @@ public boolean supportsErrorHandling() { return true; } - /** @return the newlinePossibleInFields */ + /** + * @return the newlinePossibleInFields + */ public boolean isNewlinePossibleInFields() { return newlinePossibleInFields; } - /** @param newlinePossibleInFields the newlinePossibleInFields to set */ + /** + * @param newlinePossibleInFields the newlinePossibleInFields to set + */ public void setNewlinePossibleInFields(boolean newlinePossibleInFields) { this.newlinePossibleInFields = newlinePossibleInFields; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileCSVImportProgressDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileCSVImportProgressDialog.java index 27cae273940..c6b814bf314 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileCSVImportProgressDialog.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileCSVImportProgressDialog.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.fileinput; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; @@ -40,16 +49,6 @@ import org.apache.hop.ui.pipeline.transform.common.ICsvInputAwareImportProgressDialog; import org.eclipse.swt.widgets.Shell; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** * Takes care of displaying a dialog that will handle the wait while we're finding out what tables, * views etc we can reach in the database. diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilter.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilter.java index eec3ea5785a..3a9f28efc18 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilter.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilter.java @@ -17,8 +17,10 @@ package org.apache.hop.pipeline.transforms.fileinput; -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ +@Deprecated(since = "2.0") public class TextFileFilter implements Cloneable { /** The position of the occurrence of the filter string to check at */ private int filterPosition; @@ -59,42 +61,58 @@ public Object clone() { } } - /** @return Returns the filterLastLine. */ + /** + * @return Returns the filterLastLine. + */ public boolean isFilterLastLine() { return filterLastLine; } - /** @param filterLastLine The filterLastLine to set. */ + /** + * @param filterLastLine The filterLastLine to set. + */ public void setFilterLastLine(boolean filterLastLine) { this.filterLastLine = filterLastLine; } - /** @return Returns the filterPositive. */ + /** + * @return Returns the filterPositive. + */ public boolean isFilterPositive() { return filterPositive; } - /** @param filterPositive The filterPositive to set. */ + /** + * @param filterPositive The filterPositive to set. + */ public void setFilterPositive(boolean filterPositive) { this.filterPositive = filterPositive; } - /** @return Returns the filterPosition. */ + /** + * @return Returns the filterPosition. + */ public int getFilterPosition() { return filterPosition; } - /** @param filterPosition The filterPosition to set. */ + /** + * @param filterPosition The filterPosition to set. + */ public void setFilterPosition(int filterPosition) { this.filterPosition = filterPosition; } - /** @return Returns the filterString. */ + /** + * @return Returns the filterString. + */ public String getFilterString() { return filterString; } - /** @param filterString The filterString to set. */ + /** + * @param filterString The filterString to set. + */ public void setFilterString(String filterString) { this.filterString = filterString; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilterProcessor.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilterProcessor.java index b96daee8ad4..9d0a9478717 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilterProcessor.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileFilterProcessor.java @@ -22,7 +22,7 @@ * * @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +@Deprecated(since = "2.0") public class TextFileFilterProcessor { /** The filters to process */ @@ -30,7 +30,9 @@ public class TextFileFilterProcessor { private boolean stopProcessing; - /** @param filters The filters to process */ + /** + * @param filters The filters to process + */ public TextFileFilterProcessor(TextFileFilter[] filters) { this.filters = filters; this.stopProcessing = false; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInput.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInput.java index a1127b77546..492c05eb511 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInput.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInput.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.fileinput; +import java.io.BufferedInputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -53,20 +60,13 @@ import org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerMissingFiles; import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; -import java.io.BufferedInputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * Read all sorts of text files, convert them to rows and writes these to one or more output * streams. + * * @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +@Deprecated(since = "2.0") public class TextFileInput extends BaseTransform { private static final Class PKG = TextFileInputMeta.class; // For Translator @@ -170,7 +170,7 @@ public static final String getLine( return null; } - @Deprecated(since="2.0") + @Deprecated(since = "2.0") public static final String[] guessStringsFromLine( ILogChannel log, String line, TextFileInputMeta inf, String delimiter) throws HopException { return guessStringsFromLine( diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputData.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputData.java index 334bbdbe593..1b34ee432b4 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputData.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputData.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.fileinput; +import java.io.InputStreamReader; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.IRowSet; import org.apache.hop.core.compress.CompressionInputStream; @@ -28,15 +34,10 @@ import org.apache.hop.pipeline.transform.ITransformData; import org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler; -import java.io.InputStreamReader; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ +@Deprecated(since = "2.0") public class TextFileInputData extends BaseTransformData implements ITransformData { public List lineBuffer; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java index e8ec66ddf45..a5270388c9c 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java @@ -15,9 +15,17 @@ * limitations under the License. */ - package org.apache.hop.pipeline.transforms.fileinput; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Vector; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -85,18 +93,10 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Vector; - -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ +@Deprecated(since = "2.0") public class TextFileInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = TextFileInputMeta.class; // For Translator @@ -2443,7 +2443,6 @@ private void getInfo(TextFileInputMeta meta) { field.setRepeated( BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(13))); - meta.getInputFields()[i] = field; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputMeta.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputMeta.java index 6050ae0085e..bca05a912d2 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputMeta.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputMeta.java @@ -1,4 +1,3 @@ - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -19,6 +18,10 @@ package org.apache.hop.pipeline.transforms.fileinput; import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.codec.binary.Base64; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; @@ -55,13 +58,10 @@ import org.apache.hop.resource.ResourceReference; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ +@Deprecated(since = "2.0") @Transform( id = "TextFileInput", image = "textfileinput.svg", @@ -71,7 +71,7 @@ keywords = "i18n::TextFileInputMeta.keyword", documentationUrl = "/pipeline/transforms/textfileinput.html") public class TextFileInputMeta extends BaseTransformMeta -implements IInputFileMeta { + implements IInputFileMeta { private static final Class PKG = TextFileInputMeta.class; // For Translator @@ -263,92 +263,128 @@ public class TextFileInputMeta extends BaseTransformMeta transforms) { acceptingTransform = TransformMeta.findTransform(transforms, acceptingTransformName); @@ -1338,13 +1462,17 @@ public void check( } } - /** @return Returns the escapeCharacter. */ + /** + * @return Returns the escapeCharacter. + */ @Override public String getEscapeCharacter() { return escapeCharacter; } - /** @param escapeCharacter The escapeCharacter to set. */ + /** + * @param escapeCharacter The escapeCharacter to set. + */ public void setEscapeCharacter(String escapeCharacter) { this.escapeCharacter = escapeCharacter; } @@ -1385,22 +1513,30 @@ public void setErrorTextField(String errorTextField) { this.errorTextField = errorTextField; } - /** @return Returns the lineWrapped. */ + /** + * @return Returns the lineWrapped. + */ public boolean isLineWrapped() { return lineWrapped; } - /** @param lineWrapped The lineWrapped to set. */ + /** + * @param lineWrapped The lineWrapped to set. + */ public void setLineWrapped(boolean lineWrapped) { this.lineWrapped = lineWrapped; } - /** @return Returns the nrFooterLines. */ + /** + * @return Returns the nrFooterLines. + */ public int getNrFooterLines() { return nrFooterLines; } - /** @param nrFooterLines The nrFooterLines to set. */ + /** + * @param nrFooterLines The nrFooterLines to set. + */ public void setNrFooterLines(int nrFooterLines) { this.nrFooterLines = nrFooterLines; } @@ -1416,53 +1552,73 @@ public String getRequiredFilesDesc(String tt) { } } - /** @return Returns the nrHeaderLines. */ + /** + * @return Returns the nrHeaderLines. + */ @Override public int getNrHeaderLines() { return nrHeaderLines; } - /** @param nrHeaderLines The nrHeaderLines to set. */ + /** + * @param nrHeaderLines The nrHeaderLines to set. + */ public void setNrHeaderLines(int nrHeaderLines) { this.nrHeaderLines = nrHeaderLines; } - /** @return Returns the nrWraps. */ + /** + * @return Returns the nrWraps. + */ public int getNrWraps() { return nrWraps; } - /** @param nrWraps The nrWraps to set. */ + /** + * @param nrWraps The nrWraps to set. + */ public void setNrWraps(int nrWraps) { this.nrWraps = nrWraps; } - /** @return Returns the layoutPaged. */ + /** + * @return Returns the layoutPaged. + */ public boolean isLayoutPaged() { return layoutPaged; } - /** @param layoutPaged The layoutPaged to set. */ + /** + * @param layoutPaged The layoutPaged to set. + */ public void setLayoutPaged(boolean layoutPaged) { this.layoutPaged = layoutPaged; } - /** @return Returns the nrLinesPerPage. */ + /** + * @return Returns the nrLinesPerPage. + */ public int getNrLinesPerPage() { return nrLinesPerPage; } - /** @param nrLinesPerPage The nrLinesPerPage to set. */ + /** + * @param nrLinesPerPage The nrLinesPerPage to set. + */ public void setNrLinesPerPage(int nrLinesPerPage) { this.nrLinesPerPage = nrLinesPerPage; } - /** @return Returns the nrLinesDocHeader. */ + /** + * @return Returns the nrLinesDocHeader. + */ public int getNrLinesDocHeader() { return nrLinesDocHeader; } - /** @param nrLinesDocHeader The nrLinesDocHeader to set. */ + /** + * @param nrLinesDocHeader The nrLinesDocHeader to set. + */ public void setNrLinesDocHeader(int nrLinesDocHeader) { this.nrLinesDocHeader = nrLinesDocHeader; } @@ -1523,12 +1679,16 @@ public void setDateFormatLenient(boolean dateFormatLenient) { this.dateFormatLenient = dateFormatLenient; } - /** @param isaddresult The isaddresult to set. */ + /** + * @param isaddresult The isaddresult to set. + */ public void setAddResultFile(boolean isaddresult) { this.isaddresult = isaddresult; } - /** @return Returns isaddresult. */ + /** + * @return Returns isaddresult. + */ public boolean isAddResultFile() { return isaddresult; } @@ -1542,12 +1702,16 @@ public void setErrorLineSkipped(boolean errorLineSkipped) { this.errorLineSkipped = errorLineSkipped; } - /** @return Returns the dateFormatLocale. */ + /** + * @return Returns the dateFormatLocale. + */ public Locale getDateFormatLocale() { return dateFormatLocale; } - /** @param dateFormatLocale The dateFormatLocale to set. */ + /** + * @param dateFormatLocale The dateFormatLocale to set. + */ public void setDateFormatLocale(Locale dateFormatLocale) { this.dateFormatLocale = dateFormatLocale; } @@ -1568,32 +1732,44 @@ public void setPassingThruFields(boolean passingThruFields) { this.passingThruFields = passingThruFields; } - /** @return Returns the fileNameField. */ + /** + * @return Returns the fileNameField. + */ public String getAcceptingField() { return acceptingField; } - /** @param fileNameField The fileNameField to set. */ + /** + * @param fileNameField The fileNameField to set. + */ public void setAcceptingField(String fileNameField) { this.acceptingField = fileNameField; } - /** @return Returns the acceptingTransform. */ + /** + * @return Returns the acceptingTransform. + */ public String getAcceptingTransformName() { return acceptingTransformName; } - /** @param acceptingTransform The acceptingTransform to set. */ + /** + * @param acceptingTransform The acceptingTransform to set. + */ public void setAcceptingTransformName(String acceptingTransform) { this.acceptingTransformName = acceptingTransform; } - /** @return Returns the acceptingTransform. */ + /** + * @return Returns the acceptingTransform. + */ public TransformMeta getAcceptingTransform() { return acceptingTransform; } - /** @param acceptingTransform The acceptingTransform to set. */ + /** + * @param acceptingTransform The acceptingTransform to set. + */ public void setAcceptingTransform(TransformMeta acceptingTransform) { this.acceptingTransform = acceptingTransform; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileLine.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileLine.java index 404b8bf3c06..cdef07a2d78 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileLine.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileLine.java @@ -19,8 +19,10 @@ import org.apache.commons.vfs2.FileObject; -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ +@Deprecated(since = "2.0") public class TextFileLine { public String line; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/VariableButtonListenerFactory.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/VariableButtonListenerFactory.java index ed0b5faa101..7a872b9d09a 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/VariableButtonListenerFactory.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/VariableButtonListenerFactory.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.fileinput; +import java.util.Arrays; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.ui.core.dialog.EnterSelectionDialog; @@ -27,10 +28,10 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; -import java.util.Arrays; - -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ -@Deprecated(since="2.0") +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ +@Deprecated(since = "2.0") public class VariableButtonListenerFactory { private static final Class PKG = TextFileInputMeta.class; // For Translator diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileCSVImportProgressDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileCSVImportProgressDialog.java index bdc8faa7437..05c24c1bccf 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileCSVImportProgressDialog.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileCSVImportProgressDialog.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; @@ -42,16 +51,6 @@ import org.apache.hop.ui.pipeline.transform.common.TextFileLineUtil; import org.eclipse.swt.widgets.Shell; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** * Takes care of displaying a dialog that will handle the wait while we're finding out what tables, * views etc we can reach in the database. diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilter.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilter.java index 51056eea661..574811aaddb 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilter.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilter.java @@ -63,42 +63,58 @@ public Object clone() { } } - /** @return Returns the filterLastLine. */ + /** + * @return Returns the filterLastLine. + */ public boolean isFilterLastLine() { return filterLastLine; } - /** @param filterLastLine The filterLastLine to set. */ + /** + * @param filterLastLine The filterLastLine to set. + */ public void setFilterLastLine(boolean filterLastLine) { this.filterLastLine = filterLastLine; } - /** @return Returns the filterPositive. */ + /** + * @return Returns the filterPositive. + */ public boolean isFilterPositive() { return filterPositive; } - /** @param filterPositive The filterPositive to set. */ + /** + * @param filterPositive The filterPositive to set. + */ public void setFilterPositive(boolean filterPositive) { this.filterPositive = filterPositive; } - /** @return Returns the filterPosition. */ + /** + * @return Returns the filterPosition. + */ public int getFilterPosition() { return filterPosition; } - /** @param filterPosition The filterPosition to set. */ + /** + * @param filterPosition The filterPosition to set. + */ public void setFilterPosition(int filterPosition) { this.filterPosition = filterPosition; } - /** @return Returns the filterString. */ + /** + * @return Returns the filterString. + */ public String getFilterString() { return filterString; } - /** @param filterString The filterString to set. */ + /** + * @param filterString The filterString to set. + */ public void setFilterString(String filterString) { this.filterString = filterString; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilterProcessor.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilterProcessor.java index 097c261425b..e65f3c3d05a 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilterProcessor.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileFilterProcessor.java @@ -28,7 +28,9 @@ public class TextFileFilterProcessor { private String[] filtersString; private boolean stopProcessing; - /** @param filters The filters to process */ + /** + * @param filters The filters to process + */ public TextFileFilterProcessor(TextFileFilter[] filters, IVariables variables) { this.filters = filters; this.stopProcessing = false; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputData.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputData.java index 23136c5892d..bbfb55bb960 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputData.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import java.util.LinkedList; +import java.util.List; import org.apache.hop.core.file.EncodingType; import org.apache.hop.core.playlist.IFilePlayList; import org.apache.hop.pipeline.transforms.file.BaseFileInputTransformData; -import java.util.LinkedList; -import java.util.List; - public class TextFileInputData extends BaseFileInputTransformData { public List lineBuffer; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java index c9dd0af4e14..4c3b50e104d 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package org.apache.hop.pipeline.transforms.fileinput.text; import java.io.InputStream; @@ -1931,13 +1930,13 @@ private void addFiltersTabs() { private void addFieldsTabs() { SelectionListener lsSelection = - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - fillFieldsLayoutFromSchema(); - input.setChanged(); - } - }; + new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + fillFieldsLayoutFromSchema(); + input.setChanged(); + } + }; // Fields tab... // @@ -1954,14 +1953,14 @@ public void widgetSelected(SelectionEvent e) { PropsUi.setLook(wFieldsComp); wSchemaDefinition = - new MetaSelectionLine<>( - variables, - metadataProvider, - SchemaDefinition.class, - wFieldsComp, - SWT.NONE, - BaseMessages.getString(PKG, "TextFileInputDialog.SchemaDefinition.Label"), - BaseMessages.getString(PKG, "TextFileInputDialog.SchemaDefinition.Tooltip")); + new MetaSelectionLine<>( + variables, + metadataProvider, + SchemaDefinition.class, + wFieldsComp, + SWT.NONE, + BaseMessages.getString(PKG, "TextFileInputDialog.SchemaDefinition.Label"), + BaseMessages.getString(PKG, "TextFileInputDialog.SchemaDefinition.Tooltip")); PropsUi.setLook(wSchemaDefinition); FormData fdSchemaDefinition = new FormData(); @@ -1980,7 +1979,8 @@ public void widgetSelected(SelectionEvent e) { Group wManualSchemaDefinition = new Group(wFieldsComp, SWT.SHADOW_NONE); PropsUi.setLook(wManualSchemaDefinition); - wManualSchemaDefinition.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ManualSchemaDefinition.Label")); + wManualSchemaDefinition.setText( + BaseMessages.getString(PKG, "TextFileInputDialog.ManualSchemaDefinition.Label")); FormLayout manualSchemaDefinitionLayout = new FormLayout(); manualSchemaDefinitionLayout.marginWidth = 10; @@ -2075,7 +2075,7 @@ public void widgetSelected(SelectionEvent e) { wFields = new TableView( variables, - wManualSchemaDefinition, + wManualSchemaDefinition, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, @@ -2114,7 +2114,8 @@ private void fillFieldsLayoutFromSchema() { MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); mb.setMessage( - BaseMessages.getString(PKG, "TextFileInputDialog.Load.SchemaDefinition.Message", schemaName)); + BaseMessages.getString( + PKG, "TextFileInputDialog.Load.SchemaDefinition.Message", schemaName)); mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Load.SchemaDefinition.Title")); int answer = mb.open(); @@ -2122,7 +2123,7 @@ private void fillFieldsLayoutFromSchema() { if (!Utils.isEmpty(schemaName)) { try { SchemaDefinition schemaDefinition = - (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); + (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); if (schemaDefinition != null) { IRowMeta r = schemaDefinition.getRowMeta(); if (r != null) { @@ -2136,18 +2137,19 @@ private void fillFieldsLayoutFromSchema() { item.setText(2, ValueMetaFactory.getValueMetaName(valueMeta.getType())); item.setText(3, Const.NVL(valueMeta.getConversionMask(), "")); item.setText( - 5, - valueMeta.getLength() >= 0 ? Integer.toString(valueMeta.getLength()) : ""); + 5, + valueMeta.getLength() >= 0 ? Integer.toString(valueMeta.getLength()) : ""); item.setText( - 6, - valueMeta.getPrecision() >= 0 - ? Integer.toString(valueMeta.getPrecision()) - : ""); + 6, + valueMeta.getPrecision() >= 0 + ? Integer.toString(valueMeta.getPrecision()) + : ""); item.setText(7, Const.NVL(valueMeta.getCurrencySymbol(), "")); item.setText(8, Const.NVL(valueMeta.getDecimalSymbol(), "")); item.setText(9, Const.NVL(valueMeta.getGroupingSymbol(), "")); - item.setText(12, Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); - + item.setText( + 12, + Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); } } } @@ -2456,9 +2458,7 @@ private void getFieldsData( final boolean reloadAllFields, final List newFieldNames) { final List lowerCaseNewFieldNames = - newFieldNames == null - ? new ArrayList() - : newFieldNames; + newFieldNames == null ? new ArrayList() : newFieldNames; for (int i = 0; i < in.inputFields.length; i++) { BaseFileField field = in.inputFields[i]; @@ -2645,7 +2645,6 @@ private void getInfo(TextFileInputMeta meta, boolean preview) { field.setRepeated( BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(13))); - meta.inputFields[i] = field; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java index e56ffb73650..1407db5a650 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java @@ -18,6 +18,9 @@ package org.apache.hop.pipeline.transforms.fileinput.text; import com.google.common.annotations.VisibleForTesting; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; @@ -59,10 +62,6 @@ import org.apache.hop.ui.pipeline.transform.common.TextFileLineUtil; import org.w3c.dom.Node; -import java.util.List; -import java.util.Locale; -import java.util.Map; - @Transform( id = "TextFileInput2", image = "textfileinput.svg", @@ -248,22 +247,30 @@ public void setSchemaDefinition(String schemaDefinition) { this.schemaDefinition = schemaDefinition; } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String[] getFileName() { return inputFiles.fileName; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String[] fileName) { inputFiles.fileName = fileName; } - /** @return The array of filters for the metadata of this text file input transform. */ + /** + * @return The array of filters for the metadata of this text file input transform. + */ public TextFileFilter[] getFilter() { return filter; } - /** @param filter The array of filters to use */ + /** + * @param filter The array of filters to use + */ public void setFilter(TextFileFilter[] filter) { this.filter = filter; } @@ -943,7 +950,9 @@ public String getLookupTransformName() { return null; } - /** @param transforms optionally search the info transform in a list of transforms */ + /** + * @param transforms optionally search the info transform in a list of transforms + */ @Override public void searchInfoAndTargetTransforms(List transforms) { acceptingTransform = TransformMeta.findTransform(transforms, inputFiles.acceptingTransformName); @@ -1061,7 +1070,9 @@ public void setErrorLineSkipped(boolean errorLineSkipped) { this.errorLineSkipped = errorLineSkipped; } - /** @param acceptingTransform The accepting Transform to set. */ + /** + * @param acceptingTransform The accepting Transform to set. + */ public void setAcceptingTransform(TransformMeta acceptingTransform) { this.acceptingTransform = acceptingTransform; } @@ -1159,12 +1170,16 @@ public String getEncoding() { return content.encoding; } - /** @return the length */ + /** + * @return the length + */ public String getLength() { return content.length; } - /** @param length the length to set */ + /** + * @param length the length to set + */ public void setLength(String length) { content.length = length; } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputReader.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputReader.java index 7ecb5d78262..6fe497b48a3 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputReader.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputReader.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import java.io.BufferedInputStream; +import java.io.InputStreamReader; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.compress.CompressionInputStream; import org.apache.hop.core.compress.CompressionProviderFactory; @@ -32,9 +34,6 @@ import org.apache.hop.pipeline.transforms.file.IBaseFileInputTransformControl; import org.apache.hop.ui.pipeline.transform.common.TextFileLineUtil; -import java.io.BufferedInputStream; -import java.io.InputStreamReader; - /** Reader for one text file. */ public class TextFileInputReader implements IBaseFileInputReader { private static final int BUFFER_SIZE_INPUT_STREAM = 8192; diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java index 6c3f5686b1b..7b938be5b0c 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; @@ -31,11 +35,6 @@ import org.apache.hop.pipeline.transforms.file.BaseFileField; import org.apache.hop.pipeline.transforms.file.BaseFileInputAdditionalField; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; - /** Some common methods for text file parsing. */ public class TextFileInputUtils { private static final Class PKG = TextFileInputUtils.class; // For Translator diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/VariableButtonListenerFactory.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/VariableButtonListenerFactory.java index aa75596f9b4..bc2727bacc3 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/VariableButtonListenerFactory.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/VariableButtonListenerFactory.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import java.util.Arrays; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.ui.core.dialog.EnterSelectionDialog; @@ -27,8 +28,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; -import java.util.Arrays; - public class VariableButtonListenerFactory { private static final Class PKG = TextFileInputMeta.class; // For Translator diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutput.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutput.java index 562b45d9e1f..a4b3b599f53 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutput.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutput.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.textfileoutput; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; @@ -40,14 +47,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** Converts input rows to text and then writes this text to one or more files. */ public class TextFileOutput extends BaseTransform { @@ -56,7 +55,7 @@ public class TextFileOutput( - variables, - metadataProvider, - SchemaDefinition.class, - wFieldsComp, - SWT.NONE, - BaseMessages.getString(PKG, "TextFileOutputDialog.SchemaDefinition.Label"), - BaseMessages.getString(PKG, "TextFileOutputDialog.SchemaDefinition.Tooltip")); + new MetaSelectionLine<>( + variables, + metadataProvider, + SchemaDefinition.class, + wFieldsComp, + SWT.NONE, + BaseMessages.getString(PKG, "TextFileOutputDialog.SchemaDefinition.Label"), + BaseMessages.getString(PKG, "TextFileOutputDialog.SchemaDefinition.Tooltip")); PropsUi.setLook(wSchemaDefinition); FormData fdSchemaDefinition = new FormData(); @@ -1074,7 +1074,8 @@ public void widgetSelected(SelectionEvent e) { Group wManualSchemaDefinition = new Group(wFieldsComp, SWT.SHADOW_NONE); PropsUi.setLook(wManualSchemaDefinition); - wManualSchemaDefinition.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ManualSchemaDefinition.Label")); + wManualSchemaDefinition.setText( + BaseMessages.getString(PKG, "TextFileOutputDialog.ManualSchemaDefinition.Label")); FormLayout manualSchemaDefinitionLayout = new FormLayout(); manualSchemaDefinitionLayout.marginWidth = 10; @@ -1157,7 +1158,7 @@ public void widgetSelected(SelectionEvent e) { wFields = new TableView( variables, - wManualSchemaDefinition, + wManualSchemaDefinition, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, @@ -1269,7 +1270,8 @@ private void fillFieldsLayoutFromSchema() { MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); mb.setMessage( - BaseMessages.getString(PKG, "TextFileOutputDialog.Load.SchemaDefinition.Message", schemaName)); + BaseMessages.getString( + PKG, "TextFileOutputDialog.Load.SchemaDefinition.Message", schemaName)); mb.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Load.SchemaDefinition.Title")); int answer = mb.open(); @@ -1277,7 +1279,7 @@ private void fillFieldsLayoutFromSchema() { if (!Utils.isEmpty(schemaName)) { try { SchemaDefinition schemaDefinition = - (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); + (new SchemaDefinitionUtil()).loadSchemaDefinition(metadataProvider, schemaName); if (schemaDefinition != null) { IRowMeta r = schemaDefinition.getRowMeta(); if (r != null) { @@ -1292,17 +1294,18 @@ private void fillFieldsLayoutFromSchema() { item.setText(2, ValueMetaFactory.getValueMetaName(valueMeta.getType())); item.setText(3, Const.NVL(valueMeta.getConversionMask(), "")); item.setText( - 4, - valueMeta.getLength() >= 0 ? Integer.toString(valueMeta.getLength()) : ""); + 4, + valueMeta.getLength() >= 0 ? Integer.toString(valueMeta.getLength()) : ""); item.setText( - 5, - valueMeta.getPrecision() >= 0 - ? Integer.toString(valueMeta.getPrecision()) - : ""); + 5, + valueMeta.getPrecision() >= 0 + ? Integer.toString(valueMeta.getPrecision()) + : ""); item.setText(6, Const.NVL(valueMeta.getCurrencySymbol(), "")); item.setText(7, Const.NVL(valueMeta.getDecimalSymbol(), "")); item.setText(8, Const.NVL(valueMeta.getGroupingSymbol(), "")); - item.setText(9, Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); + item.setText( + 9, Const.NVL(ValueMetaString.getTrimTypeDesc(valueMeta.getTrimType()), "")); } } } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMeta.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMeta.java index a8a8b8efa6f..ed5b2bca1a8 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMeta.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMeta.java @@ -18,6 +18,10 @@ package org.apache.hop.pipeline.transforms.textfileoutput; import com.google.common.annotations.VisibleForTesting; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -45,11 +49,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - @Transform( id = "TextFileOutput", image = "textfileoutput.svg", diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/CsvExplorerFileType.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/CsvExplorerFileType.java index 137704694e1..f94708faead 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/CsvExplorerFileType.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/CsvExplorerFileType.java @@ -39,7 +39,15 @@ public class CsvExplorerFileType extends BaseTextExplorerFileType { public CsvExplorerFileType() { - super("CSV File", ".csv", new String[] {"*.csv"}, new String[] {"CSV files"}, FileTypeCapabilities.getCapabilities(IHopFileType.CAPABILITY_SAVE, IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY)); + super( + "CSV File", + ".csv", + new String[] {"*.csv"}, + new String[] {"CSV files"}, + FileTypeCapabilities.getCapabilities( + IHopFileType.CAPABILITY_SAVE, + IHopFileType.CAPABILITY_CLOSE, + IHopFileType.CAPABILITY_FILE_HISTORY)); } @Override diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/MarkDownExplorerFileType.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/MarkDownExplorerFileType.java index db2ba0de16a..6198695ec09 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/MarkDownExplorerFileType.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/MarkDownExplorerFileType.java @@ -46,9 +46,9 @@ public MarkDownExplorerFileType() { new String[] {"MarkDown files"}, FileTypeCapabilities.getCapabilities( IHopFileType.CAPABILITY_SAVE, - IHopFileType.CAPABILITY_CLOSE, + IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY, - IHopFileType.CAPABILITY_COPY, + IHopFileType.CAPABILITY_COPY, IHopFileType.CAPABILITY_SELECT)); } diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileType.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileType.java index 0b00702b4f4..c4bba5d66b9 100644 --- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileType.java +++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileType.java @@ -39,12 +39,16 @@ public class TextExplorerFileType extends BaseTextExplorerFileType { public TextExplorerFileType() { - super("TXT File", ".txt", new String[] {"*.txt"}, new String[] {"TXT files"}, + super( + "TXT File", + ".txt", + new String[] {"*.txt"}, + new String[] {"TXT files"}, FileTypeCapabilities.getCapabilities( IHopFileType.CAPABILITY_SAVE, - IHopFileType.CAPABILITY_CLOSE, + IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY, - IHopFileType.CAPABILITY_COPY, + IHopFileType.CAPABILITY_COPY, IHopFileType.CAPABILITY_SELECT)); } diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/BaseParsingTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/BaseParsingTest.java index b5cc1c6dd4c..0c710961ce6 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/BaseParsingTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/BaseParsingTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -39,15 +47,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** Base class for all tests for BaseFileInput transforms. */ @Ignore("No tests in abstract base class") public abstract class BaseParsingTest< diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputContentParsingTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputContentParsingTest.java index ad1a23fc924..052ca6c591a 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputContentParsingTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputContentParsingTest.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.file.TextFileInputField; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.junit.ClassRule; import org.junit.Test; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; - public class CsvInputContentParsingTest extends BaseCsvParsingTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDataTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDataTest.java index b93b3938dcb..9fca60a44a6 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDataTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDataTest.java @@ -17,10 +17,10 @@ package org.apache.hop.pipeline.transforms.csvinput; -import org.junit.Test; - import static org.junit.Assert.assertEquals; +import org.junit.Test; + public class CsvInputDataTest { @Test public void testRemoveEscapedEnclosuresWithOneEscapedInMiddle() { diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDoubleLineEndTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDoubleLineEndTest.java index 15dc4c105a0..480a2f74d08 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDoubleLineEndTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputDoubleLineEndTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.file.TextFileInputField; @@ -30,10 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /** * Tests for double line endings in CsvInput transform * diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputEnclosureTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputEnclosureTest.java index 5bd15d8ea83..df1778fe042 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputEnclosureTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputEnclosureTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.File; import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; import org.apache.hop.core.file.TextFileInputField; @@ -27,12 +32,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class CsvInputEnclosureTest extends CsvInputUnitTestBase { private static final String QUOTATION_AND_EXCLAMATION_MARK = "\"!"; private static final String QUOTATION_MARK = "\""; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMetaTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMetaTest.java index 5b6d733456a..1ce9f558c7a 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMetaTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMetaTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -33,13 +39,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class CsvInputMetaTest implements IInitializer { TransformLoadSaveTester transformLoadSaveTester; Class testMetaClass = CsvInputMeta.class; @@ -116,12 +115,7 @@ public void setUpLoadSave() throws Exception { transformLoadSaveTester = new TransformLoadSaveTester( - testMetaClass, - attributes, - getterMap, - setterMap, - attrValidatorMap, - typeValidatorMap); + testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap); } // Call the allocate method on the LoadSaveTester meta class diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMultiCharDelimiterTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMultiCharDelimiterTest.java index 3fb3406e91a..a74da8dcb77 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMultiCharDelimiterTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputMultiCharDelimiterTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.File; import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; import org.apache.hop.core.file.TextFileInputField; @@ -27,12 +32,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class CsvInputMultiCharDelimiterTest extends CsvInputUnitTestBase { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputRowNumberTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputRowNumberTest.java index 68d7a30ae20..9f472763152 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputRowNumberTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputRowNumberTest.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.io.File; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.file.TextFileInputField; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.PipelineTestingUtil; @@ -26,10 +29,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; -import java.util.Arrays; -import java.util.List; - public class CsvInputRowNumberTest extends CsvInputUnitTestBase { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputTest.java index a6389fbe27d..16a53ddbeae 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +import java.io.File; import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; import org.apache.hop.core.file.TextFileInputField; @@ -27,13 +33,6 @@ import org.junit.Before; import org.junit.Test; -import java.io.File; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - public class CsvInputTest extends CsvInputUnitTestBase { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnicodeTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnicodeTest.java index e8776dda1c3..92f9986668c 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnicodeTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnicodeTest.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.nio.charset.StandardCharsets; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.file.TextFileInputField; @@ -33,8 +34,6 @@ import org.mockito.Matchers; import org.mockito.Mockito; -import java.nio.charset.StandardCharsets; - /** * Tests for unicode support in CsvInput transform * diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnitTestBase.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnitTestBase.java index 49a90bee5aa..416ad8602cc 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnitTestBase.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvInputUnitTestBase.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.csvinput; +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.file.TextFileInputField; import org.apache.hop.core.row.IValueMeta; import org.junit.BeforeClass; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; - public abstract class CsvInputUnitTestBase { static final String BUFFER_SIZE = "1024"; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvProcessRowInParallelTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvProcessRowInParallelTest.java index 4d76dc7427a..9c301fe54bf 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvProcessRowInParallelTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/CsvProcessRowInParallelTest.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; + +import java.io.File; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.file.TextFileInputField; import org.apache.hop.core.row.IRowMeta; @@ -29,10 +32,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; - -import static org.junit.Assert.assertEquals; - /** * We take file with content and run it parallel with several transforms. see docs for {@link * CsvInput#prepareToRunInParallel()} to understand how running file in parallel works diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/NamedFieldsMappingTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/NamedFieldsMappingTest.java index 54946435493..c800fa3e577 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/NamedFieldsMappingTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/NamedFieldsMappingTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class NamedFieldsMappingTest { private NamedFieldsMapping fieldsMapping; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/PDI_15270_Test.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/PDI_15270_Test.java index 7bd06c05751..f8e7cfbf685 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/PDI_15270_Test.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/PDI_15270_Test.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.File; import org.apache.hop.core.Const; import org.apache.hop.core.IRowSet; import org.apache.hop.core.QueueRowSet; @@ -27,16 +32,7 @@ import org.junit.ClassRule; import org.junit.Test; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -/** - * Csv data is taken from the attachment to the issue. - * -**/ +/** Csv data is taken from the attachment to the issue. */ public class PDI_15270_Test extends CsvInputUnitTestBase { private CsvInput csvInput; private String[] expected; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/TransformMockUtil.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/TransformMockUtil.java index ca36b9cb1e4..37bc3077dc9 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/TransformMockUtil.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/TransformMockUtil.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -26,12 +31,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -59,8 +58,12 @@ TransformMockHelper getTransformMockHelper( public static < Main extends BaseTransform, Meta extends ITransformMeta, Data extends ITransformData> Main getTransform(Class
klass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor
kons = klass.getConstructor( TransformMeta.class, @@ -81,8 +84,12 @@ Main getTransform( Class metaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( transformClass, TransformMockUtil.getTransformMockHelper(metaClass, dataClass, transformName)); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/UnnamedFieldsMappingTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/UnnamedFieldsMappingTest.java index 0da0f887151..053d2a3e5b7 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/UnnamedFieldsMappingTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/csvinput/UnnamedFieldsMappingTest.java @@ -17,11 +17,11 @@ package org.apache.hop.pipeline.transforms.csvinput; +import static org.junit.Assert.assertEquals; + import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class UnnamedFieldsMappingTest { private UnnamedFieldsMapping fieldsMapping; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BOMDetectorTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BOMDetectorTest.java index 4eceb144abd..1b3fb63590d 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BOMDetectorTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BOMDetectorTest.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.fileinput.text; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import org.junit.Test; public class BOMDetectorTest { diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BaseParsingTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BaseParsingTest.java index ce87f86d0af..41f407415ba 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BaseParsingTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/BaseParsingTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -39,15 +47,6 @@ import org.junit.Before; import org.junit.Ignore; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** Base class for all tests for BaseFileInput transforms. */ @Ignore("No tests in abstract base class") public abstract class BaseParsingTest< diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/EncodingTypeTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/EncodingTypeTest.java index f41a8e14a50..c95e16b1da6 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/EncodingTypeTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/EncodingTypeTest.java @@ -17,12 +17,12 @@ package org.apache.hop.pipeline.transforms.fileinput.text; -import org.apache.hop.core.file.EncodingType; -import org.junit.Test; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.apache.hop.core.file.EncodingType; +import org.junit.Test; + /** User: Dzmitry Stsiapanau Date: 3/11/14 Time: 11:44 AM */ public class EncodingTypeTest { @Test diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_11948_TransformsTestsParent.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_11948_TransformsTestsParent.java index c2bde6fb679..3066034493a 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_11948_TransformsTestsParent.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_11948_TransformsTestsParent.java @@ -17,12 +17,12 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.mockito.Mockito.mock; + import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.BaseTransformData; -import static org.mockito.Mockito.mock; - public class PDI_11948_TransformsTestsParent { protected T transformMock; protected Pipeline pipelineMock; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_2875_Test.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_2875_Test.java index 88f633463b8..6e8a67134eb 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_2875_Test.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/PDI_2875_Test.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Date; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; @@ -26,15 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Date; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class PDI_2875_Test { private static TransformMockHelper smh; private final String VAR_NAME = "VAR"; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaLoadSaveTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaLoadSaveTest.java index 44b3ec48ed7..cb78b08f8fa 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaLoadSaveTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaLoadSaveTest.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.file.BaseFileField; @@ -27,14 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class TextFileInputMetaLoadSaveTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaNewInjectionTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaNewInjectionTest.java index c5185a7b75b..9d80db5a6b4 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaNewInjectionTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaNewInjectionTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaString; @@ -25,8 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class TextFileInputMetaNewInjectionTest extends BaseMetadataInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaTest.java index b1b0422ea5d..616fb1f7dd9 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.util.StringUtil; import org.apache.hop.core.variables.IVariables; @@ -26,14 +34,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - public class TextFileInputMetaTest { private static final String FILE_NAME_NULL = null; private static final String FILE_NAME_EMPTY = StringUtil.EMPTY_STRING; diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputTest.java index 60c8dc41f33..33f2c9013e8 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputTest.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileContent; import org.apache.commons.vfs2.FileObject; @@ -49,19 +61,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class TextFileInputTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TransformMockUtil.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TransformMockUtil.java index 7ef11733bfe..614da4d6fd2 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TransformMockUtil.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/fileinput/text/TransformMockUtil.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.fileinput.text; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -26,12 +31,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -64,8 +63,12 @@ Main getTransform( Class metaClass, Class dataClass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor
kons = mainClass.getConstructor( TransformMeta.class, @@ -94,8 +97,12 @@ Main getTransform( Class metaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { TransformMockHelper transformMockHelper = TransformMockUtil.getTransformMockHelper(metaClass, dataClass, transformName); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/PDI_2875_Test.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/PDI_2875_Test.java index 43b156ebb7c..350754d0ed7 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/PDI_2875_Test.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/PDI_2875_Test.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.textfileinput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; @@ -29,9 +32,6 @@ import org.junit.BeforeClass; import org.junit.ClassRule; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /*** * * @deprecated replaced by implementation in the ...transforms.fileinput.text package diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TextFileInputTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TextFileInputTest.java index 745c9ceed32..f8524300012 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TextFileInputTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TextFileInputTest.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.textfileinput; +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopFileException; @@ -46,17 +55,9 @@ import org.junit.Test; import org.mockito.Mockito; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.util.Date; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */ +/** + * @deprecated replaced by implementation in the ...transforms.fileinput.text package + */ public class TextFileInputTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -323,7 +324,9 @@ private static TextFileInputField field(String name) { return new TextFileInputField(name, -1, -1); } - /** @throws Exception */ + /** + * @throws Exception + */ @Test public void convertLineToRowTest() throws Exception { ILogChannel log = Mockito.mock(ILogChannel.class); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TransformMockUtil.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TransformMockUtil.java index 12028afdcc8..8d02e058743 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TransformMockUtil.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileinput/TransformMockUtil.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.textfileinput; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.Pipeline; import org.apache.hop.pipeline.PipelineMeta; @@ -30,12 +35,6 @@ import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.mockito.Mockito; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - /** * Util class to handle TransformMock creation in generic way. * @@ -65,8 +64,12 @@ TransformMockHelper getTransformMockHelper( Main extends BaseTransform, Meta extends ITransformMeta, Data extends ITransformData> Main getTransform( Class
mainClass, Class dataClass, TransformMockHelper mock) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { Constructor
kons = mainClass.getConstructor( TransformMeta.class, dataClass, int.class, PipelineMeta.class, Pipeline.class); @@ -80,8 +83,12 @@ Main getTransform( Main extends BaseTransform, Meta extends ITransformMeta, Data extends ITransformData> Main getTransform( Class
mainClass, Class metaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { return TransformMockUtil.getTransform( mainClass, dataClass, @@ -108,8 +115,12 @@ Main getTransform( Class metaClass, Class dataClass, String transformName) - throws NoSuchMethodException, SecurityException, InstantiationException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException { + throws NoSuchMethodException, + SecurityException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { TransformMockHelper mockHelper = org.apache.hop.pipeline.transforms.fileinput.text.TransformMockUtil.getTransformMockHelper( diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaInjectionTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaInjectionTest.java index bc9dfee3428..cdfc61f6b42 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaInjectionTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaInjectionTest.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.textfileoutput; +import static org.junit.Assert.assertEquals; + import org.apache.hop.core.injection.BaseMetadataInjectionTest; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaString; @@ -25,8 +27,6 @@ import org.junit.ClassRule; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class TextFileOutputMetaInjectionTest extends BaseMetadataInjectionTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaTest.java index 4e5c3e0ffd3..6e730372a94 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.textfileoutput; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.value.ValueMetaFactory; @@ -30,15 +38,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; - public class TextFileOutputMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -181,7 +180,8 @@ public void testVarReplaceSplit() throws Exception { meta.setSplitEveryRows("${splitVar}"); IVariables varSpace = new Variables(); assertEquals(0, meta.getSplitEvery(varSpace)); - String fileName = meta.buildFilename("foo", "txt2", varSpace, 0, null, 3, false, null, 0, false, meta); + String fileName = + meta.buildFilename("foo", "txt2", varSpace, 0, null, 3, false, null, 0, false, meta); assertEquals("foo.txt2", fileName); varSpace.setVariable("splitVar", "2"); assertEquals(2, meta.getSplitEvery(varSpace)); diff --git a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputTest.java b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputTest.java index 64334741629..650e2d6a225 100644 --- a/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputTest.java +++ b/plugins/transforms/textfile/src/test/java/org/apache/hop/pipeline/transforms/textfileoutput/TextFileOutputTest.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.textfileoutput; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; @@ -49,19 +61,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** User: Dzmitry Stsiapanau Date: 10/18/13 Time: 2:23 PM */ public class TextFileOutputTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -470,9 +469,9 @@ private List doOutput( Mockito.anyInt(), Mockito.anyString(), Mockito.anyInt(), - Mockito.anyBoolean(), - Mockito.anyString(), - Mockito.anyInt(), + Mockito.anyBoolean(), + Mockito.anyString(), + Mockito.anyInt(), Mockito.anyBoolean(), Mockito.any(TextFileOutputMeta.class))) .thenReturn(pathToFile); diff --git a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/Tika.java b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/Tika.java index 13a9edb6d47..71bd38a6618 100755 --- a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/Tika.java +++ b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/Tika.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.tika; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -37,12 +42,6 @@ import org.apache.tika.metadata.Metadata; import org.json.simple.JSONObject; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.Date; -import java.util.List; - public class Tika extends BaseTransform { private static final Class PKG = TikaMeta.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$ diff --git a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaData.java b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaData.java index 737370141e4..ee00514c17d 100755 --- a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaData.java +++ b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.tika; +import java.util.Date; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.fileinput.FileInputList; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.Date; - public class TikaData extends BaseTransformData implements ITransformData { public IRowMeta inputRowMeta; public IRowMeta outputRowMeta; diff --git a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaDialog.java b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaDialog.java index c32ecf45ea7..b3c54cfb407 100755 --- a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaDialog.java +++ b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.tika; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -64,10 +67,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class TikaDialog extends BaseTransformDialog implements ITransformDialog { public static final int[] dateLengths = new int[] {23, 19, 14, 10, 10, 10, 10, 8, 8, 8, 8, 6, 6}; private static final Class PKG = TikaMeta.class; // for Translator diff --git a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaFile.java b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaFile.java index c9e96e5711d..4535d0690b5 100644 --- a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaFile.java +++ b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaFile.java @@ -77,7 +77,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -91,7 +93,9 @@ public String getMask() { return mask; } - /** @param mask The mask to set */ + /** + * @param mask The mask to set + */ public void setMask(String mask) { this.mask = mask; } @@ -105,7 +109,9 @@ public String getExcludeMask() { return excludeMask; } - /** @param excludeMask The excludeMask to set */ + /** + * @param excludeMask The excludeMask to set + */ public void setExcludeMask(String excludeMask) { this.excludeMask = excludeMask; } @@ -119,7 +125,9 @@ public boolean isRequired() { return required; } - /** @param required The required to set */ + /** + * @param required The required to set + */ public void setRequired(boolean required) { this.required = required; } @@ -133,7 +141,9 @@ public boolean isIncludingSubFolders() { return includingSubFolders; } - /** @param includingSubFolders The includingSubFolders to set */ + /** + * @param includingSubFolders The includingSubFolders to set + */ public void setIncludingSubFolders(boolean includingSubFolders) { this.includingSubFolders = includingSubFolders; } diff --git a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaMeta.java b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaMeta.java index b53396c7570..c7469f3603c 100755 --- a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaMeta.java +++ b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.tika; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; @@ -39,17 +42,13 @@ import org.apache.hop.resource.IResourceNaming; import org.apache.hop.resource.ResourceDefinition; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "Tika", image = "tika.svg", name = "i18n::Tika.Name", description = "i18n::Tika.Description", categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", - documentationUrl = "/pipeline/transforms/apache-tika.html", + documentationUrl = "/pipeline/transforms/apache-tika.html", keywords = "i18n::Tika.Keywords") public class TikaMeta extends BaseTransformMeta { private static final Class PKG = TikaMeta.class; // for Translator @@ -447,7 +446,9 @@ public List getFiles() { return files; } - /** @param files The files to set */ + /** + * @param files The files to set + */ public void setFiles(List files) { this.files = files; } @@ -461,7 +462,9 @@ public String getContentFieldName() { return contentFieldName; } - /** @param contentFieldName The contentFieldName to set */ + /** + * @param contentFieldName The contentFieldName to set + */ public void setContentFieldName(String contentFieldName) { this.contentFieldName = contentFieldName; } @@ -475,7 +478,9 @@ public String getFileSizeFieldName() { return fileSizeFieldName; } - /** @param fileSizeFieldName The fileSizeFieldName to set */ + /** + * @param fileSizeFieldName The fileSizeFieldName to set + */ public void setFileSizeFieldName(String fileSizeFieldName) { this.fileSizeFieldName = fileSizeFieldName; } @@ -489,7 +494,9 @@ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set */ + /** + * @param filenameField The filenameField to set + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } @@ -503,7 +510,9 @@ public String getRowNumberField() { return rowNumberField; } - /** @param rowNumberField The rowNumberField to set */ + /** + * @param rowNumberField The rowNumberField to set + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } @@ -517,7 +526,9 @@ public long getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set */ + /** + * @param rowLimit The rowLimit to set + */ public void setRowLimit(long rowLimit) { this.rowLimit = rowLimit; } @@ -531,7 +542,9 @@ public String getOutputFormat() { return outputFormat; } - /** @param outputFormat The outputFormat to set */ + /** + * @param outputFormat The outputFormat to set + */ public void setOutputFormat(String outputFormat) { this.outputFormat = outputFormat; } @@ -545,7 +558,9 @@ public String getEncoding() { return encoding; } - /** @param encoding The encoding to set */ + /** + * @param encoding The encoding to set + */ public void setEncoding(String encoding) { this.encoding = encoding; } @@ -559,7 +574,9 @@ public String getDynamicFilenameField() { return dynamicFilenameField; } - /** @param dynamicFilenameField The dynamicFilenameField to set */ + /** + * @param dynamicFilenameField The dynamicFilenameField to set + */ public void setDynamicFilenameField(String dynamicFilenameField) { this.dynamicFilenameField = dynamicFilenameField; } @@ -573,7 +590,9 @@ public boolean isFileInField() { return fileInField; } - /** @param fileInField The fileInField to set */ + /** + * @param fileInField The fileInField to set + */ public void setFileInField(boolean fileInField) { this.fileInField = fileInField; } @@ -587,7 +606,9 @@ public boolean isAddingResultFile() { return addingResultFile; } - /** @param addingResultFile The addingResultFile to set */ + /** + * @param addingResultFile The addingResultFile to set + */ public void setAddingResultFile(boolean addingResultFile) { this.addingResultFile = addingResultFile; } @@ -601,7 +622,9 @@ public boolean isIgnoreEmptyFile() { return ignoreEmptyFile; } - /** @param ignoreEmptyFile The ignoreEmptyFile to set */ + /** + * @param ignoreEmptyFile The ignoreEmptyFile to set + */ public void setIgnoreEmptyFile(boolean ignoreEmptyFile) { this.ignoreEmptyFile = ignoreEmptyFile; } @@ -615,7 +638,9 @@ public String getShortFileFieldName() { return shortFileFieldName; } - /** @param shortFileFieldName The shortFileFieldName to set */ + /** + * @param shortFileFieldName The shortFileFieldName to set + */ public void setShortFileFieldName(String shortFileFieldName) { this.shortFileFieldName = shortFileFieldName; } @@ -629,7 +654,9 @@ public String getPathFieldName() { return pathFieldName; } - /** @param pathFieldName The pathFieldName to set */ + /** + * @param pathFieldName The pathFieldName to set + */ public void setPathFieldName(String pathFieldName) { this.pathFieldName = pathFieldName; } @@ -643,7 +670,9 @@ public String getHiddenFieldName() { return hiddenFieldName; } - /** @param hiddenFieldName The hiddenFieldName to set */ + /** + * @param hiddenFieldName The hiddenFieldName to set + */ public void setHiddenFieldName(String hiddenFieldName) { this.hiddenFieldName = hiddenFieldName; } @@ -657,7 +686,9 @@ public String getLastModificationTimeFieldName() { return lastModificationTimeFieldName; } - /** @param lastModificationTimeFieldName The lastModificationTimeFieldName to set */ + /** + * @param lastModificationTimeFieldName The lastModificationTimeFieldName to set + */ public void setLastModificationTimeFieldName(String lastModificationTimeFieldName) { this.lastModificationTimeFieldName = lastModificationTimeFieldName; } @@ -671,7 +702,9 @@ public String getUriFieldName() { return uriFieldName; } - /** @param uriFieldName The uriFieldName to set */ + /** + * @param uriFieldName The uriFieldName to set + */ public void setUriFieldName(String uriFieldName) { this.uriFieldName = uriFieldName; } @@ -685,7 +718,9 @@ public String getRootUriNameFieldName() { return rootUriNameFieldName; } - /** @param rootUriNameFieldName The rootUriNameFieldName to set */ + /** + * @param rootUriNameFieldName The rootUriNameFieldName to set + */ public void setRootUriNameFieldName(String rootUriNameFieldName) { this.rootUriNameFieldName = rootUriNameFieldName; } @@ -699,7 +734,9 @@ public String getExtensionFieldName() { return extensionFieldName; } - /** @param extensionFieldName The extensionFieldName to set */ + /** + * @param extensionFieldName The extensionFieldName to set + */ public void setExtensionFieldName(String extensionFieldName) { this.extensionFieldName = extensionFieldName; } @@ -713,7 +750,9 @@ public String getMetadataFieldName() { return metadataFieldName; } - /** @param metadataFieldName The metadataFieldName to set */ + /** + * @param metadataFieldName The metadataFieldName to set + */ public void setMetadataFieldName(String metadataFieldName) { this.metadataFieldName = metadataFieldName; } diff --git a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaOutput.java b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaOutput.java index 0516eddb52e..684f2ece4ea 100755 --- a/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaOutput.java +++ b/plugins/transforms/tika/src/main/java/org/apache/hop/pipeline/transforms/tika/TikaOutput.java @@ -18,6 +18,24 @@ package org.apache.hop.pipeline.transforms.tika; import com.google.gson.Gson; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.text.NumberFormat; +import java.text.ParsePosition; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import javax.xml.XMLConstants; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.variables.IVariables; @@ -35,25 +53,6 @@ import org.xml.sax.ContentHandler; import org.xml.sax.helpers.DefaultHandler; -import javax.xml.XMLConstants; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; -import javax.xml.transform.stream.StreamResult; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.text.NumberFormat; -import java.text.ParsePosition; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - public class TikaOutput { private final TikaConfig tikaConfig; diff --git a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacement.java b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacement.java index d33a06dcd34..18ad24b27d4 100644 --- a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacement.java +++ b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacement.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.tokenreplacement; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.util.Iterator; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; @@ -32,19 +44,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.util.Iterator; - public class TokenReplacement extends BaseTransform { private static final Class PKG = TokenReplacementMeta.class; // For Translator diff --git a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementData.java b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementData.java index 7885fdc766c..f6552ea844d 100644 --- a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementData.java +++ b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementData.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.tokenreplacement; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.OutputStream; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class TokenReplacementData extends BaseTransformData implements ITransformData { public int splitnr; diff --git a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java index 063684543d0..22912fd9553 100644 --- a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java +++ b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java @@ -16,6 +16,9 @@ */ package org.apache.hop.pipeline.transforms.tokenreplacement; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -59,10 +62,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class TokenReplacementDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = TokenReplacementMeta.class; // For Translator diff --git a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementMeta.java b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementMeta.java index c0ef5d1c61a..4cd35c4a709 100644 --- a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementMeta.java +++ b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.tokenreplacement; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,10 +42,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - @Transform( id = "TokenReplacementPlugin", image = "token.svg", @@ -54,10 +53,10 @@ @InjectionSupported( localizationPrefix = "TokenReplacement.Injection.", groups = {"OUTPUT_FIELDS"}) -public class TokenReplacementMeta extends BaseTransformMeta { +public class TokenReplacementMeta + extends BaseTransformMeta { private static final Class PKG = TokenReplacementMeta.class; // For Translator - public static final String INPUT_TYPE = "input_type"; public static final String INPUT_FIELD_NAME = "input_field_name"; public static final String INPUT_FILENAME = "input_filename"; diff --git a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueField.java b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueField.java index 596d4a21bf7..4deb1db5118 100644 --- a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueField.java +++ b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.uniquerows; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class UniqueField { @HopMetadataProperty( diff --git a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRows.java b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRows.java index e234d949052..19c5e4f8bf2 100644 --- a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRows.java +++ b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRows.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.uniquerows; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowDataUtil; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** Removes the same consequetive rows from the input stream(s). */ public class UniqueRows extends BaseTransform { private static final Class PKG = UniqueRowsMeta.class; // For Translator diff --git a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsDialog.java b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsDialog.java index 38cb8938af7..373503dbff1 100644 --- a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsDialog.java +++ b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.uniquerows; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.IntStream; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -49,10 +52,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.IntStream; - public class UniqueRowsDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = UniqueRowsMeta.class; // For Translator @@ -379,7 +378,6 @@ private void ok() { input.setErrorDescription(wErrorDesc.getText()); input.setCompareFields(fields); - if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y"))) { MessageDialogWithToggle md = new MessageDialogWithToggle( @@ -400,13 +398,13 @@ private void ok() { if (!wRejectDuplicateRow.getSelection()) { List hops = this.pipelineMeta.getPipelineHops(); IntStream.range(0, hops.size() - 1) - .filter( - hopInd -> { - PipelineHopMeta hop = hops.get(hopInd); - return (hop.isErrorHop() - && hop.getFromTransform().getName().equals(this.transformName)); - }) - .forEach(hopInd -> this.pipelineMeta.removePipelineHop(hopInd)); + .filter( + hopInd -> { + PipelineHopMeta hop = hops.get(hopInd); + return (hop.isErrorHop() + && hop.getFromTransform().getName().equals(this.transformName)); + }) + .forEach(hopInd -> this.pipelineMeta.removePipelineHop(hopInd)); } transformName = wTransformName.getText(); // return value diff --git a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMeta.java b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMeta.java index 69a2857401b..2c7960fedab 100644 --- a/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMeta.java +++ b/plugins/transforms/uniquerows/src/main/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.uniquerows; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -32,9 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; - /* * Unique rows */ @@ -96,52 +95,72 @@ public UniqueRowsMeta(UniqueRowsMeta meta) { } } - /** @return Returns the countRows. */ + /** + * @return Returns the countRows. + */ public boolean isCountRows() { return countRows; } - /** @param countRows The countRows to set. */ + /** + * @param countRows The countRows to set. + */ public void setCountRows(boolean countRows) { this.countRows = countRows; } - /** @return Returns the countField. */ + /** + * @return Returns the countField. + */ public String getCountField() { return countField; } - /** @param countField The countField to set. */ + /** + * @param countField The countField to set. + */ public void setCountField(String countField) { this.countField = countField; } - /** @param compareField The compareField to set. */ + /** + * @param compareField The compareField to set. + */ public void setCompareFields(List compareField) { this.compareFields = compareField; } - /** @return Returns the compareField. */ + /** + * @return Returns the compareField. + */ public List getCompareFields() { return compareFields; } - /** @param rejectDuplicateRow The rejectDuplicateRow to set. */ + /** + * @param rejectDuplicateRow The rejectDuplicateRow to set. + */ public void setRejectDuplicateRow(boolean rejectDuplicateRow) { this.rejectDuplicateRow = rejectDuplicateRow; } - /** @return Returns the rejectDuplicateRow. */ + /** + * @return Returns the rejectDuplicateRow. + */ public boolean isRejectDuplicateRow() { return rejectDuplicateRow; } - /** @return Returns the errorDescription. */ + /** + * @return Returns the errorDescription. + */ public String getErrorDescription() { return errorDescription; } - /** @param errorDescription The errorDescription to set. */ + /** + * @param errorDescription The errorDescription to set. + */ public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } diff --git a/plugins/transforms/uniquerows/src/test/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMetaTest.java b/plugins/transforms/uniquerows/src/test/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMetaTest.java index ad9a60812b8..0fb4cb8db5a 100644 --- a/plugins/transforms/uniquerows/src/test/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMetaTest.java +++ b/plugins/transforms/uniquerows/src/test/java/org/apache/hop/pipeline/transforms/uniquerows/UniqueRowsMetaTest.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.uniquerows; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -29,12 +34,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class UniqueRowsMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetData.java b/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetData.java index 5981f372fe8..1c53bd3cb3e 100644 --- a/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetData.java +++ b/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetData.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.uniquerowsbyhashset; +import java.util.HashSet; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashSet; - public class UniqueRowsByHashSetData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; public IRowMeta inputRowMeta; diff --git a/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetDialog.java b/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetDialog.java index e787b982982..917f3f26054 100644 --- a/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetDialog.java +++ b/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.uniquerowsbyhashset; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.IRowMeta; @@ -49,9 +51,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class UniqueRowsByHashSetDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = UniqueRowsByHashSetMeta.class; // For Translator diff --git a/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMeta.java b/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMeta.java index 79ad45d98b5..c36f5f8cdef 100644 --- a/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMeta.java +++ b/plugins/transforms/uniquerowsbyhashset/src/main/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.uniquerowsbyhashset; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -32,8 +33,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "UniqueRowsByHashSet", image = "uniquerowsbyhashset.svg", @@ -42,7 +41,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::UniqueRowsByHashSetMeta.keyword", documentationUrl = "/pipeline/transforms/uniquerowsbyhashset.html") -public class UniqueRowsByHashSetMeta extends BaseTransformMeta { +public class UniqueRowsByHashSetMeta + extends BaseTransformMeta { private static final Class PKG = UniqueRowsByHashSetMeta.class; // For Translator /** @@ -61,7 +61,9 @@ public UniqueRowsByHashSetMeta() { super(); // allocate BaseTransformMeta } - /** @param compareField The compareField to set. */ + /** + * @param compareField The compareField to set. + */ public void setCompareFields(String[] compareField) { this.compareFields = compareField; } @@ -74,7 +76,9 @@ public void setStoreValues(boolean storeValues) { this.storeValues = storeValues; } - /** @return Returns the compareField. */ + /** + * @return Returns the compareField. + */ public String[] getCompareFields() { return compareFields; } @@ -83,22 +87,30 @@ public void allocate(int nrFields) { compareFields = new String[nrFields]; } - /** @param rejectDuplicateRow The rejectDuplicateRow to set. */ + /** + * @param rejectDuplicateRow The rejectDuplicateRow to set. + */ public void setRejectDuplicateRow(boolean rejectDuplicateRow) { this.rejectDuplicateRow = rejectDuplicateRow; } - /** @return Returns the rejectDuplicateRow. */ + /** + * @return Returns the rejectDuplicateRow. + */ public boolean isRejectDuplicateRow() { return rejectDuplicateRow; } - /** @param errorDescription The errorDescription to set. */ + /** + * @param errorDescription The errorDescription to set. + */ public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } - /** @return Returns the errorDescription. */ + /** + * @return Returns the errorDescription. + */ public String getErrorDescription() { return errorDescription; } diff --git a/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/RowKeyTest.java b/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/RowKeyTest.java index 782d2abb8da..454823b3444 100644 --- a/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/RowKeyTest.java +++ b/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/RowKeyTest.java @@ -17,18 +17,17 @@ package org.apache.hop.pipeline.transforms.uniquerowsbyhashset; -import org.junit.Ignore; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.net.InetAddress; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import org.junit.Ignore; +import org.junit.Test; public class RowKeyTest { diff --git a/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMetaTest.java b/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMetaTest.java index 427ef921462..8cb4a698180 100644 --- a/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMetaTest.java +++ b/plugins/transforms/uniquerowsbyhashset/src/test/java/org/apache/hop/pipeline/transforms/uniquerowsbyhashset/UniqueRowsByHashSetMetaTest.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.uniquerowsbyhashset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; @@ -26,11 +30,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class UniqueRowsByHashSetMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/Update.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/Update.java index fccfb4401bc..be1113f6b88 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/Update.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/Update.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.update; +import java.sql.SQLException; +import java.util.ArrayList; import org.apache.commons.lang.ArrayUtils; import org.apache.hop.core.Const; import org.apache.hop.core.database.Database; @@ -34,9 +36,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.sql.SQLException; -import java.util.ArrayList; - /** Update data in a database table, does NOT ever perform an insert. */ public class Update extends BaseTransform { private static final Class PKG = UpdateMeta.class; // For Translator diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateData.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateData.java index 29fc38c1373..643503e783f 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateData.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.update; +import java.sql.PreparedStatement; import org.apache.hop.core.database.Database; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.sql.PreparedStatement; - public class UpdateData extends BaseTransformData implements ITransformData { public Database db; diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateDialog.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateDialog.java index dc1fb0c6fff..1b0eec348ba 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateDialog.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.update; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -60,9 +62,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class UpdateDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = UpdateMeta.class; // For Translator diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateField.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateField.java index 7a6802b133b..1dd38cd3bee 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateField.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.update; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class UpdateField { diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateKeyField.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateKeyField.java index 79f8d3132b6..ecffc75c048 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateKeyField.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateKeyField.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.update; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class UpdateKeyField { /** which field in input stream to compare with? */ diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateLookupField.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateLookupField.java index ef2fc20cd26..f53d1931c8b 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateLookupField.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateLookupField.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.update; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.metadata.api.HopMetadataProperty; public class UpdateLookupField { @@ -80,22 +79,30 @@ protected void init() { updateFields = new ArrayList<>(); } - /** @return the schemaName */ + /** + * @return the schemaName + */ public String getSchemaName() { return schemaName; } - /** @param schemaName the schemaName to set */ + /** + * @param schemaName the schemaName to set + */ public void setSchemaName(String schemaName) { this.schemaName = schemaName; } - /** @return Returns the tableName. */ + /** + * @return Returns the tableName. + */ public String getTableName() { return tableName; } - /** @param tableName The tableName to set. */ + /** + * @param tableName The tableName to set. + */ public void setTableName(String tableName) { this.tableName = tableName; } diff --git a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateMeta.java b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateMeta.java index 1d142d30293..d1b9c17e757 100644 --- a/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateMeta.java +++ b/plugins/transforms/update/src/main/java/org/apache/hop/pipeline/transforms/update/UpdateMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.update; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -41,8 +42,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.utils.RowMetaUtils; -import java.util.List; - @Transform( id = "Update", image = "update.svg", @@ -125,12 +124,14 @@ public void setLookupField(UpdateLookupField lookupField) { * @return Returns the commitSize. * @deprecated use public String getCommitSizeVar() instead */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") public int getCommitSize() { return Integer.parseInt(commitSize); } - /** @return Returns the commitSize. */ + /** + * @return Returns the commitSize. + */ public String getCommitSizeVar() { return commitSize; } @@ -150,42 +151,56 @@ public int getCommitSize(IVariables vs) { * @param commitSize The commitSize to set. * @deprecated use public void setCommitSize( String commitSize ) instead */ - @Deprecated(since="2.0") + @Deprecated(since = "2.0") public void setCommitSize(int commitSize) { this.commitSize = Integer.toString(commitSize); } - /** @param commitSize The commitSize to set. */ + /** + * @param commitSize The commitSize to set. + */ public void setCommitSize(String commitSize) { this.commitSize = commitSize; } - /** @return Returns the skipLookup. */ + /** + * @return Returns the skipLookup. + */ public boolean isSkipLookup() { return skipLookup; } - /** @param skipLookup The skipLookup to set. */ + /** + * @param skipLookup The skipLookup to set. + */ public void setSkipLookup(boolean skipLookup) { this.skipLookup = skipLookup; } - /** @return Returns the ignoreError. */ + /** + * @return Returns the ignoreError. + */ public boolean isErrorIgnored() { return errorIgnored; } - /** @param ignoreError The ignoreError to set. */ + /** + * @param ignoreError The ignoreError to set. + */ public void setErrorIgnored(boolean ignoreError) { this.errorIgnored = ignoreError; } - /** @return Returns the ignoreFlagField. */ + /** + * @return Returns the ignoreFlagField. + */ public String getIgnoreFlagField() { return ignoreFlagField; } - /** @param ignoreFlagField The ignoreFlagField to set. */ + /** + * @param ignoreFlagField The ignoreFlagField to set. + */ public void setIgnoreFlagField(String ignoreFlagField) { this.ignoreFlagField = ignoreFlagField; } @@ -669,12 +684,16 @@ public boolean supportsErrorHandling() { return true; } - /** @return the useBatchUpdate */ + /** + * @return the useBatchUpdate + */ public boolean isUseBatchUpdate() { return useBatchUpdate; } - /** @param useBatchUpdate the useBatchUpdate to set */ + /** + * @param useBatchUpdate the useBatchUpdate to set + */ public void setUseBatchUpdate(boolean useBatchUpdate) { this.useBatchUpdate = useBatchUpdate; } diff --git a/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/PDI_11152_Test.java b/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/PDI_11152_Test.java index 371d531b7e7..696a46909ca 100644 --- a/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/PDI_11152_Test.java +++ b/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/PDI_11152_Test.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.update; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.sql.PreparedStatement; +import java.sql.Timestamp; import junit.framework.Assert; import org.apache.hop.core.database.Database; import org.apache.hop.core.exception.HopException; @@ -31,14 +38,6 @@ import org.junit.Ignore; import org.junit.Test; -import java.sql.PreparedStatement; -import java.sql.Timestamp; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** Regression test */ public class PDI_11152_Test { TransformMockHelper smh; diff --git a/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/UpdateMetaTest.java b/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/UpdateMetaTest.java index 0a317919bd4..9b0ab1dd2dd 100644 --- a/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/UpdateMetaTest.java +++ b/plugins/transforms/update/src/test/java/org/apache/hop/pipeline/transforms/update/UpdateMetaTest.java @@ -17,6 +17,16 @@ package org.apache.hop.pipeline.transforms.update; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -42,17 +52,6 @@ import org.junit.Test; import org.mockito.Mockito; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - public class UpdateMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/Validation.java b/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/Validation.java index b6e5e0a59ed..7916117bcee 100644 --- a/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/Validation.java +++ b/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/Validation.java @@ -27,107 +27,157 @@ public class Validation implements Cloneable { public static final String XML_TAG = "validator_field"; public static final String XML_TAG_ALLOWED = "allowed_value"; - @HopMetadataProperty(key = "validation_name", injectionKey = "NAME", - injectionKeyDescription = "Validator.Injection.NAME") + @HopMetadataProperty( + key = "validation_name", + injectionKey = "NAME", + injectionKeyDescription = "Validator.Injection.NAME") private String name; - @HopMetadataProperty(key = "name", injectionKey = "FIELD_NAME", - injectionKeyDescription = "Validator.Injection.FIELD_NAME") + @HopMetadataProperty( + key = "name", + injectionKey = "FIELD_NAME", + injectionKeyDescription = "Validator.Injection.FIELD_NAME") private String fieldName; - @HopMetadataProperty(key = "max_length", injectionKey = "MAX_LENGTH", - injectionKeyDescription = "Validator.Injection.MAX_LENGTH") + @HopMetadataProperty( + key = "max_length", + injectionKey = "MAX_LENGTH", + injectionKeyDescription = "Validator.Injection.MAX_LENGTH") private String maximumLength; - @HopMetadataProperty(key = "min_length", injectionKey = "MIN_LENGTH", - injectionKeyDescription = "Validator.Injection.MIN_LENGTH") + @HopMetadataProperty( + key = "min_length", + injectionKey = "MIN_LENGTH", + injectionKeyDescription = "Validator.Injection.MIN_LENGTH") private String minimumLength; - @HopMetadataProperty(key = "null_allowed", injectionKey = "NULL_ALLOWED", - injectionKeyDescription = "Validator.Injection.NULL_ALLOWED") + @HopMetadataProperty( + key = "null_allowed", + injectionKey = "NULL_ALLOWED", + injectionKeyDescription = "Validator.Injection.NULL_ALLOWED") private boolean nullAllowed; - @HopMetadataProperty(key = "only_null_allowed", injectionKey = "ONLY_NULL_ALLOWED", - injectionKeyDescription = "Validator.Injection.ONLY_NULL_ALLOWED") + @HopMetadataProperty( + key = "only_null_allowed", + injectionKey = "ONLY_NULL_ALLOWED", + injectionKeyDescription = "Validator.Injection.ONLY_NULL_ALLOWED") private boolean onlyNullAllowed; - @HopMetadataProperty(key = "only_numeric_allowed", injectionKey = "ONLY_NUMERIC_ALLOWED", - injectionKeyDescription = "Validator.Injection.ONLY_NUMERIC_ALLOWED") + @HopMetadataProperty( + key = "only_numeric_allowed", + injectionKey = "ONLY_NUMERIC_ALLOWED", + injectionKeyDescription = "Validator.Injection.ONLY_NUMERIC_ALLOWED") private boolean onlyNumericAllowed; - @HopMetadataProperty(key = "data_type", injectionKey = "DATA_TYPE", - injectionKeyDescription = "Validator.Injection.DATA_TYPE") + @HopMetadataProperty( + key = "data_type", + injectionKey = "DATA_TYPE", + injectionKeyDescription = "Validator.Injection.DATA_TYPE") private String dataType; - @HopMetadataProperty(key = "data_type_verified", injectionKey = "DATA_TYPE_VERIFIED", - injectionKeyDescription = "Validator.Injection.DATA_TYPE_VERIFIED") + @HopMetadataProperty( + key = "data_type_verified", + injectionKey = "DATA_TYPE_VERIFIED", + injectionKeyDescription = "Validator.Injection.DATA_TYPE_VERIFIED") private boolean dataTypeVerified; - @HopMetadataProperty(key = "conversion_mask", injectionKey = "CONVERSION_MASK", - injectionKeyDescription = "Validator.Injection.CONVERSION_MASK") + @HopMetadataProperty( + key = "conversion_mask", + injectionKey = "CONVERSION_MASK", + injectionKeyDescription = "Validator.Injection.CONVERSION_MASK") private String conversionMask; - @HopMetadataProperty(key = "decimal_symbol", injectionKey = "DECIMAL_SYMBOL", - injectionKeyDescription = "Validator.Injection.DECIMAL_SYMBOL") + @HopMetadataProperty( + key = "decimal_symbol", + injectionKey = "DECIMAL_SYMBOL", + injectionKeyDescription = "Validator.Injection.DECIMAL_SYMBOL") private String decimalSymbol; - @HopMetadataProperty(key = "grouping_symbol", injectionKey = "GROUPING_SYMBOL", - injectionKeyDescription = "Validator.Injection.GROUPING_SYMBOL") + @HopMetadataProperty( + key = "grouping_symbol", + injectionKey = "GROUPING_SYMBOL", + injectionKeyDescription = "Validator.Injection.GROUPING_SYMBOL") private String groupingSymbol; - @HopMetadataProperty(key = "is_sourcing_values", injectionKey = "SOURCING_VALUES", - injectionKeyDescription = "Validator.Injection.SOURCING_VALUES") + @HopMetadataProperty( + key = "is_sourcing_values", + injectionKey = "SOURCING_VALUES", + injectionKeyDescription = "Validator.Injection.SOURCING_VALUES") private boolean sourcingValues; - @HopMetadataProperty(key = "sourcing_transform", injectionKey = "SOURCING_TRANSFORM_NAME", - injectionKeyDescription = "Validator.Injection.SOURCING_TRANSFORM_NAME") + @HopMetadataProperty( + key = "sourcing_transform", + injectionKey = "SOURCING_TRANSFORM_NAME", + injectionKeyDescription = "Validator.Injection.SOURCING_TRANSFORM_NAME") private String sourcingTransformName; - @HopMetadataProperty(key = "sourcing_field", injectionKey = "SOURCING_FIELD", - injectionKeyDescription = "Validator.Injection.SOURCING_FIELD") + @HopMetadataProperty( + key = "sourcing_field", + injectionKey = "SOURCING_FIELD", + injectionKeyDescription = "Validator.Injection.SOURCING_FIELD") private String sourcingField; - @HopMetadataProperty(key = "min_value", injectionKey = "MIN_VALUE", - injectionKeyDescription = "Validator.Injection.MIN_VALUE") + @HopMetadataProperty( + key = "min_value", + injectionKey = "MIN_VALUE", + injectionKeyDescription = "Validator.Injection.MIN_VALUE") private String minimumValue; - @HopMetadataProperty(key = "max_value", injectionKey = "MAX_VALUE", - injectionKeyDescription = "Validator.Injection.MAX_VALUE") + @HopMetadataProperty( + key = "max_value", + injectionKey = "MAX_VALUE", + injectionKeyDescription = "Validator.Injection.MAX_VALUE") private String maximumValue; - @HopMetadataProperty(key = "start_string", injectionKey = "START_STRING", - injectionKeyDescription = "Validator.Injection.START_STRING") + @HopMetadataProperty( + key = "start_string", + injectionKey = "START_STRING", + injectionKeyDescription = "Validator.Injection.START_STRING") private String startString; - @HopMetadataProperty(key = "start_string_not_allowed", injectionKey = "START_STRING_NOT_ALLOWED", - injectionKeyDescription = "Validator.Injection.START_STRING_NOT_ALLOWED") + @HopMetadataProperty( + key = "start_string_not_allowed", + injectionKey = "START_STRING_NOT_ALLOWED", + injectionKeyDescription = "Validator.Injection.START_STRING_NOT_ALLOWED") private String startStringNotAllowed; - @HopMetadataProperty(key = "end_string", injectionKey = "END_STRING", - injectionKeyDescription = "Validator.Injection.END_STRING") + @HopMetadataProperty( + key = "end_string", + injectionKey = "END_STRING", + injectionKeyDescription = "Validator.Injection.END_STRING") private String endString; - @HopMetadataProperty(key = "end_string_not_allowed", injectionKey = "END_STRING_NOT_ALLOWED", - injectionKeyDescription = "Validator.Injection.END_STRING_NOT_ALLOWED") + @HopMetadataProperty( + key = "end_string_not_allowed", + injectionKey = "END_STRING_NOT_ALLOWED", + injectionKeyDescription = "Validator.Injection.END_STRING_NOT_ALLOWED") private String endStringNotAllowed; - @HopMetadataProperty(key = "regular_expression", injectionKey = "REGULAR_EXPRESSION_EXPECTED", - injectionKeyDescription = "Validator.Injection.REGULAR_EXPRESSION_EXPECTED") + @HopMetadataProperty( + key = "regular_expression", + injectionKey = "REGULAR_EXPRESSION_EXPECTED", + injectionKeyDescription = "Validator.Injection.REGULAR_EXPRESSION_EXPECTED") private String regularExpression; - @HopMetadataProperty(key = "regular_expression_not_allowed", injectionKey = "REGULAR_EXPRESSION_NOT_ALLOWED", - injectionKeyDescription = "Validator.Injection.REGULAR_EXPRESSION_NOT_ALLOWED") + @HopMetadataProperty( + key = "regular_expression_not_allowed", + injectionKey = "REGULAR_EXPRESSION_NOT_ALLOWED", + injectionKeyDescription = "Validator.Injection.REGULAR_EXPRESSION_NOT_ALLOWED") private String regularExpressionNotAllowed; - @HopMetadataProperty(key = "error_code", injectionKey = "ERROR_CODE", - injectionKeyDescription = "Validator.Injection.ERROR_CODE") + @HopMetadataProperty( + key = "error_code", + injectionKey = "ERROR_CODE", + injectionKeyDescription = "Validator.Injection.ERROR_CODE") private String errorCode; - @HopMetadataProperty(key = "error_description", injectionKey = "ERROR_CODE_DESCRIPTION", - injectionKeyDescription = "Validator.Injection.ERROR_CODE_DESCRIPTION") + @HopMetadataProperty( + key = "error_description", + injectionKey = "ERROR_CODE_DESCRIPTION", + injectionKeyDescription = "Validator.Injection.ERROR_CODE_DESCRIPTION") private String errorDescription; - @HopMetadataProperty(groupKey="allowed_value", key="value") + @HopMetadataProperty(groupKey = "allowed_value", key = "value") private List allowedValues; // Non-serialized diff --git a/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/ValidatorMeta.java b/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/ValidatorMeta.java index f9884e6ad39..6444e8b7e75 100644 --- a/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/ValidatorMeta.java +++ b/plugins/transforms/validator/src/main/java/org/apache/hop/pipeline/transforms/validator/ValidatorMeta.java @@ -172,7 +172,7 @@ public ITransformIOMeta getTransformIOMeta() { public void searchInfoAndTargetTransforms(List transforms) { for (Validation validation : validations) { TransformMeta transformMeta = - TransformMeta.findTransform(transforms, validation.getSourcingTransformName()); + TransformMeta.findTransform(transforms, validation.getSourcingTransformName()); validation.setSourcingTransform(transformMeta); } resetTransformIoMeta(); diff --git a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapper.java b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapper.java index 9f4cfc9dbc6..a7ccc1c6bfd 100644 --- a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapper.java +++ b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapper.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.valuemapper; +import java.util.HashMap; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; @@ -27,8 +28,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.HashMap; - /** Convert Values in a certain fields to other values */ public class ValueMapper extends BaseTransform { private static final Class PKG = ValueMapperMeta.class; // For Translator @@ -87,8 +86,9 @@ public boolean processRow() throws HopException { if (data.emptyFieldValue == null) { data.emptyFieldValue = resolve(v.getTarget()); } else { - throw new HopException(BaseMessages.getString(PKG, - "ValueMapper.RuntimeError.OnlyOneEmptyMappingAllowed.VALUEMAPPER0004")); + throw new HopException( + BaseMessages.getString( + PKG, "ValueMapper.RuntimeError.OnlyOneEmptyMappingAllowed.VALUEMAPPER0004")); } } } @@ -109,7 +109,7 @@ public boolean processRow() throws HopException { // Null/Empty mapping to value... // - if (data.emptyFieldValue!=null && (r[data.keynr] == null || Utils.isEmpty(source))) { + if (data.emptyFieldValue != null && (r[data.keynr] == null || Utils.isEmpty(source))) { target = data.emptyFieldValue; // that's all there is to it. } else { if (!Utils.isEmpty(source)) { diff --git a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperData.java b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperData.java index d29e8f59c62..fa96ef5e118 100644 --- a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperData.java +++ b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperData.java @@ -17,14 +17,13 @@ package org.apache.hop.pipeline.transforms.valuemapper; +import java.util.HashMap; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.row.value.ValueMetaString; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import java.util.HashMap; - public class ValueMapperData extends BaseTransformData implements ITransformData { public IRowMeta previousMeta; public IRowMeta outputMeta; diff --git a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperDialog.java b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperDialog.java index 6a4a8afbeed..6ffc8992e8b 100644 --- a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperDialog.java +++ b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperDialog.java @@ -211,7 +211,7 @@ public void focusGained(FocusEvent e) { ColumnInfo.COLUMN_TYPE_TEXT, false); colinf[1].setUsingVariables(true); - + wFields = new TableView( variables, @@ -320,7 +320,7 @@ private void ok() { v.setTarget(item.getText(2)); input.getValues().add(v); } - + dispose(); } } diff --git a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMeta.java b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMeta.java index 7c7b652dd3a..65ad76debd9 100644 --- a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMeta.java +++ b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.valuemapper; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -31,8 +33,6 @@ import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.ArrayList; -import java.util.List; /** Maps String values of a certain field to new values */ @Transform( @@ -45,13 +45,13 @@ documentationUrl = "/pipeline/transforms/valuemapper.html") public class ValueMapperMeta extends BaseTransformMeta { private static final Class PKG = ValueMapperMeta.class; // For Translator - + @HopMetadataProperty( key = "field_to_use", injectionKey = "FIELDNAME", injectionKeyDescription = "ValueMapper.Injection.FIELDNAME") private String fieldToUse; - + @HopMetadataProperty( key = "target_field", injectionKey = "TARGET_FIELDNAME", @@ -81,18 +81,22 @@ public ValueMapperMeta(ValueMapperMeta meta) { for (Values v : meta.values) { values.add(new Values(v)); } - + this.fieldToUse = meta.fieldToUse; this.targetField = meta.targetField; this.nonMatchDefault = meta.nonMatchDefault; } - - /** @return Returns the fieldValue. */ + + /** + * @return Returns the fieldValue. + */ public List getValues() { return values; } - /** @param fieldValue The fieldValue to set. */ + /** + * @param fieldValue The fieldValue to set. + */ public void setValues(List values) { this.values = values; } @@ -123,7 +127,7 @@ public void getFields( maxlen = v.getTarget().length(); } } - + // include default value in max length calculation // if (nonMatchDefault != null && nonMatchDefault.length() > maxlen) { @@ -197,22 +201,30 @@ public void check( } } - /** @return Returns the fieldToUse. */ + /** + * @return Returns the fieldToUse. + */ public String getFieldToUse() { return fieldToUse; } - /** @param fieldToUse The fieldToUse to set. */ + /** + * @param fieldToUse The fieldToUse to set. + */ public void setFieldToUse(String fieldToUse) { this.fieldToUse = fieldToUse; } - /** @return Returns the targetField. */ + /** + * @return Returns the targetField. + */ public String getTargetField() { return targetField; } - /** @param targetField The targetField to set. */ + /** + * @param targetField The targetField to set. + */ public void setTargetField(String targetField) { this.targetField = targetField; } diff --git a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/Values.java b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/Values.java index 83aa8dd3aed..52863c4791a 100644 --- a/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/Values.java +++ b/plugins/transforms/valuemapper/src/main/java/org/apache/hop/pipeline/transforms/valuemapper/Values.java @@ -19,19 +19,23 @@ package org.apache.hop.pipeline.transforms.valuemapper; import org.apache.hop.metadata.api.HopMetadataProperty; -/** - * The values for mapping - */ + +/** The values for mapping */ public class Values { - @HopMetadataProperty(key = "source_value", injectionKey = "SOURCE", injectionKeyDescription = "ValueMapper.Injection.SOURCE") + @HopMetadataProperty( + key = "source_value", + injectionKey = "SOURCE", + injectionKeyDescription = "ValueMapper.Injection.SOURCE") private String source; - @HopMetadataProperty(key = "target_value", injectionKey = "TARGET", injectionKeyDescription = "ValueMapper.Injection.TARGET") + @HopMetadataProperty( + key = "target_value", + injectionKey = "TARGET", + injectionKeyDescription = "ValueMapper.Injection.TARGET") private String target; - public Values() { - } + public Values() {} public Values(Values other) { this.source = other.source; @@ -60,7 +64,7 @@ public String getSource() { public void setSource(String value) { this.source = value; } - + /** * Gets target value * diff --git a/plugins/transforms/valuemapper/src/test/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMetaTest.java b/plugins/transforms/valuemapper/src/test/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMetaTest.java index b94c6a1aa3c..9e3cca400cb 100644 --- a/plugins/transforms/valuemapper/src/test/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMetaTest.java +++ b/plugins/transforms/valuemapper/src/test/java/org/apache/hop/pipeline/transforms/valuemapper/ValueMapperMetaTest.java @@ -18,6 +18,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.pipeline.transform.TransformSerializationTestUtil; @@ -25,7 +26,7 @@ import org.junit.Test; public class ValueMapperMetaTest { - + @Before public void setUpLoadSave() throws Exception { HopEnvironment.init(); @@ -42,13 +43,12 @@ public void testSerialization() throws Exception { // Test serialization with null source attribute assertNull(meta.getValues().get(0).getSource()); assertEquals("[${NOT_DEFINED}]", meta.getValues().get(0).getTarget()); - + assertEquals("BE", meta.getValues().get(1).getSource()); assertEquals("Belgium", meta.getValues().get(1).getTarget()); - + assertEquals("Country_Code", meta.getFieldToUse()); assertEquals("Country_Name", meta.getTargetField()); - assertEquals("[${NOT_FOUND}]", meta.getNonMatchDefault()); + assertEquals("[${NOT_FOUND}]", meta.getNonMatchDefault()); } } - diff --git a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderData.java b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderData.java index e59f8ee29ae..1fa1c73f20b 100644 --- a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderData.java +++ b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderData.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.vertica.bulkloader; +import java.io.IOException; +import java.io.PipedInputStream; +import java.util.List; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.row.IRowMeta; @@ -25,10 +28,6 @@ import org.apache.hop.pipeline.transforms.vertica.bulkloader.nativebinary.ColumnSpec; import org.apache.hop.pipeline.transforms.vertica.bulkloader.nativebinary.StreamEncoder; -import java.io.IOException; -import java.io.PipedInputStream; -import java.util.List; - public class VerticaBulkLoaderData extends BaseTransformData implements ITransformData { protected Database db; protected DatabaseMeta databaseMeta; diff --git a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderField.java b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderField.java index 94389c1244b..1368fe9a317 100644 --- a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderField.java +++ b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/VerticaBulkLoaderField.java @@ -17,62 +17,56 @@ package org.apache.hop.pipeline.transforms.vertica.bulkloader; -import org.apache.hop.metadata.api.HopMetadataProperty; - import java.util.Objects; +import org.apache.hop.metadata.api.HopMetadataProperty; public class VerticaBulkLoaderField { - public VerticaBulkLoaderField(){ + public VerticaBulkLoaderField() {} - } + public VerticaBulkLoaderField(String fieldDatabase, String fieldStream) { + this.fieldDatabase = fieldDatabase; + this.fieldStream = fieldStream; + } - public VerticaBulkLoaderField(String fieldDatabase, String fieldStream){ - this.fieldDatabase = fieldDatabase; - this.fieldStream = fieldStream; - } - - @HopMetadataProperty( + @HopMetadataProperty( key = "stream_name", injectionKey = "STREAM_FIELDNAME", - injectionKeyDescription = "VerticaBulkLoader.Inject.FIELDSTREAM" - ) - private String fieldStream; - - @HopMetadataProperty( - key = "column_name", - injectionKey = "DATABASE_FIELDNAME", - injectionKeyDescription = "VerticaBulkLoader.Inject.FIELDDATABASE" - ) - private String fieldDatabase; - - public String getFieldStream(){ - return fieldStream; - } - - public void setFieldStream(String fieldStream){ - this.fieldStream = fieldStream; - } - - public String getFieldDatabase(){ - return fieldDatabase; - } - - public void setFieldDatabase(String fieldDatabase){ - this.fieldDatabase = fieldDatabase; - } - - @Override - public boolean equals(Object o){ - if(this == o) return true; - if(o == null || getClass() != o.getClass()) return false; - VerticaBulkLoaderField that = (VerticaBulkLoaderField) o; - return fieldStream.equals(that.fieldStream) && fieldDatabase.equals(that.fieldDatabase); - } - - @Override - public int hashCode(){ - return Objects.hash(fieldStream, fieldDatabase); - } - + injectionKeyDescription = "VerticaBulkLoader.Inject.FIELDSTREAM") + private String fieldStream; + + @HopMetadataProperty( + key = "column_name", + injectionKey = "DATABASE_FIELDNAME", + injectionKeyDescription = "VerticaBulkLoader.Inject.FIELDDATABASE") + private String fieldDatabase; + + public String getFieldStream() { + return fieldStream; + } + + public void setFieldStream(String fieldStream) { + this.fieldStream = fieldStream; + } + + public String getFieldDatabase() { + return fieldDatabase; + } + + public void setFieldDatabase(String fieldDatabase) { + this.fieldDatabase = fieldDatabase; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + VerticaBulkLoaderField that = (VerticaBulkLoaderField) o; + return fieldStream.equals(that.fieldStream) && fieldDatabase.equals(that.fieldDatabase); + } + + @Override + public int hashCode() { + return Objects.hash(fieldStream, fieldDatabase); + } } diff --git a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/ColumnSpec.java b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/ColumnSpec.java index 12b9c02ddfd..33931ccb320 100644 --- a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/ColumnSpec.java +++ b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/ColumnSpec.java @@ -17,9 +17,6 @@ package org.apache.hop.pipeline.transforms.vertica.bulkloader.nativebinary; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IValueMeta; - import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -29,6 +26,8 @@ import java.util.GregorianCalendar; import java.util.TimeZone; import java.util.concurrent.TimeUnit; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IValueMeta; public class ColumnSpec { private static final byte BYTE_ZERO = (byte) 0; diff --git a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/StreamEncoder.java b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/StreamEncoder.java index e32d43e27c6..4f26b9a85a2 100644 --- a/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/StreamEncoder.java +++ b/plugins/transforms/verticabulkloader/src/main/java/org/apache/hop/pipeline/transforms/vertica/bulkloader/nativebinary/StreamEncoder.java @@ -17,10 +17,6 @@ package org.apache.hop.pipeline.transforms.vertica.bulkloader.nativebinary; -import org.apache.hop.core.exception.HopValueException; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.core.row.IValueMeta; - import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; @@ -33,6 +29,9 @@ import java.nio.charset.CharsetEncoder; import java.util.Collections; import java.util.List; +import org.apache.hop.core.exception.HopValueException; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.core.row.IValueMeta; public class StreamEncoder { diff --git a/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailable.java b/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailable.java index 89dcebd9d32..c67b9634947 100644 --- a/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailable.java +++ b/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailable.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.webserviceavailable; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.row.RowDataUtil; @@ -27,10 +30,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; - /** Check if a webservice is available * */ public class WebServiceAvailable extends BaseTransform { diff --git a/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMeta.java b/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMeta.java index c90bc5406cc..cf08dbc4e1a 100644 --- a/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMeta.java +++ b/plugins/transforms/webserviceavailable/src/main/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.webserviceavailable; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -33,8 +34,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "WebServiceAvailable", image = "webserviceavailable.svg", @@ -43,7 +42,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Transform", keywords = "i18n::WebServiceAvailableMeta.keyword", documentationUrl = "/pipeline/transforms/checkwebserviceavailable.html") -public class WebServiceAvailableMeta extends BaseTransformMeta { +public class WebServiceAvailableMeta + extends BaseTransformMeta { private static final Class PKG = WebServiceAvailableMeta.class; // For Translator /** dynamic filename */ @@ -72,12 +72,16 @@ public WebServiceAvailableMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the urlField. */ + /** + * @return Returns the urlField. + */ public String getUrlField() { return urlField; } - /** @param urlField The urlField to set. */ + /** + * @param urlField The urlField to set. + */ public void setUrlField(String urlField) { this.urlField = urlField; } @@ -98,12 +102,16 @@ public String getReadTimeOut() { return readTimeOut; } - /** @return Returns the resultName. */ + /** + * @return Returns the resultName. + */ public String getResultFieldName() { return resultFieldName; } - /** @param resultfieldname The resultfieldname to set. */ + /** + * @param resultfieldname The resultfieldname to set. + */ public void setResultFieldName(String resultfieldname) { this.resultFieldName = resultfieldname; } diff --git a/plugins/transforms/webserviceavailable/src/test/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMetaTest.java b/plugins/transforms/webserviceavailable/src/test/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMetaTest.java index aec956c8a3f..58840933504 100644 --- a/plugins/transforms/webserviceavailable/src/test/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMetaTest.java +++ b/plugins/transforms/webserviceavailable/src/test/java/org/apache/hop/pipeline/transforms/webserviceavailable/WebServiceAvailableMetaTest.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.webserviceavailable; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.junit.rules.RestoreHopEngineEnvironment; import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester; import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.List; - public class WebServiceAvailableMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebService.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebService.java index a0e120465c5..b22f8d0b122 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebService.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebService.java @@ -17,6 +17,35 @@ package org.apache.hop.pipeline.transforms.webservices; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.io.StringWriter; +import java.math.BigDecimal; +import java.net.URISyntaxException; +import java.net.UnknownHostException; +import java.nio.charset.Charset; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; @@ -63,36 +92,6 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.io.StringWriter; -import java.math.BigDecimal; -import java.net.URISyntaxException; -import java.net.UnknownHostException; -import java.nio.charset.Charset; -import java.text.DecimalFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - public class WebService extends BaseTransform { private static final Class PKG = WebServiceMeta.class; // For Translator diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceData.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceData.java index 4e8103ab4a0..b55241c2413 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceData.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceData.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.webservices; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class WebServiceData extends BaseTransformData implements ITransformData { public String realUrl; diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceDialog.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceDialog.java index 96ddfad7b1b..b116be7f184 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceDialog.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceDialog.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.webservices; +import java.io.File; +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 java.util.Properties; +import javax.xml.namespace.QName; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -69,16 +78,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import javax.xml.namespace.QName; -import java.io.File; -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 java.util.Properties; - public class WebServiceDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = WebServiceMeta.class; // For Translator diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMeta.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMeta.java index d0819d82411..3b5caf66232 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMeta.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.webservices; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -35,10 +38,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - @Transform( id = "WebServiceLookup", image = "webservice.svg", @@ -514,37 +513,51 @@ public void setOutFieldContainerName(String outFieldContainerName) { this.outFieldContainerName = outFieldContainerName; } - /** @return the passingInputData */ + /** + * @return the passingInputData + */ public boolean isPassingInputData() { return passingInputData; } - /** @param passingInputData the passingInputData to set */ + /** + * @param passingInputData the passingInputData to set + */ public void setPassingInputData(boolean passingInputData) { this.passingInputData = passingInputData; } - /** @return the compatible */ + /** + * @return the compatible + */ public boolean isCompatible() { return compatible; } - /** @param compatible the compatible to set */ + /** + * @param compatible the compatible to set + */ public void setCompatible(boolean compatible) { this.compatible = compatible; } - /** @return the repeatingElementName */ + /** + * @return the repeatingElementName + */ public String getRepeatingElementName() { return repeatingElementName; } - /** @param repeatingElementName the repeatingElementName to set */ + /** + * @param repeatingElementName the repeatingElementName to set + */ public void setRepeatingElementName(String repeatingElementName) { this.repeatingElementName = repeatingElementName; } - /** @return true if the reply from the service is simply passed on as a String, mostly in XML */ + /** + * @return true if the reply from the service is simply passed on as a String, mostly in XML + */ public boolean isReturningReplyAsString() { return returningReplyAsString; } @@ -557,12 +570,16 @@ public void setReturningReplyAsString(boolean returningReplyAsString) { this.returningReplyAsString = returningReplyAsString; } - /** @return the operationRequestName */ + /** + * @return the operationRequestName + */ public String getOperationRequestName() { return operationRequestName; } - /** @param operationRequestName the operationRequestName to set */ + /** + * @param operationRequestName the operationRequestName to set + */ public void setOperationRequestName(String operationRequestName) { this.operationRequestName = operationRequestName; } diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ComplexType.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ComplexType.java index f5d79b01877..33ee4b24289 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ComplexType.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ComplexType.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.w3c.dom.Element; - -import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import javax.xml.namespace.QName; +import org.w3c.dom.Element; /* This looks a little scary, but isn't so bad. Pretty much all that needs to be done here is to diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ControlWsdlLocator.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ControlWsdlLocator.java index 118f6da1e3d..46fb1b0b446 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ControlWsdlLocator.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/ControlWsdlLocator.java @@ -17,9 +17,6 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.xml.sax.InputSource; - -import javax.wsdl.xml.WSDLLocator; import java.beans.beancontext.BeanContext; import java.io.IOException; import java.io.InputStream; @@ -29,6 +26,8 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; +import javax.wsdl.xml.WSDLLocator; +import org.xml.sax.InputSource; /** * Implementation of WSDLLocator for Beehive controls. This WSDLLocator implementation may open diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/DomUtils.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/DomUtils.java index abe03939cbf..3810c672036 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/DomUtils.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/DomUtils.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; +import java.util.ArrayList; +import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import java.util.ArrayList; -import java.util.List; - /** Some DOM utility methods. */ public final class DomUtils { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/Wsdl.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/Wsdl.java index a690fffefc8..0932d54619e 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/Wsdl.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/Wsdl.java @@ -17,14 +17,14 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.core.HttpProtocol; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopTransformException; -import org.apache.hop.core.logging.LogChannel; -import org.apache.hop.core.xml.XmlHandler; -import org.apache.http.auth.AuthenticationException; -import org.w3c.dom.Document; - +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import javax.wsdl.Binding; import javax.wsdl.Definition; import javax.wsdl.Operation; @@ -37,14 +37,13 @@ import javax.wsdl.xml.WSDLLocator; import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; +import org.apache.hop.core.HttpProtocol; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopTransformException; +import org.apache.hop.core.logging.LogChannel; +import org.apache.hop.core.xml.XmlHandler; +import org.apache.http.auth.AuthenticationException; +import org.w3c.dom.Document; /** Wsdl abstraction. */ public final class Wsdl implements java.io.Serializable { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlComplexTypes.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlComplexTypes.java index 1985feec52b..470e06c7d4f 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlComplexTypes.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlComplexTypes.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.w3c.dom.Element; - -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.schema.Schema; import java.util.HashMap; import java.util.List; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.schema.Schema; +import org.w3c.dom.Element; /** Represents a map of all named complex types in the WSDL. */ public final class WsdlComplexTypes implements java.io.Serializable { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpFaultList.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpFaultList.java index dbce95e64f4..89426bf0705 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpFaultList.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpFaultList.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.core.exception.HopTransformException; -import org.w3c.dom.Element; - +import java.util.ArrayList; +import java.util.Map; import javax.wsdl.Fault; import javax.wsdl.Message; import javax.wsdl.Part; import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Map; +import org.apache.hop.core.exception.HopTransformException; +import org.w3c.dom.Element; /** WsdlOpFaultList represents the list of parameters for a WSDL operaton. */ public final class WsdlOpFaultList extends ArrayList { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameter.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameter.java index 725781d2143..272440c3e18 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameter.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameter.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.w3c.dom.Element; - -import javax.xml.namespace.QName; import java.util.Objects; +import javax.xml.namespace.QName; +import org.w3c.dom.Element; /** WSDL operation parameter abstraction. */ public final class WsdlOpParameter extends WsdlOpReturnType implements java.io.Serializable { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterContainer.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterContainer.java index d7a78c37dd4..ec24724c20e 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterContainer.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterContainer.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.pipeline.transforms.webservices.WebServiceMeta; - import javax.xml.namespace.QName; +import org.apache.hop.pipeline.transforms.webservices.WebServiceMeta; public class WsdlOpParameterContainer implements WsdlParamContainer { private WsdlOpParameter parameter; diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterList.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterList.java index e4cb84d31ee..bf085bab344 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterList.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOpParameterList.java @@ -17,15 +17,14 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.core.exception.HopTransformException; -import org.w3c.dom.Element; - -import javax.wsdl.Binding; -import javax.wsdl.Operation; -import javax.wsdl.Part; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import javax.wsdl.Binding; +import javax.wsdl.Operation; +import javax.wsdl.Part; +import org.apache.hop.core.exception.HopTransformException; +import org.w3c.dom.Element; /** WsdlOpParameterList represents the list of parameters for an operation. */ public final class WsdlOpParameterList extends ArrayList { @@ -73,7 +72,9 @@ protected WsdlOperation.SOAPParameterStyle getParameterStyle() { return _parameterStyle; } - /** @return the operation for this parameter list */ + /** + * @return the operation for this parameter list + */ public Operation getOperation() { return _operation; } diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperation.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperation.java index 901840e231d..00b8b506711 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperation.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperation.java @@ -17,9 +17,8 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.exception.HopTransformException; - +import java.util.List; +import java.util.Map; import javax.wsdl.Binding; import javax.wsdl.Fault; import javax.wsdl.Input; @@ -28,8 +27,8 @@ import javax.wsdl.Output; import javax.wsdl.Part; import javax.xml.namespace.QName; -import java.util.List; -import java.util.Map; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.exception.HopTransformException; /** WSDL operation abstraction. */ public final class WsdlOperation implements java.io.Serializable { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperationContainer.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperationContainer.java index d52849be8a6..e7b784e4417 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperationContainer.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlOperationContainer.java @@ -17,10 +17,9 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.pipeline.transforms.webservices.wsdl.WsdlOpParameter.ParameterMode; - import java.util.ArrayList; import java.util.List; +import org.apache.hop.pipeline.transforms.webservices.wsdl.WsdlOpParameter.ParameterMode; public class WsdlOperationContainer implements WsdlParamContainer { diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlTypes.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlTypes.java index a4e504f58a5..30d56980d6f 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlTypes.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlTypes.java @@ -17,22 +17,21 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; -import org.apache.hop.core.exception.HopTransformException; -import org.apache.hop.i18n.BaseMessages; -import org.w3c.dom.Element; - -import javax.wsdl.Definition; -import javax.wsdl.Types; -import javax.wsdl.extensions.ElementExtensible; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.schema.Schema; -import javax.xml.namespace.QName; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; +import javax.wsdl.Definition; +import javax.wsdl.Types; +import javax.wsdl.extensions.ElementExtensible; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.schema.Schema; +import javax.xml.namespace.QName; +import org.apache.hop.core.exception.HopTransformException; +import org.apache.hop.i18n.BaseMessages; +import org.w3c.dom.Element; /** * WsdlTypes provides utilities for getting information about the <types> section of the WSDL. diff --git a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlUtils.java b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlUtils.java index f2a57f7f6a0..037f80e810b 100644 --- a/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlUtils.java +++ b/plugins/transforms/webservices/src/main/java/org/apache/hop/pipeline/transforms/webservices/wsdl/WsdlUtils.java @@ -18,8 +18,9 @@ package org.apache.hop.pipeline.transforms.webservices.wsdl; import com.ibm.wsdl.extensions.soap12.SOAP12BodyImpl; -import org.apache.hop.core.exception.HopException; - +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import javax.wsdl.Binding; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; @@ -36,9 +37,7 @@ import javax.wsdl.extensions.soap12.SOAP12Binding; import javax.wsdl.extensions.soap12.SOAP12Header; import javax.wsdl.extensions.soap12.SOAP12Operation; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; +import org.apache.hop.core.exception.HopException; /** Utilities for getting extensibility elements. */ final class WsdlUtils { diff --git a/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaLoadSaveTest.java b/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaLoadSaveTest.java index 518ca89e04c..ab806f3addf 100644 --- a/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaLoadSaveTest.java +++ b/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaLoadSaveTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.webservices; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; @@ -29,13 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class WebServiceMetaLoadSaveTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); LoadSaveTester loadSaveTester; diff --git a/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaTest.java b/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaTest.java index 4c9dab99888..1a878251d44 100644 --- a/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaTest.java +++ b/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceMetaTest.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.webservices; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.HopClientEnvironment; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.database.DatabaseMeta; @@ -38,18 +49,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class WebServiceMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); @@ -126,9 +125,9 @@ public void testGetFields() throws Exception { webServiceMeta.setFieldsOut(Arrays.asList(field1, field2, field3)); webServiceMeta.getFields( rmi, "idk", new IRowMeta[] {rmi2}, nextTransform, new Variables(), metadataProvider); - //verify(rmi).addValueMeta(argThat(matchValueMetaString("field1"))); - //verify(rmi).addValueMeta(argThat(matchValueMetaString("field2"))); - //verify(rmi).addValueMeta(argThat(matchValueMetaString("field3"))); + // verify(rmi).addValueMeta(argThat(matchValueMetaString("field1"))); + // verify(rmi).addValueMeta(argThat(matchValueMetaString("field2"))); + // verify(rmi).addValueMeta(argThat(matchValueMetaString("field3"))); } private Matcher matchValueMetaString(final String fieldName) { diff --git a/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceTest.java b/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceTest.java index b921fdcafbc..ca3af80182c 100644 --- a/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceTest.java +++ b/plugins/transforms/webservices/src/test/java/org/apache/hop/pipeline/transforms/webservices/WebServiceTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.webservices; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.net.URISyntaxException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.pipeline.transforms.mock.TransformMockHelper; import org.apache.http.Header; @@ -26,15 +34,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URISyntaxException; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class WebServiceTest { private static final String LOCATION_HEADER = "Location"; diff --git a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java index df13974ffb4..d5c392bdd85 100644 --- a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java +++ b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutor.java @@ -294,26 +294,24 @@ private void executeWorkflow() throws HopException { // .. but before, perform all the consistency checks just one time just in the first result // row if (!rowConsistencyChecked) { - for (int i = 0; i < meta.getResultRowsField().length; i++) { - int idx = row.getRowMeta().indexOfValue(meta.getResultRowsField()[i]); - - if (idx == -1) { - missingFields += - (missingFields.length() > 0 ? "," : "") - + meta.getResultRowsField()[i]; - } - - IValueMeta valueMeta = row.getRowMeta().getValueMeta(i); - - if (valueMeta != null && valueMeta.getType() != meta.getResultRowsType()[i]) { - expectedTypes += - (expectedTypes.length() > 0 ? "," : "") - + ValueMetaFactory.getValueMetaName(meta.getResultRowsType()[i]); - currentTypes += - (currentTypes.length() > 0 ? "," : "") + valueMeta.getTypeDesc(); - } + for (int i = 0; i < meta.getResultRowsField().length; i++) { + int idx = row.getRowMeta().indexOfValue(meta.getResultRowsField()[i]); + + if (idx == -1) { + missingFields += + (missingFields.length() > 0 ? "," : "") + meta.getResultRowsField()[i]; + } + + IValueMeta valueMeta = row.getRowMeta().getValueMeta(i); + + if (valueMeta != null && valueMeta.getType() != meta.getResultRowsType()[i]) { + expectedTypes += + (expectedTypes.length() > 0 ? "," : "") + + ValueMetaFactory.getValueMetaName(meta.getResultRowsType()[i]); + currentTypes += (currentTypes.length() > 0 ? "," : "") + valueMeta.getTypeDesc(); } - rowConsistencyChecked = true; + } + rowConsistencyChecked = true; if (missingFields.length() > 0) { logError("Unable to find required fields [" + missingFields + "] in result row!"); @@ -321,13 +319,10 @@ private void executeWorkflow() throws HopException { if (currentTypes.length() > 0) { logError( - BaseMessages.getString( - PKG, - "WorkflowExecutor.IncorrectDataTypePassed", - currentTypes, - expectedTypes)); + BaseMessages.getString( + PKG, "WorkflowExecutor.IncorrectDataTypePassed", currentTypes, expectedTypes)); throw new HopException( - "We got into troubles while performing a consistency check on incoming result rows!"); + "We got into troubles while performing a consistency check on incoming result rows!"); } } diff --git a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorData.java b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorData.java index 8c9d0a8961d..ef69632f7e0 100644 --- a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorData.java +++ b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorData.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.workflowexecutor; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; @@ -26,8 +27,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.apache.hop.workflow.engine.IWorkflowEngine; -import java.util.List; - public class WorkflowExecutorData extends BaseTransformData implements ITransformData { public IWorkflowEngine executorWorkflow; public WorkflowMeta executorWorkflowMeta; diff --git a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorDialog.java b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorDialog.java index 0d6146f4290..dc67b547eb7 100644 --- a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorDialog.java +++ b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.workflowexecutor; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.SourceToTargetMapping; @@ -68,10 +71,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class WorkflowExecutorDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = WorkflowExecutorMeta.class; // For Translator @@ -1205,7 +1204,6 @@ private void collectInformation() { workflowExecutorMeta.setResultRowsLength(new int[nrFields]); workflowExecutorMeta.setResultRowsPrecision(new int[nrFields]); - for (int i = 0; i < nrFields; i++) { TableItem item = wResultRowsFields.getNonEmpty(i); workflowExecutorMeta.getResultRowsField()[i] = item.getText(1); diff --git a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java index e955f4a28a4..606c6a3812c 100644 --- a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java +++ b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.workflowexecutor; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -59,10 +62,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** Meta-data for the Workflow executor transform. */ @Transform( id = "WorkflowExecutor", @@ -72,7 +71,8 @@ categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow", documentationUrl = "/pipeline/transforms/workflow-executor.html", keywords = "i18n::WorkflowExecutorMeta.keyword") -public class WorkflowExecutorMeta extends BaseTransformMeta { +public class WorkflowExecutorMeta + extends BaseTransformMeta { private static final Class PKG = WorkflowExecutorMeta.class; // For Translator /** The name of the workflow run configuration to execute with */ @@ -790,282 +790,394 @@ public PipelineType[] getSupportedPipelineTypes() { }; } - /** @return the fileName */ + /** + * @return the fileName + */ public String getFilename() { return filename; } - /** @param filename the fileName to set */ + /** + * @param filename the fileName to set + */ public void setFilename(String filename) { this.filename = filename; } - /** @return the mappingParameters */ + /** + * @return the mappingParameters + */ public WorkflowExecutorParameters getMappingParameters() { return parameters; } - /** @param mappingParameters the mappingParameters to set */ + /** + * @param mappingParameters the mappingParameters to set + */ public void setMappingParameters(WorkflowExecutorParameters mappingParameters) { this.parameters = mappingParameters; } - /** @return the parameters */ + /** + * @return the parameters + */ public WorkflowExecutorParameters getParameters() { return parameters; } - /** @param parameters the parameters to set */ + /** + * @param parameters the parameters to set + */ public void setParameters(WorkflowExecutorParameters parameters) { this.parameters = parameters; } - /** @return the executionTimeField */ + /** + * @return the executionTimeField + */ public String getExecutionTimeField() { return executionTimeField; } - /** @param executionTimeField the executionTimeField to set */ + /** + * @param executionTimeField the executionTimeField to set + */ public void setExecutionTimeField(String executionTimeField) { this.executionTimeField = executionTimeField; } - /** @return the executionResultField */ + /** + * @return the executionResultField + */ public String getExecutionResultField() { return executionResultField; } - /** @param executionResultField the executionResultField to set */ + /** + * @param executionResultField the executionResultField to set + */ public void setExecutionResultField(String executionResultField) { this.executionResultField = executionResultField; } - /** @return the executionNrErrorsField */ + /** + * @return the executionNrErrorsField + */ public String getExecutionNrErrorsField() { return executionNrErrorsField; } - /** @param executionNrErrorsField the executionNrErrorsField to set */ + /** + * @param executionNrErrorsField the executionNrErrorsField to set + */ public void setExecutionNrErrorsField(String executionNrErrorsField) { this.executionNrErrorsField = executionNrErrorsField; } - /** @return the executionLinesReadField */ + /** + * @return the executionLinesReadField + */ public String getExecutionLinesReadField() { return executionLinesReadField; } - /** @param executionLinesReadField the executionLinesReadField to set */ + /** + * @param executionLinesReadField the executionLinesReadField to set + */ public void setExecutionLinesReadField(String executionLinesReadField) { this.executionLinesReadField = executionLinesReadField; } - /** @return the executionLinesWrittenField */ + /** + * @return the executionLinesWrittenField + */ public String getExecutionLinesWrittenField() { return executionLinesWrittenField; } - /** @param executionLinesWrittenField the executionLinesWrittenField to set */ + /** + * @param executionLinesWrittenField the executionLinesWrittenField to set + */ public void setExecutionLinesWrittenField(String executionLinesWrittenField) { this.executionLinesWrittenField = executionLinesWrittenField; } - /** @return the executionLinesInputField */ + /** + * @return the executionLinesInputField + */ public String getExecutionLinesInputField() { return executionLinesInputField; } - /** @param executionLinesInputField the executionLinesInputField to set */ + /** + * @param executionLinesInputField the executionLinesInputField to set + */ public void setExecutionLinesInputField(String executionLinesInputField) { this.executionLinesInputField = executionLinesInputField; } - /** @return the executionLinesOutputField */ + /** + * @return the executionLinesOutputField + */ public String getExecutionLinesOutputField() { return executionLinesOutputField; } - /** @param executionLinesOutputField the executionLinesOutputField to set */ + /** + * @param executionLinesOutputField the executionLinesOutputField to set + */ public void setExecutionLinesOutputField(String executionLinesOutputField) { this.executionLinesOutputField = executionLinesOutputField; } - /** @return the executionLinesRejectedField */ + /** + * @return the executionLinesRejectedField + */ public String getExecutionLinesRejectedField() { return executionLinesRejectedField; } - /** @param executionLinesRejectedField the executionLinesRejectedField to set */ + /** + * @param executionLinesRejectedField the executionLinesRejectedField to set + */ public void setExecutionLinesRejectedField(String executionLinesRejectedField) { this.executionLinesRejectedField = executionLinesRejectedField; } - /** @return the executionLinesUpdatedField */ + /** + * @return the executionLinesUpdatedField + */ public String getExecutionLinesUpdatedField() { return executionLinesUpdatedField; } - /** @param executionLinesUpdatedField the executionLinesUpdatedField to set */ + /** + * @param executionLinesUpdatedField the executionLinesUpdatedField to set + */ public void setExecutionLinesUpdatedField(String executionLinesUpdatedField) { this.executionLinesUpdatedField = executionLinesUpdatedField; } - /** @return the executionLinesDeletedField */ + /** + * @return the executionLinesDeletedField + */ public String getExecutionLinesDeletedField() { return executionLinesDeletedField; } - /** @param executionLinesDeletedField the executionLinesDeletedField to set */ + /** + * @param executionLinesDeletedField the executionLinesDeletedField to set + */ public void setExecutionLinesDeletedField(String executionLinesDeletedField) { this.executionLinesDeletedField = executionLinesDeletedField; } - /** @return the executionFilesRetrievedField */ + /** + * @return the executionFilesRetrievedField + */ public String getExecutionFilesRetrievedField() { return executionFilesRetrievedField; } - /** @param executionFilesRetrievedField the executionFilesRetrievedField to set */ + /** + * @param executionFilesRetrievedField the executionFilesRetrievedField to set + */ public void setExecutionFilesRetrievedField(String executionFilesRetrievedField) { this.executionFilesRetrievedField = executionFilesRetrievedField; } - /** @return the executionExitStatusField */ + /** + * @return the executionExitStatusField + */ public String getExecutionExitStatusField() { return executionExitStatusField; } - /** @param executionExitStatusField the executionExitStatusField to set */ + /** + * @param executionExitStatusField the executionExitStatusField to set + */ public void setExecutionExitStatusField(String executionExitStatusField) { this.executionExitStatusField = executionExitStatusField; } - /** @return the executionLogTextField */ + /** + * @return the executionLogTextField + */ public String getExecutionLogTextField() { return executionLogTextField; } - /** @param executionLogTextField the executionLogTextField to set */ + /** + * @param executionLogTextField the executionLogTextField to set + */ public void setExecutionLogTextField(String executionLogTextField) { this.executionLogTextField = executionLogTextField; } - /** @return the executionLogChannelIdField */ + /** + * @return the executionLogChannelIdField + */ public String getExecutionLogChannelIdField() { return executionLogChannelIdField; } - /** @param executionLogChannelIdField the executionLogChannelIdField to set */ + /** + * @param executionLogChannelIdField the executionLogChannelIdField to set + */ public void setExecutionLogChannelIdField(String executionLogChannelIdField) { this.executionLogChannelIdField = executionLogChannelIdField; } - /** @return the resultRowsTargetTransform */ + /** + * @return the resultRowsTargetTransform + */ public String getResultRowsTargetTransform() { return resultRowsTargetTransform; } - /** @param resultRowsTargetTransform the result Rows Target Transform to set */ + /** + * @param resultRowsTargetTransform the result Rows Target Transform to set + */ public void setResultRowsTargetTransform(String resultRowsTargetTransform) { this.resultRowsTargetTransform = resultRowsTargetTransform; } - /** @return the resultRowsField */ + /** + * @return the resultRowsField + */ public String[] getResultRowsField() { return resultRowsField; } - /** @param resultRowsField the resultRowsField to set */ + /** + * @param resultRowsField the resultRowsField to set + */ public void setResultRowsField(String[] resultRowsField) { this.resultRowsField = resultRowsField; } - /** @return the resultRowsType */ + /** + * @return the resultRowsType + */ public int[] getResultRowsType() { return resultRowsType; } - /** @param resultRowsType the resultRowsType to set */ + /** + * @param resultRowsType the resultRowsType to set + */ public void setResultRowsType(int[] resultRowsType) { this.resultRowsType = resultRowsType; } - /** @return the resultRowsLength */ + /** + * @return the resultRowsLength + */ public int[] getResultRowsLength() { return resultRowsLength; } - /** @param resultRowsLength the resultRowsLength to set */ + /** + * @param resultRowsLength the resultRowsLength to set + */ public void setResultRowsLength(int[] resultRowsLength) { this.resultRowsLength = resultRowsLength; } - /** @return the resultRowsPrecision */ + /** + * @return the resultRowsPrecision + */ public int[] getResultRowsPrecision() { return resultRowsPrecision; } - /** @param resultRowsPrecision the resultRowsPrecision to set */ + /** + * @param resultRowsPrecision the resultRowsPrecision to set + */ public void setResultRowsPrecision(int[] resultRowsPrecision) { this.resultRowsPrecision = resultRowsPrecision; } - /** @return the result Files Target Transform */ + /** + * @return the result Files Target Transform + */ public String getResultFilesTargetTransform() { return resultFilesTargetTransform; } - /** @param resultFilesTargetTransform the result Files Target Transform to set */ + /** + * @param resultFilesTargetTransform the result Files Target Transform to set + */ public void setResultFilesTargetTransform(String resultFilesTargetTransform) { this.resultFilesTargetTransform = resultFilesTargetTransform; } - /** @return the resultRowsTargetTransformMeta */ + /** + * @return the resultRowsTargetTransformMeta + */ public TransformMeta getResultRowsTargetTransformMeta() { return resultRowsTargetTransformMeta; } - /** @param resultRowsTargetTransformMeta the resultRowsTargetTransformMeta to set */ + /** + * @param resultRowsTargetTransformMeta the resultRowsTargetTransformMeta to set + */ public void setResultRowsTargetTransformMeta(TransformMeta resultRowsTargetTransformMeta) { this.resultRowsTargetTransformMeta = resultRowsTargetTransformMeta; } - /** @return the resultFilesTargetTransformMeta */ + /** + * @return the resultFilesTargetTransformMeta + */ public TransformMeta getResultFilesTargetTransformMeta() { return resultFilesTargetTransformMeta; } - /** @param resultFilesTargetTransformMeta the resultFilesTargetTransformMeta to set */ + /** + * @param resultFilesTargetTransformMeta the resultFilesTargetTransformMeta to set + */ public void setResultFilesTargetTransformMeta(TransformMeta resultFilesTargetTransformMeta) { this.resultFilesTargetTransformMeta = resultFilesTargetTransformMeta; } - /** @return the groupSize */ + /** + * @return the groupSize + */ public String getGroupSize() { return groupSize; } - /** @param groupSize the groupSize to set */ + /** + * @param groupSize the groupSize to set + */ public void setGroupSize(String groupSize) { this.groupSize = groupSize; } - /** @return the groupField */ + /** + * @return the groupField + */ public String getGroupField() { return groupField; } - /** @param groupField the groupField to set */ + /** + * @param groupField the groupField to set + */ public void setGroupField(String groupField) { this.groupField = groupField; } - /** @return the groupTime */ + /** + * @return the groupTime + */ public String getGroupTime() { return groupTime; } - /** @param groupTime the groupTime to set */ + /** + * @param groupTime the groupTime to set + */ public void setGroupTime(String groupTime) { this.groupTime = groupTime; } @@ -1075,33 +1187,45 @@ public boolean excludeFromCopyDistributeVerification() { return true; } - /** @return the execution Result Target Transform */ + /** + * @return the execution Result Target Transform + */ public String getExecutionResultTargetTransform() { return executionResultTargetTransform; } - /** @param executionResultTargetTransform the executionResultTargetTransform to set */ + /** + * @param executionResultTargetTransform the executionResultTargetTransform to set + */ public void setExecutionResultTargetTransform(String executionResultTargetTransform) { this.executionResultTargetTransform = executionResultTargetTransform; } - /** @return the executionResultTargetTransformMeta */ + /** + * @return the executionResultTargetTransformMeta + */ public TransformMeta getExecutionResultTargetTransformMeta() { return executionResultTargetTransformMeta; } - /** @param executionResultTargetTransformMeta the executionResultTargetTransformMeta to set */ + /** + * @param executionResultTargetTransformMeta the executionResultTargetTransformMeta to set + */ public void setExecutionResultTargetTransformMeta( TransformMeta executionResultTargetTransformMeta) { this.executionResultTargetTransformMeta = executionResultTargetTransformMeta; } - /** @return the resultFilesFileNameField */ + /** + * @return the resultFilesFileNameField + */ public String getResultFilesFileNameField() { return resultFilesFileNameField; } - /** @param resultFilesFileNameField the resultFilesFileNameField to set */ + /** + * @param resultFilesFileNameField the resultFilesFileNameField to set + */ public void setResultFilesFileNameField(String resultFilesFileNameField) { this.resultFilesFileNameField = resultFilesFileNameField; } @@ -1192,7 +1316,9 @@ public String getRunConfigurationName() { return runConfigurationName; } - /** @param runConfigurationName The runConfigurationName to set */ + /** + * @param runConfigurationName The runConfigurationName to set + */ public void setRunConfigurationName(String runConfigurationName) { this.runConfigurationName = runConfigurationName; } diff --git a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorParameters.java b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorParameters.java index 763f6f04071..e072c167494 100644 --- a/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorParameters.java +++ b/plugins/transforms/workflowexecutor/src/main/java/org/apache/hop/pipeline/transforms/workflowexecutor/WorkflowExecutorParameters.java @@ -98,42 +98,58 @@ public String getXml() { return xml.toString(); } - /** @return the field name to use */ + /** + * @return the field name to use + */ public String[] getField() { return field; } - /** @param field the input field name to set */ + /** + * @param field the input field name to set + */ public void setField(String[] field) { this.field = field; } - /** @return the variable */ + /** + * @return the variable + */ public String[] getVariable() { return variable; } - /** @param variable the variable to set */ + /** + * @param variable the variable to set + */ public void setVariable(String[] variable) { this.variable = variable; } - /** @return the inheritingAllVariables */ + /** + * @return the inheritingAllVariables + */ public boolean isInheritingAllVariables() { return inheritingAllVariables; } - /** @param inheritingAllVariables the inheritingAllVariables to set */ + /** + * @param inheritingAllVariables the inheritingAllVariables to set + */ public void setInheritingAllVariables(boolean inheritingAllVariables) { this.inheritingAllVariables = inheritingAllVariables; } - /** @return the input */ + /** + * @return the input + */ public String[] getInput() { return input; } - /** @param input the input to set */ + /** + * @param input the input to set + */ public void setInput(String[] input) { this.input = input; } diff --git a/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogDialog.java b/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogDialog.java index d1d5e2fad38..0169e85f9d7 100644 --- a/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogDialog.java +++ b/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.writetolog; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -53,9 +55,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.List; - public class WriteToLogDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = WriteToLogDialog.class; // For Translator diff --git a/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogMeta.java b/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogMeta.java index 200b10ae63f..e9933b68ec3 100644 --- a/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogMeta.java +++ b/plugins/transforms/writetolog/src/main/java/org/apache/hop/pipeline/transforms/writetolog/WriteToLogMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.writetolog; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -33,9 +35,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.List; - @Transform( id = "WriteToLog", image = "writetolog.svg", @@ -128,12 +127,16 @@ public void allocate(int nrFields) { fieldName = new String[nrFields]; } - /** @return Returns the fieldName. */ + /** + * @return Returns the fieldName. + */ public String[] getFieldName() { return fieldName; } - /** @param fieldName The fieldName to set. */ + /** + * @param fieldName The fieldName to set. + */ public void setFieldName(String[] fieldName) { this.fieldName = fieldName; } diff --git a/plugins/transforms/writetolog/src/test/java/org/apache/pipeline/transforms/writetolog/WriteToLogMetaTest.java b/plugins/transforms/writetolog/src/test/java/org/apache/pipeline/transforms/writetolog/WriteToLogMetaTest.java index 584958d28ae..c5ebc6303ba 100644 --- a/plugins/transforms/writetolog/src/test/java/org/apache/pipeline/transforms/writetolog/WriteToLogMetaTest.java +++ b/plugins/transforms/writetolog/src/test/java/org/apache/pipeline/transforms/writetolog/WriteToLogMetaTest.java @@ -16,6 +16,11 @@ */ package org.apache.pipeline.transforms.writetolog; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -30,12 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - public class WriteToLogMetaTest implements IInitializer { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); LoadSaveTester loadSaveTester; diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/Dom4JUtil.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/Dom4JUtil.java index e05f4b6a22d..0df45b7dfaa 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/Dom4JUtil.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/Dom4JUtil.java @@ -16,20 +16,18 @@ */ package org.apache.hop.pipeline.transforms.xml; +import javax.xml.XMLConstants; import org.apache.hop.core.logging.HopLogStore; import org.apache.hop.core.logging.ILogChannel; import org.dom4j.io.SAXReader; import org.xml.sax.SAXException; -import javax.xml.XMLConstants; - public class Dom4JUtil { - + private static final ILogChannel log = HopLogStore.getLogChannelFactory().create("Xml"); - private Dom4JUtil() { - } - + private Dom4JUtil() {} + public static SAXReader getSAXReader() { SAXReader reader = new SAXReader(); try { diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/RowTransformCollector.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/RowTransformCollector.java index 1942008deae..5c36b0f8c80 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/RowTransformCollector.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/RowTransformCollector.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.xml; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.IRowListener; -import java.util.ArrayList; -import java.util.List; - /** * Helper class for testcases. You can add an instance of this class to a transform to read all of * the Rows the transform read or wrote. diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXml.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXml.java index 08821040a07..2d5d39f2900 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXml.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXml.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.xml.addxml; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -36,17 +45,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; - /** Converts input rows to one or more XML files. */ public class AddXml extends BaseTransform { private static final Class PKG = AddXml.class; // For Translator diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlData.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlData.java index d9852606145..4fdf5bae984 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlData.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlData.java @@ -17,10 +17,6 @@ package org.apache.hop.pipeline.transforms.xml.addxml; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - import java.io.OutputStreamWriter; import java.text.DateFormatSymbols; import java.text.DecimalFormat; @@ -28,6 +24,9 @@ import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.zip.ZipOutputStream; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class AddXmlData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlDialog.java index 2a5d02d7147..a34a1aaaa81 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlDialog.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.xml.addxml; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -58,13 +64,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class AddXmlDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = AddXmlMeta.class; // For Translator @@ -596,7 +595,6 @@ private void getInfo(AddXmlMeta tfoi) { field.setAttribute(BaseMessages.getString(PKG, "System.Combo.Yes").equals(item.getText(11))); field.setAttributeParentName(item.getText(12)); - tfoi.getOutputFields()[i] = field; } } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMeta.java index b88f27afdd1..f254d787489 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.xml.addxml; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -39,8 +40,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - /** This class knows how to handle the MetaData for the XML output transform */ @Transform( id = "AddXML", @@ -87,12 +86,16 @@ public AddXmlMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the zipped. */ + /** + * @return Returns the zipped. + */ public boolean isOmitXMLheader() { return omitXMLheader; } - /** @param omitXMLheader The omit XML header flag to set. */ + /** + * @param omitXMLheader The omit XML header flag to set. + */ public void setOmitXMLheader(boolean omitXMLheader) { this.omitXMLheader = omitXMLheader; } @@ -107,12 +110,16 @@ public boolean isOmitNullValues() { return omitNullValues; } - /** @return Returns the outputFields. */ + /** + * @return Returns the outputFields. + */ public XmlField[] getOutputFields() { return outputFields; } - /** @param outputFields The outputFields to set. */ + /** + * @param outputFields The outputFields to set. + */ public void setOutputFields(XmlField[] outputFields) { this.outputFields = outputFields; } @@ -347,12 +354,16 @@ public void setEncoding(String encoding) { this.encoding = encoding; } - /** @return Returns the rootNode. */ + /** + * @return Returns the rootNode. + */ public String getRootNode() { return rootNode; } - /** @param rootNode The root node to set. */ + /** + * @param rootNode The root node to set. + */ public void setRootNode(String rootNode) { this.rootNode = rootNode; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/XmlField.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/XmlField.java index 5e495125529..4328f5ea475 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/XmlField.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/addxml/XmlField.java @@ -194,17 +194,23 @@ public String toString() { return fieldName + ":" + getTypeDesc() + ":" + elementName; } - /** @return Returns the elementName. */ + /** + * @return Returns the elementName. + */ public String getElementName() { return elementName; } - /** @param elementName The elementName to set. */ + /** + * @param elementName The elementName to set. + */ public void setElementName(String elementName) { this.elementName = elementName; } - /** @return true if the field should be encoded as attribute instead of a child node. */ + /** + * @return true if the field should be encoded as attribute instead of a child node. + */ public boolean isAttribute() { return attribute; } @@ -217,12 +223,16 @@ public void setAttribute(boolean attribute) { this.attribute = attribute; } - /** @return Returns the attributeParentName. */ + /** + * @return Returns the attributeParentName. + */ public String getAttributeParentName() { return attributeParentName; } - /** @param attributeParentName The attributeParentName to set. */ + /** + * @param attributeParentName The attributeParentName to set. + */ public void setAttributeParentName(String attributeParentName) { this.attributeParentName = attributeParentName; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlData.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlData.java index 1ff5b519965..7339ed42c01 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlData.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlData.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.io.InputStream; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.zip.GZIPInputStream; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.hop.core.Const; @@ -51,13 +57,6 @@ import org.dom4j.io.SAXReader; import org.dom4j.tree.AbstractNode; -import java.io.InputStream; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.zip.GZIPInputStream; - /** * Read XML files, parse them and convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataData.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataData.java index 7c050d03333..b0f641135d2 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataData.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataData.java @@ -17,14 +17,6 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; -import org.apache.commons.vfs2.FileObject; -import org.apache.hop.core.fileinput.FileInputList; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; -import org.dom4j.Document; -import org.dom4j.Node; - import java.io.BufferedInputStream; import java.io.FileInputStream; import java.text.DateFormatSymbols; @@ -37,6 +29,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.vfs2.FileObject; +import org.apache.hop.core.fileinput.FileInputList; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; +import org.dom4j.Document; +import org.dom4j.Node; public class GetXmlDataData extends BaseTransformData implements ITransformData { public String thisline; diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataDialog.java index 6bca04ab657..e546b437bc6 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataDialog.java @@ -15,9 +15,11 @@ * limitations under the License. */ - package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.RowMetaAndData; @@ -70,10 +72,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.ArrayList; - public class GetXmlDataDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = GetXmlDataMeta.class; // For Translator @@ -1929,7 +1927,6 @@ private void getInfo(GetXmlDataMeta in) throws HopException { field.setRepeated( BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(13))); - in.getInputFields()[i] = field; } in.setShortFileNameField(wShortFileFieldName.getText()); diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataMeta.java index 4f3ade74a20..7d252be18ff 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXmlDataMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -45,10 +48,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** Store run-time data on the getXMLData transform. */ @Transform( id = "getXMLData", @@ -163,107 +162,149 @@ public GetXmlDataMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the shortFileFieldName. */ + /** + * @return Returns the shortFileFieldName. + */ public String getShortFileNameField() { return shortFileFieldName; } - /** @param field The shortFileFieldName to set. */ + /** + * @param field The shortFileFieldName to set. + */ public void setShortFileNameField(String field) { shortFileFieldName = field; } - /** @return Returns the pathFieldName. */ + /** + * @return Returns the pathFieldName. + */ public String getPathField() { return pathFieldName; } - /** @param field The pathFieldName to set. */ + /** + * @param field The pathFieldName to set. + */ public void setPathField(String field) { this.pathFieldName = field; } - /** @return Returns the hiddenFieldName. */ + /** + * @return Returns the hiddenFieldName. + */ public String isHiddenField() { return hiddenFieldName; } - /** @param field The hiddenFieldName to set. */ + /** + * @param field The hiddenFieldName to set. + */ public void setIsHiddenField(String field) { hiddenFieldName = field; } - /** @return Returns the lastModificationTimeFieldName. */ + /** + * @return Returns the lastModificationTimeFieldName. + */ public String getLastModificationDateField() { return lastModificationTimeFieldName; } - /** @param field The lastModificationTimeFieldName to set. */ + /** + * @param field The lastModificationTimeFieldName to set. + */ public void setLastModificationDateField(String field) { lastModificationTimeFieldName = field; } - /** @return Returns the uriNameFieldName. */ + /** + * @return Returns the uriNameFieldName. + */ public String getUriField() { return uriNameFieldName; } - /** @param field The uriNameFieldName to set. */ + /** + * @param field The uriNameFieldName to set. + */ public void setUriField(String field) { uriNameFieldName = field; } - /** @return Returns the uriNameFieldName. */ + /** + * @return Returns the uriNameFieldName. + */ public String getRootUriField() { return rootUriNameFieldName; } - /** @param field The rootUriNameFieldName to set. */ + /** + * @param field The rootUriNameFieldName to set. + */ public void setRootUriField(String field) { rootUriNameFieldName = field; } - /** @return Returns the extensionFieldName. */ + /** + * @return Returns the extensionFieldName. + */ public String getExtensionField() { return extensionFieldName; } - /** @param field The extensionFieldName to set. */ + /** + * @param field The extensionFieldName to set. + */ public void setExtensionField(String field) { extensionFieldName = field; } - /** @return Returns the sizeFieldName. */ + /** + * @return Returns the sizeFieldName. + */ public String getSizeField() { return sizeFieldName; } - /** @param field The sizeFieldName to set. */ + /** + * @param field The sizeFieldName to set. + */ public void setSizeField(String field) { sizeFieldName = field; } - /** @return the add result filesname flag */ + /** + * @return the add result filesname flag + */ public boolean addResultFile() { return addResultFile; } - /** @return the validating flag */ + /** + * @return the validating flag + */ public boolean isValidating() { return validating; } - /** @param validating the validating flag to set */ + /** + * @param validating the validating flag to set + */ public void setValidating(boolean validating) { this.validating = validating; } - /** @return the readurl flag */ + /** + * @return the readurl flag + */ public boolean isReadUrl() { return readurl; } - /** @param readurl the readurl flag to set */ + /** + * @param readurl the readurl flag to set + */ public void setReadUrl(boolean readurl) { this.readurl = readurl; } @@ -272,22 +313,30 @@ public void setAddResultFile(boolean addResultFile) { this.addResultFile = addResultFile; } - /** @return Returns the input fields. */ + /** + * @return Returns the input fields. + */ public GetXmlDataField[] getInputFields() { return inputFields; } - /** @param inputFields The input fields to set. */ + /** + * @param inputFields The input fields to set. + */ public void setInputFields(GetXmlDataField[] inputFields) { this.inputFields = inputFields; } - /** @return Returns the excludeFileMask. */ + /** + * @return Returns the excludeFileMask. + */ public String[] getExludeFileMask() { return excludeFileMask; } - /** @param excludeFileMask The excludeFileMask to set. */ + /** + * @param excludeFileMask The excludeFileMask to set. + */ public void setExcludeFileMask(String[] excludeFileMask) { this.excludeFileMask = excludeFileMask; } @@ -307,17 +356,23 @@ public boolean isInFields() { return inFields; } - /** @param inFields set the inFields. */ + /** + * @param inFields set the inFields. + */ public void setInFields(boolean inFields) { this.inFields = inFields; } - /** @return Returns the fileMask. */ + /** + * @return Returns the fileMask. + */ public String[] getFileMask() { return fileMask; } - /** @param fileMask The fileMask to set. */ + /** + * @param fileMask The fileMask to set. + */ public void setFileMask(String[] fileMask) { this.fileMask = fileMask; } @@ -338,132 +393,184 @@ public void setIncludeSubFolders(String[] includeSubFoldersin) { } } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String[] getFileName() { return fileName; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String[] fileName) { this.fileName = fileName; } - /** @return Returns the filenameField. */ + /** + * @return Returns the filenameField. + */ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set. */ + /** + * @param filenameField The filenameField to set. + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } - /** @return Returns the includeFilename. */ + /** + * @return Returns the includeFilename. + */ public boolean includeFilename() { return includeFilename; } - /** @param includeFilename The includeFilename to set. */ + /** + * @param includeFilename The includeFilename to set. + */ public void setIncludeFilename(boolean includeFilename) { this.includeFilename = includeFilename; } - /** @return Returns the includeRowNumber. */ + /** + * @return Returns the includeRowNumber. + */ public boolean includeRowNumber() { return includeRowNumber; } - /** @param includeRowNumber The includeRowNumber to set. */ + /** + * @param includeRowNumber The includeRowNumber to set. + */ public void setIncludeRowNumber(boolean includeRowNumber) { this.includeRowNumber = includeRowNumber; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public long getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(long rowLimit) { this.rowLimit = rowLimit; } - /** @return Returns the LoopXPath */ + /** + * @return Returns the LoopXPath + */ public String getLoopXPath() { return loopxpath; } - /** @param loopxpath The loopxpath to set. */ + /** + * @param loopxpath The loopxpath to set. + */ public void setLoopXPath(String loopxpath) { this.loopxpath = loopxpath; } - /** @param usetoken the "use token" flag to set */ + /** + * @param usetoken the "use token" flag to set + */ public void setuseToken(boolean usetoken) { this.usetoken = usetoken; } - /** @return the use token flag */ + /** + * @return the use token flag + */ public boolean isuseToken() { return usetoken; } - /** @return the IsIgnoreEmptyFile flag */ + /** + * @return the IsIgnoreEmptyFile flag + */ public boolean isIgnoreEmptyFile() { return isIgnoreEmptyFile; } - /** @param isIgnoreEmptyFile the isIgnoreEmptyFile to set */ + /** + * @param isIgnoreEmptyFile the isIgnoreEmptyFile to set + */ public void setIgnoreEmptyFile(boolean isIgnoreEmptyFile) { this.isIgnoreEmptyFile = isIgnoreEmptyFile; } - /** @return the doNotFailIfNoFile flag */ + /** + * @return the doNotFailIfNoFile flag + */ public boolean isdoNotFailIfNoFile() { return doNotFailIfNoFile; } - /** @param doNotFailIfNoFile the doNotFailIfNoFile to set */ + /** + * @param doNotFailIfNoFile the doNotFailIfNoFile to set + */ public void setdoNotFailIfNoFile(boolean doNotFailIfNoFile) { this.doNotFailIfNoFile = doNotFailIfNoFile; } - /** @return the ignorecomments flag */ + /** + * @return the ignorecomments flag + */ public boolean isIgnoreComments() { return ignorecomments; } - /** @param ignorecomments the ignorecomments to set */ + /** + * @param ignorecomments the ignorecomments to set + */ public void setIgnoreComments(boolean ignorecomments) { this.ignorecomments = ignorecomments; } - /** @param nameSpaceAware the name variables aware flag to set */ + /** + * @param nameSpaceAware the name variables aware flag to set + */ public void setNamespaceAware(boolean nameSpaceAware) { this.nameSpaceAware = nameSpaceAware; } - /** @return the name variables aware flag */ + /** + * @return the name variables aware flag + */ public boolean isNamespaceAware() { return nameSpaceAware; } - /** @return Returns the rowNumberField. */ + /** + * @return Returns the rowNumberField. + */ public String getRowNumberField() { return rowNumberField; } - /** @param rowNumberField The rowNumberField to set. */ + /** + * @param rowNumberField The rowNumberField to set. + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } - /** @return the encoding */ + /** + * @return the encoding + */ public String getEncoding() { return encoding; } - /** @param encoding the encoding to set */ + /** + * @param encoding the encoding to set + */ public void setEncoding(String encoding) { this.encoding = encoding; } @@ -476,7 +583,9 @@ public void setIsAFile(boolean isAFile) { this.isAFile = isAFile; } - /** @return the prunePath */ + /** + * @return the prunePath + */ public String getPrunePath() { return prunePath; } @@ -485,7 +594,9 @@ public String[] getIncludeSubFolders() { return includeSubFolders; } - /** @param prunePath the prunePath to set */ + /** + * @param prunePath the prunePath to set + */ public void setPrunePath(String prunePath) { this.prunePath = prunePath; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/IgnoreDtdEntityResolver.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/IgnoreDtdEntityResolver.java index 0ea56762d58..745ff418695 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/IgnoreDtdEntityResolver.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/IgnoreDtdEntityResolver.java @@ -17,12 +17,11 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.io.ByteArrayInputStream; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import java.io.ByteArrayInputStream; - public class IgnoreDtdEntityResolver implements EntityResolver { @Override diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/LoopNodesImportProgressDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/LoopNodesImportProgressDialog.java index 0668e0229b7..6a40070cb66 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/LoopNodesImportProgressDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/LoopNodesImportProgressDialog.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.io.InputStream; +import java.io.StringReader; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; import org.apache.hop.core.util.Utils; @@ -31,13 +37,6 @@ import org.dom4j.io.SAXReader; import org.eclipse.swt.widgets.Shell; -import java.io.InputStream; -import java.io.StringReader; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - /** * Takes care of displaying a dialog that will handle the wait while we're finding out loop nodes * for an XML file diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/PdOption.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/PdOption.java index 51b4a1a8407..3bb5f50a7bb 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/PdOption.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/PdOption.java @@ -18,65 +18,65 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; public class PdOption { - private boolean isValidating; - private boolean useUrl; - private boolean useSnippet; - private String encoding; - private boolean isXmlSourceFile; - private String loopXPath; + private boolean isValidating; + private boolean useUrl; + private boolean useSnippet; + private String encoding; + private boolean isXmlSourceFile; + private String loopXPath; - PdOption() { - isValidating = false; - useUrl = false; - useSnippet = false; - encoding = null; - isXmlSourceFile = false; - loopXPath = ""; - } + PdOption() { + isValidating = false; + useUrl = false; + useSnippet = false; + encoding = null; + isXmlSourceFile = false; + loopXPath = ""; + } - public void setValidating(boolean validating) { - isValidating = validating; - } + public void setValidating(boolean validating) { + isValidating = validating; + } - public void setUseUrl(boolean useUrl) { - this.useUrl = useUrl; - } + public void setUseUrl(boolean useUrl) { + this.useUrl = useUrl; + } - public void setUseSnippet(boolean useSnippet) { - this.useSnippet = useSnippet; - } + public void setUseSnippet(boolean useSnippet) { + this.useSnippet = useSnippet; + } - //if the encoding is not null, the source must be a file - public void setEncoding(String encoding) { - this.encoding = encoding; - this.isXmlSourceFile=true; - } + // if the encoding is not null, the source must be a file + public void setEncoding(String encoding) { + this.encoding = encoding; + this.isXmlSourceFile = true; + } - public boolean isValidating() { - return isValidating; - } + public boolean isValidating() { + return isValidating; + } - public boolean isUseUrl() { - return useUrl; - } + public boolean isUseUrl() { + return useUrl; + } - public boolean isUseSnippet() { - return useSnippet; - } + public boolean isUseSnippet() { + return useSnippet; + } - public String getEncoding() { - return encoding; - } + public String getEncoding() { + return encoding; + } - public boolean isXmlSourceIsFile() { - return isXmlSourceFile; - } + public boolean isXmlSourceIsFile() { + return isXmlSourceFile; + } - public String getLoopXPath() { - return loopXPath; - } + public String getLoopXPath() { + return loopXPath; + } - public void setLoopXPath(String loopXPath) { - this.loopXPath = loopXPath; - } + public void setLoopXPath(String loopXPath) { + this.loopXPath = loopXPath; + } } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/XmlInputFieldsImportProgressDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/XmlInputFieldsImportProgressDialog.java index 1f313384f03..6b2fd4db210 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/XmlInputFieldsImportProgressDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/getxmldata/XmlInputFieldsImportProgressDialog.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.io.InputStream; +import java.io.StringReader; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; import org.apache.hop.core.RowMetaAndData; @@ -34,15 +42,6 @@ import org.dom4j.io.SAXReader; import org.eclipse.swt.widgets.Shell; -import java.io.InputStream; -import java.io.StringReader; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - /** * Takes care of displaying a dialog that will handle the wait while we're finding out loop nodes * for an XML file diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/types/XmlExplorerFileType.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/types/XmlExplorerFileType.java index b479de3942f..ebba7b8dab0 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/types/XmlExplorerFileType.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/types/XmlExplorerFileType.java @@ -46,9 +46,9 @@ public XmlExplorerFileType() { new String[] {"XML files"}, FileTypeCapabilities.getCapabilities( IHopFileType.CAPABILITY_SAVE, - IHopFileType.CAPABILITY_CLOSE, + IHopFileType.CAPABILITY_CLOSE, IHopFileType.CAPABILITY_FILE_HISTORY, - IHopFileType.CAPABILITY_COPY, + IHopFileType.CAPABILITY_COPY, IHopFileType.CAPABILITY_SELECT)); } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStream.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStream.java index 3454723ce69..ff55061ff1b 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStream.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStream.java @@ -17,6 +17,19 @@ package org.apache.hop.pipeline.transforms.xml.xmlinputstream; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.Attribute; +import javax.xml.stream.events.EndElement; +import javax.xml.stream.events.Namespace; +import javax.xml.stream.events.XMLEvent; import org.apache.commons.vfs2.FileSystemException; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; @@ -33,20 +46,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.events.Attribute; -import javax.xml.stream.events.EndElement; -import javax.xml.stream.events.Namespace; -import javax.xml.stream.events.XMLEvent; -import java.io.IOException; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - /** Use a StAX parser to read XML in a flexible and fast way. */ // TODO black box testing public class XmlInputStream extends BaseTransform { diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamData.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamData.java index 0341b0ea588..b27db8275d2 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamData.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamData.java @@ -17,16 +17,15 @@ package org.apache.hop.pipeline.transforms.xml.xmlinputstream; +import java.io.InputStream; +import java.util.Map; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLInputFactory; -import java.io.InputStream; -import java.util.Map; - public class XmlInputStreamData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamMeta.java index 83b7671d436..6a1ed89ca99 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.xml.xmlinputstream; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,8 +37,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "XMLInputStream", image = "xml_input_stream.svg", @@ -75,6 +74,7 @@ public class XmlInputStreamMeta extends BaseTransformMeta { diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinDialog.java index b1dcd9c4a7f..ca15b40b692 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.xml.xmljoin; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; @@ -46,10 +49,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class XmlJoinDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = XmlJoinMeta.class; // For Translator diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMeta.java index a07616b21bf..c93f953cec3 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.xml.xmljoin; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -43,9 +45,6 @@ import org.apache.hop.pipeline.transform.stream.StreamIcon; import org.w3c.dom.Node; -import java.util.Arrays; -import java.util.List; - /** This class knows how to handle the MetaData for the XML join transform */ @Transform( id = "XMLJoin", @@ -423,7 +422,9 @@ public String getTargetXmlTransform() { return targetXmlTransform; } - /** @param targetXmlTransform The targetXmlTransform to set */ + /** + * @param targetXmlTransform The targetXmlTransform to set + */ public void setTargetXmlTransform(String targetXmlTransform) { this.targetXmlTransform = targetXmlTransform; } @@ -445,7 +446,9 @@ public String getSourceXmlTransform() { return sourceXmlTransform; } - /** @param sourceXmlTransform The sourceXmlTransform to set */ + /** + * @param sourceXmlTransform The sourceXmlTransform to set + */ public void setSourceXmlTransform(String sourceXmlTransform) { this.sourceXmlTransform = sourceXmlTransform; } @@ -496,7 +499,9 @@ public boolean isOmitXmlHeader() { return omitXmlHeader; } - /** @param omitXmlHeader The omitXmlHeader to set */ + /** + * @param omitXmlHeader The omitXmlHeader to set + */ public void setOmitXmlHeader(boolean omitXmlHeader) { this.omitXmlHeader = omitXmlHeader; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlField.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlField.java index 5f90e0751f4..f3f317636a0 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlField.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlField.java @@ -209,22 +209,30 @@ public String toString() { return fieldName + ":" + getTypeDesc() + ":" + elementName; } - /** @return Returns the elementName. */ + /** + * @return Returns the elementName. + */ public String getElementName() { return elementName; } - /** @param elementName The elementName to set. */ + /** + * @param elementName The elementName to set. + */ public void setElementName(String elementName) { this.elementName = elementName; } - /** @return the contentType */ + /** + * @return the contentType + */ public ContentType getContentType() { return contentType; } - /** @param contentType the contentType to set */ + /** + * @param contentType the contentType to set + */ public void setContentType(ContentType contentType) { this.contentType = contentType; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutput.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutput.java index 29a5b3e243e..875541601d8 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutput.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutput.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.xml.xmloutput; +import java.io.File; +import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; @@ -33,16 +39,7 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transforms.xml.xmloutput.XmlField.ContentType; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import java.io.File; -import java.io.OutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * Converts input rows to one or more XML files. - */ +/** Converts input rows to one or more XML files. */ public class XmlOutput extends BaseTransform { private static final String EOL = "\n"; // force EOL char because woodstox library encodes CRLF incorrectly @@ -240,7 +237,7 @@ void writeRowAttributes(Object[] r) throws HopValueException, XMLStreamException } } } - + private void writeField(IValueMeta valueMeta, Object valueData, String element) throws HopTransformException { try { diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputData.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputData.java index 2c3f249d220..9dca1cc1c41 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputData.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputData.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.xml.xmloutput; -import org.apache.hop.core.row.IRowMeta; -import org.apache.hop.pipeline.transform.BaseTransformData; -import org.apache.hop.pipeline.transform.ITransformData; - -import javax.xml.stream.XMLStreamWriter; import java.text.DateFormatSymbols; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.zip.ZipOutputStream; +import javax.xml.stream.XMLStreamWriter; +import org.apache.hop.core.row.IRowMeta; +import org.apache.hop.pipeline.transform.BaseTransformData; +import org.apache.hop.pipeline.transform.ITransformData; public class XmlOutputData extends BaseTransformData implements ITransformData { public int splitnr; diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputDialog.java index d5951f4703f..c37ea5156f9 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.xml.xmloutput; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -63,10 +66,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - public class XmlOutputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = XmlOutputMeta.class; // For Translator @@ -115,7 +114,6 @@ public class XmlOutputDialog extends BaseTransformDialog implements ITransformDi private final List inputFields = new ArrayList<>(); - public XmlOutputDialog( Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String sname) { super(parent, variables, (BaseTransformMeta) in, pipelineMeta, sname); @@ -1008,7 +1006,6 @@ private void getInfo(XmlOutputMeta xmlOutputMeta) { field.setGroupingSymbol(item.getText(index++)); field.setNullString(item.getText(index++)); - xmlOutputMeta.getOutputFields()[i] = field; } } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMeta.java index 53a692aaaf5..7eee5d20c8e 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMeta.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.xml.xmloutput; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -45,12 +50,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - @Transform( id = "XMLOutput", image = "XOU.svg", @@ -136,82 +135,114 @@ public XmlOutputMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the dateInFilename. */ + /** + * @return Returns the dateInFilename. + */ public boolean isDateInFilename() { return dateInFilename; } - /** @param dateInFilename The dateInFilename to set. */ + /** + * @param dateInFilename The dateInFilename to set. + */ public void setDateInFilename(boolean dateInFilename) { this.dateInFilename = dateInFilename; } - /** @return Returns the extension. */ + /** + * @return Returns the extension. + */ public String getExtension() { return extension; } - /** @param extension The extension to set. */ + /** + * @param extension The extension to set. + */ public void setExtension(String extension) { this.extension = extension; } - /** @return Returns the "do not open new file at init" flag. */ + /** + * @return Returns the "do not open new file at init" flag. + */ public boolean isDoNotOpenNewFileInit() { return doNotOpenNewFileInit; } - /** @param doNotOpenNewFileInit The "do not open new file at init" flag to set. */ + /** + * @param doNotOpenNewFileInit The "do not open new file at init" flag to set. + */ public void setDoNotOpenNewFileInit(boolean doNotOpenNewFileInit) { this.doNotOpenNewFileInit = doNotOpenNewFileInit; } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String getFileName() { return fileName; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String fileName) { this.fileName = fileName; } - /** @return Returns the splitEvery. */ + /** + * @return Returns the splitEvery. + */ public int getSplitEvery() { return splitEvery; } - /** @param splitEvery The splitEvery to set. */ + /** + * @param splitEvery The splitEvery to set. + */ public void setSplitEvery(int splitEvery) { this.splitEvery = splitEvery; } - /** @return Returns the transformNrInFilename. */ + /** + * @return Returns the transformNrInFilename. + */ public boolean isTransformNrInFilename() { return transformNrInFilename; } - /** @param transformNrInFilename The transformNrInFilename to set. */ + /** + * @param transformNrInFilename The transformNrInFilename to set. + */ public void setTransformNrInFilename(boolean transformNrInFilename) { this.transformNrInFilename = transformNrInFilename; } - /** @return Returns the timeInFilename. */ + /** + * @return Returns the timeInFilename. + */ public boolean isTimeInFilename() { return timeInFilename; } - /** @param timeInFilename The timeInFilename to set. */ + /** + * @param timeInFilename The timeInFilename to set. + */ public void setTimeInFilename(boolean timeInFilename) { this.timeInFilename = timeInFilename; } - /** @return Returns the add to result filesname. */ + /** + * @return Returns the add to result filesname. + */ public boolean isAddToResultFiles() { return addToResultFilenames; } - /** @param addtoresultfilenamesin The addtoresultfilenames to set. */ + /** + * @param addtoresultfilenamesin The addtoresultfilenames to set. + */ public void setAddToResultFiles(boolean addtoresultfilenamesin) { this.addToResultFilenames = addtoresultfilenamesin; } @@ -232,22 +263,30 @@ public void setDateTimeFormat(String dateTimeFormat) { this.dateTimeFormat = dateTimeFormat; } - /** @return Returns the zipped. */ + /** + * @return Returns the zipped. + */ public boolean isZipped() { return zipped; } - /** @param zipped The zipped to set. */ + /** + * @param zipped The zipped to set. + */ public void setZipped(boolean zipped) { this.zipped = zipped; } - /** @return Returns the outputFields. */ + /** + * @return Returns the outputFields. + */ public XmlField[] getOutputFields() { return outputFields; } - /** @param outputFields The outputFields to set. */ + /** + * @param outputFields The outputFields to set. + */ public void setOutputFields(XmlField[] outputFields) { this.outputFields = outputFields; } @@ -635,32 +674,44 @@ public void setEncoding(String encoding) { this.encoding = encoding; } - /** @return Returns the mainElement. */ + /** + * @return Returns the mainElement. + */ public String getMainElement() { return mainElement; } - /** @param mainElement The mainElement to set. */ + /** + * @param mainElement The mainElement to set. + */ public void setMainElement(String mainElement) { this.mainElement = mainElement; } - /** @return Returns the repeatElement. */ + /** + * @return Returns the repeatElement. + */ public String getRepeatElement() { return repeatElement; } - /** @param repeatElement The repeatElement to set. */ + /** + * @param repeatElement The repeatElement to set. + */ public void setRepeatElement(String repeatElement) { this.repeatElement = repeatElement; } - /** @return Returns the nameSpace. */ + /** + * @return Returns the nameSpace. + */ public String getNameSpace() { return nameSpace; } - /** @param nameSpace The nameSpace to set. */ + /** + * @param nameSpace The nameSpace to set. + */ public void setNameSpace(String nameSpace) { this.nameSpace = nameSpace; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidator.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidator.java index b20a129c77d..6056ec9f063 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidator.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidator.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.xml.xsdvalidator; +import java.io.File; +import java.io.IOException; +import java.io.StringReader; +import javax.xml.XMLConstants; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; import org.apache.commons.lang3.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -33,16 +42,6 @@ import org.apache.xerces.xni.parser.XMLEntityResolver; import org.xml.sax.SAXException; -import javax.xml.XMLConstants; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; -import java.io.File; -import java.io.IOException; -import java.io.StringReader; - /** * Executes a xsd validator on the values in the input stream. New fields were calculated values can * then be put on the output stream. diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMeta.java index 8b649d0f280..302479cb717 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.xml.xsdvalidator; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -41,9 +43,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.util.List; -import java.util.Map; - @Transform( id = "XSDValidator", image = "XOU.svg", @@ -160,7 +159,9 @@ public XsdValidatorMeta() { ALLOW_EXTERNAL_ENTITIES_FOR_XSD_VALIDATION_DEFAULT)); } - /** @return Returns the XSD filename. */ + /** + * @return Returns the XSD filename. + */ public String getXSDFilename() { return xsdFilename; } @@ -173,7 +174,9 @@ public String getXMLStream() { return xmlStream; } - /** @param xdsFilename The XSD filename to set. */ + /** + * @param xdsFilename The XSD filename to set. + */ public void setXSDfilename(String xdsFilename) { this.xsdFilename = xdsFilename; } diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/Xslt.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/Xslt.java index c733cd086d1..ecacfcec284 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/Xslt.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/Xslt.java @@ -17,6 +17,13 @@ package org.apache.hop.pipeline.transforms.xml.xslt; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.Properties; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.hop.core.exception.HopException; @@ -31,15 +38,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Properties; - /** Executes a XSL Transform on the values in the input stream. */ public class Xslt extends BaseTransform { diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltData.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltData.java index e51e5c274aa..e2ad4d77ca3 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltData.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltData.java @@ -17,20 +17,19 @@ package org.apache.hop.pipeline.transforms.xml.xslt; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Properties; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.vfs.HopVfs; import org.apache.hop.pipeline.transform.BaseTransformData; import org.apache.hop.pipeline.transform.ITransformData; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamSource; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Properties; - public class XsltData extends BaseTransformData implements ITransformData { public IRowMeta outputRowMeta; diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltDialog.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltDialog.java index 29643d3c3d3..918966a0843 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltDialog.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltDialog.java @@ -17,6 +17,11 @@ package org.apache.hop.pipeline.transforms.xml.xslt; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -57,12 +62,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class XsltDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = XsltMeta.class; // For Translator @@ -575,16 +574,17 @@ public void widgetSelected(SelectionEvent arg0) { // Listen to the Browse... button wbbFilename.addListener( SWT.Selection, - e -> BaseDialog.presentFileDialog( - shell, - wXSLFilename, - variables, - new String[] {"*.xsl;*.XSL", "*.xslt;.*XSLT", "*"}, - new String[] { - BaseMessages.getString(PKG, "XsltDialog.FileType"), - BaseMessages.getString(PKG, "System.FileType.AllFiles") - }, - true)); + e -> + BaseDialog.presentFileDialog( + shell, + wXSLFilename, + variables, + new String[] {"*.xsl;*.XSL", "*.xslt;.*XSLT", "*"}, + new String[] { + BaseMessages.getString(PKG, "XsltDialog.FileType"), + BaseMessages.getString(PKG, "System.FileType.AllFiles") + }, + true)); wTabFolder.setSelection(0); diff --git a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltMeta.java b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltMeta.java index 9be44c58136..705a94269e9 100644 --- a/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltMeta.java +++ b/plugins/transforms/xml/src/main/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltMeta.java @@ -17,6 +17,8 @@ package org.apache.hop.pipeline.transforms.xml.xslt; +import java.io.File; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -36,9 +38,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.io.File; -import java.util.List; - @Transform( id = "XSLT", image = "XSLT.svg", @@ -87,47 +86,65 @@ public XsltMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the parameterName. */ + /** + * @return Returns the parameterName. + */ public String[] getParameterName() { return parameterName; } - /** @param argumentDirection The parameterName to set. */ + /** + * @param argumentDirection The parameterName to set. + */ public void setParameterName(String[] argumentDirection) { this.parameterName = argumentDirection; } - /** @return Returns the parameterField. */ + /** + * @return Returns the parameterField. + */ public String[] getParameterField() { return parameterField; } - /** @param argumentDirection The parameterField to set. */ + /** + * @param argumentDirection The parameterField to set. + */ public void setParameterField(String[] argumentDirection) { this.parameterField = argumentDirection; } - /** @return Returns the XSL filename. */ + /** + * @return Returns the XSL filename. + */ public String getXslFilename() { return xslFilename; } - /** @return Returns the OutputPropertyName. */ + /** + * @return Returns the OutputPropertyName. + */ public String[] getOutputPropertyName() { return outputPropertyName; } - /** @param argumentDirection The OutputPropertyName to set. */ + /** + * @param argumentDirection The OutputPropertyName to set. + */ public void setOutputPropertyName(String[] argumentDirection) { this.outputPropertyName = argumentDirection; } - /** @return Returns the OutputPropertyField. */ + /** + * @return Returns the OutputPropertyField. + */ public String[] getOutputPropertyValue() { return outputPropertyValue; } - /** @param argumentDirection The outputPropertyValue to set. */ + /** + * @param argumentDirection The outputPropertyValue to set. + */ public void setOutputPropertyValue(String[] argumentDirection) { this.outputPropertyValue = argumentDirection; } @@ -140,7 +157,9 @@ public void setXSLFactory(String xslfactoryin) { xslFactory = xslfactoryin; } - /** @return Returns the XSL factory type. */ + /** + * @return Returns the XSL factory type. + */ public String getXSLFactory() { return xslFactory; } @@ -157,7 +176,9 @@ public String getFieldname() { return fieldName; } - /** @param xslFilename The Xsl filename to set. */ + /** + * @param xslFilename The Xsl filename to set. + */ public void setXslFilename(String xslFilename) { this.xslFilename = xslFilename; } diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/PipelineTestFactory.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/PipelineTestFactory.java index 4e2c21a5846..6e4d67b501f 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/PipelineTestFactory.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/PipelineTestFactory.java @@ -17,6 +17,10 @@ package org.apache.hop.pipeline.transforms.xml; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -35,11 +39,6 @@ import org.apache.hop.pipeline.transforms.dummy.DummyMeta; import org.apache.hop.pipeline.transforms.injector.InjectorMeta; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - /** * We can use this factory to create transformations with a source and target transform.
* The source transform is an Injector transform.
diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMetaTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMetaTest.java index 8246774ed68..a93aa491e8d 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMetaTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlMetaTest.java @@ -17,17 +17,16 @@ package org.apache.hop.pipeline.transforms.xml.addxml; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.hop.core.exception.HopException; import org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator; import org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class AddXmlMetaTest { @Test diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlTest.java index daf8a1265ab..2cdd01873a3 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/addxml/AddXmlTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.xml.addxml; +import static java.util.Arrays.asList; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; @@ -27,12 +33,6 @@ import org.junit.Test; import org.mockito.Mockito; -import static java.util.Arrays.asList; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class AddXmlTest { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXMLDataTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXMLDataTest.java index 1c2f52f0e34..fd0ee656c98 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXMLDataTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/getxmldata/GetXMLDataTest.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.xml.getxmldata; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import junit.framework.TestCase; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.RowMetaAndData; @@ -38,10 +41,6 @@ import org.apache.hop.pipeline.transforms.injector.InjectorMeta; import org.apache.hop.pipeline.transforms.xml.RowTransformCollector; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** Test class for the "Get XML Data" transform. */ public class GetXMLDataTest extends TestCase { public IRowMeta createRowMetaInterface() { diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/BaseParsingTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/BaseParsingTest.java index f7a2985754d..0e4cb5afdbe 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/BaseParsingTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/BaseParsingTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.xml.xmlinputstream; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -39,19 +47,12 @@ import org.junit.Before; import org.junit.Ignore; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - /** Base class for all tests for BaseFileInput transforms. */ @Ignore("No tests in abstract base class") public abstract class BaseParsingTest< - Meta extends ITransformMeta, Data extends ITransformData, Transform extends BaseTransform> { + Meta extends ITransformMeta, + Data extends ITransformData, + Transform extends BaseTransform> { protected ILogChannel log = new LogChannel("junit"); protected FileSystemManager fs; diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamTest.java index 19aca91dff4..582352d41ba 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmlinputstream/XmlInputStreamTest.java @@ -16,6 +16,19 @@ */ package org.apache.hop.pipeline.transforms.xml.xmlinputstream; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.IRowSet; import org.apache.hop.core.SingleRowRowSet; @@ -31,20 +44,6 @@ import org.junit.Before; import org.junit.Test; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - public class XmlInputStreamTest { private static final String INCORRECT_XML_DATA_VALUE_MESSAGE = "Incorrect xml data value - "; private static final String INCORRECT_XML_DATA_NAME_MESSAGE = "Incorrect xml data name - "; @@ -141,10 +140,12 @@ public void testParseXmlWithPrefixes_WhenSetEnableNamespaceAsTrue() INCORRECT_XML_PATH_MESSAGE, "/Products/Product/Fruits:ProductGroup", rl.getWritten().get(expectedRowNum)[pathPos]); - assertTrue(INCORRECT_XML_DATA_NAME_MESSAGE, - expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); - assertTrue(INCORRECT_XML_DATA_VALUE_MESSAGE, - expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); + assertTrue( + INCORRECT_XML_DATA_NAME_MESSAGE, + expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); + assertTrue( + INCORRECT_XML_DATA_VALUE_MESSAGE, + expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); // ATTRIBUTE_2 expectedRowNum++; assertEquals( @@ -155,10 +156,12 @@ public void testParseXmlWithPrefixes_WhenSetEnableNamespaceAsTrue() INCORRECT_XML_PATH_MESSAGE, "/Products/Product/Fruits:ProductGroup", rl.getWritten().get(expectedRowNum)[pathPos]); - assertTrue(INCORRECT_XML_DATA_NAME_MESSAGE, - expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); - assertTrue(INCORRECT_XML_DATA_VALUE_MESSAGE, - expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); + assertTrue( + INCORRECT_XML_DATA_NAME_MESSAGE, + expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); + assertTrue( + INCORRECT_XML_DATA_VALUE_MESSAGE, + expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); // check EndElement for the ProductGroup element expectedRowNum = expectedRowNum + 2; @@ -218,8 +221,9 @@ public void testParseXmlWithPrefixes_WhenSetEnableNamespaceAsFalse() INCORRECT_XML_DATA_NAME_MESSAGE, "attribute", rl.getWritten().get(expectedRowNum)[dataNamePos]); - assertTrue(INCORRECT_XML_DATA_VALUE_MESSAGE, - expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); + assertTrue( + INCORRECT_XML_DATA_VALUE_MESSAGE, + expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); // ATTRIBUTE_2 expectedRowNum++; assertEquals( @@ -234,8 +238,9 @@ public void testParseXmlWithPrefixes_WhenSetEnableNamespaceAsFalse() INCORRECT_XML_DATA_NAME_MESSAGE, "attribute", rl.getWritten().get(expectedRowNum)[dataNamePos]); - assertTrue(INCORRECT_XML_DATA_VALUE_MESSAGE, - expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); + assertTrue( + INCORRECT_XML_DATA_VALUE_MESSAGE, + expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); // check EndElement for the ProductGroup element expectedRowNum = expectedRowNum + 2; @@ -295,10 +300,12 @@ public void testParseXmlWithoutPrefixes_WhenSetEnableNamespaceAsTrue() INCORRECT_XML_PATH_MESSAGE, "/Products/Product/ProductGroup", rl.getWritten().get(expectedRowNum)[pathPos]); - assertTrue(INCORRECT_XML_DATA_NAME_MESSAGE, - expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); - assertTrue(INCORRECT_XML_DATA_VALUE_MESSAGE, - expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); + assertTrue( + INCORRECT_XML_DATA_NAME_MESSAGE, + expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); + assertTrue( + INCORRECT_XML_DATA_VALUE_MESSAGE, + expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); // ATTRIBUTE_2 expectedRowNum++; assertEquals( @@ -309,10 +316,12 @@ public void testParseXmlWithoutPrefixes_WhenSetEnableNamespaceAsTrue() INCORRECT_XML_PATH_MESSAGE, "/Products/Product/ProductGroup", rl.getWritten().get(expectedRowNum)[pathPos]); - assertTrue(INCORRECT_XML_DATA_NAME_MESSAGE, - expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); - assertTrue(INCORRECT_XML_DATA_VALUE_MESSAGE, - expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); + assertTrue( + INCORRECT_XML_DATA_NAME_MESSAGE, + expectedAttributeNames.contains(rl.getWritten().get(expectedRowNum)[dataNamePos])); + assertTrue( + INCORRECT_XML_DATA_VALUE_MESSAGE, + expectedAttributeValues.contains(rl.getWritten().get(expectedRowNum)[dataValue])); // check EndElement for the ProductGroup element expectedRowNum = expectedRowNum + 2; diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMetaGetFieldsTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMetaGetFieldsTest.java index cb200fe0890..d3c4ab32388 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMetaGetFieldsTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinMetaGetFieldsTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.xml.xmljoin; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.RowMeta; import org.apache.hop.core.row.value.ValueMetaString; @@ -25,10 +29,6 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - public class XmlJoinMetaGetFieldsTest { XmlJoinMeta xmlJoinMeta; diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinOmitNullValuesTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinOmitNullValuesTest.java index 836ede3bccf..714faf65699 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinOmitNullValuesTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmljoin/XmlJoinOmitNullValuesTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.xml.xmljoin; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.IRowSet; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; @@ -30,15 +38,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - /** * Test for XmlJoin transform * diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMetaTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMetaTest.java index b7602d45fc5..1bf617fd01a 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMetaTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputMetaTest.java @@ -17,6 +17,20 @@ package org.apache.hop.pipeline.transforms.xml.xmloutput; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.HopClientEnvironment; @@ -38,21 +52,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class XmlOutputMetaTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputTest.java index e82cb29bc0f..77768dd63eb 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xmloutput/XmlOutputTest.java @@ -16,6 +16,17 @@ */ package org.apache.hop.pipeline.transforms.xml.xmloutput; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.logging.ILoggingObject; import org.apache.hop.core.logging.LogLevel; @@ -31,18 +42,6 @@ import org.junit.Test; import org.mockito.Matchers; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class XmlOutputTest { private TransformMockHelper transformMockHelper; diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorIntTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorIntTest.java index aedc075afdb..25f4b3c5f6b 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorIntTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorIntTest.java @@ -17,6 +17,17 @@ package org.apache.hop.pipeline.transforms.xml.xsdvalidator; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.RowMetaAndData; @@ -32,18 +43,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class XsdValidatorIntTest { private static final String RAMDIR = "ram://" + XsdValidatorIntTest.class.getSimpleName(); @@ -193,7 +192,7 @@ private static long copy(InputStream inp, OutputStream out, long limit) throws I long totalCount = 0; int readBytes = -1; do { - int todoBytes = (int)((limit < 0) ? buff.length : Math.min(limit-totalCount, buff.length)); + int todoBytes = (int) ((limit < 0) ? buff.length : Math.min(limit - totalCount, buff.length)); if (todoBytes > 0) { readBytes = inp.read(buff, 0, todoBytes); if (readBytes > 0) { diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMetaTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMetaTest.java index a23ffda2dc5..433d65157c7 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMetaTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xsdvalidator/XsdValidatorMetaTest.java @@ -17,13 +17,12 @@ package org.apache.hop.pipeline.transforms.xml.xsdvalidator; -import org.apache.hop.core.exception.HopException; -import org.junit.Test; - import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.hop.core.exception.HopException; +import org.junit.Test; public class XsdValidatorMetaTest { diff --git a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltTest.java b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltTest.java index 78bea0cb9d5..1f56f9ffa88 100644 --- a/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltTest.java +++ b/plugins/transforms/xml/src/test/java/org/apache/hop/pipeline/transforms/xml/xslt/XsltTest.java @@ -17,6 +17,12 @@ package org.apache.hop.pipeline.transforms.xml.xslt; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import junit.framework.TestCase; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.RowMetaAndData; @@ -39,13 +45,6 @@ import org.apache.hop.pipeline.transforms.injector.InjectorMeta; import org.apache.hop.pipeline.transforms.xml.RowTransformCollector; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - public class XsltTest extends TestCase { private static final String TEST1_XML = diff --git a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInput.java b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInput.java index 29250fbff42..2acba1c3841 100644 --- a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInput.java +++ b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInput.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.yamlinput; +import java.util.List; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.ResultFile; @@ -34,8 +35,6 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - /** * Read YAML files, parse them and convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputDialog.java b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputDialog.java index d8a066f0df0..906da451cb5 100644 --- a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputDialog.java +++ b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.yamlinput; +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.exception.HopException; @@ -68,8 +69,6 @@ import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; - public class YamlInputDialog extends BaseTransformDialog implements ITransformDialog { private static final Class PKG = YamlInputMeta.class; // For Translator @@ -1244,7 +1243,6 @@ private void getInfo(YamlInputMeta in) throws HopException { field.setGroupSymbol(item.getText(9)); field.setTrimType(YamlInputField.getTrimTypeByDesc(item.getText(10))); - in.getInputFields()[i] = field; } } diff --git a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMeta.java b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMeta.java index fb5d2c54717..f15f66057e6 100644 --- a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMeta.java +++ b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.yamlinput; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; @@ -44,10 +47,6 @@ import org.apache.hop.resource.ResourceDefinition; import org.w3c.dom.Node; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "YamlInput", image = "yamlinput.svg", @@ -126,17 +125,23 @@ public YamlInputMeta() { super(); // allocate BaseTransformMeta } - /** @return the add result filesname flag */ + /** + * @return the add result filesname flag + */ public boolean addResultFile() { return addResultFile; } - /** @return the validating flag */ + /** + * @return the validating flag + */ public boolean isValidating() { return validating; } - /** @param validating the validating flag to set */ + /** + * @param validating the validating flag to set + */ public void setValidating(boolean validating) { this.validating = validating; } @@ -145,12 +150,16 @@ public void setAddResultFile(boolean addResultFile) { this.addResultFile = addResultFile; } - /** @return Returns the input fields. */ + /** + * @return Returns the input fields. + */ public YamlInputField[] getInputFields() { return inputFields; } - /** @param inputFields The input fields to set. */ + /** + * @param inputFields The input fields to set. + */ public void setInputFields(YamlInputField[] inputFields) { this.inputFields = inputFields; } @@ -170,17 +179,23 @@ public boolean isInFields() { return inFields; } - /** @param inFields set the inFields. */ + /** + * @param inFields set the inFields. + */ public void setInFields(boolean inFields) { this.inFields = inFields; } - /** @return Returns the fileMask. */ + /** + * @return Returns the fileMask. + */ public String[] getFileMask() { return fileMask; } - /** @param fileMask The fileMask to set. */ + /** + * @param fileMask The fileMask to set. + */ public void setFileMask(String[] fileMask) { this.fileMask = fileMask; } @@ -201,92 +216,128 @@ public void setIncludeSubFolders(String[] includeSubFoldersin) { } } - /** @return Returns the fileName. */ + /** + * @return Returns the fileName. + */ public String[] getFileName() { return fileName; } - /** @param fileName The fileName to set. */ + /** + * @param fileName The fileName to set. + */ public void setFileName(String[] fileName) { this.fileName = fileName; } - /** @return Returns the filenameField. */ + /** + * @return Returns the filenameField. + */ public String getFilenameField() { return filenameField; } - /** @param filenameField The filenameField to set. */ + /** + * @param filenameField The filenameField to set. + */ public void setFilenameField(String filenameField) { this.filenameField = filenameField; } - /** @return Returns the includeFilename. */ + /** + * @return Returns the includeFilename. + */ public boolean includeFilename() { return includeFilename; } - /** @param includeFilename The includeFilename to set. */ + /** + * @param includeFilename The includeFilename to set. + */ public void setIncludeFilename(boolean includeFilename) { this.includeFilename = includeFilename; } - /** @return Returns the includeRowNumber. */ + /** + * @return Returns the includeRowNumber. + */ public boolean includeRowNumber() { return includeRowNumber; } - /** @param includeRowNumber The includeRowNumber to set. */ + /** + * @param includeRowNumber The includeRowNumber to set. + */ public void setIncludeRowNumber(boolean includeRowNumber) { this.includeRowNumber = includeRowNumber; } - /** @return Returns the rowLimit. */ + /** + * @return Returns the rowLimit. + */ public long getRowLimit() { return rowLimit; } - /** @param rowLimit The rowLimit to set. */ + /** + * @param rowLimit The rowLimit to set. + */ public void setRowLimit(long rowLimit) { this.rowLimit = rowLimit; } - /** @return the IsIgnoreEmptyFile flag */ + /** + * @return the IsIgnoreEmptyFile flag + */ public boolean isIgnoreEmptyFile() { return isIgnoreEmptyFile; } - /** @param isIgnoreEmptyFile the isIgnoreEmptyFile to set */ + /** + * @param isIgnoreEmptyFile the isIgnoreEmptyFile to set + */ public void setIgnoreEmptyFile(boolean isIgnoreEmptyFile) { this.isIgnoreEmptyFile = isIgnoreEmptyFile; } - /** @return the doNotFailIfNoFile flag */ + /** + * @return the doNotFailIfNoFile flag + */ public boolean isdoNotFailIfNoFile() { return doNotFailIfNoFile; } - /** @param doNotFailIfNoFile the doNotFailIfNoFile to set */ + /** + * @param doNotFailIfNoFile the doNotFailIfNoFile to set + */ public void setdoNotFailIfNoFile(boolean doNotFailIfNoFile) { this.doNotFailIfNoFile = doNotFailIfNoFile; } - /** @return Returns the rowNumberField. */ + /** + * @return Returns the rowNumberField. + */ public String getRowNumberField() { return rowNumberField; } - /** @param rowNumberField The rowNumberField to set. */ + /** + * @param rowNumberField The rowNumberField to set. + */ public void setRowNumberField(String rowNumberField) { this.rowNumberField = rowNumberField; } - /** @return the encoding */ + /** + * @return the encoding + */ public String getEncoding() { return encoding; } - /** @param encoding the encoding to set */ + /** + * @param encoding the encoding to set + */ public void setEncoding(String encoding) { this.encoding = encoding; } diff --git a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlReader.java b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlReader.java index e4d2a6b91ae..d3b9f48eca5 100644 --- a/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlReader.java +++ b/plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlReader.java @@ -17,6 +17,15 @@ package org.apache.hop.pipeline.transforms.yamlinput; +import java.io.InputStream; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -30,16 +39,6 @@ import org.apache.hop.core.vfs.HopVfs; import org.yaml.snakeyaml.Yaml; -import java.io.InputStream; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - /** * Read YAML files, parse them and convert them to rows and writes these to one or more output * streams. diff --git a/plugins/transforms/yamlinput/src/test/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMetaTest.java b/plugins/transforms/yamlinput/src/test/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMetaTest.java index 55518a938fd..4bb8fae0c9f 100644 --- a/plugins/transforms/yamlinput/src/test/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMetaTest.java +++ b/plugins/transforms/yamlinput/src/test/java/org/apache/hop/pipeline/transforms/yamlinput/YamlInputMetaTest.java @@ -16,6 +16,12 @@ */ package org.apache.hop.pipeline.transforms.yamlinput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -29,13 +35,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - public class YamlInputMetaTest implements IInitializer { LoadSaveTester loadSaveTester; Class testMetaClass = YamlInputMeta.class; diff --git a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java index 4577733c398..c50e2e25fc7 100644 --- a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java +++ b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java @@ -17,6 +17,18 @@ package org.apache.hop.pipeline.transforms.zipfile; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashSet; +import java.util.zip.Deflater; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; @@ -31,22 +43,8 @@ import org.apache.hop.pipeline.transform.BaseTransform; import org.apache.hop.pipeline.transform.TransformMeta; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashSet; -import java.util.zip.Deflater; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - /** Zip file * */ -public class ZipFile extends BaseTransform -{ +public class ZipFile extends BaseTransform { private static final Class PKG = ZipFileMeta.class; // For Translator private static final String ZIP_COULD_NOT_FIND_FIELD = "ZipFile.Exception.CouldnotFindField"; diff --git a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java index a2eaa196d65..a009a088472 100644 --- a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java +++ b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.zipfile; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; @@ -30,8 +31,6 @@ import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; -import java.util.List; - @Transform( id = "ZipFile", image = "zipfile.svg", @@ -94,98 +93,136 @@ public ZipFileMeta() { super(); // allocate BaseTransformMeta } - /** @return Returns the sourcefilenamefield. */ + /** + * @return Returns the sourcefilenamefield. + */ public String getSourceFilenameField() { return sourceFilenameField; } - /** @param sourceFilenameField The sourcefilenamefield to set. */ + /** + * @param sourceFilenameField The sourcefilenamefield to set. + */ public void setSourceFilenameField(String sourceFilenameField) { this.sourceFilenameField = sourceFilenameField; } - /** @return Returns the baseFolderField. */ + /** + * @return Returns the baseFolderField. + */ public String getBaseFolderField() { return baseFolderField; } - /** @param baseFolderField The baseFolderField to set. */ + /** + * @param baseFolderField The baseFolderField to set. + */ public void setBaseFolderField(String baseFolderField) { this.baseFolderField = baseFolderField; } - /** @return Returns the movetofolderfield. */ + /** + * @return Returns the movetofolderfield. + */ public String getMoveToFolderField() { return moveToFolderField; } - /** @param movetofolderfield The movetofolderfield to set. */ + /** + * @param movetofolderfield The movetofolderfield to set. + */ public void setMoveToFolderField(String movetofolderfield) { this.moveToFolderField = movetofolderfield; } - /** @return Returns the targetfilenamefield. */ + /** + * @return Returns the targetfilenamefield. + */ public String getTargetFilenameField() { return targetFilenameField; } - /** @param targetFilenameField The targetfilenamefield to set. */ + /** + * @param targetFilenameField The targetfilenamefield to set. + */ public void setTargetFilenameField(String targetFilenameField) { this.targetFilenameField = targetFilenameField; } - /** @return Returns if the fieldnames are added to the result */ + /** + * @return Returns if the fieldnames are added to the result + */ public boolean isAddResultFilenames() { return addResultFilenames; } - /** @return Return if destination file may be overwritten */ + /** + * @return Return if destination file may be overwritten + */ public boolean isOverwriteZipEntry() { return overwriteZipEntry; } - /** @return Return if parent folder should be created */ + /** + * @return Return if parent folder should be created + */ public boolean isCreateParentFolder() { return createParentFolder; } - /** @return Return if sourcefolder has to be kept */ + /** + * @return Return if sourcefolder has to be kept + */ public boolean isKeepSourceFolder() { return keepSourceFolder; } - /** @param value Set to true if sourcefolder has to be kept */ + /** + * @param value Set to true if sourcefolder has to be kept + */ public void setKeepSourceFolder(boolean value) { keepSourceFolder = value; } - /** @param addResultFilenames Add the result filenames to the result */ + /** + * @param addResultFilenames Add the result filenames to the result + */ public void setAddResultFilenames(boolean addResultFilenames) { this.addResultFilenames = addResultFilenames; } - /** @param overwriteZipEntry Overwrite the destination zipfile if exists */ + /** + * @param overwriteZipEntry Overwrite the destination zipfile if exists + */ public void setOverwriteZipEntry(boolean overwriteZipEntry) { this.overwriteZipEntry = overwriteZipEntry; } - /** @param createParentFolder Create parent folder if it does nto exist */ + /** + * @param createParentFolder Create parent folder if it does nto exist + */ public void setCreateParentFolder(boolean createParentFolder) { this.createParentFolder = createParentFolder; } - /** @return The opration type saved in the serialization */ + /** + * @return The opration type saved in the serialization + */ public String getOperationTypeMeta() { return getOperationTypeCode(operationType); } - /** @param operationTypeMeta OperationCode used by the serialization */ + /** + * @param operationTypeMeta OperationCode used by the serialization + */ public void setOperationTypeMeta(String operationTypeMeta) { this.operationTypeMeta = operationTypeMeta; this.operationType = getOperationTypeByCode(operationTypeMeta); } - /** @return The Integer value of the operation */ + /** + * @return The Integer value of the operation + */ public int getOperationType() { return operationType; } diff --git a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java index 52c21fd6961..77119dd3dd3 100644 --- a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java +++ b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java @@ -16,6 +16,10 @@ */ package org.apache.hop.pipeline.transforms.zipfile; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginRegistry; @@ -27,11 +31,6 @@ import org.junit.ClassRule; import org.junit.Test; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ZipFileMetaLoadSaveTest { @ClassRule public static RestoreHopEngineEnvironment env = new RestoreHopEngineEnvironment(); LoadSaveTester loadSaveTester; diff --git a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaTest.java b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaTest.java index 6dce8324e7e..9fa6590eda5 100644 --- a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaTest.java +++ b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaTest.java @@ -17,6 +17,14 @@ package org.apache.hop.pipeline.transforms.zipfile; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.database.DatabaseMeta; @@ -34,15 +42,6 @@ import org.junit.Test; import org.w3c.dom.Node; -import java.util.ArrayList; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class ZipFileMetaTest { private static final String SOURCE_FILENAME = "Files"; diff --git a/plugins/valuetypes/json/src/main/java/org/apache/hop/core/row/value/ValueMetaJson.java b/plugins/valuetypes/json/src/main/java/org/apache/hop/core/row/value/ValueMetaJson.java index 6fad7de4491..3db69be7986 100644 --- a/plugins/valuetypes/json/src/main/java/org/apache/hop/core/row/value/ValueMetaJson.java +++ b/plugins/valuetypes/json/src/main/java/org/apache/hop/core/row/value/ValueMetaJson.java @@ -25,14 +25,13 @@ import com.fasterxml.jackson.databind.node.DecimalNode; import com.fasterxml.jackson.databind.node.DoubleNode; import com.fasterxml.jackson.databind.node.LongNode; +import java.math.BigDecimal; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.json.HopJson; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; -import java.math.BigDecimal; - @ValueMetaPlugin(id = "11", name = "JSON", description = "JSON object", image = "json.svg") public class ValueMetaJson extends ValueMetaBase implements IValueMeta { diff --git a/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelListenerImpl.java b/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelListenerImpl.java index 3ada40c394f..9ff9de1920e 100644 --- a/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelListenerImpl.java +++ b/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelListenerImpl.java @@ -17,14 +17,13 @@ package org.apache.hop.ui.core.widget.svg; +import java.io.IOException; +import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.apache.hop.ui.hopgui.ISingletonProvider; import org.eclipse.rap.rwt.SingletonUtil; import org.eclipse.rap.rwt.scripting.ClientListener; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - public class SvgLabelListenerImpl extends ClientListener implements ISingletonProvider { @Override @@ -41,7 +40,8 @@ private static String getText() { try { canvasScript = IOUtils.toString( - SvgLabelListenerImpl.class.getResourceAsStream("svg-label.js"), StandardCharsets.UTF_8); + SvgLabelListenerImpl.class.getResourceAsStream("svg-label.js"), + StandardCharsets.UTF_8); } catch (IOException e1) { e1.printStackTrace(); } diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java b/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java index 6f11c39141f..3ea7c022350 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java @@ -26,7 +26,6 @@ import org.apache.hop.workflow.WorkflowMeta; import org.eclipse.rap.json.JsonArray; import org.eclipse.rap.json.JsonObject; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; public class CanvasFacadeImpl extends CanvasFacade { diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasListenerImpl.java b/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasListenerImpl.java index 1cf814d451b..1482b59c485 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasListenerImpl.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/CanvasListenerImpl.java @@ -17,13 +17,12 @@ package org.apache.hop.ui.hopgui; +import java.io.IOException; +import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.eclipse.rap.rwt.SingletonUtil; import org.eclipse.rap.rwt.scripting.ClientListener; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - public class CanvasListenerImpl extends ClientListener implements ISingletonProvider { @Override diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/Clipboard.java b/rap/src/main/java/org/apache/hop/ui/hopgui/Clipboard.java index a18067bb36e..238836be53d 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/Clipboard.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/Clipboard.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.hopgui; +import java.util.ArrayList; +import java.util.List; import org.eclipse.rap.json.JsonObject; import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.client.service.ClientFileLoader; @@ -30,9 +32,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Widget; -import java.util.ArrayList; -import java.util.List; - /** * Clipboard implemented as a custom widget. This class is meant to be instantiated only once per UI * session. diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/DownloadServiceHandler.java b/rap/src/main/java/org/apache/hop/ui/hopgui/DownloadServiceHandler.java index bdfa5b5644f..35eb5fdb103 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/DownloadServiceHandler.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/DownloadServiceHandler.java @@ -17,14 +17,13 @@ package org.apache.hop.ui.hopgui; -import org.eclipse.rap.rwt.service.ServiceHandler; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.eclipse.rap.rwt.service.ServiceHandler; public class DownloadServiceHandler implements ServiceHandler { diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java index 6e010fff147..5ad949e8c66 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java @@ -17,6 +17,17 @@ package org.apache.hop.ui.hopgui; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; @@ -40,18 +51,6 @@ import org.eclipse.rap.rwt.client.WebClient; import org.eclipse.rap.rwt.service.ResourceLoader; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; - public class HopWeb implements ApplicationConfiguration { public static final String HOP_WEB_THEME = "HOP_WEB_THEME"; @@ -77,8 +76,7 @@ public void configure(Application application) { // Find metadata, perspective plugins // - List plugins = - PluginRegistry.getInstance().getPlugins(MetadataPluginType.class); + List plugins = PluginRegistry.getInstance().getPlugins(MetadataPluginType.class); plugins.addAll(PluginRegistry.getInstance().getPlugins(HopPerspectivePluginType.class)); // Add the plugin images as resources @@ -164,7 +162,7 @@ private void addResource( } // See if the resource was already added.q // - if (SvgCache.findSvg(imageFilename)!=null) { + if (SvgCache.findSvg(imageFilename) != null) { return; } diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebEntryPoint.java b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebEntryPoint.java index 4e0b055dfe1..63188fbfebc 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebEntryPoint.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebEntryPoint.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.hopgui; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.extension.ExtensionPointHandler; import org.apache.hop.core.extension.HopExtensionPoint; import org.apache.hop.ui.core.PropsUi; @@ -26,9 +28,6 @@ import org.eclipse.rap.rwt.widgets.WidgetUtil; import org.eclipse.swt.widgets.Composite; -import java.util.ArrayList; -import java.util.List; - public class HopWebEntryPoint extends AbstractEntryPoint { @Override diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebServletContextListener.java b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebServletContextListener.java index fd8bcc885cb..982e0c8d858 100644 --- a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebServletContextListener.java +++ b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWebServletContextListener.java @@ -17,13 +17,12 @@ package org.apache.hop.ui.hopgui; +import java.util.logging.Logger; +import javax.servlet.ServletContextEvent; import org.apache.hop.core.HopEnvironment; import org.apache.hop.core.exception.HopException; import org.eclipse.rap.rwt.engine.RWTServletContextListener; -import javax.servlet.ServletContextEvent; -import java.util.logging.Logger; - public class HopWebServletContextListener extends RWTServletContextListener { private static final Logger logger = Logger.getLogger(HopWebServletContextListener.class.getName()); diff --git a/rcp/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java b/rcp/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java index 9e1bc9c60d9..12bddb6be36 100644 --- a/rcp/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java +++ b/rcp/src/main/java/org/apache/hop/ui/hopgui/CanvasFacadeImpl.java @@ -17,16 +17,13 @@ package org.apache.hop.ui.hopgui; -import org.apache.hop.base.AbstractMeta; import org.apache.hop.core.gui.DPoint; -import org.apache.hop.core.variables.IVariables; import org.eclipse.swt.widgets.Canvas; public class CanvasFacadeImpl extends CanvasFacade { @Override - void setDataInternal( - Canvas canvas, float magnification, DPoint offset, Object meta) { + void setDataInternal(Canvas canvas, float magnification, DPoint offset, Object meta) { // do nothing } } diff --git a/rest/src/main/java/org/apache/hop/rest/Hop.java b/rest/src/main/java/org/apache/hop/rest/Hop.java index 23b9a163a16..414576e0555 100644 --- a/rest/src/main/java/org/apache/hop/rest/Hop.java +++ b/rest/src/main/java/org/apache/hop/rest/Hop.java @@ -97,7 +97,7 @@ private Hop() { if (configFile.exists()) { try (InputStream inputStream = new FileInputStream(configFile)) { properties.load(inputStream); - log.logBasic("Configuration file " + configFileName+" was successfully loaded."); + log.logBasic("Configuration file " + configFileName + " was successfully loaded."); } } else { try (InputStream inputStream = getClass().getResourceAsStream("/hop-rest.properties")) { diff --git a/rest/src/main/java/org/apache/hop/rest/v1/HopApplication.java b/rest/src/main/java/org/apache/hop/rest/v1/HopApplication.java index 9d0d04fc9f7..cb18a4dd2bb 100644 --- a/rest/src/main/java/org/apache/hop/rest/v1/HopApplication.java +++ b/rest/src/main/java/org/apache/hop/rest/v1/HopApplication.java @@ -24,7 +24,7 @@ @ApplicationPath("/api/v1/") public class HopApplication extends Application { - public HopApplication() { - Hop.getInstance(); - } + public HopApplication() { + Hop.getInstance(); + } } diff --git a/ui/src/main/java/org/apache/hop/core/SwtUniversalImage.java b/ui/src/main/java/org/apache/hop/core/SwtUniversalImage.java index 42daedb3055..02bb298f0b4 100644 --- a/ui/src/main/java/org/apache/hop/core/SwtUniversalImage.java +++ b/ui/src/main/java/org/apache/hop/core/SwtUniversalImage.java @@ -17,16 +17,15 @@ package org.apache.hop.core; +import java.awt.image.BufferedImage; +import java.util.Map; +import java.util.TreeMap; import org.eclipse.swt.graphics.Device; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.PaletteData; import org.eclipse.swt.graphics.RGB; -import java.awt.image.BufferedImage; -import java.util.Map; -import java.util.TreeMap; - /** * Universal image storage for SWT processing. It contains SVG or bitmap image depends on file and * settings. @@ -35,7 +34,7 @@ public abstract class SwtUniversalImage { private Map cache = new TreeMap<>(); - @Deprecated(since="2.0") + @Deprecated(since = "2.0") protected abstract Image renderSimple(Device device); protected abstract Image renderSimple(Device device, int width, int height); @@ -61,8 +60,10 @@ private void checkDisposed() { } } - /** @deprecated Use getAsBitmapForSize() instead. */ - @Deprecated(since="2.0") + /** + * @deprecated Use getAsBitmapForSize() instead. + */ + @Deprecated(since = "2.0") public synchronized Image getAsBitmap(Device device) { checkDisposed(); diff --git a/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java b/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java index d4868be010d..bcf19cb0dac 100644 --- a/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java +++ b/ui/src/main/java/org/apache/hop/core/SwtUniversalImageSvg.java @@ -17,6 +17,13 @@ package org.apache.hop.core; +import java.awt.Graphics2D; +import java.awt.geom.Dimension2D; +import java.awt.image.BufferedImage; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.batik.anim.dom.SVGDOMImplementation; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.DocumentLoader; @@ -38,14 +45,6 @@ import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGSVGElement; -import java.awt.Graphics2D; -import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SwtUniversalImageSvg extends SwtUniversalImage { private final GraphicsNode svgGraphicsNode; private final Dimension2D svgGraphicsSize; diff --git a/ui/src/main/java/org/apache/hop/ui/core/ConstUi.java b/ui/src/main/java/org/apache/hop/ui/core/ConstUi.java index 8ee6e0a6b4d..1ffc552fdd9 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/ConstUi.java +++ b/ui/src/main/java/org/apache/hop/ui/core/ConstUi.java @@ -17,13 +17,13 @@ package org.apache.hop.ui.core; +import java.util.Arrays; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.TreeItem; -import java.util.Arrays; -import java.util.List; /** * This class is used to define a number of default values for various settings throughout Hop. It @@ -226,27 +226,27 @@ public static void displayMenu(Menu menu, Control control) { } menu.setVisible(true); } - + /** * Sort field names if options is enabled - * + * * @param names */ public static String[] sortFieldNames(List names) { String[] result = names.toArray(new String[0]); - if ( PropsUi.getInstance().isSortFieldByName() ) { + if (PropsUi.getInstance().isSortFieldByName()) { Arrays.sort(result); } return result; } - + /** * Sort field names if options is enabled - * + * * @param names */ - public static String[] sortFieldNames(String[] names) { - if ( PropsUi.getInstance().isSortFieldByName() ) { + public static String[] sortFieldNames(String[] names) { + if (PropsUi.getInstance().isSortFieldByName()) { Arrays.sort(names); } return names; diff --git a/ui/src/main/java/org/apache/hop/ui/core/GetFieldsDialogOperation.java b/ui/src/main/java/org/apache/hop/ui/core/GetFieldsDialogOperation.java index 63a5483e65b..e30529f33fe 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/GetFieldsDialogOperation.java +++ b/ui/src/main/java/org/apache/hop/ui/core/GetFieldsDialogOperation.java @@ -17,9 +17,8 @@ package org.apache.hop.ui.core; -import org.eclipse.swt.widgets.Shell; - import java.util.List; +import org.eclipse.swt.widgets.Shell; public class GetFieldsDialogOperation { private Shell shell; diff --git a/ui/src/main/java/org/apache/hop/ui/core/WidgetUtils.java b/ui/src/main/java/org/apache/hop/ui/core/WidgetUtils.java index b4fec9a47ed..d67bae33e32 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/WidgetUtils.java +++ b/ui/src/main/java/org/apache/hop/ui/core/WidgetUtils.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.row.IRowMeta; @@ -36,8 +37,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Listener; -import java.util.List; - public abstract class WidgetUtils { private WidgetUtils() {} diff --git a/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEvent.java b/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEvent.java index 01c472c21e1..45cea4e256d 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEvent.java +++ b/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEvent.java @@ -64,7 +64,9 @@ public String getId() { return id; } - /** @param id The id to set */ + /** + * @param id The id to set + */ public void setId(String id) { this.id = id; } @@ -78,7 +80,9 @@ public T getSubject() { return subject; } - /** @param subject The subject to set */ + /** + * @param subject The subject to set + */ public void setSubject(T subject) { this.subject = subject; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEventsHandler.java b/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEventsHandler.java index 8c4dfbffbba..c8cddbc337f 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEventsHandler.java +++ b/ui/src/main/java/org/apache/hop/ui/core/bus/HopGuiEventsHandler.java @@ -17,11 +17,10 @@ package org.apache.hop.ui.core.bus; -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.exception.HopException; - import java.util.HashMap; import java.util.Map; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.exception.HopException; /** * This event handler contains event listeners per event ID and GUI ID. Suggestions for event IDs @@ -209,7 +208,9 @@ public Map> getGuiEventListenerMap() { return guiEventListenerMap; } - /** @param guiEventListenerMap The guiEventListenerMap to set */ + /** + * @param guiEventListenerMap The guiEventListenerMap to set + */ public void setGuiEventListenerMap( Map> guiEventListenerMap) { this.guiEventListenerMap = guiEventListenerMap; diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java b/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java index 8fde20ddb68..e09c35f2d2d 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java +++ b/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java @@ -17,9 +17,15 @@ package org.apache.hop.ui.core.database; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; -import org.apache.hop.core.DbCache; import org.apache.hop.core.Props; import org.apache.hop.core.database.BaseDatabaseMeta; import org.apache.hop.core.database.DatabaseMeta; @@ -27,8 +33,6 @@ import org.apache.hop.core.database.DatabaseTestResults; import org.apache.hop.core.database.IDatabase; import org.apache.hop.core.gui.plugin.GuiPlugin; -import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement; -import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElementFilter; import org.apache.hop.core.plugins.IPlugin; import org.apache.hop.core.plugins.PluginRegistry; import org.apache.hop.core.util.Utils; @@ -45,7 +49,6 @@ import org.apache.hop.ui.core.metadata.MetadataEditor; import org.apache.hop.ui.core.metadata.MetadataManager; import org.apache.hop.ui.core.widget.ColumnInfo; -import org.apache.hop.ui.core.widget.MetaSelectionLine; import org.apache.hop.ui.core.widget.TableView; import org.apache.hop.ui.core.widget.TextVar; import org.apache.hop.ui.hopgui.HopGui; @@ -69,14 +72,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - @GuiPlugin(description = "This is the editor for database connection metadata") /** * The metadata editor for DatabaseMeta Don't move this class around as it's sync'ed with the @@ -285,18 +280,18 @@ private void addGeneralTab() { fdConnectionType.right = new FormAttachment(wToolBar, -margin); wConnectionType.setLayoutData(fdConnectionType); Control lastControl = wConnectionType; - + // JDBC Driver information // Label wlDriverInfo = new Label(wGeneralComp, SWT.RIGHT); PropsUi.setLook(wlDriverInfo); - wlDriverInfo.setText(BaseMessages.getString(PKG, "DatabaseDialog.label.InstalledDriver")); + wlDriverInfo.setText(BaseMessages.getString(PKG, "DatabaseDialog.label.InstalledDriver")); FormData fdlDriverInfo = new FormData(); fdlDriverInfo.top = new FormAttachment(lastControl, margin * 2); fdlDriverInfo.left = new FormAttachment(0, 0); fdlDriverInfo.right = new FormAttachment(middle, -margin); wlDriverInfo.setLayoutData(fdlDriverInfo); - + wDriverInfo = new Label(wGeneralComp, SWT.LEFT); wDriverInfo.setEnabled(false); PropsUi.setLook(wDriverInfo); @@ -492,7 +487,7 @@ public void widgetModified( busyChangingConnectionType.set(false); } - + private void addAdvancedTab() { CTabItem wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE); @@ -804,7 +799,7 @@ public void setWidgetsContent() { wName.setText(Const.NVL(databaseMeta.getName(), "")); wConnectionType.setText(Const.NVL(databaseMeta.getPluginName(), "")); - + wUsername.setText(Const.NVL(databaseMeta.getUsername(), "")); wPassword.setText(Const.NVL(databaseMeta.getPassword(), "")); @@ -874,28 +869,26 @@ public void getWidgetsContent(DatabaseMeta meta) { } } - /** - * Update JDBC driver information and version - */ + /** Update JDBC driver information and version */ protected void updateDriverInfo() { try { DatabaseMeta databaseMeta = new DatabaseMeta(); this.getWidgetsContent(databaseMeta); - + wDriverInfo.setText(""); String driverName = databaseMeta.getDriverClass(getVariables()); - if ( !Utils.isEmpty(driverName) ) { + if (!Utils.isEmpty(driverName)) { ClassLoader classLoader = databaseMeta.getIDatabase().getClass().getClassLoader(); Class driver = classLoader.loadClass(driverName); - - if ( driver.getPackage().getImplementationVersion()!=null ) { - driverName = driverName+" ("+driver.getPackage().getImplementationVersion()+")"; + + if (driver.getPackage().getImplementationVersion() != null) { + driverName = driverName + " (" + driver.getPackage().getImplementationVersion() + ")"; } - + wDriverInfo.setText(driverName); } } catch (Exception e) { - wDriverInfo.setText("No driver installed"); + wDriverInfo.setText("No driver installed"); } } diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/DatabaseExplorerDialog.java b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/DatabaseExplorerDialog.java index b3cae43901f..aba27d676c2 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/DatabaseExplorerDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/DatabaseExplorerDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.database.dialog; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; @@ -68,10 +70,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - /** * This dialog represents an explorer type of interface on a given database connection. It shows the * tables defined in the visible schemas or catalogs on that connection. The interface also allows @@ -783,16 +781,16 @@ public void previewTable(String tableName, boolean asklimit) { public void showTable(String tableName) { String sql = dbMeta.getSqlQueryFields(tableName); -// GetQueryFieldsProgressDialog pd = -// new GetQueryFieldsProgressDialog(shell, variables, dbMeta, sql); -// IRowMeta result = pd.open(); + // GetQueryFieldsProgressDialog pd = + // new GetQueryFieldsProgressDialog(shell, variables, dbMeta, sql); + // IRowMeta result = pd.open(); IRowMeta result = null; Database db = new Database(HopGui.getInstance().getLoggingObject(), variables, dbMeta); try { - db.connect(); + db.connect(); result = db.getQueryFields(sql, false); - } catch (Exception e) {} - finally { + } catch (Exception e) { + } finally { db.disconnect(); } if (result != null) { @@ -803,7 +801,8 @@ public void showTable(String tableName) { } public void showCount(String tableName) { - String realTableName = (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); + String realTableName = + (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); GetTableSizeProgressDialog pd = new GetTableSizeProgressDialog(shell, variables, dbMeta, realTableName); Long size = pd.open(); @@ -822,7 +821,8 @@ public void getDDL(String tableName) { try { db.connect(); IRowMeta r = db.getTableFields(tableName); - String realTableName = (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); + String realTableName = + (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); String sql = db.getCreateTableStatement(realTableName, r, null, false, null, true); SqlEditor se = new SqlEditor(shell, SWT.NONE, variables, dbMeta, dbcache, sql); @@ -845,7 +845,8 @@ public void getDDLForOther(String tableName) { try { database.connect(); - String realTableName = (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); + String realTableName = + (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); IRowMeta rowMeta = database.getTableFields(realTableName); // Now select the other connection... @@ -896,9 +897,11 @@ public void getDDLForOther(String tableName) { } public void getSql(String tableName) { - String realTableName = (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); + String realTableName = + (tableName.contains(".") ? tableName.substring(tableName.indexOf(".") + 1) : tableName); SqlEditor sqlEditor = - new SqlEditor(shell, SWT.NONE, variables, dbMeta, dbcache, "SELECT * FROM " + realTableName); + new SqlEditor( + shell, SWT.NONE, variables, dbMeta, dbcache, "SELECT * FROM " + realTableName); sqlEditor.open(); } diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetPreviewTableProgressDialog.java b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetPreviewTableProgressDialog.java index 43f3011331b..b6ac215453e 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetPreviewTableProgressDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetPreviewTableProgressDialog.java @@ -70,50 +70,50 @@ public GetPreviewTableProgressDialog( } public List open() { - if(!EnvironmentUtils.getInstance().isWeb()){ + if (!EnvironmentUtils.getInstance().isWeb()) { IRunnableWithProgress op = - monitor -> { - db = new Database(HopGui.getInstance().getLoggingObject(), variables, dbMeta); - try { - db.connect(); - - if (limit > 0) { - db.setQueryLimit(limit); - } - - rows = db.getFirstRows(tableName, limit, new ProgressMonitorAdapter(monitor)); - rowMeta = db.getReturnRowMeta(); - } catch (HopException e) { - throw new InvocationTargetException( - e, "Couldn't find any rows because of an error :" + e.toString()); - } finally { - db.disconnect(); - } - }; + monitor -> { + db = new Database(HopGui.getInstance().getLoggingObject(), variables, dbMeta); + try { + db.connect(); + + if (limit > 0) { + db.setQueryLimit(limit); + } + + rows = db.getFirstRows(tableName, limit, new ProgressMonitorAdapter(monitor)); + rowMeta = db.getReturnRowMeta(); + } catch (HopException e) { + throw new InvocationTargetException( + e, "Couldn't find any rows because of an error :" + e.toString()); + } finally { + db.disconnect(); + } + }; try { final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell); // Run something in the background to cancel active database queries, forecably if needed! Runnable run = - () -> { - IProgressMonitor monitor = pmd.getProgressMonitor(); - while (pmd.getShell() == null - || (!pmd.getShell().isDisposed() && !monitor.isCanceled())) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // Ignore - } - } - - if (monitor.isCanceled()) { // Disconnect and see what happens! - - try { - db.cancelQuery(); - } catch (Exception e) { - // Ignore - } - } - }; + () -> { + IProgressMonitor monitor = pmd.getProgressMonitor(); + while (pmd.getShell() == null + || (!pmd.getShell().isDisposed() && !monitor.isCanceled())) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // Ignore + } + } + + if (monitor.isCanceled()) { // Disconnect and see what happens! + + try { + db.cancelQuery(); + } catch (Exception e) { + // Ignore + } + } + }; // Start the cancel tracker in the background! new Thread(run).start(); @@ -122,8 +122,8 @@ public List open() { showErrorDialog(e); return null; } - }else{ - try{ + } else { + try { Cursor cursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(cursor); @@ -137,16 +137,14 @@ public List open() { rows = db.getFirstRows(tableName, limit, null); rowMeta = db.getReturnRowMeta(); - }catch(HopDatabaseException e){ + } catch (HopDatabaseException e) { showErrorDialog(e); return null; - }finally{ + } finally { db.disconnect(); } - } - return rows; } @@ -163,9 +161,10 @@ private void showErrorDialog(Exception e) { e); } - /** @return the rowMeta */ + /** + * @return the rowMeta + */ public IRowMeta getRowMeta() { return rowMeta; } - } diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetQueryFieldsProgressDialog.java b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetQueryFieldsProgressDialog.java index e35376c1b18..5d09ee1eac2 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetQueryFieldsProgressDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetQueryFieldsProgressDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.database.dialog; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; import org.apache.hop.core.database.Database; @@ -29,8 +30,6 @@ import org.apache.hop.ui.hopgui.HopGui; import org.eclipse.swt.widgets.Shell; -import java.lang.reflect.InvocationTargetException; - /** * Takes care of displaying a dialog that will handle the wait while we're finding out which fields * are output by a certain SQL query on a database. diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetTableSizeProgressDialog.java b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetTableSizeProgressDialog.java index 8444a97f7d7..b97f5026d13 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetTableSizeProgressDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/GetTableSizeProgressDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.database.dialog; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; import org.apache.hop.core.RowMetaAndData; @@ -30,8 +31,6 @@ import org.apache.hop.ui.hopgui.HopGui; import org.eclipse.swt.widgets.Shell; -import java.lang.reflect.InvocationTargetException; - /** * Takes care of displaying a dialog that will handle the wait while we're getting the number of * rows for a certain table in a database. diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/SqlEditor.java b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/SqlEditor.java index 2e7c7581af4..4a5e50581d4 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/database/dialog/SqlEditor.java +++ b/ui/src/main/java/org/apache/hop/ui/core/database/dialog/SqlEditor.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.database.dialog; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.DbCache; import org.apache.hop.core.Props; @@ -58,8 +59,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import java.util.List; - /** Dialog that allows the user to launch SQL statements towards the database. */ public class SqlEditor { private static final Class PKG = SqlEditor.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java index 1da04e4e947..25c371388a5 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java @@ -87,9 +87,11 @@ public abstract class BaseDialog extends Dialog { public static final int MEDIUM_SMALL_FIELD = 150; public static final int SMALL_FIELD = 50; public static final int SHELL_WIDTH_OFFSET = 16; + @Deprecated public static final int VAR_ICON_WIDTH = GuiResource.getInstance().getImageVariableMini().getBounds().width; + @Deprecated public static final int VAR_ICON_HEIGHT = GuiResource.getInstance().getImageVariableMini().getBounds().height; @@ -120,6 +122,7 @@ public static final String presentFileDialog( return presentFileDialog( false, shell, null, null, null, filterExtensions, filterNames, folderAndFile); } + public static final String presentFileDialog( boolean save, Shell shell, diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/BrowserEnvironmentWarningDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/BrowserEnvironmentWarningDialog.java index 8db32e992a9..62f0ca3eb42 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/BrowserEnvironmentWarningDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/BrowserEnvironmentWarningDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.dialog; +import java.awt.Desktop; +import java.net.URI; import org.apache.hop.core.Const; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -39,9 +41,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.awt.Desktop; -import java.net.URI; - /** Dialog that shows a warning when the Browser Environment is not supported. */ public class BrowserEnvironmentWarningDialog extends Dialog { private static final Class PKG = BrowserEnvironmentWarningDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/CheckResultDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/CheckResultDialog.java index 88afb8736ad..8a5aeddaf10 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/CheckResultDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/CheckResultDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.dialog; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.ICheckResultSource; @@ -40,8 +41,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.List; - /** Dialog to display the results of a verify operation. */ public class CheckResultDialog extends Dialog { private static final Class PKG = CheckResultDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ConfigurationDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ConfigurationDialog.java index 31936d63cc0..24c3e12829b 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ConfigurationDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ConfigurationDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import org.apache.hop.IExecutionConfiguration; import org.apache.hop.base.AbstractMeta; import org.apache.hop.core.Const; @@ -49,11 +53,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - public abstract class ConfigurationDialog extends Dialog { protected AbstractMeta abstractMeta; @@ -156,7 +155,9 @@ protected void cancel() { dispose(); } - /** @return True if all is OK. Returns false if there is an error in the configuration */ + /** + * @return True if all is OK. Returns false if there is an error in the configuration + */ public abstract boolean getInfo(); protected void getParamsData() { @@ -192,7 +193,9 @@ protected void getParamsData() { wParams.optWidth(true); } - /** @param configuration the configuration to set */ + /** + * @param configuration the configuration to set + */ public void setConfiguration(IExecutionConfiguration configuration) { this.configuration = configuration; } @@ -285,7 +288,10 @@ protected void parametersSectionLayout(Class PKG, String prefix) { false, null, PropsUi.getInstance(), - false, null, false, false); + false, + null, + false, + false); FormData fdParams = new FormData(); fdParams.top = new FormAttachment(0, 0); fdParams.right = new FormAttachment(100, 0); @@ -331,7 +337,10 @@ protected void parametersSectionLayout(Class PKG, String prefix) { false, null, PropsUi.getInstance(), - false, null, true, false); + false, + null, + true, + false); FormData fdVariables = new FormData(); fdVariables.top = new FormAttachment(0, 0); diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java index c44e92a867c..9f34500ffa5 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java @@ -17,6 +17,12 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -66,13 +72,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - @GuiPlugin(description = "This dialog presents you all the actions you can take in a given context") public class ContextDialog extends Dialog { @@ -336,7 +335,8 @@ public GuiAction open() { for (GuiAction action : actions) { CategoryAndOrder categoryAndOrder; if (StringUtils.isNotEmpty(action.getCategory())) { - categoryAndOrder = new CategoryAndOrder( + categoryAndOrder = + new CategoryAndOrder( action.getCategory(), Const.NVL(action.getCategoryOrder(), "0"), false); } else { // Add an "Other" category @@ -752,12 +752,11 @@ private void onMouseMove(Event event) { } private void onMouseUp(Event event) { - AreaOwner areaOwner = - AreaOwner.getVisibleAreaOwner(areaOwners, event.x, event.y); + AreaOwner areaOwner = AreaOwner.getVisibleAreaOwner(areaOwners, event.x, event.y); if (areaOwner == null) { return; } - + OwnerType ownerType = (OwnerType) areaOwner.getParent(); switch (ownerType) { case CATEGORY: diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java index c9366f60201..1d553c97a46 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.hop.core.Const; import org.apache.hop.ui.core.PropsUi; import org.apache.hop.ui.core.gui.GuiResource; @@ -31,9 +33,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import java.util.ArrayList; -import java.util.concurrent.atomic.AtomicInteger; - public class DialogBoxWithButtons { private PropsUi props; @@ -67,7 +66,7 @@ public int open() { formLayout.marginRight = formMargin; shell.setLayout(formLayout); PropsUi.setLook(shell); - + Label wLabel = new Label(shell, SWT.CENTER | SWT.WRAP); PropsUi.setLook(wLabel); wLabel.setText(Const.NVL(message, "")); diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/DisplayInvocationHandler.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/DisplayInvocationHandler.java index 0f67751299c..1eb63e3ced8 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/DisplayInvocationHandler.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/DisplayInvocationHandler.java @@ -17,14 +17,13 @@ package org.apache.hop.ui.core.dialog; -import org.apache.commons.lang.ClassUtils; -import org.apache.hop.core.logging.ILogChannel; -import org.eclipse.swt.widgets.Display; - import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; +import org.apache.commons.lang.ClassUtils; +import org.apache.hop.core.logging.ILogChannel; +import org.eclipse.swt.widgets.Display; public class DisplayInvocationHandler implements InvocationHandler { private final Display display; diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EditRowsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EditRowsDialog.java index 179302c323d..928645dd23a 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EditRowsDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EditRowsDialog.java @@ -18,6 +18,8 @@ package org.apache.hop.ui.core.dialog; import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopValueException; @@ -46,9 +48,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.ArrayList; -import java.util.List; - /** Allows the user to edit a list of rows in a TableView. */ public class EditRowsDialog { private static final Class PKG = EditRowsDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterListDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterListDialog.java index 4a0c2862d9c..a45aad05830 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterListDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterListDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.dialog; +import java.util.Hashtable; +import java.util.StringTokenizer; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.ui.core.PropsUi; @@ -49,9 +51,6 @@ import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; -import java.util.Hashtable; -import java.util.StringTokenizer; - /** This dialogs allows you to select a number of items from a list of strings. */ public class EnterListDialog extends Dialog { private static final Class PKG = EnterListDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterMappingDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterMappingDialog.java index 2da83c60a0a..d24e3aff5fa 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterMappingDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterMappingDialog.java @@ -17,6 +17,10 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.SourceToTargetMapping; @@ -37,11 +41,6 @@ import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; - /** * Shows a user 2 lists of strings and allows the linkage of values between values in the 2 lists */ @@ -576,7 +575,9 @@ public String getSourceSeparator() { return sourceSeparator; } - /** @param sourceSeparator The sourceSeparator to set */ + /** + * @param sourceSeparator The sourceSeparator to set + */ public void setSourceSeparator(String sourceSeparator) { this.sourceSeparator = sourceSeparator; } @@ -590,7 +591,9 @@ public String getTargetSeparator() { return targetSeparator; } - /** @param targetSeparator The targetSeparator to set */ + /** + * @param targetSeparator The targetSeparator to set + */ public void setTargetSeparator(String targetSeparator) { this.targetSeparator = targetSeparator; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterNumberDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterNumberDialog.java index 74d7d99d803..7db639aa7fb 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterNumberDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterNumberDialog.java @@ -38,7 +38,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; - /** This dialog allows you to enter a number. */ public class EnterNumberDialog extends Dialog { private static final Class PKG = EnterNumberDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOrderedListDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOrderedListDialog.java index 306ddfd18b4..173637262c7 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOrderedListDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOrderedListDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.dialog; +import java.util.Stack; +import java.util.StringTokenizer; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.i18n.BaseMessages; @@ -50,9 +52,6 @@ import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; -import java.util.Stack; -import java.util.StringTokenizer; - /** This dialogs allows you to select a ordered number of items from a list of strings. */ public class EnterOrderedListDialog extends Dialog { private static final Class PKG = EnterOrderedListDialog.class; diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterPrintDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterPrintDialog.java index 7fc6698513a..7e140b93aeb 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterPrintDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterPrintDialog.java @@ -40,7 +40,6 @@ import org.eclipse.swt.widgets.Slider; import org.eclipse.swt.widgets.Text; - /** A dialog that sets the printer settings for a Hop printout. */ public class EnterPrintDialog extends Dialog { private static final Class PKG = EnterPrintDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSearchDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSearchDialog.java index c41e652281d..fbb3a212b13 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSearchDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSearchDialog.java @@ -228,12 +228,16 @@ public boolean isSearchingNotes() { return searchingNotes; } - /** @return Returns the filterString. */ + /** + * @return Returns the filterString. + */ public String getFilterString() { return filterString; } - /** @param filterString The filterString to set. */ + /** + * @param filterString The filterString to set. + */ public void setFilterString(String filterString) { this.filterString = filterString; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSelectionDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSelectionDialog.java index 265de7c5371..6b0c89783c7 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSelectionDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterSelectionDialog.java @@ -17,6 +17,9 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.hop.core.Const; import org.apache.hop.core.Props; import org.apache.hop.core.util.Utils; @@ -44,10 +47,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.util.ArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** Allows the user to make a selection from a list of values. */ public class EnterSelectionDialog extends Dialog { private static final Class PKG = EnterSelectionDialog.class; // For Translator @@ -203,7 +202,7 @@ public String open() { FormData fdlFilter = new FormData(); fdlFilter.top = new FormAttachment(0, 5); fdlFilter.right = new FormAttachment(treeTb, -5); - wlFilter.setLayoutData(fdlFilter); + wlFilter.setLayoutData(fdlFilter); // From transform line wlSelection = new Label(shell, SWT.NONE); @@ -273,7 +272,8 @@ public String open() { buttons.add(wCancel); } - BaseTransformDialog.positionBottomButtons(shell, buttons.toArray(new Button[0]), PropsUi.getMargin(), null); + BaseTransformDialog.positionBottomButtons( + shell, buttons.toArray(new Button[0]), PropsUi.getMargin(), null); Control nextControl = wOk; @@ -492,27 +492,37 @@ public int[] getSelectionIndeces() { return indices; } - /** @return the fixed */ + /** + * @return the fixed + */ public boolean isFixed() { return fixed; } - /** @param fixed the fixed to set */ + /** + * @param fixed the fixed to set + */ public void setFixed(boolean fixed) { this.fixed = fixed; } - /** @return the selectedNrs */ + /** + * @return the selectedNrs + */ public int[] getSelectedNrs() { return selectedNrs; } - /** @param selectedNrs the selectedNrs to set */ + /** + * @param selectedNrs the selectedNrs to set + */ public void setSelectedNrs(int[] selectedNrs) { this.selectedNrs = selectedNrs; } - /** @param selectedNrs the selectedNrs to set */ + /** + * @param selectedNrs the selectedNrs to set + */ public void setSelectedNrs(java.util.List selectedNrs) { this.selectedNrs = new int[selectedNrs.size()]; for (int i = 0; i < selectedNrs.size(); i++) { @@ -573,7 +583,9 @@ public boolean isAddNoneOption() { return addNoneOption; } - /** @param addNoneOption The addNoneOption to set */ + /** + * @param addNoneOption The addNoneOption to set + */ public void setAddNoneOption(boolean addNoneOption) { this.addNoneOption = addNoneOption; } @@ -587,7 +599,9 @@ public boolean isNoneClicked() { return noneClicked; } - /** @param noneClicked The noneClicked to set */ + /** + * @param noneClicked The noneClicked to set + */ public void setNoneClicked(boolean noneClicked) { this.noneClicked = noneClicked; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringDialog.java index 6115dc108fd..4c8e10aa45c 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringDialog.java @@ -212,12 +212,16 @@ private void ok() { dispose(); } - /** @return the mandatory */ + /** + * @return the mandatory + */ public boolean isMandatory() { return mandatory; } - /** @param mandatory the manditory to set */ + /** + * @param mandatory the manditory to set + */ public void setMandatory(boolean mandatory) { this.mandatory = mandatory; } @@ -231,7 +235,9 @@ public char getEchoChar() { return echoChar; } - /** @param echoChar The echoChar to set */ + /** + * @param echoChar The echoChar to set + */ public void setEchoChar(char echoChar) { this.echoChar = echoChar; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringsDialog.java index 8ff8ee13004..9628f8f8b39 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringsDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterStringsDialog.java @@ -199,7 +199,7 @@ private void ok() { if (valueMeta.getName().equalsIgnoreCase(name)) { String stringValue = item.getText(2); - + strings.getData()[j] = stringValue; } } @@ -219,37 +219,51 @@ private void ok() { dispose(); } - /** @return Returns the readOnly. */ + /** + * @return Returns the readOnly. + */ public boolean isReadOnly() { return readOnly; } - /** @param readOnly The readOnly to set. */ + /** + * @param readOnly The readOnly to set. + */ public void setReadOnly(boolean readOnly) { this.readOnly = readOnly; } - /** @return the message */ + /** + * @return the message + */ public String getMessage() { return message; } - /** @param message the message to set */ + /** + * @param message the message to set + */ public void setMessage(String message) { this.message = message; } - /** @return the title */ + /** + * @return the title + */ public String getTitle() { return title; } - /** @param title the title to set */ + /** + * @param title the title to set + */ public void setTitle(String title) { this.title = title; } - /** @param shellImage the shellImage to set */ + /** + * @param shellImage the shellImage to set + */ public void setShellImage(Image shellImage) { this.shellImage = shellImage; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterValueDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterValueDialog.java index 6d90a2161dc..7b37bc0609f 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterValueDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterValueDialog.java @@ -397,12 +397,16 @@ public void test() { } } - /** @return the modalDialog */ + /** + * @return the modalDialog + */ public boolean isModalDialog() { return modalDialog; } - /** @param modalDialog the modalDialog to set */ + /** + * @param modalDialog the modalDialog to set + */ public void setModalDialog(boolean modalDialog) { this.modalDialog = modalDialog; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorDialog.java index 8fa007552fc..21ec03c9dda 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorDialog.java @@ -18,6 +18,9 @@ package org.apache.hop.ui.core.dialog; import com.google.common.annotations.VisibleForTesting; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.function.Function; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.ui.core.PropsUi; @@ -36,10 +39,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.function.Function; - public class ErrorDialog extends Dialog { private static final Class PKG = ErrorDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/HopDescribedVariablesDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/HopDescribedVariablesDialog.java index dec01f28400..a73054163e2 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/HopDescribedVariablesDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/HopDescribedVariablesDialog.java @@ -103,7 +103,8 @@ public List open() { wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); wCancel.addListener(SWT.Selection, e -> cancel()); - BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wEncode, wCancel}, margin, wFields); + BaseTransformDialog.positionBottomButtons( + shell, new Button[] {wOk, wEncode, wCancel}, margin, wFields); // Message line at the top // diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/NativeFileDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/NativeFileDialog.java index 2556d6de8bc..aeb477505b8 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/NativeFileDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/NativeFileDialog.java @@ -76,7 +76,9 @@ public FileDialog getFileDialog() { return fileDialog; } - /** @param fileDialog The fileDialog to set */ + /** + * @param fileDialog The fileDialog to set + */ public void setFileDialog(FileDialog fileDialog) { this.fileDialog = fileDialog; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/PreviewRowsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/PreviewRowsDialog.java index 6f897dbd0c4..6e756fd8ac1 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/PreviewRowsDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/PreviewRowsDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.logging.ILogChannel; @@ -49,9 +51,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.ArrayList; -import java.util.List; - /** Displays an ArrayList of rows in a TableView. */ public class PreviewRowsDialog { private static final Class PKG = PreviewRowsDialog.class; // For Translator @@ -465,12 +464,16 @@ public void setVMax(int m) { vmax = m; } - /** @return true if the user is asking to grab the next rows with preview */ + /** + * @return true if the user is asking to grab the next rows with preview + */ public boolean isAskingForMoreRows() { return askingForMoreRows; } - /** @return true if the dialog is proposing to ask for more rows */ + /** + * @return true if the dialog is proposing to ask for more rows + */ public boolean isProposingToGetMoreRows() { return proposingToGetMoreRows; } @@ -483,17 +486,23 @@ public void setProposingToGetMoreRows(boolean proposingToGetMoreRows) { this.proposingToGetMoreRows = proposingToGetMoreRows; } - /** @return the askingToStop */ + /** + * @return the askingToStop + */ public boolean isAskingToStop() { return askingToStop; } - /** @return the proposingToStop */ + /** + * @return the proposingToStop + */ public boolean isProposingToStop() { return proposingToStop; } - /** @param proposingToStop the proposingToStop to set */ + /** + * @param proposingToStop the proposingToStop to set + */ public void setProposingToStop(boolean proposingToStop) { this.proposingToStop = proposingToStop; } @@ -508,7 +517,8 @@ public synchronized void addDataRow(final IRowMeta rowMeta, final Object[] rowDa return; } - HopGui.getInstance().getDisplay() + HopGui.getInstance() + .getDisplay() .syncExec( () -> { if (wFields.isDisposed()) { diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ProgressMonitorDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ProgressMonitorDialog.java index a7759ce4b76..007a973a809 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ProgressMonitorDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ProgressMonitorDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.dialog; +import java.lang.reflect.InvocationTargetException; import org.apache.hop.core.Const; import org.apache.hop.core.IProgressMonitor; import org.apache.hop.core.IRunnableWithProgress; @@ -36,8 +37,6 @@ import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; -import java.lang.reflect.InvocationTargetException; - /** A modal dialog that displays progress during a long running operation. */ public class ProgressMonitorDialog { private static final Class PKG = ProgressMonitorDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/SelectRowDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/SelectRowDialog.java index 89acff02ec9..bf0b0dc7d0f 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/SelectRowDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/SelectRowDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.dialog; +import java.util.List; import org.apache.hop.core.RowMetaAndData; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; @@ -38,8 +39,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import java.util.List; - /** Displays an ArrayList of rows in a TableView and allows you to select one. */ public class SelectRowDialog extends Dialog { private static final Class PKG = SelectRowDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java index 1eb38c9be8f..61a626ddd12 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowHelpDialog.java @@ -17,6 +17,8 @@ package org.apache.hop.ui.core.dialog; +import java.net.MalformedURLException; +import java.net.URL; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.laf.BasePropertyHandler; @@ -42,9 +44,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.net.MalformedURLException; -import java.net.URL; - public class ShowHelpDialog extends Dialog { private static final Class PKG = HopGui.class; @@ -205,7 +204,7 @@ public void changing(LocationEvent event) { if (event.location.endsWith(".pdf")) { try { EnvironmentUtils.getInstance().openUrl(event.location); - } catch(Exception e) { + } catch (Exception e) { new ErrorDialog(shell, "Error", "Error opening URL", e); } event.doit = false; diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowMessageDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowMessageDialog.java index b526f146bd9..4b7d04c8429 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowMessageDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ShowMessageDialog.java @@ -17,6 +17,11 @@ package org.apache.hop.ui.core.dialog; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.apache.hop.core.Const; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.ui.core.PropsUi; @@ -39,12 +44,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import java.util.ArrayList; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - /** Dialog to enter a text. (descriptions etc.) */ public class ShowMessageDialog extends Dialog { private static final Class PKG = ShowMessageDialog.class; // For Translator @@ -328,12 +327,16 @@ private void setFdlDesc( } } - /** @return the timeOut */ + /** + * @return the timeOut + */ public int getTimeOut() { return timeOut; } - /** @param timeOut the timeOut to set */ + /** + * @param timeOut the timeOut to set + */ public void setTimeOut(int timeOut) { this.timeOut = timeOut; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/SqlStatementsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/SqlStatementsDialog.java index 611fe47fe37..5b6d63d5d3f 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/dialog/SqlStatementsDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/SqlStatementsDialog.java @@ -17,6 +17,7 @@ package org.apache.hop.ui.core.dialog; +import java.util.List; import org.apache.hop.core.Const; import org.apache.hop.core.SqlStatement; import org.apache.hop.core.database.Database; @@ -44,8 +45,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; -import java.util.List; - /** Dialog to display the results of an SQL generation operation. */ public class SqlStatementsDialog extends Dialog { private static final Class PKG = SqlStatementsDialog.class; // For Translator diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/BaseGuiWidgets.java b/ui/src/main/java/org/apache/hop/ui/core/gui/BaseGuiWidgets.java index 3b34b6203e9..ada9d74f36f 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/BaseGuiWidgets.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/BaseGuiWidgets.java @@ -17,6 +17,9 @@ package org.apache.hop.ui.core.gui; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.gui.plugin.GuiRegistry; import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarItem; @@ -27,10 +30,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Listener; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - public class BaseGuiWidgets { /** @@ -46,9 +45,7 @@ public class BaseGuiWidgets { */ protected String guiPluginClassName; - /** - * The plugin object which is registered - */ + /** The plugin object which is registered */ protected Object guiPluginObject; public BaseGuiWidgets(String instanceId) { @@ -211,7 +208,7 @@ protected Listener getListener( } Object guiPluginInstance = - findGuiPluginInstance(classLoader, listenerClassName, instanceId); + findGuiPluginInstance(classLoader, listenerClassName, instanceId); Method listenerMethod = guiPluginInstance.getClass().getDeclaredMethod(listenerMethodName); listenerMethod.invoke(guiPluginInstance); @@ -222,7 +219,8 @@ protected Listener getListener( + " in class " + listenerClassName + " : " - + exception.getMessage(), e); + + exception.getMessage(), + e); } }; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java index 6b4fe511ac2..d0310054a8e 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java @@ -17,6 +17,12 @@ package org.apache.hop.ui.core.gui; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.exception.HopException; @@ -49,13 +55,6 @@ import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Text; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** This class contains the widgets for the GUI elements of a GUI Plugin */ public class GuiCompositeWidgets { @@ -335,10 +334,7 @@ private Button getButtonControl( } private Link getLinkControl( - Composite parent, - GuiElements guiElements, - PropsUi props, - Control lastControl) { + Composite parent, GuiElements guiElements, PropsUi props, Control lastControl) { Link link = new Link(parent, SWT.NONE); PropsUi.setLook(link); diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiMenuWidgets.java b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiMenuWidgets.java index d7d4a8d0da6..4b7581a8a76 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiMenuWidgets.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiMenuWidgets.java @@ -17,6 +17,12 @@ package org.apache.hop.ui.core.gui; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.gui.plugin.GuiRegistry; @@ -31,13 +37,6 @@ import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - /** This class contains the widgets for Menu Bars */ public class GuiMenuWidgets extends BaseGuiWidgets { diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java index 779812eaff8..05047daf961 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java @@ -15,9 +15,13 @@ * limitations under the License. */ - package org.apache.hop.ui.core.gui; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; import org.apache.hop.core.SwtUniversalImage; import org.apache.hop.core.logging.ILogChannel; import org.apache.hop.core.logging.LogChannel; @@ -51,12 +55,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; -import java.util.Collection; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - /* * colors etc. are allocated once and released once at the end of the program. * @@ -81,13 +79,13 @@ public class GuiResource { private Color colorRed; private Color colorDarkRed; - + private Color colorSuccessGreen; private Color colorBlueCustomGrid; private Color colorGreen; - + private Color colorDarkGreen; private Color colorBlue; @@ -386,9 +384,9 @@ private void getResources() { colorTab = new Color(display, props.contrastColor(new RGB(128, 128, 128))); colorSuccessGreen = new Color(display, props.contrastColor(0, 139, 0)); colorRed = new Color(display, props.contrastColor(255, 0, 0)); - colorDarkRed = new Color(display, props.contrastColor(192, 57, 43)); + colorDarkRed = new Color(display, props.contrastColor(192, 57, 43)); colorGreen = new Color(display, props.contrastColor(0, 255, 0)); - colorDarkGreen = new Color(display, props.contrastColor(16, 172, 132)); + colorDarkGreen = new Color(display, props.contrastColor(16, 172, 132)); colorBlue = new Color(display, props.contrastColor(0, 0, 255)); colorYellow = new Color(display, props.contrastColor(255, 255, 0)); colorMagenta = new Color(display, props.contrastColor(255, 0, 255)); @@ -1013,14 +1011,14 @@ public Color getColorGray() { public Color getColorGreen() { return colorGreen; } - + /** * @return Returns the color dark green. */ public Color getColorDarkGreen() { return colorDarkGreen; } - + /** * @return Returns the colorLightGray. */ @@ -1070,14 +1068,14 @@ public Color getColorSuccessGreen() { public Color getColorRed() { return colorRed; } - + /** - * @return Returns the color dark red. + * @return Returns the color dark red. */ public Color getColorDarkRed() { return colorDarkRed; } - + /** * @return Returns the colorBlueCustomGrid. */ @@ -1341,13 +1339,14 @@ private Image getZoomedImaged( * @return the imageVariable */ public Image getImageVariable() { - return getZoomedImaged(imageVariable, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE); + return getZoomedImaged( + imageVariable, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE); } public Image getImageVariableMini() { return getZoomedImaged(imageVariable, display, 10, 10); } - + public Image getImagePipeline() { return getZoomedImaged( imagePipeline, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE); @@ -1356,6 +1355,7 @@ public Image getImagePipeline() { public Image getImagePlugin() { return imagePlugin; } + public Image getImageUser() { return imageUser; } @@ -2019,11 +2019,11 @@ public Image getImageLocation() { public Image getImageOptions() { return imageOptions; } - + public Image getImagePalette() { return imagePalette; } - + public Image getImageAddAll() { return imageAddAll; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java index 474c2912588..2acc535cb8a 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java @@ -17,6 +17,12 @@ package org.apache.hop.ui.core.gui; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.commons.lang.StringUtils; import org.apache.hop.core.Const; import org.apache.hop.core.Props; @@ -46,13 +52,6 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - /** This class contains the widgets for the GUI elements of a GUI Plugin */ public class GuiToolbarWidgets extends BaseGuiWidgets { @@ -445,7 +444,8 @@ public void refreshComboItemList(String id) { Combo combo = (Combo) control; combo.setItems(getComboItems(item)); } else { - LogChannel.UI.logError("toolbar item with id '" + id + "' : widget not of instance Combo"); + LogChannel.UI.logError( + "toolbar item with id '" + id + "' : widget not of instance Combo"); } } else { LogChannel.UI.logError( diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/HopNamespace.java b/ui/src/main/java/org/apache/hop/ui/core/gui/HopNamespace.java index 424d746863e..132ce58588c 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/HopNamespace.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/HopNamespace.java @@ -52,7 +52,9 @@ public static final String getNamespace() { return getInstance().namespace; } - /** @param namespace The namespace to set */ + /** + * @param namespace The namespace to set + */ public static final void setNamespace(String namespace) { getInstance().namespace = namespace; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/ManagedFont.java b/ui/src/main/java/org/apache/hop/ui/core/gui/ManagedFont.java index b187dc3d27f..2ff1a6fb7af 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/ManagedFont.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/ManagedFont.java @@ -54,22 +54,30 @@ public void dispose() { } } - /** @return Returns the font. */ + /** + * @return Returns the font. + */ public Font getFont() { return font; } - /** @return true if this is a system font. */ + /** + * @return true if this is a system font. + */ public boolean isSystemFont() { return systemFont; } - /** @param font the font to set */ + /** + * @param font the font to set + */ public void setFont(Font font) { this.font = font; } - /** @param systemFont the systemFont to set */ + /** + * @param systemFont the systemFont to set + */ public void setSystemFont(boolean systemFont) { this.systemFont = systemFont; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/WindowProperty.java b/ui/src/main/java/org/apache/hop/ui/core/gui/WindowProperty.java index 127a758c48a..1dc83eefefe 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/gui/WindowProperty.java +++ b/ui/src/main/java/org/apache/hop/ui/core/gui/WindowProperty.java @@ -17,6 +17,9 @@ package org.apache.hop.ui.core.gui; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; @@ -24,10 +27,6 @@ import org.eclipse.swt.widgets.Monitor; import org.eclipse.swt.widgets.Shell; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - /** This class stores information about a screen, window, etc. */ public class WindowProperty { private String name; @@ -267,7 +266,9 @@ public String getName() { return name; } - /** @param name The name to set */ + /** + * @param name The name to set + */ public void setName(String name) { this.name = name; } @@ -281,7 +282,9 @@ public boolean isMaximized() { return maximized; } - /** @param maximized The maximized to set */ + /** + * @param maximized The maximized to set + */ public void setMaximized(boolean maximized) { this.maximized = maximized; } @@ -295,7 +298,9 @@ public int getX() { return x; } - /** @param x The x to set */ + /** + * @param x The x to set + */ public void setX(int x) { this.x = x; } @@ -309,7 +314,9 @@ public int getY() { return y; } - /** @param y The y to set */ + /** + * @param y The y to set + */ public void setY(int y) { this.y = y; } @@ -323,7 +330,9 @@ public int getWidth() { return width; } - /** @param width The width to set */ + /** + * @param width The width to set + */ public void setWidth(int width) { this.width = width; } @@ -337,7 +346,9 @@ public int getHeight() { return height; } - /** @param height The height to set */ + /** + * @param height The height to set + */ public void setHeight(int height) { this.height = height; } diff --git a/ui/src/main/java/org/apache/hop/ui/core/metadata/IMetadataEditor.java b/ui/src/main/java/org/apache/hop/ui/core/metadata/IMetadataEditor.java index e004446c6c1..3c29c6170b0 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/metadata/IMetadataEditor.java +++ b/ui/src/main/java/org/apache/hop/ui/core/metadata/IMetadataEditor.java @@ -1,76 +1,76 @@ -/* - * 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 org.apache.hop.ui.core.metadata; - -import org.apache.hop.core.exception.HopException; -import org.apache.hop.metadata.api.IHopMetadata; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; - -public interface IMetadataEditor { - - T getMetadata(); - - void setMetadata(T metadata); - - /** - * Return the title of the editor - * - * @return The title of this editor - */ - String getTitle(); - - /** - * Returns the title image of this editor - * - * @return - */ - Image getTitleImage(); - - /** - * Returns the title tool tip text of this editor - * - * @return - */ - String getTitleToolTip(); - - void createControl(Composite _parent); - - /** - * Returns whether the contents of this editor have changed since the last save operation. - * - * @return - */ - boolean hasChanged(); - - /** Flag the editor as changed */ - void setChanged(); - - /** Clear the changed flag */ - void resetChanged(); - - /** Save the editor input */ - void save() throws HopException; - - /** Save the editor input to file after asking for a filename */ - void saveAs(String filename) throws HopException; - - boolean setFocus(); - - void dispose(); -} +/* + * 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 org.apache.hop.ui.core.metadata; + +import org.apache.hop.core.exception.HopException; +import org.apache.hop.metadata.api.IHopMetadata; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; + +public interface IMetadataEditor { + + T getMetadata(); + + void setMetadata(T metadata); + + /** + * Return the title of the editor + * + * @return The title of this editor + */ + String getTitle(); + + /** + * Returns the title image of this editor + * + * @return + */ + Image getTitleImage(); + + /** + * Returns the title tool tip text of this editor + * + * @return + */ + String getTitleToolTip(); + + void createControl(Composite _parent); + + /** + * Returns whether the contents of this editor have changed since the last save operation. + * + * @return + */ + boolean hasChanged(); + + /** Flag the editor as changed */ + void setChanged(); + + /** Clear the changed flag */ + void resetChanged(); + + /** Save the editor input */ + void save() throws HopException; + + /** Save the editor input to file after asking for a filename */ + void saveAs(String filename) throws HopException; + + boolean setFocus(); + + void dispose(); +} diff --git a/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditor.java b/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditor.java index 7a6d107011e..feb1875aa83 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditor.java +++ b/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditor.java @@ -1,355 +1,354 @@ -/* - * 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 org.apache.hop.ui.core.metadata; - -import org.apache.commons.lang.StringUtils; -import org.apache.hop.core.Const; -import org.apache.hop.core.exception.HopException; -import org.apache.hop.core.extension.ExtensionPointHandler; -import org.apache.hop.core.extension.HopExtensionPoint; -import org.apache.hop.core.plugins.IPlugin; -import org.apache.hop.core.plugins.PluginRegistry; -import org.apache.hop.core.util.TranslateUtil; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.metadata.api.HopMetadata; -import org.apache.hop.metadata.api.IHopMetadata; -import org.apache.hop.metadata.api.IHopMetadataSerializer; -import org.apache.hop.metadata.plugin.MetadataPluginType; -import org.apache.hop.ui.core.ConstUi; -import org.apache.hop.ui.core.bus.HopGuiEvents; -import org.apache.hop.ui.core.dialog.ErrorDialog; -import org.apache.hop.ui.core.dialog.MessageBox; -import org.apache.hop.ui.core.gui.GuiResource; -import org.apache.hop.ui.hopgui.HopGui; -import org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective; -import org.apache.hop.ui.util.HelpUtils; -import org.apache.hop.ui.util.SwtSvgImageUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Objects; - -/** Abstract implementation of all metadata editors. */ -public abstract class MetadataEditor extends MetadataFileTypeHandler - implements IMetadataEditor { - - private static final Class PKG = MetadataEditorDialog.class; // For Translator - - protected HopGui hopGui; - protected MetadataManager manager; - protected T metadata; - - protected String title; - protected String toolTip; - protected Image titleImage; - protected Image image; - protected boolean isChanged = false; - protected String originalName; - - public MetadataEditor(HopGui hopGui, MetadataManager manager, T metadata) { - super(metadata); - this.hopGui = hopGui; - this.manager = manager; - this.metadata = metadata; - this.originalName = metadata.getName(); - - // Search metadata annotation - Type superclass = getClass().getGenericSuperclass(); - ParameterizedType parameterized = (ParameterizedType) superclass; - Class managedClass = (Class) parameterized.getActualTypeArguments()[0]; - HopMetadata annotation = managedClass.getAnnotation(HopMetadata.class); - - // Initialize editor - this.setTitle(metadata.getName()); - - String titleToolTip = TranslateUtil.translate(annotation.name(), managedClass); - if (StringUtils.isNotEmpty(metadata.getMetadataProviderName())) { - titleToolTip += Const.CR + "Source: " + metadata.getMetadataProviderName(); - } - this.setTitleToolTip(titleToolTip); - - this.setTitleImage( - GuiResource.getInstance() - .getImage( - annotation.image(), - managedClass.getClassLoader(), - ConstUi.SMALL_ICON_SIZE, - ConstUi.SMALL_ICON_SIZE)); - - // Use SwtSvgImageUtil because GuiResource cache have small icon. - this.setImage( - SwtSvgImageUtil.getImage( - hopGui.getDisplay(), - managedClass.getClassLoader(), - annotation.image(), - ConstUi.LARGE_ICON_SIZE, - ConstUi.LARGE_ICON_SIZE)); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MetadataEditor that = (MetadataEditor) o; - return Objects.equals(metadata, that.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(hopGui, manager, metadata, title, toolTip, titleImage, image, isChanged, originalName); - } - - public Button[] createButtonsForButtonBar(final Composite parent) { - return null; - } - - protected Button createHelpButton(final Shell shell) { - HopMetadata annotation = manager.getManagedClass().getAnnotation(HopMetadata.class); - IPlugin plugin = - PluginRegistry.getInstance().getPlugin(MetadataPluginType.class, annotation.key()); - return HelpUtils.createHelpButton(shell, plugin); - } - - public HopGui getHopGui() { - return hopGui; - } - - public MetadataManager getMetadataManager() { - return manager; - } - - @Override - public T getMetadata() { - return metadata; - } - - @Override - public void setMetadata(T metadata) { - this.metadata = metadata; - } - - public Shell getShell() { - return hopGui.getShell(); - } - - public Image getImage() { - return image; - } - - protected void setImage(Image image) { - this.image = image; - } - - @Override - public String getTitle() { - return title; - } - - protected void setTitle(String title) { - this.title = title; - } - - @Override - public Image getTitleImage() { - return titleImage; - } - - protected void setTitleImage(Image image) { - this.titleImage = image; - } - - @Override - public String getTitleToolTip() { - return toolTip; - } - - protected void setTitleToolTip(String toolTip) { - this.toolTip = toolTip; - } - - @Override - public boolean hasChanged() { - return isChanged; - } - - @Override - public void resetChanged() { - this.isChanged = false; - } - - @Override - public void setChanged() { - if (!this.isChanged) { - this.isChanged = true; - MetadataPerspective.getInstance().updateEditor(this); - try { - hopGui.getEventsHandler().fire(HopGuiEvents.MetadataChanged.name()); - } catch (HopException e) { - throw new RuntimeException(e); - } - } - } - - /** Inline usage: copy information from the metadata onto the various widgets */ - public abstract void setWidgetsContent(); - - /** - * Inline usage: Reads the information or state of the various widgets and modifies the provided - * metadata object. - * - * @param meta The metadata object to populate from the widgets - */ - public abstract void getWidgetsContent(T meta); - - @Override - public boolean isCloseable() { - - // Check if the metadata is saved. If not, ask for it to be saved. - // - if (this.hasChanged()) { - - MessageBox messageDialog = - new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL); - messageDialog.setText(manager.getManagedName()); - messageDialog.setMessage( - BaseMessages.getString( - PKG, "MetadataEditor.WantToSaveBeforeClosing.Message", getTitle())); - - int answer = messageDialog.open(); - - if ((answer & SWT.YES) != 0) { - try { - save(); - } catch (Exception e) { - new ErrorDialog(getShell(), "Error", "Error preparing editor close", e); - return false; - } - } - - if ((answer & SWT.CANCEL) != 0) { - return false; - } - } - - return true; - } - - @Override - public void save() throws HopException { - - getWidgetsContent(metadata); - String name = metadata.getName(); - - boolean isCreated = false; - boolean isRename = false; - - if (StringUtils.isEmpty(name)) { - throw new HopException(BaseMessages.getString(PKG, "MetadataEditor.Error.NoName")); - } - - if(StringUtils.startsWith(name, "$")) { - throw new HopException(BaseMessages.getString(PKG, "MetadataEditor.Error.IncorrectName")); - } - - // The serializer of the metadata - // - IHopMetadataSerializer serializer = manager.getSerializer(); - - if (StringUtils.isEmpty(originalName)) { - isCreated = true; - } - - // If rename - // - else if (!originalName.equals(name)) { - - // See if the name collides with an existing one... - // - if (serializer.exists(name)) { - throw new HopException( - BaseMessages.getString(PKG, "MetadataEditor.Error.NameAlreadyExists", name)); - } else { - isRename = true; - } - } - - // Save it in the metadata - serializer.save(metadata); - - if (isCreated) - ExtensionPointHandler.callExtensionPoint( - hopGui.getLog(), - manager.getVariables(), - HopExtensionPoint.HopGuiMetadataObjectCreated.id, - metadata); - else - ExtensionPointHandler.callExtensionPoint( - hopGui.getLog(), - manager.getVariables(), - HopExtensionPoint.HopGuiMetadataObjectUpdated.id, - metadata); - - // Reset changed flag - this.isChanged = false; - this.title = metadata.getName(); - - if (isRename) { - // Code hardening for scenario where a new metadata object isn't yet persisted on disk yet. - // The delete command can throw an error otherwise. - // - if (serializer.exists(originalName)) { - serializer.delete(originalName); - } - this.originalName = metadata.getName(); - } - - MetadataPerspective.getInstance().updateEditor(this); - } - - @Override - public void saveAs(String filename) throws HopException { - throw new HopException("Metadata editor doesn't support saveAs"); - } - - @Override - public boolean setFocus() { - return true; - } - - @Override - public void dispose() {} - - @Override - public void updateGui() { - hopGui - .getDisplay() - .asyncExec( - () -> - hopGui.handleFileCapabilities( - this.getFileType(), this.hasChanged(), false, false)); - } -} +/* + * 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 org.apache.hop.ui.core.metadata; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Objects; +import org.apache.commons.lang.StringUtils; +import org.apache.hop.core.Const; +import org.apache.hop.core.exception.HopException; +import org.apache.hop.core.extension.ExtensionPointHandler; +import org.apache.hop.core.extension.HopExtensionPoint; +import org.apache.hop.core.plugins.IPlugin; +import org.apache.hop.core.plugins.PluginRegistry; +import org.apache.hop.core.util.TranslateUtil; +import org.apache.hop.i18n.BaseMessages; +import org.apache.hop.metadata.api.HopMetadata; +import org.apache.hop.metadata.api.IHopMetadata; +import org.apache.hop.metadata.api.IHopMetadataSerializer; +import org.apache.hop.metadata.plugin.MetadataPluginType; +import org.apache.hop.ui.core.ConstUi; +import org.apache.hop.ui.core.bus.HopGuiEvents; +import org.apache.hop.ui.core.dialog.ErrorDialog; +import org.apache.hop.ui.core.dialog.MessageBox; +import org.apache.hop.ui.core.gui.GuiResource; +import org.apache.hop.ui.hopgui.HopGui; +import org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective; +import org.apache.hop.ui.util.HelpUtils; +import org.apache.hop.ui.util.SwtSvgImageUtil; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; + +/** Abstract implementation of all metadata editors. */ +public abstract class MetadataEditor extends MetadataFileTypeHandler + implements IMetadataEditor { + + private static final Class PKG = MetadataEditorDialog.class; // For Translator + + protected HopGui hopGui; + protected MetadataManager manager; + protected T metadata; + + protected String title; + protected String toolTip; + protected Image titleImage; + protected Image image; + protected boolean isChanged = false; + protected String originalName; + + public MetadataEditor(HopGui hopGui, MetadataManager manager, T metadata) { + super(metadata); + this.hopGui = hopGui; + this.manager = manager; + this.metadata = metadata; + this.originalName = metadata.getName(); + + // Search metadata annotation + Type superclass = getClass().getGenericSuperclass(); + ParameterizedType parameterized = (ParameterizedType) superclass; + Class managedClass = (Class) parameterized.getActualTypeArguments()[0]; + HopMetadata annotation = managedClass.getAnnotation(HopMetadata.class); + + // Initialize editor + this.setTitle(metadata.getName()); + + String titleToolTip = TranslateUtil.translate(annotation.name(), managedClass); + if (StringUtils.isNotEmpty(metadata.getMetadataProviderName())) { + titleToolTip += Const.CR + "Source: " + metadata.getMetadataProviderName(); + } + this.setTitleToolTip(titleToolTip); + + this.setTitleImage( + GuiResource.getInstance() + .getImage( + annotation.image(), + managedClass.getClassLoader(), + ConstUi.SMALL_ICON_SIZE, + ConstUi.SMALL_ICON_SIZE)); + + // Use SwtSvgImageUtil because GuiResource cache have small icon. + this.setImage( + SwtSvgImageUtil.getImage( + hopGui.getDisplay(), + managedClass.getClassLoader(), + annotation.image(), + ConstUi.LARGE_ICON_SIZE, + ConstUi.LARGE_ICON_SIZE)); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MetadataEditor that = (MetadataEditor) o; + return Objects.equals(metadata, that.metadata); + } + + @Override + public int hashCode() { + return Objects.hash( + hopGui, manager, metadata, title, toolTip, titleImage, image, isChanged, originalName); + } + + public Button[] createButtonsForButtonBar(final Composite parent) { + return null; + } + + protected Button createHelpButton(final Shell shell) { + HopMetadata annotation = manager.getManagedClass().getAnnotation(HopMetadata.class); + IPlugin plugin = + PluginRegistry.getInstance().getPlugin(MetadataPluginType.class, annotation.key()); + return HelpUtils.createHelpButton(shell, plugin); + } + + public HopGui getHopGui() { + return hopGui; + } + + public MetadataManager getMetadataManager() { + return manager; + } + + @Override + public T getMetadata() { + return metadata; + } + + @Override + public void setMetadata(T metadata) { + this.metadata = metadata; + } + + public Shell getShell() { + return hopGui.getShell(); + } + + public Image getImage() { + return image; + } + + protected void setImage(Image image) { + this.image = image; + } + + @Override + public String getTitle() { + return title; + } + + protected void setTitle(String title) { + this.title = title; + } + + @Override + public Image getTitleImage() { + return titleImage; + } + + protected void setTitleImage(Image image) { + this.titleImage = image; + } + + @Override + public String getTitleToolTip() { + return toolTip; + } + + protected void setTitleToolTip(String toolTip) { + this.toolTip = toolTip; + } + + @Override + public boolean hasChanged() { + return isChanged; + } + + @Override + public void resetChanged() { + this.isChanged = false; + } + + @Override + public void setChanged() { + if (!this.isChanged) { + this.isChanged = true; + MetadataPerspective.getInstance().updateEditor(this); + try { + hopGui.getEventsHandler().fire(HopGuiEvents.MetadataChanged.name()); + } catch (HopException e) { + throw new RuntimeException(e); + } + } + } + + /** Inline usage: copy information from the metadata onto the various widgets */ + public abstract void setWidgetsContent(); + + /** + * Inline usage: Reads the information or state of the various widgets and modifies the provided + * metadata object. + * + * @param meta The metadata object to populate from the widgets + */ + public abstract void getWidgetsContent(T meta); + + @Override + public boolean isCloseable() { + + // Check if the metadata is saved. If not, ask for it to be saved. + // + if (this.hasChanged()) { + + MessageBox messageDialog = + new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL); + messageDialog.setText(manager.getManagedName()); + messageDialog.setMessage( + BaseMessages.getString( + PKG, "MetadataEditor.WantToSaveBeforeClosing.Message", getTitle())); + + int answer = messageDialog.open(); + + if ((answer & SWT.YES) != 0) { + try { + save(); + } catch (Exception e) { + new ErrorDialog(getShell(), "Error", "Error preparing editor close", e); + return false; + } + } + + if ((answer & SWT.CANCEL) != 0) { + return false; + } + } + + return true; + } + + @Override + public void save() throws HopException { + + getWidgetsContent(metadata); + String name = metadata.getName(); + + boolean isCreated = false; + boolean isRename = false; + + if (StringUtils.isEmpty(name)) { + throw new HopException(BaseMessages.getString(PKG, "MetadataEditor.Error.NoName")); + } + + if (StringUtils.startsWith(name, "$")) { + throw new HopException(BaseMessages.getString(PKG, "MetadataEditor.Error.IncorrectName")); + } + + // The serializer of the metadata + // + IHopMetadataSerializer serializer = manager.getSerializer(); + + if (StringUtils.isEmpty(originalName)) { + isCreated = true; + } + + // If rename + // + else if (!originalName.equals(name)) { + + // See if the name collides with an existing one... + // + if (serializer.exists(name)) { + throw new HopException( + BaseMessages.getString(PKG, "MetadataEditor.Error.NameAlreadyExists", name)); + } else { + isRename = true; + } + } + + // Save it in the metadata + serializer.save(metadata); + + if (isCreated) + ExtensionPointHandler.callExtensionPoint( + hopGui.getLog(), + manager.getVariables(), + HopExtensionPoint.HopGuiMetadataObjectCreated.id, + metadata); + else + ExtensionPointHandler.callExtensionPoint( + hopGui.getLog(), + manager.getVariables(), + HopExtensionPoint.HopGuiMetadataObjectUpdated.id, + metadata); + + // Reset changed flag + this.isChanged = false; + this.title = metadata.getName(); + + if (isRename) { + // Code hardening for scenario where a new metadata object isn't yet persisted on disk yet. + // The delete command can throw an error otherwise. + // + if (serializer.exists(originalName)) { + serializer.delete(originalName); + } + this.originalName = metadata.getName(); + } + + MetadataPerspective.getInstance().updateEditor(this); + } + + @Override + public void saveAs(String filename) throws HopException { + throw new HopException("Metadata editor doesn't support saveAs"); + } + + @Override + public boolean setFocus() { + return true; + } + + @Override + public void dispose() {} + + @Override + public void updateGui() { + hopGui + .getDisplay() + .asyncExec( + () -> + hopGui.handleFileCapabilities(this.getFileType(), this.hasChanged(), false, false)); + } +} diff --git a/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditorDialog.java b/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditorDialog.java index 98a8350cdd3..c2bf64a6395 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditorDialog.java +++ b/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataEditorDialog.java @@ -1,140 +1,139 @@ -/* - * 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 org.apache.hop.ui.core.metadata; - -import org.apache.hop.core.exception.HopException; -import org.apache.hop.i18n.BaseMessages; -import org.apache.hop.ui.core.PropsUi; -import org.apache.hop.ui.core.dialog.BaseDialog; -import org.apache.hop.ui.core.dialog.ErrorDialog; -import org.apache.hop.ui.core.gui.WindowProperty; -import org.apache.hop.ui.pipeline.transform.BaseTransformDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; -import org.eclipse.swt.widgets.Shell; - -import java.util.ArrayList; -import java.util.List; - -public class MetadataEditorDialog extends Dialog implements IMetadataDialog { - private static final Class PKG = MetadataEditorDialog.class; // For Translator - - private Shell shell; - private MetadataEditor editor; - private String result; - - public MetadataEditorDialog(Shell parent, MetadataEditor editor) { - super(parent); - this.editor = editor; - } - - @Override - public String open() { - PropsUi props = PropsUi.getInstance(); - - Shell parent = getParent(); - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); - shell.setText(editor.getTitle()); - shell.setImage(editor.getTitleImage()); - FormLayout formLayout = new FormLayout(); - formLayout.marginWidth = PropsUi.getFormMargin() * 2; - formLayout.marginHeight = PropsUi.getFormMargin() * 2; - shell.setLayout(formLayout); - PropsUi.setLook(shell); - - // Create buttons - Button wOk = new Button(shell, SWT.PUSH); - wOk.setText(BaseMessages.getString(PKG, "System.Button.OK")); - wOk.addListener(SWT.Selection, e -> ok()); - - Button wCancel = new Button(shell, SWT.PUSH); - wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); - wCancel.addListener(SWT.Selection, e -> cancel()); - - List