From f14f940389346a2b6e6a1940accbda69cde62ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lehel=20Bo=C3=A9r?= Date: Tue, 27 Sep 2022 11:34:13 +0200 Subject: [PATCH] NIFI-10551: Improve GetHubSpot documentation This closes #6452. Signed-off-by: Peter Turcsanyi --- .../org/apache/nifi/processors/hubspot/GetHubSpot.java | 7 ++++--- .../additionalDetails.html | 9 +++++++++ .../apache/nifi/processors/hubspot/GetHubSpotTest.java | 6 ++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/java/org/apache/nifi/processors/hubspot/GetHubSpot.java b/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/java/org/apache/nifi/processors/hubspot/GetHubSpot.java index 58c0d02c58..ccac612157 100644 --- a/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/java/org/apache/nifi/processors/hubspot/GetHubSpot.java +++ b/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/java/org/apache/nifi/processors/hubspot/GetHubSpot.java @@ -116,7 +116,7 @@ public class GetHubSpot extends AbstractProcessor { " the previous run time and the current time (optionally adjusted by the Incremental Delay property).") .required(true) .allowableValues("true", "false") - .defaultValue("false") + .defaultValue("true") .build(); static final PropertyDescriptor INCREMENTAL_DELAY = new PropertyDescriptor.Builder() @@ -124,9 +124,10 @@ public class GetHubSpot extends AbstractProcessor { .displayName("Incremental Delay") .description(("The ending timestamp of the time window will be adjusted earlier by the amount configured in this property." + " For example, with a property value of 10 seconds, an ending timestamp of 12:30:45 would be changed to 12:30:35." + - " Set this property to avoid missing objects when the clock of your local machines and HubSpot servers' clock are not in sync.")) + " Set this property to avoid missing objects when the clock of your local machines and HubSpot servers' clock are not in sync" + + " and to protect against HubSpot's mechanism that changes last updated timestamps after object creation.")) .required(true) - .defaultValue("3 sec") + .defaultValue("30 sec") .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR) .dependsOn(IS_INCREMENTAL, "true") diff --git a/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/resources/docs/org.apache.nifi.processors.hubspot.GetHubSpot/additionalDetails.html b/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/resources/docs/org.apache.nifi.processors.hubspot.GetHubSpot/additionalDetails.html index 6f2dd67fa6..86bfec9d94 100644 --- a/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/resources/docs/org.apache.nifi.processors.hubspot.GetHubSpot/additionalDetails.html +++ b/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/main/resources/docs/org.apache.nifi.processors.hubspot.GetHubSpot/additionalDetails.html @@ -32,5 +32,14 @@ last run time of the processor are processed. The processor state can be reset in the context menu. The incremental loading is based on the objects last modified time.

+

Paging

+

+ GetHubSpot supports both paging and incrementality at the same time. In case the number of results exceeds the 'Result Limit', + in the next processor run the remaining objects will be returned. +

+

+ Due to the page handling mechanism of the HubSpot API, parallel deletions are not supported. + Some objects may be omitted if any object is deleted between fetching two pages. +

\ No newline at end of file diff --git a/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/test/java/org/apache/nifi/processors/hubspot/GetHubSpotTest.java b/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/test/java/org/apache/nifi/processors/hubspot/GetHubSpotTest.java index 410a279ce7..d18b49d316 100644 --- a/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/test/java/org/apache/nifi/processors/hubspot/GetHubSpotTest.java +++ b/nifi-nar-bundles/nifi-hubspot-bundle/nifi-hubspot-processors/src/test/java/org/apache/nifi/processors/hubspot/GetHubSpotTest.java @@ -135,7 +135,7 @@ class GetHubSpotTest { server.enqueue(new MockResponse().setBody(response)); final String limit = "2"; - final int defaultDelay = 3000; + final int defaultDelay = 30000; final String endTime = String.valueOf(Instant.now().toEpochMilli()); final Map stateMap = new HashMap<>(); stateMap.put(END_INCREMENTAL_KEY, endTime); @@ -178,13 +178,11 @@ class GetHubSpotTest { final String limit = "2"; final String after = "nextPage"; - final String objectType = COMPANIES.getValue(); - final String cursorKey = String.format(CURSOR_KEY, objectType); final Instant now = Instant.now(); final String startTime = String.valueOf(now.toEpochMilli()); final String endTime = String.valueOf(now.plus(2, ChronoUnit.MINUTES).toEpochMilli()); final Map stateMap = new HashMap<>(); - stateMap.put(cursorKey, after); + stateMap.put(CURSOR_KEY, after); stateMap.put(START_INCREMENTAL_KEY, startTime); stateMap.put(END_INCREMENTAL_KEY, endTime);