embulk-input-zendesk-all 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +126 -0
- data/LICENSE.txt +21 -0
- data/README.md +91 -0
- data/build.gradle +123 -0
- data/config/checkstyle/checkstyle.xml +128 -0
- data/config/checkstyle/default.xml +108 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +5 -0
- data/gradlew +172 -0
- data/gradlew.bat +84 -0
- data/lib/embulk/guess/zendesk.rb +21 -0
- data/lib/embulk/input/zendesk.rb +3 -0
- data/src/main/java/org/embulk/input/zendesk/RecordImporter.java +134 -0
- data/src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java +513 -0
- data/src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java +291 -0
- data/src/main/java/org/embulk/input/zendesk/models/AuthenticationMethod.java +23 -0
- data/src/main/java/org/embulk/input/zendesk/models/Target.java +47 -0
- data/src/main/java/org/embulk/input/zendesk/models/ZendeskException.java +25 -0
- 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 +347 -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 +63 -0
- 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 +72 -0
- data/src/main/java/org/embulk/input/zendesk/utils/ZendeskDateUtils.java +68 -0
- data/src/main/java/org/embulk/input/zendesk/utils/ZendeskUtils.java +92 -0
- data/src/test/java/org/embulk/input/zendesk/TestRecordImporter.java +114 -0
- data/src/test/java/org/embulk/input/zendesk/TestZendeskInputPlugin.java +402 -0
- data/src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java +337 -0
- 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 +261 -0
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskSupportAPIService.java +130 -0
- data/src/test/java/org/embulk/input/zendesk/services/TestZendeskUserEventService.java +158 -0
- data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java +87 -0
- data/src/test/java/org/embulk/input/zendesk/utils/TestZendeskUtil.java +22 -0
- data/src/test/java/org/embulk/input/zendesk/utils/ZendeskPluginTestRuntime.java +133 -0
- data/src/test/java/org/embulk/input/zendesk/utils/ZendeskTestHelper.java +92 -0
- data/src/test/resources/config/base.yml +14 -0
- data/src/test/resources/config/base_validator.yml +48 -0
- data/src/test/resources/config/incremental.yml +54 -0
- data/src/test/resources/config/non-incremental.yml +39 -0
- data/src/test/resources/config/nps.yml +31 -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/config/util.yml +18 -0
- data/src/test/resources/data/client.json +293 -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/error_data.json +187 -0
- data/src/test/resources/data/expected/ticket_column.json +148 -0
- data/src/test/resources/data/expected/ticket_column_with_related_objects.json +152 -0
- data/src/test/resources/data/expected/ticket_fields_column.json +92 -0
- data/src/test/resources/data/expected/ticket_metrics_column.json +98 -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_fields.json +225 -0
- data/src/test/resources/data/ticket_metrics.json +397 -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_related_objects.json +67 -0
- data/src/test/resources/data/ticket_with_updated_by_system_records.json +187 -0
- data/src/test/resources/data/tickets.json +232 -0
- data/src/test/resources/data/tickets_continue.json +52 -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
- data/src/test/resources/data/util.json +19 -0
- data/src/test/resources/data/util_page.json +227 -0
- metadata +168 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
package org.embulk.input.zendesk.utils;
|
|
2
|
+
|
|
3
|
+
import org.embulk.spi.DataException;
|
|
4
|
+
import org.junit.Assert;
|
|
5
|
+
import org.junit.Test;
|
|
6
|
+
|
|
7
|
+
import java.util.Optional;
|
|
8
|
+
|
|
9
|
+
import static org.junit.Assert.assertEquals;
|
|
10
|
+
import static org.junit.Assert.assertFalse;
|
|
11
|
+
import static org.junit.Assert.assertThrows;
|
|
12
|
+
import static org.junit.Assert.assertTrue;
|
|
13
|
+
|
|
14
|
+
public class TestZendeskDateUtils
|
|
15
|
+
{
|
|
16
|
+
@Test
|
|
17
|
+
public void testIsoToEpochSecondShouldReturnCorrectValue()
|
|
18
|
+
{
|
|
19
|
+
long expectedValue = 1550645445;
|
|
20
|
+
|
|
21
|
+
long value = ZendeskDateUtils.isoToEpochSecond("2019-02-20T06:50:45Z");
|
|
22
|
+
Assert.assertEquals(expectedValue, value);
|
|
23
|
+
|
|
24
|
+
value = ZendeskDateUtils.isoToEpochSecond("2019-02-20 06:50:45 +0000");
|
|
25
|
+
Assert.assertEquals(expectedValue, value);
|
|
26
|
+
|
|
27
|
+
value = ZendeskDateUtils.isoToEpochSecond("2019-02-20T06:50:45.000Z");
|
|
28
|
+
Assert.assertEquals(expectedValue, value);
|
|
29
|
+
|
|
30
|
+
value = ZendeskDateUtils.isoToEpochSecond("2019-02-20T06:50:45+00:00");
|
|
31
|
+
Assert.assertEquals(expectedValue, value);
|
|
32
|
+
|
|
33
|
+
value = ZendeskDateUtils.isoToEpochSecond("2019-02-20 06:50:45+0000");
|
|
34
|
+
Assert.assertEquals(expectedValue, value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Test
|
|
38
|
+
public void testIsoToEpochSecondShouldThrowException()
|
|
39
|
+
{
|
|
40
|
+
assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-02asdasdasd-20T06:50:45Z"));
|
|
41
|
+
assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-002-20T06:50:45Z"));
|
|
42
|
+
assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-02-200T06:50:45.000Z"));
|
|
43
|
+
assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-02-20T24:01:00Z"));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Test
|
|
47
|
+
public void testConvertToDateTimeFormat()
|
|
48
|
+
{
|
|
49
|
+
String expectedString = "2019-05-01T07:14:50Z";
|
|
50
|
+
|
|
51
|
+
String actualString = ZendeskDateUtils.convertToDateTimeFormat("2019-05-01 07:14:50 +0000", ZendeskConstants.Misc.ISO_INSTANT);
|
|
52
|
+
assertEquals(expectedString, actualString);
|
|
53
|
+
|
|
54
|
+
actualString = ZendeskDateUtils.convertToDateTimeFormat("2019-05-01 07:14:50+0000", ZendeskConstants.Misc.ISO_INSTANT);
|
|
55
|
+
assertEquals(expectedString, actualString);
|
|
56
|
+
|
|
57
|
+
actualString = ZendeskDateUtils.convertToDateTimeFormat("2019-05-01T07:14:50.000Z", ZendeskConstants.Misc.ISO_INSTANT);
|
|
58
|
+
assertEquals(expectedString, actualString);
|
|
59
|
+
|
|
60
|
+
actualString = ZendeskDateUtils.convertToDateTimeFormat("2019-05-01T07:14:50+00:00", ZendeskConstants.Misc.ISO_INSTANT);
|
|
61
|
+
assertEquals(expectedString, actualString);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Test
|
|
65
|
+
public void testSupportedTimeFormat()
|
|
66
|
+
{
|
|
67
|
+
Optional optional = ZendeskDateUtils.supportedTimeFormat("2019-05-01 07:14:50+0000");
|
|
68
|
+
assertTrue(optional.isPresent());
|
|
69
|
+
|
|
70
|
+
optional = ZendeskDateUtils.supportedTimeFormat("2019-05-01T07:14:50");
|
|
71
|
+
assertFalse(optional.isPresent());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@Test
|
|
75
|
+
public void testGetStartTime()
|
|
76
|
+
{
|
|
77
|
+
long expectedValue = 1550645445;
|
|
78
|
+
long actualValue = ZendeskDateUtils.getStartTime("2019-02-20 06:512310:45 +0000");
|
|
79
|
+
assertEquals(0, actualValue);
|
|
80
|
+
|
|
81
|
+
actualValue = ZendeskDateUtils.getStartTime("2019-02-30 06:50:45 +0000");
|
|
82
|
+
assertEquals(0, actualValue);
|
|
83
|
+
|
|
84
|
+
actualValue = ZendeskDateUtils.getStartTime("2019-02-20 06:50:45 +0000");
|
|
85
|
+
assertEquals(expectedValue, actualValue);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package org.embulk.input.zendesk.utils;
|
|
2
|
+
|
|
3
|
+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
4
|
+
import org.embulk.EmbulkTestRuntime;
|
|
5
|
+
import org.junit.Rule;
|
|
6
|
+
import org.junit.Test;
|
|
7
|
+
import static org.junit.Assert.assertEquals;
|
|
8
|
+
|
|
9
|
+
public class TestZendeskUtil
|
|
10
|
+
{
|
|
11
|
+
@Rule
|
|
12
|
+
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
|
13
|
+
public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
|
|
14
|
+
|
|
15
|
+
@Test
|
|
16
|
+
public void testConvertBase64()
|
|
17
|
+
{
|
|
18
|
+
String expectedResult = "YWhrc2RqZmhramFzZGhma2phaGRma2phaGRramZoYWtqZGY=";
|
|
19
|
+
String encode = ZendeskUtils.convertBase64("ahksdjfhkjasdhfkjahdfkjahdkjfhakjdf");
|
|
20
|
+
assertEquals(expectedResult, encode);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
package org.embulk.input.zendesk.utils;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
4
|
+
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
|
5
|
+
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
6
|
+
import com.google.inject.Binder;
|
|
7
|
+
import com.google.inject.Injector;
|
|
8
|
+
import com.google.inject.Module;
|
|
9
|
+
import org.embulk.GuiceBinder;
|
|
10
|
+
import org.embulk.RandomManager;
|
|
11
|
+
import org.embulk.TestPluginSourceModule;
|
|
12
|
+
import org.embulk.TestUtilityModule;
|
|
13
|
+
import org.embulk.config.ConfigSource;
|
|
14
|
+
import org.embulk.config.DataSourceImpl;
|
|
15
|
+
import org.embulk.config.ModelManager;
|
|
16
|
+
import org.embulk.exec.ExecModule;
|
|
17
|
+
import org.embulk.exec.ExtensionServiceLoaderModule;
|
|
18
|
+
import org.embulk.exec.SystemConfigModule;
|
|
19
|
+
import org.embulk.jruby.JRubyScriptingModule;
|
|
20
|
+
import org.embulk.plugin.BuiltinPluginSourceModule;
|
|
21
|
+
import org.embulk.plugin.PluginClassLoaderFactory;
|
|
22
|
+
import org.embulk.plugin.PluginClassLoaderModule;
|
|
23
|
+
import org.embulk.spi.BufferAllocator;
|
|
24
|
+
import org.embulk.spi.Exec;
|
|
25
|
+
import org.embulk.spi.ExecAction;
|
|
26
|
+
import org.embulk.spi.ExecSession;
|
|
27
|
+
import org.junit.runner.Description;
|
|
28
|
+
import org.junit.runners.model.Statement;
|
|
29
|
+
|
|
30
|
+
import java.util.Random;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This is a clone from {@link org.embulk.EmbulkTestRuntime}, since there is no easy way to extend it.
|
|
34
|
+
* The only modification is on the provided systemConfig, enable tests to run `embulk/guess/zendesk.rb`
|
|
35
|
+
*/
|
|
36
|
+
public class ZendeskPluginTestRuntime extends GuiceBinder
|
|
37
|
+
{
|
|
38
|
+
public static class TestRuntimeModule implements Module
|
|
39
|
+
{
|
|
40
|
+
@Override
|
|
41
|
+
public void configure(Binder binder)
|
|
42
|
+
{
|
|
43
|
+
ConfigSource systemConfig = getSystemConfig();
|
|
44
|
+
new SystemConfigModule(systemConfig).configure(binder);
|
|
45
|
+
new ExecModule().configure(binder);
|
|
46
|
+
new ExtensionServiceLoaderModule(systemConfig).configure(binder);
|
|
47
|
+
new BuiltinPluginSourceModule().configure(binder);
|
|
48
|
+
new JRubyScriptingModule(systemConfig).configure(binder);
|
|
49
|
+
new PluginClassLoaderModule(systemConfig).configure(binder);
|
|
50
|
+
new TestUtilityModule().configure(binder);
|
|
51
|
+
new TestPluginSourceModule().configure(binder);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private ExecSession exec;
|
|
56
|
+
|
|
57
|
+
public ZendeskPluginTestRuntime()
|
|
58
|
+
{
|
|
59
|
+
super(new TestRuntimeModule());
|
|
60
|
+
Injector injector = getInjector();
|
|
61
|
+
ConfigSource execConfig = new DataSourceImpl(injector.getInstance(ModelManager.class));
|
|
62
|
+
this.exec = ExecSession.builder(injector).fromExecConfig(execConfig).build();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public ExecSession getExec()
|
|
66
|
+
{
|
|
67
|
+
return exec;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public BufferAllocator getBufferAllocator()
|
|
71
|
+
{
|
|
72
|
+
return getInstance(BufferAllocator.class);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public ModelManager getModelManager()
|
|
76
|
+
{
|
|
77
|
+
return getInstance(ModelManager.class);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public Random getRandom()
|
|
81
|
+
{
|
|
82
|
+
return getInstance(RandomManager.class).getRandom();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public PluginClassLoaderFactory getPluginClassLoaderFactory()
|
|
86
|
+
{
|
|
87
|
+
return getInstance(PluginClassLoaderFactory.class);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@Override
|
|
91
|
+
public Statement apply(Statement base, Description description)
|
|
92
|
+
{
|
|
93
|
+
final Statement superStatement = ZendeskPluginTestRuntime.super.apply(base, description);
|
|
94
|
+
return new Statement() {
|
|
95
|
+
public void evaluate() throws Throwable
|
|
96
|
+
{
|
|
97
|
+
try {
|
|
98
|
+
Exec.doWith(exec, (ExecAction<Void>) () -> {
|
|
99
|
+
try {
|
|
100
|
+
superStatement.evaluate();
|
|
101
|
+
}
|
|
102
|
+
catch (Throwable ex) {
|
|
103
|
+
throw new RuntimeExecutionException(ex);
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
catch (RuntimeException ex) {
|
|
109
|
+
throw ex.getCause();
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
exec.cleanup();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private static class RuntimeExecutionException extends RuntimeException
|
|
119
|
+
{
|
|
120
|
+
public RuntimeExecutionException(Throwable cause)
|
|
121
|
+
{
|
|
122
|
+
super(cause);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private static ConfigSource getSystemConfig()
|
|
127
|
+
{
|
|
128
|
+
ObjectNode configNode = JsonNodeFactory.instance.objectNode();
|
|
129
|
+
configNode.set("jruby_load_path", JsonNodeFactory.instance.arrayNode().add("lib"));
|
|
130
|
+
|
|
131
|
+
return new DataSourceImpl(new ModelManager(null, new ObjectMapper()), configNode);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
package org.embulk.input.zendesk.utils;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.databind.JsonNode;
|
|
4
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
5
|
+
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
|
|
6
|
+
|
|
7
|
+
import org.embulk.EmbulkTestRuntime;
|
|
8
|
+
import org.embulk.config.ConfigLoader;
|
|
9
|
+
import org.embulk.config.ConfigSource;
|
|
10
|
+
import org.embulk.config.ModelManager;
|
|
11
|
+
import org.embulk.spi.ExecSession;
|
|
12
|
+
import org.embulk.test.EmbulkTests;
|
|
13
|
+
import org.junit.Assert;
|
|
14
|
+
|
|
15
|
+
import java.io.IOException;
|
|
16
|
+
import java.io.InputStream;
|
|
17
|
+
import java.lang.reflect.Field;
|
|
18
|
+
|
|
19
|
+
import static junit.framework.TestCase.fail;
|
|
20
|
+
|
|
21
|
+
public final class ZendeskTestHelper
|
|
22
|
+
{
|
|
23
|
+
private ZendeskTestHelper() {}
|
|
24
|
+
|
|
25
|
+
private static ObjectMapper mapper;
|
|
26
|
+
private static final ConfigLoader configLoader;
|
|
27
|
+
|
|
28
|
+
static {
|
|
29
|
+
mapper = new ObjectMapper();
|
|
30
|
+
mapper.registerModule(new Jdk8Module());
|
|
31
|
+
configLoader = new ConfigLoader(new ModelManager(null, mapper));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public static JsonNode getJsonFromFile(String fileName)
|
|
35
|
+
{
|
|
36
|
+
try {
|
|
37
|
+
return mapper.readTree(EmbulkTests.readResource(fileName));
|
|
38
|
+
}
|
|
39
|
+
catch (IOException e) {
|
|
40
|
+
fail("Fail to load file from " + fileName);
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static ConfigSource getConfigSource(String file)
|
|
46
|
+
{
|
|
47
|
+
ConfigSource configSource = null;
|
|
48
|
+
InputStream is = null;
|
|
49
|
+
try {
|
|
50
|
+
is = ZendeskTestHelper.class.getResourceAsStream("/config/" + file);
|
|
51
|
+
configSource = configLoader.fromYaml(is);
|
|
52
|
+
}
|
|
53
|
+
catch (IOException ex) {
|
|
54
|
+
Assert.fail(ex.getMessage());
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
if (is != null) {
|
|
58
|
+
try {
|
|
59
|
+
is.close();
|
|
60
|
+
}
|
|
61
|
+
catch (IOException ex) { }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return configSource;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public static void setPreviewMode(final EmbulkTestRuntime runtime, final boolean isPreview)
|
|
68
|
+
{
|
|
69
|
+
// A small hack to make the plugin executed in preview mode so
|
|
70
|
+
try {
|
|
71
|
+
final Field previewField = ExecSession.class.getDeclaredField("preview");
|
|
72
|
+
previewField.setAccessible(true);
|
|
73
|
+
previewField.set(runtime.getExec(), isPreview);
|
|
74
|
+
}
|
|
75
|
+
catch (NoSuchFieldException | IllegalAccessException e) {
|
|
76
|
+
Assert.fail(e.getMessage());
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public static void setPreviewMode(final ZendeskPluginTestRuntime runtime, final boolean isPreview)
|
|
81
|
+
{
|
|
82
|
+
// A small hack to make the plugin executed in preview mode so
|
|
83
|
+
try {
|
|
84
|
+
final Field previewField = ExecSession.class.getDeclaredField("preview");
|
|
85
|
+
previewField.setAccessible(true);
|
|
86
|
+
previewField.set(runtime.getExec(), isPreview);
|
|
87
|
+
}
|
|
88
|
+
catch (NoSuchFieldException | IllegalAccessException e) {
|
|
89
|
+
Assert.fail(e.getMessage());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type: zendesk
|
|
2
|
+
login_url: https://abc.zendesk.com
|
|
3
|
+
auth_method: oauth
|
|
4
|
+
username: dummy
|
|
5
|
+
password: dummy
|
|
6
|
+
token: dummy
|
|
7
|
+
access_token: dummy
|
|
8
|
+
app_marketplace_integration_name: abc
|
|
9
|
+
app_marketplace_app_id: abc
|
|
10
|
+
app_marketplace_org_id: abc
|
|
11
|
+
retry_initial_wait_sec: 1
|
|
12
|
+
max_retry_wait_sec: 30
|
|
13
|
+
retry_limit: 2
|
|
14
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
type: zendesk
|
|
2
|
+
login_url: https://abc.zendesk.com
|
|
3
|
+
auth_method: oauth
|
|
4
|
+
username: dummy
|
|
5
|
+
password: dummy
|
|
6
|
+
token: dummy
|
|
7
|
+
access_token: dummy
|
|
8
|
+
app_marketplace_integration_name: abc
|
|
9
|
+
app_marketplace_app_id: abc
|
|
10
|
+
app_marketplace_org_id: abc
|
|
11
|
+
target: tickets
|
|
12
|
+
columns:
|
|
13
|
+
- {name: url, type: string}
|
|
14
|
+
- {name: id, type: long}
|
|
15
|
+
- {name: external_id, type: string}
|
|
16
|
+
- {name: via, type: json}
|
|
17
|
+
- {name: created_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
|
|
18
|
+
- {name: updated_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
|
|
19
|
+
- {name: type, type: string}
|
|
20
|
+
- {name: subject, type: string}
|
|
21
|
+
- {name: raw_subject, type: string}
|
|
22
|
+
- {name: description, type: string}
|
|
23
|
+
- {name: priority, type: string}
|
|
24
|
+
- {name: status, type: string}
|
|
25
|
+
- {name: recipient, type: string}
|
|
26
|
+
- {name: requester_id, type: long}
|
|
27
|
+
- {name: submitter_id, type: long}
|
|
28
|
+
- {name: assignee_id, type: long}
|
|
29
|
+
- {name: organization_id, type: long}
|
|
30
|
+
- {name: group_id, type: long}
|
|
31
|
+
- {name: collaborator_ids, type: json}
|
|
32
|
+
- {name: follower_ids, type: json}
|
|
33
|
+
- {name: email_cc_ids, type: json}
|
|
34
|
+
- {name: forum_topic_id, type: string}
|
|
35
|
+
- {name: problem_id, type: string}
|
|
36
|
+
- {name: has_incidents, type: boolean}
|
|
37
|
+
- {name: is_public, type: boolean}
|
|
38
|
+
- {name: due_at, type: string}
|
|
39
|
+
- {name: tags, type: json}
|
|
40
|
+
- {name: custom_fields, type: json}
|
|
41
|
+
- {name: satisfaction_rating, type: string}
|
|
42
|
+
- {name: sharing_agreement_ids, type: json}
|
|
43
|
+
- {name: fields, type: json}
|
|
44
|
+
- {name: followup_ids, type: json}
|
|
45
|
+
- {name: brand_id, type: long}
|
|
46
|
+
- {name: allow_channelback, type: boolean}
|
|
47
|
+
- {name: allow_attachments, type: boolean}
|
|
48
|
+
- {name: generated_timestamp, type: long}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type: zendesk
|
|
2
|
+
login_url: https://abc.zendesk.com
|
|
3
|
+
auth_method: oauth
|
|
4
|
+
username: dummy
|
|
5
|
+
password: dummy
|
|
6
|
+
token: dummy
|
|
7
|
+
access_token: dummy
|
|
8
|
+
target: tickets
|
|
9
|
+
app_marketplace_integration_name: abc
|
|
10
|
+
app_marketplace_app_id: abc
|
|
11
|
+
app_marketplace_org_id: abc
|
|
12
|
+
incremental: true
|
|
13
|
+
dedup: true
|
|
14
|
+
retry_initial_wait_sec: 1
|
|
15
|
+
max_retry_wait_sec: 30
|
|
16
|
+
retry_limit: 2
|
|
17
|
+
start_time: "2019-01-12 06:51:50 +0000"
|
|
18
|
+
columns:
|
|
19
|
+
- {name: url, type: string}
|
|
20
|
+
- {name: id, type: long}
|
|
21
|
+
- {name: external_id, type: string}
|
|
22
|
+
- {name: via, type: json}
|
|
23
|
+
- {name: created_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
|
|
24
|
+
- {name: updated_at, type: timestamp, format: '%Y-%m-%dT%H:%M:%S%z'}
|
|
25
|
+
- {name: type, type: string}
|
|
26
|
+
- {name: subject, type: string}
|
|
27
|
+
- {name: raw_subject, type: string}
|
|
28
|
+
- {name: description, type: string}
|
|
29
|
+
- {name: priority, type: string}
|
|
30
|
+
- {name: status, type: string}
|
|
31
|
+
- {name: recipient, type: string}
|
|
32
|
+
- {name: requester_id, type: long}
|
|
33
|
+
- {name: submitter_id, type: long}
|
|
34
|
+
- {name: assignee_id, type: long}
|
|
35
|
+
- {name: organization_id, type: long}
|
|
36
|
+
- {name: group_id, type: long}
|
|
37
|
+
- {name: collaborator_ids, type: json}
|
|
38
|
+
- {name: follower_ids, type: json}
|
|
39
|
+
- {name: email_cc_ids, type: json}
|
|
40
|
+
- {name: forum_topic_id, type: string}
|
|
41
|
+
- {name: problem_id, type: string}
|
|
42
|
+
- {name: has_incidents, type: boolean}
|
|
43
|
+
- {name: is_public, type: boolean}
|
|
44
|
+
- {name: due_at, type: string}
|
|
45
|
+
- {name: tags, type: json}
|
|
46
|
+
- {name: custom_fields, type: json}
|
|
47
|
+
- {name: satisfaction_rating, type: string}
|
|
48
|
+
- {name: sharing_agreement_ids, type: json}
|
|
49
|
+
- {name: fields, type: json}
|
|
50
|
+
- {name: followup_ids, type: json}
|
|
51
|
+
- {name: brand_id, type: long}
|
|
52
|
+
- {name: allow_channelback, type: boolean}
|
|
53
|
+
- {name: allow_attachments, type: boolean}
|
|
54
|
+
- {name: generated_timestamp, type: long}
|