embulk-input-zendesk 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +32 -2
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/input/zendesk/RecordImporter.java +134 -0
- data/src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java +182 -202
- data/src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java +54 -52
- data/src/main/java/org/embulk/input/zendesk/models/Target.java +3 -3
- data/src/main/java/org/embulk/input/zendesk/models/ZendeskException.java +1 -1
- data/src/main/java/org/embulk/input/zendesk/services/ZendeskCustomObjectService.java +110 -0
- data/src/main/java/org/embulk/input/zendesk/services/ZendeskNPSService.java +30 -0
- data/src/main/java/org/embulk/input/zendesk/services/ZendeskNormalServices.java +239 -0
- data/src/main/java/org/embulk/input/zendesk/services/ZendeskService.java +14 -0
- data/src/main/java/org/embulk/input/zendesk/services/ZendeskSupportAPIService.java +25 -83
- data/src/main/java/org/embulk/input/zendesk/services/ZendeskUserEventService.java +158 -0
- data/src/main/java/org/embulk/input/zendesk/stream/PagingSpliterator.java +40 -0
- data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/CustomObjectSpliterator.java +42 -0
- data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/SunshineSpliterator.java +66 -0
- data/src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/UserEventSpliterator.java +35 -0
- data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/OrganizationSpliterator.java +13 -0
- data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/SupportSpliterator.java +44 -0
- data/src/main/java/org/embulk/input/zendesk/stream/paginator/support/UserSpliterator.java +13 -0
- data/src/main/java/org/embulk/input/zendesk/utils/ZendeskConstants.java +13 -1
- data/src/main/java/org/embulk/input/zendesk/utils/ZendeskDateUtils.java +22 -11
- data/src/main/java/org/embulk/input/zendesk/utils/ZendeskUtils.java +52 -114
- data/src/test/java/org/embulk/input/zendesk/TestRecordImporter.java +114 -0
- data/src/test/java/org/embulk/input/zendesk/TestZendeskInputPlugin.java +184 -99
- data/src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java +6 -20
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskCustomObjectService.java +161 -0
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskNPSService.java +56 -0
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskNormalService.java +189 -0
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskSupportAPIService.java +18 -60
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskUserEventService.java +158 -0
- data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java +50 -2
- data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskUtil.java +0 -138
- data/src/test/java/org/embulk/input/zendesk/utils/ZendeskTestHelper.java +16 -0
- data/src/test/resources/config/nps.yml +29 -0
- data/src/test/resources/config/object_records.yml +24 -0
- data/src/test/resources/config/relationship_records.yml +23 -0
- data/src/test/resources/config/user_events.yml +29 -0
- data/src/test/resources/data/duplicate_user.json +0 -0
- data/src/test/resources/data/empty_result.json +7 -0
- data/src/test/resources/data/expected/user_events_column.json +40 -0
- data/src/test/resources/data/object_records.json +30 -0
- data/src/test/resources/data/organization.json +39 -0
- data/src/test/resources/data/relationship_records.json +57 -0
- data/src/test/resources/data/scores.json +21 -0
- data/src/test/resources/data/scores_share_same_time_with_next_page.json +35 -0
- data/src/test/resources/data/scores_share_same_time_without_next_page.json +35 -0
- data/src/test/resources/data/simple_organization.json +23 -0
- data/src/test/resources/data/simple_user.json +50 -0
- data/src/test/resources/data/simple_user_event.json +19 -0
- data/src/test/resources/data/ticket_events_share_same_time_with_next_page.json +279 -0
- data/src/test/resources/data/ticket_events_share_same_time_without_next_page.json +279 -0
- data/src/test/resources/data/ticket_events_updated_by_system_records.json +279 -0
- data/src/test/resources/data/ticket_share_same_time_with_next_page.json +232 -0
- data/src/test/resources/data/ticket_share_same_time_without_next_page.json +232 -0
- data/src/test/resources/data/ticket_with_updated_by_system_records.json +187 -0
- data/src/test/resources/data/user_event.json +19 -0
- data/src/test/resources/data/user_event_contain_latter_create_at.json +19 -0
- data/src/test/resources/data/user_event_multiple.json +33 -0
- metadata +46 -5
- data/src/main/java/org/embulk/input/zendesk/utils/ZendeskValidatorUtils.java +0 -79
- data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskValidatorUtils.java +0 -130
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"id": "5c7f31aef8df240001e60bbf",
|
5
|
+
"type": "remove_from_cart",
|
6
|
+
"source": "shopify",
|
7
|
+
"description": "",
|
8
|
+
"authenticated": true,
|
9
|
+
"created_at": "2019-03-06T02:34:22Z",
|
10
|
+
"received_at": "2019-03-06T02:34:22Z",
|
11
|
+
"properties": {
|
12
|
+
"model": 221,
|
13
|
+
"size": 6
|
14
|
+
},
|
15
|
+
"user_id": "123123121232"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"id": "5c7f31aef8df240001e60b3f",
|
19
|
+
"type": "remove_from_cart2",
|
20
|
+
"source": "shopify",
|
21
|
+
"description": "",
|
22
|
+
"authenticated": true,
|
23
|
+
"created_at": "2019-03-06T02:34:30Z",
|
24
|
+
"received_at": "2019-03-06T02:34:30Z",
|
25
|
+
"properties": {
|
26
|
+
"model": 221,
|
27
|
+
"size": 6
|
28
|
+
},
|
29
|
+
"user_id": "123123121232"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"links": null
|
33
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-zendesk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hieu.duong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,45 +59,86 @@ files:
|
|
59
59
|
- gradlew.bat
|
60
60
|
- lib/embulk/guess/zendesk.rb
|
61
61
|
- lib/embulk/input/zendesk.rb
|
62
|
+
- src/main/java/org/embulk/input/zendesk/RecordImporter.java
|
62
63
|
- src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java
|
63
64
|
- src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java
|
64
65
|
- src/main/java/org/embulk/input/zendesk/models/AuthenticationMethod.java
|
65
66
|
- src/main/java/org/embulk/input/zendesk/models/Target.java
|
66
67
|
- src/main/java/org/embulk/input/zendesk/models/ZendeskException.java
|
68
|
+
- src/main/java/org/embulk/input/zendesk/services/ZendeskCustomObjectService.java
|
69
|
+
- src/main/java/org/embulk/input/zendesk/services/ZendeskNPSService.java
|
70
|
+
- src/main/java/org/embulk/input/zendesk/services/ZendeskNormalServices.java
|
71
|
+
- src/main/java/org/embulk/input/zendesk/services/ZendeskService.java
|
67
72
|
- src/main/java/org/embulk/input/zendesk/services/ZendeskSupportAPIService.java
|
73
|
+
- src/main/java/org/embulk/input/zendesk/services/ZendeskUserEventService.java
|
74
|
+
- src/main/java/org/embulk/input/zendesk/stream/PagingSpliterator.java
|
75
|
+
- src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/CustomObjectSpliterator.java
|
76
|
+
- src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/SunshineSpliterator.java
|
77
|
+
- src/main/java/org/embulk/input/zendesk/stream/paginator/sunshine/UserEventSpliterator.java
|
78
|
+
- src/main/java/org/embulk/input/zendesk/stream/paginator/support/OrganizationSpliterator.java
|
79
|
+
- src/main/java/org/embulk/input/zendesk/stream/paginator/support/SupportSpliterator.java
|
80
|
+
- src/main/java/org/embulk/input/zendesk/stream/paginator/support/UserSpliterator.java
|
68
81
|
- src/main/java/org/embulk/input/zendesk/utils/ZendeskConstants.java
|
69
82
|
- src/main/java/org/embulk/input/zendesk/utils/ZendeskDateUtils.java
|
70
83
|
- src/main/java/org/embulk/input/zendesk/utils/ZendeskUtils.java
|
71
|
-
- src/
|
84
|
+
- src/test/java/org/embulk/input/zendesk/TestRecordImporter.java
|
72
85
|
- src/test/java/org/embulk/input/zendesk/TestZendeskInputPlugin.java
|
73
86
|
- src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java
|
87
|
+
- src/test/java/org/embulk/input/zendesk/services/TestZendeskCustomObjectService.java
|
88
|
+
- src/test/java/org/embulk/input/zendesk/services/TestZendeskNPSService.java
|
89
|
+
- src/test/java/org/embulk/input/zendesk/services/TestZendeskNormalService.java
|
74
90
|
- src/test/java/org/embulk/input/zendesk/services/TestZendeskSupportAPIService.java
|
91
|
+
- src/test/java/org/embulk/input/zendesk/services/TestZendeskUserEventService.java
|
75
92
|
- src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java
|
76
93
|
- src/test/java/org/embulk/input/zendesk/utils/TestZendeskUtil.java
|
77
|
-
- src/test/java/org/embulk/input/zendesk/utils/TestZendeskValidatorUtils.java
|
78
94
|
- src/test/java/org/embulk/input/zendesk/utils/ZendeskPluginTestRuntime.java
|
79
95
|
- src/test/java/org/embulk/input/zendesk/utils/ZendeskTestHelper.java
|
80
96
|
- src/test/resources/config/base.yml
|
81
97
|
- src/test/resources/config/base_validator.yml
|
82
98
|
- src/test/resources/config/incremental.yml
|
83
99
|
- src/test/resources/config/non-incremental.yml
|
100
|
+
- src/test/resources/config/nps.yml
|
101
|
+
- src/test/resources/config/object_records.yml
|
102
|
+
- src/test/resources/config/relationship_records.yml
|
103
|
+
- src/test/resources/config/user_events.yml
|
84
104
|
- src/test/resources/config/util.yml
|
85
105
|
- src/test/resources/data/client.json
|
106
|
+
- src/test/resources/data/duplicate_user.json
|
107
|
+
- src/test/resources/data/empty_result.json
|
86
108
|
- src/test/resources/data/error_data.json
|
87
109
|
- src/test/resources/data/expected/ticket_column.json
|
88
110
|
- src/test/resources/data/expected/ticket_column_with_related_objects.json
|
89
111
|
- src/test/resources/data/expected/ticket_fields_column.json
|
90
112
|
- src/test/resources/data/expected/ticket_metrics_column.json
|
113
|
+
- src/test/resources/data/expected/user_events_column.json
|
114
|
+
- src/test/resources/data/object_records.json
|
115
|
+
- src/test/resources/data/organization.json
|
116
|
+
- src/test/resources/data/relationship_records.json
|
117
|
+
- src/test/resources/data/scores.json
|
118
|
+
- src/test/resources/data/scores_share_same_time_with_next_page.json
|
119
|
+
- src/test/resources/data/scores_share_same_time_without_next_page.json
|
120
|
+
- src/test/resources/data/simple_organization.json
|
121
|
+
- src/test/resources/data/simple_user.json
|
122
|
+
- src/test/resources/data/simple_user_event.json
|
123
|
+
- src/test/resources/data/ticket_events_share_same_time_with_next_page.json
|
124
|
+
- src/test/resources/data/ticket_events_share_same_time_without_next_page.json
|
125
|
+
- src/test/resources/data/ticket_events_updated_by_system_records.json
|
91
126
|
- src/test/resources/data/ticket_fields.json
|
92
127
|
- src/test/resources/data/ticket_metrics.json
|
128
|
+
- src/test/resources/data/ticket_share_same_time_with_next_page.json
|
129
|
+
- src/test/resources/data/ticket_share_same_time_without_next_page.json
|
93
130
|
- src/test/resources/data/ticket_with_related_objects.json
|
131
|
+
- src/test/resources/data/ticket_with_updated_by_system_records.json
|
94
132
|
- src/test/resources/data/tickets.json
|
95
133
|
- src/test/resources/data/tickets_continue.json
|
134
|
+
- src/test/resources/data/user_event.json
|
135
|
+
- src/test/resources/data/user_event_contain_latter_create_at.json
|
136
|
+
- src/test/resources/data/user_event_multiple.json
|
96
137
|
- src/test/resources/data/util.json
|
97
138
|
- src/test/resources/data/util_page.json
|
98
139
|
- classpath/commons-logging-1.2.jar
|
99
|
-
- classpath/embulk-input-zendesk-0.3.4.jar
|
100
140
|
- classpath/httpcore-4.4.10.jar
|
141
|
+
- classpath/embulk-input-zendesk-0.3.5.jar
|
101
142
|
- classpath/httpclient-4.5.6.jar
|
102
143
|
- classpath/commons-codec-1.10.jar
|
103
144
|
homepage: https://github.com/treasure-data/embulk-input-zendesk
|
@@ -1,79 +0,0 @@
|
|
1
|
-
package org.embulk.input.zendesk.utils;
|
2
|
-
|
3
|
-
import org.embulk.config.ConfigException;
|
4
|
-
import org.embulk.input.zendesk.ZendeskInputPlugin;
|
5
|
-
import org.embulk.input.zendesk.services.ZendeskSupportAPIService;
|
6
|
-
import org.embulk.spi.Exec;
|
7
|
-
import org.slf4j.Logger;
|
8
|
-
|
9
|
-
public class ZendeskValidatorUtils
|
10
|
-
{
|
11
|
-
private ZendeskValidatorUtils(){}
|
12
|
-
|
13
|
-
private static final Logger logger = Exec.getLogger(ZendeskValidatorUtils.class);
|
14
|
-
|
15
|
-
public static void validateInputTask(final ZendeskInputPlugin.PluginTask task, final ZendeskSupportAPIService zendeskSupportAPIService)
|
16
|
-
{
|
17
|
-
validateAppMarketPlace(task.getAppMarketPlaceIntegrationName().isPresent(),
|
18
|
-
task.getAppMarketPlaceAppId().isPresent(),
|
19
|
-
task.getAppMarketPlaceOrgId().isPresent());
|
20
|
-
validateCredentials(task);
|
21
|
-
validateIncremental(task);
|
22
|
-
}
|
23
|
-
|
24
|
-
private static void validateCredentials(final ZendeskInputPlugin.PluginTask task)
|
25
|
-
{
|
26
|
-
switch (task.getAuthenticationMethod()) {
|
27
|
-
case OAUTH:
|
28
|
-
if (!task.getAccessToken().isPresent()) {
|
29
|
-
throw new ConfigException(String.format("access_token is required for authentication method '%s'",
|
30
|
-
task.getAuthenticationMethod().name().toLowerCase()));
|
31
|
-
}
|
32
|
-
break;
|
33
|
-
case TOKEN:
|
34
|
-
if (!task.getUsername().isPresent() || !task.getToken().isPresent()) {
|
35
|
-
throw new ConfigException(String.format("username and token are required for authentication method '%s'",
|
36
|
-
task.getAuthenticationMethod().name().toLowerCase()));
|
37
|
-
}
|
38
|
-
break;
|
39
|
-
case BASIC:
|
40
|
-
if (!task.getUsername().isPresent() || !task.getPassword().isPresent()) {
|
41
|
-
throw new ConfigException(String.format("username and password are required for authentication method '%s'",
|
42
|
-
task.getAuthenticationMethod().name().toLowerCase()));
|
43
|
-
}
|
44
|
-
break;
|
45
|
-
default:
|
46
|
-
throw new ConfigException("Unknown authentication method");
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
private static void validateAppMarketPlace(final boolean isAppMarketIntegrationNamePresent,
|
51
|
-
final boolean isAppMarketAppIdPresent,
|
52
|
-
final boolean isAppMarketOrgIdPresent)
|
53
|
-
{
|
54
|
-
final boolean isAllAvailable =
|
55
|
-
isAppMarketIntegrationNamePresent && isAppMarketAppIdPresent && isAppMarketOrgIdPresent;
|
56
|
-
final boolean isAllUnAvailable =
|
57
|
-
!isAppMarketIntegrationNamePresent && !isAppMarketAppIdPresent && !isAppMarketOrgIdPresent;
|
58
|
-
// All or nothing needed
|
59
|
-
if (!(isAllAvailable || isAllUnAvailable)) {
|
60
|
-
throw new ConfigException("All of app_marketplace_integration_name, app_marketplace_org_id, " +
|
61
|
-
"app_marketplace_app_id " +
|
62
|
-
"are required to fill out for Apps Marketplace API header");
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
private static void validateIncremental(final ZendeskInputPlugin.PluginTask task)
|
67
|
-
{
|
68
|
-
if (task.getIncremental()) {
|
69
|
-
if (!task.getDedup()) {
|
70
|
-
logger.warn("You've selected to skip de-duplicating records, result may contain duplicated data");
|
71
|
-
}
|
72
|
-
|
73
|
-
if (!ZendeskUtils.isSupportAPIIncremental(task.getTarget()) && task.getStartTime().isPresent()) {
|
74
|
-
logger.warn(String.format("Target: '%s' doesn't support incremental export API. Will be ignored start_time option",
|
75
|
-
task.getTarget()));
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
@@ -1,130 +0,0 @@
|
|
1
|
-
package org.embulk.input.zendesk.utils;
|
2
|
-
|
3
|
-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
4
|
-
import org.embulk.config.ConfigSource;
|
5
|
-
|
6
|
-
import org.embulk.input.zendesk.ZendeskInputPlugin;
|
7
|
-
import org.embulk.input.zendesk.services.ZendeskSupportAPIService;
|
8
|
-
|
9
|
-
import org.embulk.spi.InputPlugin;
|
10
|
-
import org.embulk.test.TestingEmbulk;
|
11
|
-
|
12
|
-
import org.junit.Before;
|
13
|
-
import org.junit.Rule;
|
14
|
-
import org.junit.Test;
|
15
|
-
import org.junit.rules.ExpectedException;
|
16
|
-
import org.junit.rules.RuleChain;
|
17
|
-
import org.junit.rules.TestRule;
|
18
|
-
|
19
|
-
import static org.junit.Assert.assertEquals;
|
20
|
-
import static org.junit.Assert.fail;
|
21
|
-
|
22
|
-
import static org.mockito.Mockito.mock;
|
23
|
-
|
24
|
-
import java.util.Collections;
|
25
|
-
|
26
|
-
public class TestZendeskValidatorUtils
|
27
|
-
{
|
28
|
-
private final ExpectedException thrown = ExpectedException.none();
|
29
|
-
private final TestingEmbulk embulk = TestingEmbulk.builder()
|
30
|
-
.registerPlugin(InputPlugin.class, "zendesk", ZendeskInputPlugin.class)
|
31
|
-
.build();
|
32
|
-
public ZendeskPluginTestRuntime runtime = new ZendeskPluginTestRuntime();
|
33
|
-
ConfigSource configSource;
|
34
|
-
|
35
|
-
@Rule
|
36
|
-
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
37
|
-
public TestRule chain = RuleChain.outerRule(embulk).around(runtime).around(thrown);
|
38
|
-
|
39
|
-
private ZendeskSupportAPIService zendeskSupportAPIService = mock(ZendeskSupportAPIService.class);
|
40
|
-
|
41
|
-
@Before
|
42
|
-
public void prepare()
|
43
|
-
{
|
44
|
-
configSource = getBaseConfigSource();
|
45
|
-
}
|
46
|
-
|
47
|
-
@Test
|
48
|
-
public void validateCredentialOauthShouldThrowException()
|
49
|
-
{
|
50
|
-
configSource.set("auth_method", "oauth");
|
51
|
-
configSource.remove("access_token");
|
52
|
-
final ZendeskInputPlugin.PluginTask task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
53
|
-
assertValidation(task, "access_token is required for authentication method 'oauth'");
|
54
|
-
}
|
55
|
-
|
56
|
-
@Test
|
57
|
-
public void validateCredentialBasicShouldThrowException()
|
58
|
-
{
|
59
|
-
configSource.set("auth_method", "basic");
|
60
|
-
configSource.remove("username");
|
61
|
-
ZendeskInputPlugin.PluginTask task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
62
|
-
assertValidation(task, "username and password are required for authentication method 'basic'");
|
63
|
-
|
64
|
-
configSource.set("username", "");
|
65
|
-
configSource.remove("password");
|
66
|
-
task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
67
|
-
assertValidation(task, "username and password are required for authentication method 'basic'");
|
68
|
-
}
|
69
|
-
|
70
|
-
@Test
|
71
|
-
public void validateCredentialTokenShouldThrowException()
|
72
|
-
{
|
73
|
-
configSource.set("auth_method", "token");
|
74
|
-
configSource.remove("token");
|
75
|
-
ZendeskInputPlugin.PluginTask task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
76
|
-
assertValidation(task, "username and token are required for authentication method 'token'");
|
77
|
-
|
78
|
-
configSource.set("token", "");
|
79
|
-
configSource.remove("username");
|
80
|
-
task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
81
|
-
assertValidation(task, "username and token are required for authentication method 'token'");
|
82
|
-
}
|
83
|
-
|
84
|
-
@Test
|
85
|
-
public void validateAppMarketPlaceShouldThrowException()
|
86
|
-
{
|
87
|
-
configSource.remove("app_marketplace_integration_name");
|
88
|
-
ZendeskInputPlugin.PluginTask task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
89
|
-
assertValidation(task, "All of app_marketplace_integration_name, app_marketplace_org_id, " +
|
90
|
-
"app_marketplace_app_id " +
|
91
|
-
"are required to fill out for Apps Marketplace API header");
|
92
|
-
}
|
93
|
-
|
94
|
-
@Test
|
95
|
-
public void validateInclude()
|
96
|
-
{
|
97
|
-
configSource.set("target", "ticket_fields");
|
98
|
-
configSource.set("includes", Collections.singletonList("organizations"));
|
99
|
-
final ZendeskInputPlugin.PluginTask task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
100
|
-
ZendeskValidatorUtils.validateInputTask(task, zendeskSupportAPIService);
|
101
|
-
}
|
102
|
-
|
103
|
-
@Test
|
104
|
-
public void validateIncremental()
|
105
|
-
{
|
106
|
-
configSource.set("target", "ticket_fields");
|
107
|
-
configSource.set("incremental", true);
|
108
|
-
configSource.set("dedup", false);
|
109
|
-
configSource.set(ZendeskConstants.Field.START_TIME, "");
|
110
|
-
|
111
|
-
final ZendeskInputPlugin.PluginTask task = configSource.loadConfig(ZendeskInputPlugin.PluginTask.class);
|
112
|
-
ZendeskValidatorUtils.validateInputTask(task, zendeskSupportAPIService);
|
113
|
-
}
|
114
|
-
|
115
|
-
private static ConfigSource getBaseConfigSource()
|
116
|
-
{
|
117
|
-
return ZendeskTestHelper.getConfigSource("base_validator.yml");
|
118
|
-
}
|
119
|
-
|
120
|
-
private void assertValidation(final ZendeskInputPlugin.PluginTask task, final String message)
|
121
|
-
{
|
122
|
-
try {
|
123
|
-
ZendeskValidatorUtils.validateInputTask(task, zendeskSupportAPIService);
|
124
|
-
fail("Should not reach here");
|
125
|
-
}
|
126
|
-
catch (final Exception e) {
|
127
|
-
assertEquals(message, e.getMessage());
|
128
|
-
}
|
129
|
-
}
|
130
|
-
}
|