diff --git a/assemblies/plugins/pom.xml b/assemblies/plugins/pom.xml index 333b8b013398..3c4dc5c483fb 100644 --- a/assemblies/plugins/pom.xml +++ b/assemblies/plugins/pom.xml @@ -40,6 +40,7 @@ ${project.version} ${project.version} ${project.version} + ${project.version} ${project.version} ${project.version} ${project.version} @@ -340,6 +341,18 @@ + + org.pentaho.di.plugins + sftpput-plugin + ${sftpput-plugin.version} + zip + + + * + * + + + org.pentaho.di.plugins mondrianinput-plugin diff --git a/engine/src/main/resources/kettle-steps.xml b/engine/src/main/resources/kettle-steps.xml index bb7cc55d848f..7d64e8a0f994 100644 --- a/engine/src/main/resources/kettle-steps.xml +++ b/engine/src/main/resources/kettle-steps.xml @@ -121,7 +121,6 @@ i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.ZipFile org.pentaho.di.trans.steps.zipfile.ZipFileMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Utility i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.ZipFile ui/images/ZIP.svg http://wiki.pentaho.com/display/EAI/Zip+file+%28step%29 i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.SASInput org.pentaho.di.trans.steps.sasinput.SasInputMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Input i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.SASInput ui/images/SASInput.svg http://wiki.pentaho.com/display/EAI/SAS+Input i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.TableCompare org.pentaho.di.trans.steps.tablecompare.TableCompareMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Utility i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.TableCompare ui/images/TBLCMP.svg http://wiki.pentaho.com/display/EAI/Table+Compare - i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.SFTPPut org.pentaho.di.trans.steps.sftpput.SFTPPutMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Experimental i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.SFTPPut ui/images/SFP.svg http://wiki.pentaho.com/display/EAI/SFTP+Put i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.PGPEncryptStream org.pentaho.di.trans.steps.pgpencryptstream.PGPEncryptStreamMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Cryptography i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.PGPEncryptStream ui/images/GPGEncrypt.svg http://wiki.pentaho.com/display/EAI/Encrypt+files+with+PGP i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.PGPDecryptStream org.pentaho.di.trans.steps.pgpdecryptstream.PGPDecryptStreamMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Cryptography i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.PGPDecryptStream ui/images/GPGDecrypt.svg http://wiki.pentaho.com/display/EAI/Decrypt+files+with+PGP i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.TransExecutor org.pentaho.di.trans.steps.transexecutor.TransExecutorMeta i18n:org.pentaho.di.trans.step:BaseStep.Category.Flow i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.TransExecutor ui/images/TRNEx.svg Products/Transformation_Executor diff --git a/engine/src/main/resources/org/pentaho/di/trans/step/messages/messages_en_US.properties b/engine/src/main/resources/org/pentaho/di/trans/step/messages/messages_en_US.properties index 3e8c299481ee..f410ba271888 100644 --- a/engine/src/main/resources/org/pentaho/di/trans/step/messages/messages_en_US.properties +++ b/engine/src/main/resources/org/pentaho/di/trans/step/messages/messages_en_US.properties @@ -415,8 +415,6 @@ BaseStep.Category.DataQuality=Data Quality BaseStep.TypeLongDesc.Edi2Xml=EDI to XML BaseStep.TypeTooltipDesc.Edi2Xml=Converts Edi text to generic XML -BaseStep.TypeLongDesc.SFTPPut=SFTP put -BaseStep.TypeTooltipDesc.SFTPPut=Upload a file or a stream file to remote host via SFTP BaseStepDialog.WizardConnectionButton.Label=Wizard... BaseStep.Log.LoadBalancingActivated=Load balancing activated diff --git a/plugins/README.md b/plugins/README.md index 1b871ed80f05..f0b94ac2950e 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -11,6 +11,7 @@ __List of the current core plugins:__ * drools * dummy * gpload +* sftpput * hl7 * json * openerp diff --git a/plugins/pom.xml b/plugins/pom.xml index 16ac1c45a961..527f19c3f705 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -47,6 +47,7 @@ mondrianinput avro-format get-repository-names + sftpput connected-to-repository diff --git a/plugins/sftpput/assemblies/plugin/pom.xml b/plugins/sftpput/assemblies/plugin/pom.xml new file mode 100644 index 000000000000..6fbc357deefc --- /dev/null +++ b/plugins/sftpput/assemblies/plugin/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + + org.pentaho.di.plugins + sftpput-assemblies + 10.1.0.0-SNAPSHOT + + + sftpput-plugin + 10.1.0.0-SNAPSHOT + pom + + PDI SFTP put Plugin Distribution + + + + + org.pentaho.di.plugins + sftpput-plugin-impl + ${project.version} + + + org.pentaho.di.plugins + sftpput-plugin-ui + ${project.version} + + + + + + + maven-dependency-plugin + + + add-libs + generate-resources + + copy-dependencies + + + ${project.build.directory}/assembly/lib + compile + sftpput-plugin-impl,sftpput-plugin-ui + + + + + + + + diff --git a/plugins/sftpput/assemblies/plugin/src/assembly/assembly.xml b/plugins/sftpput/assemblies/plugin/src/assembly/assembly.xml new file mode 100644 index 000000000000..577c5e90d901 --- /dev/null +++ b/plugins/sftpput/assemblies/plugin/src/assembly/assembly.xml @@ -0,0 +1,37 @@ + + sftpput-plugin + + zip + + sftpput-plugin + + + + ${project.basedir}/src/main/resources/version.xml + . + true + + + + + + + ${project.build.directory}/assembly + . + + + + + + . + + org.pentaho.di.plugins:sftpput-plugin-impl:jar + org.pentaho.di.plugins:sftpput-plugin-ui:jar + + false + + + + + diff --git a/plugins/sftpput/assemblies/plugin/src/main/resources/version.xml b/plugins/sftpput/assemblies/plugin/src/main/resources/version.xml new file mode 100644 index 000000000000..7724ea192ce1 --- /dev/null +++ b/plugins/sftpput/assemblies/plugin/src/main/resources/version.xml @@ -0,0 +1,2 @@ + +${project.version} \ No newline at end of file diff --git a/plugins/sftpput/assemblies/pom.xml b/plugins/sftpput/assemblies/pom.xml new file mode 100644 index 000000000000..1c232e12e5e6 --- /dev/null +++ b/plugins/sftpput/assemblies/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + + org.pentaho.di.plugins + sftpput + 10.1.0.0-SNAPSHOT + + + sftpput-assemblies + 10.1.0.0-SNAPSHOT + pom + + PDI SFTP Put Plugins Assemblies + + + plugin + + diff --git a/plugins/sftpput/impl/pom.xml b/plugins/sftpput/impl/pom.xml new file mode 100644 index 000000000000..3e39583d5e31 --- /dev/null +++ b/plugins/sftpput/impl/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + + org.pentaho.di.plugins + sftpput + 10.1.0.0-SNAPSHOT + + + sftpput-plugin-impl + PDI SFTP Put Plugin Impl + + + + pentaho-kettle + kettle-core + provided + + + pentaho-kettle + kettle-engine + provided + + + com.healthmarketscience.jackcess + jackcess + compile + + + + + org.mockito + mockito-all + test + + + org.hamcrest + hamcrest-core + 1.3 + test + + + pentaho-kettle + kettle-core + tests + test + + + pentaho-kettle + kettle-engine + tests + test + + + diff --git a/plugins/sftpput/impl/src/it/org/pentaho/di/trans/steps/sftpput/SFTPPutIntegrationIT.java b/plugins/sftpput/impl/src/it/org/pentaho/di/trans/steps/sftpput/SFTPPutIntegrationIT.java new file mode 100644 index 000000000000..bde8af73c5e3 --- /dev/null +++ b/plugins/sftpput/impl/src/it/org/pentaho/di/trans/steps/sftpput/SFTPPutIntegrationIT.java @@ -0,0 +1,136 @@ +/*! ****************************************************************************** + * + * Pentaho Data Integration + * + * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * + ******************************************************************************* + * + * Licensed 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.pentaho.di.trans.steps.sftpput; + +import com.jcraft.jsch.ChannelSftp; +import com.jcraft.jsch.Session; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.pentaho.di.TestUtilities; +import org.pentaho.di.core.KettleEnvironment; +import org.pentaho.di.job.entries.sftp.SftpServer; +import org.pentaho.di.trans.Trans; + +import java.io.ByteArrayOutputStream; + +import static org.junit.Assert.assertEquals; + +/** + * @author Andrey Khayrutdinov + */ +public class SFTPPutIntegrationIT { + + private static TemporaryFolder folder; + + private static SftpServer server; + + @BeforeClass + public static void startServer() throws Exception { + KettleEnvironment.init(); + + folder = new TemporaryFolder(); + folder.create(); + + server = SftpServer.createDefaultServer( folder ); + server.start(); + } + + @AfterClass + public static void stopServer() throws Exception { + server.stop(); + server = null; + + folder.delete(); + folder = null; + } + + + private Session session; + private ChannelSftp channel; + + @Before + public void setUp() throws Exception { + session = server.createJschSession(); + session.connect(); + + channel = (ChannelSftp) session.openChannel( "sftp" ); + } + + @After + public void tearDown() throws Exception { + if ( channel != null && channel.isConnected() ) { + channel.disconnect(); + } + channel = null; + + if ( session.isConnected() ) { + session.disconnect(); + } + session = null; + } + + + /** + * This case relates to PDI-13897. + * It executes a transformation with two steps: data grid and sftp put. + * The latter uploads to an SFTP server a file pdi-13897/uploaded.txt, that contains a + * qwerty string.
+ * + * Parameters of the transformation are: + * + * @throws Exception + */ + @Test + public void putFileStreamingContentFromField() throws Exception { + // prepare a directory for transformation's execution + channel.connect(); + channel.mkdir( "pdi-13897" ); + + // execute the transformation + Trans trans = TestUtilities.loadAndRunTransformation( + "src/it/resources/org/pentaho/di/trans/steps/sftpput/pdi-13897.ktr", + "server", "localhost", + "port", server.getPort(), + "username", server.getUsername(), + "password", server.getPassword() + ); + assertEquals( 0, trans.getErrors() ); + + // verify the results + ByteArrayOutputStream os = new ByteArrayOutputStream(); + channel.cd( "pdi-13897" ); + channel.get( "uploaded.txt", os ); + String content = new String( os.toByteArray() ); + assertEquals( "qwerty", content ); + } +} diff --git a/plugins/sftpput/impl/src/it/resources/org/pentaho/di/trans/steps/sftpput/pdi-13897.ktr b/plugins/sftpput/impl/src/it/resources/org/pentaho/di/trans/steps/sftpput/pdi-13897.ktr new file mode 100644 index 000000000000..365f41086763 --- /dev/null +++ b/plugins/sftpput/impl/src/it/resources/org/pentaho/di/trans/steps/sftpput/pdi-13897.ktr @@ -0,0 +1,251 @@ + + + + pdi-13897 + + + + Normal + 0 + / + + + password + + + + + port + + + + + server + + + + + username + + + + + + + + + + + +ID_BATCHYID_BATCHCHANNEL_IDYCHANNEL_IDTRANSNAMEYTRANSNAMESTATUSYSTATUSLINES_READYLINES_READLINES_WRITTENYLINES_WRITTENLINES_UPDATEDYLINES_UPDATEDLINES_INPUTYLINES_INPUTLINES_OUTPUTYLINES_OUTPUTLINES_REJECTEDYLINES_REJECTEDERRORSYERRORSSTARTDATEYSTARTDATEENDDATEYENDDATELOGDATEYLOGDATEDEPDATEYDEPDATEREPLAYDATEYREPLAYDATELOG_FIELDYLOG_FIELDEXECUTING_SERVERNEXECUTING_SERVEREXECUTING_USERNEXECUTING_USERCLIENTNCLIENT + + +
+ + +ID_BATCHYID_BATCHSEQ_NRYSEQ_NRLOGDATEYLOGDATETRANSNAMEYTRANSNAMESTEPNAMEYSTEPNAMESTEP_COPYYSTEP_COPYLINES_READYLINES_READLINES_WRITTENYLINES_WRITTENLINES_UPDATEDYLINES_UPDATEDLINES_INPUTYLINES_INPUTLINES_OUTPUTYLINES_OUTPUTLINES_REJECTEDYLINES_REJECTEDERRORSYERRORSINPUT_BUFFER_ROWSYINPUT_BUFFER_ROWSOUTPUT_BUFFER_ROWSYOUTPUT_BUFFER_ROWS + + +
+ +ID_BATCHYID_BATCHCHANNEL_IDYCHANNEL_IDLOG_DATEYLOG_DATELOGGING_OBJECT_TYPEYLOGGING_OBJECT_TYPEOBJECT_NAMEYOBJECT_NAMEOBJECT_COPYYOBJECT_COPYREPOSITORY_DIRECTORYYREPOSITORY_DIRECTORYFILENAMEYFILENAMEOBJECT_IDYOBJECT_IDOBJECT_REVISIONYOBJECT_REVISIONPARENT_CHANNEL_IDYPARENT_CHANNEL_IDROOT_CHANNEL_IDYROOT_CHANNEL_ID + + +
+ +ID_BATCHYID_BATCHCHANNEL_IDYCHANNEL_IDLOG_DATEYLOG_DATETRANSNAMEYTRANSNAMESTEPNAMEYSTEPNAMESTEP_COPYYSTEP_COPYLINES_READYLINES_READLINES_WRITTENYLINES_WRITTENLINES_UPDATEDYLINES_UPDATEDLINES_INPUTYLINES_INPUTLINES_OUTPUTYLINES_OUTPUTLINES_REJECTEDYLINES_REJECTEDERRORSYERRORSLOG_FIELDNLOG_FIELD + + +
+ +ID_BATCHYID_BATCHCHANNEL_IDYCHANNEL_IDLOG_DATEYLOG_DATEMETRICS_DATEYMETRICS_DATEMETRICS_CODEYMETRICS_CODEMETRICS_DESCRIPTIONYMETRICS_DESCRIPTIONMETRICS_SUBJECTYMETRICS_SUBJECTMETRICS_TYPEYMETRICS_TYPEMETRICS_VALUEYMETRICS_VALUE + + + +
+ + 0.0 + 0.0 + + 10000 + 50 + 50 + N + Y + 50000 + Y + + N + 1000 + 100 + + + + + + + + + - + 2015/06/08 02:22:37.065 + - + 2015/06/08 02:22:37.065 + + N + + + + + AgileBI + localhost + MONETDB + Native + pentaho-instaview + 50006 + monetdb + Encrypted 2be98afc86aa7f2e4cb14a17edb86abd8 + + + + true + + EXTRA_OPTION_INFOBRIGHT.characterEncodingUTF-8 + EXTRA_OPTION_MYSQL.defaultFetchSize500 + EXTRA_OPTION_MYSQL.useCursorFetchtrue + PORT_NUMBER50006 + PRESERVE_RESERVED_WORD_CASEY + SUPPORTS_BOOLEAN_DATA_TYPEY + SUPPORTS_TIMESTAMP_DATA_TYPEY + + + + AgileBI-copy + localhost + MONETDB + Native + pentaho-instaview + 50006 + monetdb + Encrypted 2be98afc86aa7f2e4cb14a17edb86abd8 + + + + true + + EXTRA_OPTION_INFOBRIGHT.characterEncodingUTF-8 + EXTRA_OPTION_MYSQL.defaultFetchSize500 + EXTRA_OPTION_MYSQL.useCursorFetchtrue + PORT_NUMBER50006 + PRESERVE_RESERVED_WORD_CASEY + SUPPORTS_BOOLEAN_DATA_TYPEY + SUPPORTS_TIMESTAMP_DATA_TYPEY + + + + Data GridSFTP PutY + + + SFTP Put + SFTPPut + + Y + + 1 + + none + + + ${server} + ${port} + ${username} + ${password} + data + remoteDir + Y + N + N + + Encrypted + none + + + + + Encrypted + N + nothing + + N + remoteFilename + + + 177 + 185 + Y + + + + + Data Grid + DataGrid + + Y + + 1 + + none + + + + + data + String + + + + + -1 + -1 + N + + + remoteDir + String + + + + + -1 + -1 + N + + + remoteFilename + String + + + + + -1 + -1 + N + + + + qwertypdi-13897uploaded.txt + + + + 82 + 185 + Y + + + + + + + + N + + diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java similarity index 99% rename from engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java rename to plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java index 1918db81f752..cbfe52964a07 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java +++ b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,20 +22,15 @@ package org.pentaho.di.trans.steps.sftpput; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; - import com.google.common.annotations.VisibleForTesting; import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.Const; -import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.ResultFile; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleJobException; import org.pentaho.di.core.exception.KettleStepException; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.job.entries.sftp.SFTPClient; @@ -48,6 +43,11 @@ import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.step.StepMetaInterface; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; + /** * Send file to SFTP host. * diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutData.java b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutData.java similarity index 96% rename from engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutData.java rename to plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutData.java index e3627b62274c..17437714d637 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutData.java +++ b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutData.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java similarity index 97% rename from engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java rename to plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java index 86e05311cc9a..13f4f44d28f5 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java +++ b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,11 +22,10 @@ package org.pentaho.di.trans.steps.sftpput; -import java.util.List; - import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; +import org.pentaho.di.core.annotations.Step; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.exception.KettleException; @@ -49,13 +48,20 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; +import java.util.List; + /** * Send file to SFTP host. * * @author Samatar Hassan * @since 30-April-2012 */ - +@Step( id = "SFTPPut", name = "BaseStep.TypeLongDesc.SFTPPut", + description = "BaseStep.TypeTooltipDesc.SFTPPut", + categoryDescription = "i18n:org.pentaho.di.trans.step:BaseStep.Category.Experimental", + image = "SFP.svg", + documentationUrl = "http://wiki.pentaho.com/display/EAI/SFTP+Put", + i18nPackageName = "org.pentaho.di.trans.steps.sftpput" ) public class SFTPPutMeta extends BaseStepMeta implements StepMetaInterface { private static Class PKG = SFTPPutMeta.class; // for i18n purposes, needed by Translator2!! diff --git a/engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_en_US.properties b/plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_en_US.properties similarity index 100% rename from engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_en_US.properties rename to plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_en_US.properties diff --git a/engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_fr_FR.properties b/plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_fr_FR.properties similarity index 100% rename from engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_fr_FR.properties rename to plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_fr_FR.properties diff --git a/engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_it_IT.properties b/plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_it_IT.properties similarity index 100% rename from engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_it_IT.properties rename to plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_it_IT.properties diff --git a/engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_ja_JP.properties b/plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_ja_JP.properties similarity index 100% rename from engine/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_ja_JP.properties rename to plugins/sftpput/impl/src/main/resources/org/pentaho/di/trans/steps/sftpput/messages/messages_ja_JP.properties diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMetaTest.java b/plugins/sftpput/impl/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMetaTest.java similarity index 96% rename from engine/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMetaTest.java rename to plugins/sftpput/impl/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMetaTest.java index 46b1280e2eff..e6db47eed0e0 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMetaTest.java +++ b/plugins/sftpput/impl/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMetaTest.java @@ -1,81 +1,81 @@ -/*! ****************************************************************************** - * - * Pentaho Data Integration - * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com - * - ******************************************************************************* - * - * Licensed 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.pentaho.di.trans.steps.sftpput; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; -import org.pentaho.di.core.KettleEnvironment; -import org.pentaho.di.core.exception.KettleException; -import org.pentaho.di.core.plugins.PluginRegistry; -import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; -import org.pentaho.di.trans.step.StepMetaInterface; -import org.pentaho.di.trans.steps.loadsave.LoadSaveTester; -import org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator; -import org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator; - -public class SFTPPutMetaTest { - LoadSaveTester loadSaveTester; - Class testMetaClass = SFTPPutMeta.class; - ThreadLocal testingMeta = new ThreadLocal(); // here for validating afterFTPS - @ClassRule public static RestorePDIEngineEnvironment env = new RestorePDIEngineEnvironment(); - - @Before - public void setUpLoadSave() throws Exception { - KettleEnvironment.init(); - PluginRegistry.init( false ); - List attributes = - Arrays.asList( "serverName", "serverPort", "userName", "password", "sourceFileFieldName", "remoteDirectoryFieldName", - "addFilenameResut", "inputStream", "useKeyFile", "keyFilename", "keyPassPhrase", "compression", "createRemoteFolder", - "proxyType", "proxyHost", "proxyPort", "proxyUsername", "proxyPassword", "destinationFolderFieldName", "createDestinationFolder", - "afterFTPS", "remoteFilenameFieldName" ); - - Map getterMap = new HashMap(); - Map setterMap = new HashMap(); - - Map> attrValidatorMap = new HashMap>(); - // See JobEntrySFTPPUT for the boundary ... chose not to create a test dependency between the Step and the JobEntry. - attrValidatorMap.put( "afterFTPS", new IntLoadSaveValidator( 3 ) ); - Map> typeValidatorMap = new HashMap>(); - - loadSaveTester = - new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap ); - } - - @Test - public void testSerialization() throws KettleException { - loadSaveTester.testSerialization(); - } - - // Call the allocate method on the LoadSaveTester meta class - public void modify( StepMetaInterface someMeta ) { - if ( someMeta instanceof SFTPPutMeta ) { - SFTPPutMeta curMeta = (SFTPPutMeta) someMeta; - testingMeta.set( curMeta ); - } - } -} +/*! ****************************************************************************** + * + * Pentaho Data Integration + * + * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * + ******************************************************************************* + * + * Licensed 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.pentaho.di.trans.steps.sftpput; + +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import org.pentaho.di.core.KettleEnvironment; +import org.pentaho.di.core.exception.KettleException; +import org.pentaho.di.core.plugins.PluginRegistry; +import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; +import org.pentaho.di.trans.step.StepMetaInterface; +import org.pentaho.di.trans.steps.loadsave.LoadSaveTester; +import org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator; +import org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SFTPPutMetaTest { + LoadSaveTester loadSaveTester; + Class testMetaClass = SFTPPutMeta.class; + ThreadLocal testingMeta = new ThreadLocal(); // here for validating afterFTPS + @ClassRule public static RestorePDIEngineEnvironment env = new RestorePDIEngineEnvironment(); + + @Before + public void setUpLoadSave() throws Exception { + KettleEnvironment.init(); + PluginRegistry.init( false ); + List attributes = + Arrays.asList( "serverName", "serverPort", "userName", "password", "sourceFileFieldName", "remoteDirectoryFieldName", + "addFilenameResut", "inputStream", "useKeyFile", "keyFilename", "keyPassPhrase", "compression", "createRemoteFolder", + "proxyType", "proxyHost", "proxyPort", "proxyUsername", "proxyPassword", "destinationFolderFieldName", "createDestinationFolder", + "afterFTPS", "remoteFilenameFieldName" ); + + Map getterMap = new HashMap(); + Map setterMap = new HashMap(); + + Map> attrValidatorMap = new HashMap>(); + // See JobEntrySFTPPUT for the boundary ... chose not to create a test dependency between the Step and the JobEntry. + attrValidatorMap.put( "afterFTPS", new IntLoadSaveValidator( 3 ) ); + Map> typeValidatorMap = new HashMap>(); + + loadSaveTester = + new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap ); + } + + @Test + public void testSerialization() throws KettleException { + loadSaveTester.testSerialization(); + } + + // Call the allocate method on the LoadSaveTester meta class + public void modify( StepMetaInterface someMeta ) { + if ( someMeta instanceof SFTPPutMeta ) { + SFTPPutMeta curMeta = (SFTPPutMeta) someMeta; + testingMeta.set( curMeta ); + } + } +} diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutTest.java b/plugins/sftpput/impl/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutTest.java similarity index 98% rename from engine/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutTest.java rename to plugins/sftpput/impl/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutTest.java index bc1400358e39..944d3d1a6cb8 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutTest.java +++ b/plugins/sftpput/impl/src/test/java/org/pentaho/di/trans/steps/sftpput/SFTPPutTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,7 +22,6 @@ package org.pentaho.di.trans.steps.sftpput; -import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; diff --git a/plugins/sftpput/pom.xml b/plugins/sftpput/pom.xml new file mode 100644 index 000000000000..6d27976033f7 --- /dev/null +++ b/plugins/sftpput/pom.xml @@ -0,0 +1,118 @@ + + + 4.0.0 + + + org.pentaho.di.plugins + pdi-plugins + 10.1.0.0-SNAPSHOT + + + sftpput + 10.1.0.0-SNAPSHOT + pom + + PDI SFTP put Plugin + This plugin is for pentaho Data integration (ETL) a.k.a kettle + http://www.pentaho.com/ + + + impl + ui + assemblies + + + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + 4.6 + 3.3.0-I20070606-0010 + 10.1.0.0-SNAPSHOT + + + + + + pentaho-kettle + kettle-engine + ${pdi.version} + provided + + + pentaho-kettle + kettle-core + ${pdi.version} + provided + + + pentaho-kettle + kettle-ui-swt + ${pdi.version} + provided + + + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86_64 + ${org.eclipse.swt.version} + provided + + + * + * + + + + + org.eclipse + jface + ${jface.version} + provided + + + * + * + + + + + + pentaho-kettle + kettle-core + ${pdi.version} + tests + test + + + pentaho-kettle + kettle-engine + ${pdi.version} + tests + test + + + + com.healthmarketscience.jackcess + jackcess + 1.2.6 + compile + + + * + * + + + + + + diff --git a/plugins/sftpput/ui/pom.xml b/plugins/sftpput/ui/pom.xml new file mode 100644 index 000000000000..cd8d652ba6e1 --- /dev/null +++ b/plugins/sftpput/ui/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + + org.pentaho.di.plugins + sftpput + 10.1.0.0-SNAPSHOT + + + sftpput-plugin-ui + PDI SFTP put Plugin UI + + + + org.pentaho.di.plugins + sftpput-plugin-impl + ${project.version} + + + + pentaho-kettle + kettle-core + provided + + + pentaho-kettle + kettle-engine + provided + + + pentaho-kettle + kettle-ui-swt + provided + + + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86_64 + provided + + + * + * + + + + + org.mockito + mockito-all + 1.10.19 + test + + + pentaho-kettle + kettle-engine + ${pdi.version} + tests + test + + + pentaho-kettle + kettle-core + ${pdi.version} + tests + test + + + org.pentaho.di.plugins + sftpput-plugin-impl + 9.6.0.0-SNAPSHOT + compile + + + org.pentaho.di.plugins + sftpput-plugin-impl + 10.1.0.0-SNAPSHOT + compile + + + + diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java b/plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java similarity index 99% rename from ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java rename to plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java index 8d8c523f9aef..f1104765f385 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java +++ b/plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java @@ -22,9 +22,6 @@ package org.pentaho.di.ui.trans.steps.sftpput; -import java.net.InetAddress; -import java.net.UnknownHostException; - import com.google.common.annotations.VisibleForTesting; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; @@ -52,11 +49,12 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.pentaho.di.core.Const; -import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.Props; +import org.pentaho.di.core.annotations.PluginDialog; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleJobException; import org.pentaho.di.core.row.RowMetaInterface; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.job.entries.sftp.SFTPClient; import org.pentaho.di.job.entries.sftpput.JobEntrySFTPPUT; @@ -74,12 +72,18 @@ import org.pentaho.di.ui.core.widget.TextVar; import org.pentaho.di.ui.trans.step.BaseStepDialog; +import java.net.InetAddress; +import java.net.UnknownHostException; + /** * Send file to SFTP host. * * @author Samatar Hassan * @since 30-April-2012 */ + +@PluginDialog( id = "SFTPPut", image = "SFP.svg", pluginType = PluginDialog.PluginType.STEP, + documentationUrl = "http://wiki.pentaho.com/display/EAI/SFTP+Put" ) public class SFTPPutDialog extends BaseStepDialog implements StepDialogInterface { //for i18n purposes, needed by Translator2!! private static Class PKG = org.pentaho.di.trans.steps.sftpput.SFTPPutMeta.class; diff --git a/ui/src/main/resources/ui/images/SFP.png b/plugins/sftpput/ui/src/main/resources/SFP.png similarity index 100% rename from ui/src/main/resources/ui/images/SFP.png rename to plugins/sftpput/ui/src/main/resources/SFP.png diff --git a/ui/src/main/resources/ui/images/SFP.svg b/plugins/sftpput/ui/src/main/resources/SFP.svg similarity index 98% rename from ui/src/main/resources/ui/images/SFP.svg rename to plugins/sftpput/ui/src/main/resources/SFP.svg index 280c7faab2f8..10d16317ef8e 100644 --- a/ui/src/main/resources/ui/images/SFP.svg +++ b/plugins/sftpput/ui/src/main/resources/SFP.svg @@ -1,61 +1,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/test/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialogTest.java b/plugins/sftpput/ui/src/test/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialogTest.java similarity index 95% rename from ui/src/test/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialogTest.java rename to plugins/sftpput/ui/src/test/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialogTest.java index 1fd15324d038..07221263f4f0 100644 --- a/ui/src/test/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialogTest.java +++ b/plugins/sftpput/ui/src/test/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialogTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2015 - 2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2015 - 2023 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,10 +33,11 @@ import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.steps.sftpput.SFTPPutMeta; import org.pentaho.di.ui.core.PropsUI; +import org.pentaho.di.ui.trans.steps.sftpput.SFTPPutDialog; import java.lang.reflect.Field; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.*; /**