This is an automated email from the ASF dual-hosted git repository.
mattcasters pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 3e6a49ce27 Fix Get mails (POP3/IMAP) IMAP Retrieve persistence and
2.13 XML load (#8379)
3e6a49ce27 is described below
commit 3e6a49ce27a536ae3bd244cf9ea7a963d051a00c
Author: Lance <[email protected]>
AuthorDate: Thu Sep 17 01:36:47 2026 +0800
Fix Get mails (POP3/IMAP) IMAP Retrieve persistence and 2.13 XML load
(#8379)
Signed-off-by: leehaut <[email protected]>
These suggestions are not enough to stop progress. Well done.
---
.../ROOT/pages/workflow/actions/getpop.adoc | 9 +-
integration-tests/deserialize/all-actions.hwf | 4 +
integration-tests/mail/main-0001-james-rest.hwf | 4 +
.../mail/main-0002-mail-transform.hwf | 4 +
integration-tests/mail/main-0003-mail-action.hwf | 4 +
.../main-0005-get-mails-action-from-connection.hwf | 4 +
.../main-0006-mail-transform-from-connection.hwf | 4 +
integration-tests/mail/main-0009-mail-with-zip.hwf | 4 +
.../mail/workflow/actions/getpop/ActionGetPOP.java | 25 ++-
.../actions/getpop/MailConnectionMeta.java | 129 ++++++++-------
.../getpop/ActionGetPOPSerializationTest.java | 76 +++++++++
.../workflow/actions/getpop/ActionGetPOPTest.java | 119 ++++++++++++++
.../actions/getpop/MailConnectionFilterTest.java | 21 ++-
.../actions/getpop/MailConnectionMetaTest.java | 175 +++++++++++++++++++++
.../actions/getpop/MailConnectionTest.java | 13 ++
.../getpop/WorkflowActionGetPOPLoadSaveTest.java | 24 ++-
...op-action.xml => getpop-action-legacy-2.13.xml} | 24 ++-
.../misc/mail/src/test/resources/getpop-action.xml | 4 +
18 files changed, 554 insertions(+), 93 deletions(-)
diff --git
a/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/getpop.adoc
b/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/getpop.adoc
index 7f8da61133..e837ea58fb 100644
--- a/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/getpop.adoc
+++ b/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/getpop.adoc
@@ -96,8 +96,10 @@ a|Select the e-mails to retrieve:
* Get not draft messages
* Get answered messages
* Get not answered messages
+
+The selected value is stored with the workflow (XML tag `valueimaplist`, for
example `imaplistunread`). Reopening the action keeps the same Retrieve option.
|Retrieve the first...emails|specify the number of messages to retrieve
-|After retrieved a|specfiy the action to perform on email messages after
retrieval:
+|After retrieved a|specify the action to perform on email messages after
retrieval:
* Do nothing
* Delete message
@@ -129,3 +131,8 @@ a|Select the e-mails to retrieve:
* Between `Date 1` and `Date 2`
|===
+== Notes
+
+* IMAP **Retrieve** (unread, new, flagged, and the other list options) is
stored with the workflow. Saving and reopening keeps the selected option.
+* Workflows saved in Hop 2.13 still load: date conditions such as `ignore` and
IMAP list codes such as `imaplistunread` are accepted, not only integer indexes.
+
diff --git a/integration-tests/deserialize/all-actions.hwf
b/integration-tests/deserialize/all-actions.hwf
index 3f86f27bef..a4558d3217 100644
--- a/integration-tests/deserialize/all-actions.hwf
+++ b/integration-tests/deserialize/all-actions.hwf
@@ -652,6 +652,10 @@ limitations under the License.
<password>Encrypted </password>
<protocol>POP3</protocol>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistunread</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<usedifferentfolderforattachment>N</usedifferentfolderforattachment>
diff --git a/integration-tests/mail/main-0001-james-rest.hwf
b/integration-tests/mail/main-0001-james-rest.hwf
index 2d51ae2baf..15dc86dea2 100644
--- a/integration-tests/mail/main-0001-james-rest.hwf
+++ b/integration-tests/mail/main-0001-james-rest.hwf
@@ -147,6 +147,10 @@ curl -XPUT
http://${MAIL_SMTP_SERVER}:8000/users/[email protected] -d '{"pass
<password>Encrypted 2be98afc86aa7f2e4bb18bd63c99dbdde</password>
<protocol>IMAP</protocol>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistall</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<servername>${MAIL_SMTP_SERVER}</servername>
diff --git a/integration-tests/mail/main-0002-mail-transform.hwf
b/integration-tests/mail/main-0002-mail-transform.hwf
index 8c0ea05ccf..94d0a1f328 100644
--- a/integration-tests/mail/main-0002-mail-transform.hwf
+++ b/integration-tests/mail/main-0002-mail-transform.hwf
@@ -143,6 +143,10 @@ limitations under the License.
<receivedDate2/>
<recipientsearch/>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistall</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<sendersearch/>
diff --git a/integration-tests/mail/main-0003-mail-action.hwf
b/integration-tests/mail/main-0003-mail-action.hwf
index 46bff8ddad..5ca7ab71f7 100644
--- a/integration-tests/mail/main-0003-mail-action.hwf
+++ b/integration-tests/mail/main-0003-mail-action.hwf
@@ -154,6 +154,10 @@ limitations under the License.
<receivedDate2/>
<recipientsearch/>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistall</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<sendersearch/>
diff --git
a/integration-tests/mail/main-0005-get-mails-action-from-connection.hwf
b/integration-tests/mail/main-0005-get-mails-action-from-connection.hwf
index 2a17a0e60e..7c0226cb40 100644
--- a/integration-tests/mail/main-0005-get-mails-action-from-connection.hwf
+++ b/integration-tests/mail/main-0005-get-mails-action-from-connection.hwf
@@ -155,6 +155,10 @@ limitations under the License.
<receivedDate2/>
<recipientsearch/>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistall</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<sendersearch/>
diff --git
a/integration-tests/mail/main-0006-mail-transform-from-connection.hwf
b/integration-tests/mail/main-0006-mail-transform-from-connection.hwf
index 846fec73fd..2394660a16 100644
--- a/integration-tests/mail/main-0006-mail-transform-from-connection.hwf
+++ b/integration-tests/mail/main-0006-mail-transform-from-connection.hwf
@@ -145,6 +145,10 @@ limitations under the License.
<receivedDate2/>
<recipientsearch/>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistall</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<sendersearch/>
diff --git a/integration-tests/mail/main-0009-mail-with-zip.hwf
b/integration-tests/mail/main-0009-mail-with-zip.hwf
index 54f9fa8dfa..ed51945922 100644
--- a/integration-tests/mail/main-0009-mail-with-zip.hwf
+++ b/integration-tests/mail/main-0009-mail-with-zip.hwf
@@ -70,6 +70,10 @@ limitations under the License.
<password>Encrypted 2be98afc86aa7f2e4bb18bd63c99dbdde</password>
<protocol>IMAP</protocol>
<retrievemails>0</retrievemails>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistall</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<servername>${MAIL_SMTP_SERVER}</servername>
diff --git
a/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOP.java
b/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOP.java
index 38002f99db..1c070b6042 100644
---
a/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOP.java
+++
b/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOP.java
@@ -70,7 +70,6 @@ import
org.apache.hop.workflow.action.validator.ValidatorContext;
keywords = "i18n::ActionGetPOP.keyword",
documentationUrl = "/workflow/actions/getpop.html",
actionTransformTypes = {ActionTransformType.MAIL})
-@SuppressWarnings("java:S1104")
public class ActionGetPOP extends ActionBase implements Cloneable, IAction {
private static final Class<?> PKG = ActionGetPOP.class;
private static final String CONST_PASSWORD = "password";
@@ -84,15 +83,25 @@ public class ActionGetPOP extends ActionBase implements
Cloneable, IAction {
public static final String
ACTION_GET_MAILS_FROM_POP_ERROR_RECEIVED_DATES_SEARCH_TERM_EMPTY =
"ActionGetMailsFromPOP.Error.ReceivedDatesSearchTermEmpty";
- public int actionType;
+ @HopMetadataProperty(
+ key = "actiontype",
+ intCodeConverter = MailConnectionMeta.ActionTypeConverter.class)
+ private int actionType;
- @HopMetadataProperty(key = "conditionreceiveddate")
- public int conditionReceivedDate;
+ @HopMetadataProperty(
+ key = "conditionreceiveddate",
+ intCodeConverter = MailConnectionMeta.ConditionDateConverter.class)
+ private int conditionReceivedDate;
- public int valueIMAPList;
+ @HopMetadataProperty(
+ key = "valueimaplist",
+ intCodeConverter = MailConnectionMeta.ValueImapListConverter.class)
+ private int valueIMAPList;
- @HopMetadataProperty(key = "aftergetimap")
- public int afterGetIMAP;
+ @HopMetadataProperty(
+ key = "aftergetimap",
+ intCodeConverter = MailConnectionMeta.AfterGetImapConverter.class)
+ private int afterGetIMAP;
@HopMetadataProperty(key = "servername")
private String serverName;
@@ -128,7 +137,7 @@ public class ActionGetPOP extends ActionBase implements
Cloneable, IAction {
private String firstMails;
@HopMetadataProperty(key = "retrievemails")
- public int retrieveMails;
+ private int retrieveMails;
@HopMetadataProperty private boolean delete;
diff --git
a/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMeta.java
b/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMeta.java
index dc35305e72..b85df859e0 100644
---
a/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMeta.java
+++
b/plugins/misc/mail/src/main/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMeta.java
@@ -19,6 +19,7 @@ package org.apache.hop.mail.workflow.actions.getpop;
import org.apache.commons.lang3.StringUtils;
import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.metadata.api.IIntCodeConverter;
/** MailConnection handles the process of connecting to, reading from
POP3/IMAP. */
public class MailConnectionMeta {
@@ -130,69 +131,48 @@ public class MailConnectionMeta {
return valueIMAPListCode[i];
}
- public static int getConditionByCode(String tt) {
- if (tt == null) {
+ /**
+ * Resolve a persisted code. Accepts the historical string codes ({@code
ignore}, {@code
+ * imaplistunread}, {@code nothing}, …) and integer indexes written by Hop
2.19 before converters
+ * were added.
+ */
+ static int parseCodeOrInt(String value, String[] codes) {
+ if (StringUtils.isBlank(value)) {
return 0;
}
-
- for (int i = 0; i < conditionDateCode.length; i++) {
- if (conditionDateCode[i].equalsIgnoreCase(tt)) {
+ String trimmed = value.trim();
+ for (int i = 0; i < codes.length; i++) {
+ if (codes[i].equalsIgnoreCase(trimmed)) {
return i;
}
}
+ if (StringUtils.isNumeric(trimmed)) {
+ int parsed = Integer.parseInt(trimmed);
+ if (parsed >= 0 && parsed < codes.length) {
+ return parsed;
+ }
+ }
return 0;
}
- public static int getActionTypeByCode(String tt) {
- if (tt == null) {
- return 0;
- }
+ public static int getConditionByCode(String tt) {
+ return parseCodeOrInt(tt, conditionDateCode);
+ }
- for (int i = 0; i < actionTypeCode.length; i++) {
- if (actionTypeCode[i].equalsIgnoreCase(tt)) {
- return i;
- }
- }
- return 0;
+ public static int getActionTypeByCode(String tt) {
+ return parseCodeOrInt(tt, actionTypeCode);
}
public static int getAfterGetIMAPByCode(String tt) {
- if (tt == null) {
- return 0;
- }
-
- for (int i = 0; i < afterGetIMAPCode.length; i++) {
- if (afterGetIMAPCode[i].equalsIgnoreCase(tt)) {
- return i;
- }
- }
- return 0;
+ return parseCodeOrInt(tt, afterGetIMAPCode);
}
public static int getValueImapListByCode(String tt) {
- if (tt == null) {
- return 0;
- }
-
- for (int i = 0; i < valueIMAPListCode.length; i++) {
- if (valueIMAPListCode[i].equalsIgnoreCase(tt)) {
- return i;
- }
- }
- return 0;
+ return parseCodeOrInt(tt, valueIMAPListCode);
}
public static int getValueListImapListByCode(String tt) {
- if (tt == null) {
- return 0;
- }
-
- for (int i = 0; i < valueIMAPListCode.length; i++) {
- if (valueIMAPListCode[i].equalsIgnoreCase(tt)) {
- return i;
- }
- }
- return 0;
+ return getValueImapListByCode(tt);
}
public static String getActionTypeCode(int i) {
@@ -306,27 +286,66 @@ public class MailConnectionMeta {
}
public static int getConditionDateByCode(String tt) {
- if (tt == null) {
- return 0;
+ return getConditionByCode(tt);
+ }
+
+ public static final class ActionTypeConverter implements IIntCodeConverter {
+ @Override
+ public String getCode(int type) {
+ return getActionTypeCode(type);
}
- for (int i = 0; i < conditionDateCode.length; i++) {
- if (conditionDateCode[i].equalsIgnoreCase(tt)) {
- return i;
- }
+ @Override
+ public int getType(String code) {
+ return getActionTypeByCode(code);
+ }
+ }
+
+ public static final class ConditionDateConverter implements
IIntCodeConverter {
+ @Override
+ public String getCode(int type) {
+ return getConditionDateCode(type);
+ }
+
+ @Override
+ public int getType(String code) {
+ return getConditionDateByCode(code);
+ }
+ }
+
+ public static final class ValueImapListConverter implements
IIntCodeConverter {
+ @Override
+ public String getCode(int type) {
+ return getValueImapListCode(type);
+ }
+
+ @Override
+ public int getType(String code) {
+ return getValueImapListByCode(code);
+ }
+ }
+
+ public static final class AfterGetImapConverter implements IIntCodeConverter
{
+ @Override
+ public String getCode(int type) {
+ return getAfterGetIMAPCode(type);
+ }
+
+ @Override
+ public int getType(String code) {
+ return getAfterGetIMAPByCode(code);
}
- return 0;
}
public static int getProtocolFromString(String protocolCode, int
defaultProtocol) {
if (protocolCode == null) {
return defaultProtocol;
}
- if (protocolCode.toUpperCase().equals(PROTOCOL_STRING_IMAP)) {
+ if (protocolCode.equalsIgnoreCase(PROTOCOL_STRING_IMAP)) {
return PROTOCOL_IMAP;
- } else if (protocolCode.toUpperCase().equals(PROTOCOL_STRING_POP3)) {
+ } else if (protocolCode.equalsIgnoreCase(PROTOCOL_STRING_POP3)) {
return PROTOCOL_POP3;
- } else if (protocolCode.toUpperCase().equals(PROTOCOL_STRING_MBOX)) {
+ } else if (protocolCode.equalsIgnoreCase(PROTOCOL_STRING_MBOX)) {
return PROTOCOL_MBOX;
}
return defaultProtocol;
diff --git
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPSerializationTest.java
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPSerializationTest.java
index 900b577bed..559a0de93a 100644
---
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPSerializationTest.java
+++
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPSerializationTest.java
@@ -21,11 +21,16 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.hop.core.HopClientEnvironment;
+import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil;
import org.apache.hop.workflow.action.ActionSerializationTestUtil;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+/** Unit test for {@link ActionGetPOP} */
class ActionGetPOPSerializationTest {
@BeforeAll
@@ -53,5 +58,76 @@ class ActionGetPOPSerializationTest {
assertEquals("[email protected]", action.getSenderSearch());
assertEquals("invoice", action.getSubjectSearch());
assertEquals("urgent", action.getBodySearch());
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
action.getValueIMAPList());
+ assertEquals(MailConnectionMeta.CONDITION_DATE_IGNORE,
action.getConditionReceivedDate());
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_NOTHING,
action.getAfterGetIMAP());
+ assertEquals(MailConnectionMeta.ACTION_TYPE_GET, action.getActionType());
+ }
+
+ @Test
+ void imapRetrieveUnreadSurvivesRoundTrip() throws Exception {
+ ActionGetPOP original = new ActionGetPOP("Get mails (POP3/IMAP)");
+ original.setProtocol("IMAP");
+ original.setValueIMAPList(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD);
+ original.setActionType(MailConnectionMeta.ACTION_TYPE_MOVE);
+ original.setAfterGetIMAP(MailConnectionMeta.AFTER_GET_IMAP_DELETE);
+
original.setConditionReceivedDate(MailConnectionMeta.CONDITION_DATE_GREATER);
+
+ String xml = ActionSerializationTestUtil.getXml(original);
+ assertTrue(xml.contains("<valueimaplist>imaplistunread</valueimaplist>"),
xml);
+ assertTrue(xml.contains("<actiontype>move</actiontype>"), xml);
+ assertTrue(xml.contains("<aftergetimap>delete</aftergetimap>"), xml);
+
assertTrue(xml.contains("<conditionreceiveddate>greater</conditionreceiveddate>"),
xml);
+
+ Document copyDocument = XmlHandler.loadXmlString(xml);
+ Node copyNode = XmlHandler.getSubNode(copyDocument, "action");
+ ActionGetPOP copy =
+ XmlMetadataUtil.deSerializeFromXml(
+ copyNode, ActionGetPOP.class, new MemoryMetadataProvider());
+
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
copy.getValueIMAPList());
+ assertEquals(MailConnectionMeta.ACTION_TYPE_MOVE, copy.getActionType());
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_DELETE,
copy.getAfterGetIMAP());
+ assertEquals(MailConnectionMeta.CONDITION_DATE_GREATER,
copy.getConditionReceivedDate());
+ }
+
+ @Test
+ void hop213LegacyIgnoreAndUnreadCodesLoad() throws Exception {
+ MemoryMetadataProvider provider = new MemoryMetadataProvider();
+ ActionGetPOP action =
+ ActionSerializationTestUtil.testSerialization(
+ "/getpop-action-legacy-2.13.xml", ActionGetPOP.class, provider);
+
+ assertEquals("IMAP", action.getProtocol());
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
action.getValueIMAPList());
+ assertEquals(MailConnectionMeta.CONDITION_DATE_IGNORE,
action.getConditionReceivedDate());
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_NOTHING,
action.getAfterGetIMAP());
+ assertEquals(MailConnectionMeta.ACTION_TYPE_GET, action.getActionType());
+ }
+
+ @Test
+ void hop219IntegerCodesStillLoad() throws Exception {
+ String xml =
+ """
+ <action>
+ <name>Get mails (POP3/IMAP)</name>
+ <type>GET_POP</type>
+ <protocol>IMAP</protocol>
+ <valueimaplist>4</valueimaplist>
+ <conditionreceiveddate>0</conditionreceiveddate>
+ <aftergetimap>1</aftergetimap>
+ <actiontype>2</actiontype>
+ </action>
+ """;
+
+ Document document = XmlHandler.loadXmlString(xml);
+ Node node = XmlHandler.getSubNode(document, "action");
+ ActionGetPOP action =
+ XmlMetadataUtil.deSerializeFromXml(node, ActionGetPOP.class, new
MemoryMetadataProvider());
+
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
action.getValueIMAPList());
+ assertEquals(MailConnectionMeta.CONDITION_DATE_IGNORE,
action.getConditionReceivedDate());
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_DELETE,
action.getAfterGetIMAP());
+ assertEquals(MailConnectionMeta.ACTION_TYPE_DELETE,
action.getActionType());
}
}
diff --git
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPTest.java
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPTest.java
new file mode 100644
index 0000000000..fe5c45ef32
--- /dev/null
+++
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/ActionGetPOPTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.mail.workflow.actions.getpop;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.hop.core.HopClientEnvironment;
+import org.apache.hop.core.ICheckResult;
+import org.apache.hop.core.variables.Variables;
+import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
+import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.workflow.WorkflowMeta;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+/** Unit test for {@link ActionGetPOP} */
+class ActionGetPOPTest {
+
+ @RegisterExtension
+ static RestoreHopEngineEnvironmentExtension env = new
RestoreHopEngineEnvironmentExtension();
+
+ @BeforeAll
+ static void setUpBeforeClass() throws Exception {
+ HopClientEnvironment.init();
+ }
+
+ @Test
+ void defaultsUsePop3AllMessagesAndGetAction() {
+ ActionGetPOP action = new ActionGetPOP("mails");
+ assertEquals("mails", action.getName());
+ assertEquals(MailConnectionMeta.PROTOCOL_STRING_POP3,
action.getProtocol());
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_ALL,
action.getValueIMAPList());
+ assertEquals(MailConnectionMeta.ACTION_TYPE_GET, action.getActionType());
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_NOTHING,
action.getAfterGetIMAP());
+ assertEquals(0, action.getRetrieveMails());
+ assertTrue(action.isSaveMessage());
+ assertTrue(action.isSaveAttachment());
+ assertTrue(action.isEvaluation());
+ }
+
+ @Test
+ void realAccessorsResolveVariables() {
+ ActionGetPOP action = new ActionGetPOP();
+ action.setVariable("MAIL_HOST", "imap.example.com");
+ action.setVariable("MAIL_USER", "alice");
+ action.setVariable("MAIL_PORT", "993");
+ action.setVariable("MAIL_DIR", "/tmp/out");
+ action.setVariable("MAIL_ATTACH", "/tmp/att");
+ action.setVariable("MAIL_PROXY", "proxy-user");
+ action.setVariable("MAIL_PATTERN", "msg_${MAIL_USER}.eml");
+
+ action.setServerName("${MAIL_HOST}");
+ action.setUserName("${MAIL_USER}");
+ action.setSslPort("${MAIL_PORT}");
+ action.setOutputDirectory("${MAIL_DIR}");
+ action.setAttachmentFolder("${MAIL_ATTACH}");
+ action.setProxyUsername("${MAIL_PROXY}");
+ action.setFilenamePattern("${MAIL_PATTERN}");
+
+ assertEquals("imap.example.com", action.getRealServername());
+ assertEquals("alice", action.getRealUsername());
+ assertEquals("993", action.getRealPort());
+ assertEquals("/tmp/out", action.getRealOutputDirectory());
+ assertEquals("/tmp/att", action.getRealAttachmentFolder());
+ assertEquals("proxy-user", action.getRealProxyUsername());
+ assertEquals("msg_alice.eml", action.getRealFilenamePattern());
+ }
+
+ @Test
+ void checkReportsMissingServer() {
+ ActionGetPOP action = new ActionGetPOP("mails");
+ List<ICheckResult> remarks = new ArrayList<>();
+ action.check(remarks, new WorkflowMeta(), new Variables(), new
MemoryMetadataProvider());
+ assertTrue(remarks.stream().anyMatch(r -> r.getType() ==
ICheckResult.TYPE_RESULT_ERROR));
+ }
+
+ @Test
+ void createOutputDirectoryRejectsUnknownFolderType() {
+ ActionGetPOP action = new ActionGetPOP();
+ assertThrows(IllegalArgumentException.class, () ->
action.createOutputDirectory(99));
+ }
+
+ @Test
+ void lombokAccessorsCoverImapRetrieveSettings() {
+ ActionGetPOP action = new ActionGetPOP();
+ action.setValueIMAPList(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD);
+ action.setActionType(MailConnectionMeta.ACTION_TYPE_MOVE);
+ action.setAfterGetIMAP(MailConnectionMeta.AFTER_GET_IMAP_MOVE);
+ action.setConditionReceivedDate(MailConnectionMeta.CONDITION_DATE_BETWEEN);
+ action.setImapFolder("Archive");
+ action.setIncludeSubFolders(true);
+
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
action.getValueIMAPList());
+ assertEquals(MailConnectionMeta.ACTION_TYPE_MOVE, action.getActionType());
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_MOVE,
action.getAfterGetIMAP());
+ assertEquals(MailConnectionMeta.CONDITION_DATE_BETWEEN,
action.getConditionReceivedDate());
+ assertEquals("Archive", action.getImapFolder());
+ assertTrue(action.isIncludeSubFolders());
+ }
+}
diff --git
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionFilterTest.java
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionFilterTest.java
index 41a98e95a9..ed4322b18f 100644
---
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionFilterTest.java
+++
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionFilterTest.java
@@ -44,6 +44,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+/** Unit test for {@link MailConnection} */
class MailConnectionFilterTest {
private MailConnection conn;
@@ -55,7 +56,7 @@ class MailConnectionFilterTest {
}
@BeforeEach
- void setUp() throws HopException, MessagingException {
+ void setUp() throws HopException {
ILogChannel log = new LogChannel(new Object());
conn =
new MailConnection(
@@ -90,12 +91,28 @@ class MailConnectionFilterTest {
assertNull(conn.getSearchTerm());
}
+ @Test
+ void recipientTermEmptyIsNoop() {
+ conn.setReceipientTerm("");
+ conn.setReceipientTerm(null);
+ assertNull(conn.getSearchTerm());
+ }
+
@Test
void recipientTermAdded() {
conn.setReceipientTerm("[email protected]");
assertInstanceOf(RecipientStringTerm.class, conn.getSearchTerm());
}
+ @Test
+ void subjectAndBodyEmptyAreNoop() {
+ conn.setSubjectTerm("", false);
+ conn.setSubjectTerm(null, true);
+ conn.setBodyTerm("", false);
+ conn.setBodyTerm(null, true);
+ assertNull(conn.getSearchTerm());
+ }
+
@Test
void subjectTermAdded() {
conn.setSubjectTerm("invoice", false);
@@ -128,7 +145,7 @@ class MailConnectionFilterTest {
}
@Test
- void receivedDateTermsAreSkippedForPop3() throws HopException,
MessagingException {
+ void receivedDateTermsAreSkippedForPop3() throws HopException {
MailConnection pop3 =
new MailConnection(
new LogChannel(new Object()),
diff --git
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMetaTest.java
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMetaTest.java
new file mode 100644
index 0000000000..f4e383cb9e
--- /dev/null
+++
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionMetaTest.java
@@ -0,0 +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.mail.workflow.actions.getpop;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.hop.core.HopClientEnvironment;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+/** Unit test for {@link MailConnectionMeta} */
+class MailConnectionMetaTest {
+
+ @BeforeAll
+ static void setUpBeforeClass() throws Exception {
+ HopClientEnvironment.init();
+ }
+
+ @Test
+ void parseCodeOrIntAcceptsBlankUnknownAndOutOfRange() {
+ assertEquals(0, MailConnectionMeta.parseCodeOrInt(null,
MailConnectionMeta.conditionDateCode));
+ assertEquals(0, MailConnectionMeta.parseCodeOrInt(" ",
MailConnectionMeta.conditionDateCode));
+ assertEquals(
+ 0, MailConnectionMeta.parseCodeOrInt("nope",
MailConnectionMeta.conditionDateCode));
+ assertEquals(0, MailConnectionMeta.parseCodeOrInt("99",
MailConnectionMeta.conditionDateCode));
+ assertEquals(0, MailConnectionMeta.parseCodeOrInt("-1",
MailConnectionMeta.conditionDateCode));
+ }
+
+ @Test
+ void conditionDateCodesAndIndexesRoundTrip() {
+ assertEquals(
+ MailConnectionMeta.CONDITION_DATE_IGNORE,
+ MailConnectionMeta.getConditionDateByCode("ignore"));
+ assertEquals(
+ MailConnectionMeta.CONDITION_DATE_EQUAL,
+ MailConnectionMeta.getConditionDateByCode("equal"));
+ assertEquals(
+ MailConnectionMeta.CONDITION_DATE_BETWEEN,
+ MailConnectionMeta.getConditionByCode("between"));
+ assertEquals(
+ MailConnectionMeta.CONDITION_DATE_GREATER,
MailConnectionMeta.getConditionDateByCode("3"));
+ assertEquals("ignore", MailConnectionMeta.getConditionDateCode(0));
+ assertEquals("ignore", MailConnectionMeta.getConditionDateCode(-1));
+ assertEquals("ignore", MailConnectionMeta.getConditionDateCode(99));
+ }
+
+ @Test
+ void imapListCodesAndIndexesRoundTrip() {
+ assertEquals(
+ MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
+ MailConnectionMeta.getValueImapListByCode("imaplistunread"));
+ assertEquals(
+ MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
MailConnectionMeta.getValueImapListByCode("4"));
+ assertEquals(
+ MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
+ MailConnectionMeta.getValueListImapListByCode("imaplistunread"));
+ assertEquals("imaplistall", MailConnectionMeta.getValueImapListCode(-5));
+ assertEquals(
+ "imaplistunread",
+
MailConnectionMeta.getValueImapListCode(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD));
+ }
+
+ @Test
+ void actionTypeAndAfterGetCodesRoundTrip() {
+ assertEquals(
+ MailConnectionMeta.ACTION_TYPE_MOVE,
MailConnectionMeta.getActionTypeByCode("move"));
+ assertEquals(
+ MailConnectionMeta.ACTION_TYPE_DELETE,
MailConnectionMeta.getActionTypeByCode("2"));
+ assertEquals(
+ MailConnectionMeta.AFTER_GET_IMAP_MOVE,
MailConnectionMeta.getAfterGetIMAPByCode("move"));
+ assertEquals(
+ MailConnectionMeta.AFTER_GET_IMAP_DELETE,
MailConnectionMeta.getAfterGetIMAPByCode("1"));
+ assertEquals("get", MailConnectionMeta.getActionTypeCode(99));
+ assertEquals("nothing", MailConnectionMeta.getAfterGetIMAPCode(-1));
+ }
+
+ @Test
+ void descLookupsFallBackToCode() {
+ assertEquals(
+ MailConnectionMeta.VALUE_IMAP_LIST_NEW,
+ MailConnectionMeta.getValueImapListByDesc("imaplistnew"));
+ assertEquals(
+ MailConnectionMeta.CONDITION_DATE_SMALLER,
+ MailConnectionMeta.getConditionDateByDesc("smaller"));
+ assertEquals(MailConnectionMeta.ACTION_TYPE_GET,
MailConnectionMeta.getActionTypeByDesc("get"));
+ assertEquals(
+ MailConnectionMeta.AFTER_GET_IMAP_NOTHING,
+ MailConnectionMeta.getAfterGetIMAPByDesc("nothing"));
+ assertEquals(0, MailConnectionMeta.getValueImapListByDesc(null));
+ assertEquals(0, MailConnectionMeta.getConditionDateByDesc(" "));
+ assertEquals(0, MailConnectionMeta.getActionTypeByDesc(null));
+ assertEquals(0, MailConnectionMeta.getAfterGetIMAPByDesc(null));
+ }
+
+ @Test
+ void descByIndexFallsBackToFirstEntry() {
+ assertEquals(
+ MailConnectionMeta.getValueImapListDesc(0),
MailConnectionMeta.getValueImapListDesc(-1));
+ assertEquals(
+ MailConnectionMeta.getConditionDateDesc(0),
MailConnectionMeta.getConditionDateDesc(50));
+ assertEquals(MailConnectionMeta.getActionTypeDesc(0),
MailConnectionMeta.getActionTypeDesc(-2));
+ assertEquals(
+ MailConnectionMeta.getAfterGetIMAPDesc(0),
MailConnectionMeta.getAfterGetIMAPDesc(9));
+ }
+
+ @Test
+ void protocolFromString() {
+ assertEquals(
+ MailConnectionMeta.PROTOCOL_IMAP,
+ MailConnectionMeta.getProtocolFromString("IMAP",
MailConnectionMeta.PROTOCOL_POP3));
+ assertEquals(
+ MailConnectionMeta.PROTOCOL_POP3,
+ MailConnectionMeta.getProtocolFromString("pop3",
MailConnectionMeta.PROTOCOL_IMAP));
+ assertEquals(
+ MailConnectionMeta.PROTOCOL_MBOX,
+ MailConnectionMeta.getProtocolFromString("MBOX",
MailConnectionMeta.PROTOCOL_POP3));
+ assertEquals(
+ MailConnectionMeta.PROTOCOL_POP3,
+ MailConnectionMeta.getProtocolFromString(null,
MailConnectionMeta.PROTOCOL_POP3));
+ assertEquals(
+ MailConnectionMeta.PROTOCOL_IMAP,
+ MailConnectionMeta.getProtocolFromString("nntp",
MailConnectionMeta.PROTOCOL_IMAP));
+ }
+
+ @Test
+ void convertersMatchStaticHelpers() {
+ MailConnectionMeta.ValueImapListConverter imap =
+ new MailConnectionMeta.ValueImapListConverter();
+ assertEquals("imaplistunread",
imap.getCode(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD));
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
imap.getType("imaplistunread"));
+ assertEquals(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD, imap.getType("4"));
+
+ MailConnectionMeta.ConditionDateConverter date =
+ new MailConnectionMeta.ConditionDateConverter();
+ assertEquals("ignore", date.getCode(0));
+ assertEquals(MailConnectionMeta.CONDITION_DATE_IGNORE,
date.getType("ignore"));
+
+ MailConnectionMeta.ActionTypeConverter action = new
MailConnectionMeta.ActionTypeConverter();
+ assertEquals("delete",
action.getCode(MailConnectionMeta.ACTION_TYPE_DELETE));
+ assertEquals(MailConnectionMeta.ACTION_TYPE_MOVE, action.getType("move"));
+
+ MailConnectionMeta.AfterGetImapConverter after = new
MailConnectionMeta.AfterGetImapConverter();
+ assertEquals("nothing", after.getCode(0));
+ assertEquals(MailConnectionMeta.AFTER_GET_IMAP_DELETE,
after.getType("delete"));
+ }
+
+ @Test
+ void descLookupUsesDisplayedLabel() {
+ String unreadLabel =
+
MailConnectionMeta.getValueImapListDesc(MailConnectionMeta.VALUE_IMAP_LIST_UNREAD);
+ assertEquals(
+ MailConnectionMeta.VALUE_IMAP_LIST_UNREAD,
+ MailConnectionMeta.getValueImapListByDesc(unreadLabel));
+
+ String ignoreLabel =
+
MailConnectionMeta.getConditionDateDesc(MailConnectionMeta.CONDITION_DATE_IGNORE);
+ assertEquals(
+ MailConnectionMeta.CONDITION_DATE_IGNORE,
+ MailConnectionMeta.getConditionDateByDesc(ignoreLabel));
+ }
+}
diff --git
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionTest.java
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionTest.java
index 99b142eb25..ac39416d0f 100644
---
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionTest.java
+++
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/MailConnectionTest.java
@@ -34,6 +34,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
+/** Unit test for{@link MailConnection} */
class MailConnectionTest {
private Mconn conn;
@@ -45,6 +46,18 @@ class MailConnectionTest {
conn = new Mconn(log);
}
+ @Test
+ void constructorStoresConnectionSettings() {
+ Assertions.assertEquals("junit", conn.getServer());
+ Assertions.assertEquals(0, conn.getPort());
+ Assertions.assertEquals("junit", conn.getUsername());
+ Assertions.assertFalse(conn.isUseSSL());
+ Assertions.assertFalse(conn.isUseXOAUTH2());
+ Assertions.assertFalse(conn.isUseProxy());
+ Assertions.assertEquals("junit", conn.getProxyUsername());
+ Assertions.assertFalse(conn.isConnected());
+ }
+
/**
* Test {@link MailConnection#openFolder(String, boolean, boolean)} method.
tests that folders are
* opened recursively
diff --git
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java
index 01b6952d35..3ae86360db 100644
---
a/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java
+++
b/plugins/misc/mail/src/test/java/org/apache/hop/mail/workflow/actions/getpop/WorkflowActionGetPOPLoadSaveTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.hop.mail.workflow.actions.getpop;
import java.util.Arrays;
@@ -55,8 +54,7 @@ class WorkflowActionGetPOPLoadSaveTest extends
WorkflowActionLoadSaveTestSupport
"protocol",
"attachmentFolder",
"attachmentWildcard",
- // "valueIMAPList",
- "firstMails",
+ "valueIMAPList",
"imapFolder",
"senderSearch",
"notTermSenderSearch",
@@ -66,11 +64,11 @@ class WorkflowActionGetPOPLoadSaveTest extends
WorkflowActionLoadSaveTestSupport
"notTermSubjectSearch",
"bodySearch",
"notTermBodySearch",
- // "conditionReceivedDate",
+ "conditionReceivedDate",
"notTermReceivedDateSearch",
"receivedDate1",
"receivedDate2",
- // "actionType",
+ "actionType",
"moveToIMAPFolder",
"createMoveToFolder",
"createLocalFolder",
@@ -83,17 +81,15 @@ class WorkflowActionGetPOPLoadSaveTest extends
WorkflowActionLoadSaveTestSupport
@Override
protected Map<String, IFieldLoadSaveValidator<?>>
createAttributeValidatorsMap() {
Map<String, IFieldLoadSaveValidator<?>> validators = new HashMap<>();
- // validators.put(
- // "valueIMAPList", new
- // IntLoadSaveValidator(MailConnectionMeta.valueIMAPListCode.length));
- // validators.put(
- // "conditionReceivedDate",
- // new
IntLoadSaveValidator(MailConnectionMeta.conditionDateCode.length));
- // validators.put(
- // "actionType", new
IntLoadSaveValidator(MailConnectionMeta.actionTypeCode.length));
+ validators.put(
+ "valueIMAPList", new
IntLoadSaveValidator(MailConnectionMeta.valueIMAPListCode.length));
+ validators.put(
+ "conditionReceivedDate",
+ new IntLoadSaveValidator(MailConnectionMeta.conditionDateCode.length));
+ validators.put(
+ "actionType", new
IntLoadSaveValidator(MailConnectionMeta.actionTypeCode.length));
validators.put(
"afterGetIMAP", new
IntLoadSaveValidator(MailConnectionMeta.afterGetIMAPCode.length));
-
return validators;
}
}
diff --git a/plugins/misc/mail/src/test/resources/getpop-action.xml
b/plugins/misc/mail/src/test/resources/getpop-action-legacy-2.13.xml
similarity index 76%
copy from plugins/misc/mail/src/test/resources/getpop-action.xml
copy to plugins/misc/mail/src/test/resources/getpop-action-legacy-2.13.xml
index d71492e6e7..38c015ad7e 100644
--- a/plugins/misc/mail/src/test/resources/getpop-action.xml
+++ b/plugins/misc/mail/src/test/resources/getpop-action-legacy-2.13.xml
@@ -17,7 +17,7 @@
-->
<action>
<name>Get mails (POP3/IMAP)</name>
- <description/>
+ <description>Saved in Hop 2.13 with IMAP Retrieve = Get unread
messages</description>
<type>GET_POP</type>
<servername>imap.example.com</servername>
<username>alice</username>
@@ -25,26 +25,24 @@
<usessl>Y</usessl>
<sslport>993</sslport>
<usexoauth2>N</usexoauth2>
- <useproxy>N</useproxy>
<outputdirectory>/tmp/mail</outputdirectory>
- <filenamepattern>mail_%date</filenamepattern>
- <firstmails>5</firstmails>
+
<filenamepattern>name_{SYS|hhmmss_MMddyyyy|}_#IdFile#.mail</filenamepattern>
+ <retrievemails>0</retrievemails>
<delete>N</delete>
<protocol>IMAP</protocol>
- <saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
+ <saveattachment>Y</saveattachment>
<usedifferentfolderforattachment>N</usedifferentfolderforattachment>
- <imapfirstmails>10</imapfirstmails>
+ <valueimaplist>imaplistunread</valueimaplist>
+ <imapfirstmails>0</imapfirstmails>
<imapfolder>INBOX</imapfolder>
- <sendersearch>[email protected]</sendersearch>
- <nottermsendersearch>N</nottermsendersearch>
- <recipientsearch>[email protected]</recipientsearch>
- <subjectsearch>invoice</subjectsearch>
- <bodysearch>urgent</bodysearch>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <actiontype>get</actiontype>
+ <aftergetimap>nothing</aftergetimap>
<includesubfolders>N</includesubfolders>
<attributes/>
<parallel>N</parallel>
- <xloc>240</xloc>
- <yloc>128</yloc>
+ <xloc>336</xloc>
+ <yloc>96</yloc>
<attributes_hac/>
</action>
diff --git a/plugins/misc/mail/src/test/resources/getpop-action.xml
b/plugins/misc/mail/src/test/resources/getpop-action.xml
index d71492e6e7..d6f5423607 100644
--- a/plugins/misc/mail/src/test/resources/getpop-action.xml
+++ b/plugins/misc/mail/src/test/resources/getpop-action.xml
@@ -31,6 +31,10 @@
<firstmails>5</firstmails>
<delete>N</delete>
<protocol>IMAP</protocol>
+ <actiontype>get</actiontype>
+ <valueimaplist>imaplistunread</valueimaplist>
+ <conditionreceiveddate>ignore</conditionreceiveddate>
+ <aftergetimap>nothing</aftergetimap>
<saveattachment>Y</saveattachment>
<savemessage>Y</savemessage>
<usedifferentfolderforattachment>N</usedifferentfolderforattachment>