embulk-input-dynamodb 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -3
- data/build.gradle +29 -5
- data/circle.yml +8 -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 +2 -2
- data/lib/embulk/input/dynamodb.rb +1 -1
- data/src/main/scala/org/embulk/input/dynamodb/AttributeValueHelper.scala +41 -0
- data/src/main/scala/org/embulk/input/dynamodb/AwsCredentials.scala +71 -0
- data/src/main/scala/org/embulk/input/{DynamoDBUtil.scala → dynamodb/DynamoDBUtil.scala} +54 -62
- data/src/main/scala/org/embulk/input/{DynamodbInputPlugin.scala → dynamodb/DynamodbInputPlugin.scala} +14 -8
- data/src/main/scala/org/embulk/input/{Filter.scala → dynamodb/Filter.scala} +2 -2
- data/src/main/scala/org/embulk/input/{FilterConfig.scala → dynamodb/FilterConfig.scala} +1 -1
- data/src/main/scala/org/embulk/input/{PluginTask.scala → dynamodb/PluginTask.scala} +10 -2
- data/src/test/resources/json/test.json +50 -0
- data/src/test/resources/json/test.template +27 -0
- data/src/test/resources/yaml/authMethodBasic.yml +20 -0
- data/src/test/resources/yaml/authMethodBasic_Error.yml +18 -0
- data/src/test/resources/yaml/authMethodEnv.yml +18 -0
- data/src/test/resources/yaml/authMethodProfile.yml +19 -0
- data/src/test/resources/yaml/notSetAuthMethod.yml +19 -0
- data/src/test/scala/org/embulk/input/dynamodb/AttributeValueHelperTest.scala +192 -0
- data/src/test/scala/org/embulk/input/dynamodb/AwsCredentialsTest.scala +135 -0
- metadata +29 -16
@@ -0,0 +1,135 @@
|
|
1
|
+
package org.embulk.input.dynamodb
|
2
|
+
|
3
|
+
import java.io.File
|
4
|
+
import java.nio.charset.Charset
|
5
|
+
import java.nio.file.{FileSystems, Files}
|
6
|
+
|
7
|
+
import com.google.inject.{Binder, Module}
|
8
|
+
import org.embulk.config.ConfigSource
|
9
|
+
import org.embulk.exec.PartialExecutionException
|
10
|
+
import org.embulk.plugin.InjectedPluginSource
|
11
|
+
import org.embulk.spi.InputPlugin
|
12
|
+
import org.embulk.{EmbulkEmbed, EmbulkTestRuntime}
|
13
|
+
import org.junit.Assert.assertEquals
|
14
|
+
import org.junit.{Before, Rule, Test}
|
15
|
+
|
16
|
+
class AwsCredentialsTest {
|
17
|
+
private var EMBULK_DYNAMODB_TEST_REGION: String = null
|
18
|
+
private var EMBULK_DYNAMODB_TEST_TABLE: String = null
|
19
|
+
private var EMBULK_DYNAMODB_TEST_ACCESS_KEY: String = null
|
20
|
+
private var EMBULK_DYNAMODB_TEST_SECRET_KEY: String = null
|
21
|
+
private var EMBULK_DYNAMODB_TEST_PROFILE_NAME: String = null
|
22
|
+
|
23
|
+
private var embulk: EmbulkEmbed = null
|
24
|
+
|
25
|
+
@Rule
|
26
|
+
def runtime: EmbulkTestRuntime = new EmbulkTestRuntime
|
27
|
+
|
28
|
+
@Before
|
29
|
+
def createResources() {
|
30
|
+
// Get Environments
|
31
|
+
EMBULK_DYNAMODB_TEST_REGION = System.getenv("EMBULK_DYNAMODB_TEST_REGION")
|
32
|
+
EMBULK_DYNAMODB_TEST_TABLE = System.getenv("EMBULK_DYNAMODB_TEST_TABLE")
|
33
|
+
EMBULK_DYNAMODB_TEST_ACCESS_KEY = System.getenv("EMBULK_DYNAMODB_TEST_ACCESS_KEY")
|
34
|
+
EMBULK_DYNAMODB_TEST_SECRET_KEY = System.getenv("EMBULK_DYNAMODB_TEST_SECRET_KEY")
|
35
|
+
EMBULK_DYNAMODB_TEST_PROFILE_NAME = System.getenv("EMBULK_DYNAMODB_TEST_PROFILE_NAME")
|
36
|
+
|
37
|
+
val bootstrap = new EmbulkEmbed.Bootstrap()
|
38
|
+
bootstrap.addModules(new Module {
|
39
|
+
def configure(binder: Binder): Unit = {
|
40
|
+
InjectedPluginSource.registerPluginTo(binder,
|
41
|
+
classOf[InputPlugin],
|
42
|
+
"dynamodb",
|
43
|
+
classOf[DynamodbInputPlugin])
|
44
|
+
}
|
45
|
+
})
|
46
|
+
|
47
|
+
embulk = bootstrap.initializeCloseable()
|
48
|
+
}
|
49
|
+
|
50
|
+
def doTest(config: ConfigSource) {
|
51
|
+
embulk.run(config)
|
52
|
+
|
53
|
+
val fs = FileSystems.getDefault
|
54
|
+
val lines = Files.readAllLines(fs.getPath("result000.00.tsv"), Charset.forName("UTF-8"))
|
55
|
+
assertEquals("KEY-1\t1\tHogeHoge", lines.get(0))
|
56
|
+
}
|
57
|
+
|
58
|
+
@Test
|
59
|
+
def notSetAuthMethod_SetCredentials() {
|
60
|
+
val config = embulk.newConfigLoader().fromYamlFile(
|
61
|
+
new File("src/test/resources/yaml/notSetAuthMethod.yml"))
|
62
|
+
|
63
|
+
config.getNested("in")
|
64
|
+
.set("region", EMBULK_DYNAMODB_TEST_REGION)
|
65
|
+
.set("table", EMBULK_DYNAMODB_TEST_TABLE)
|
66
|
+
.set("access_key", EMBULK_DYNAMODB_TEST_ACCESS_KEY)
|
67
|
+
.set("secret_key", EMBULK_DYNAMODB_TEST_SECRET_KEY)
|
68
|
+
|
69
|
+
doTest(config)
|
70
|
+
}
|
71
|
+
|
72
|
+
@Test
|
73
|
+
def setAuthMethod_Basic() {
|
74
|
+
val config = embulk.newConfigLoader().fromYamlFile(
|
75
|
+
new File("src/test/resources/yaml/authMethodBasic.yml"))
|
76
|
+
|
77
|
+
config.getNested("in")
|
78
|
+
.set("region", EMBULK_DYNAMODB_TEST_REGION)
|
79
|
+
.set("table", EMBULK_DYNAMODB_TEST_TABLE)
|
80
|
+
.set("access_key", EMBULK_DYNAMODB_TEST_ACCESS_KEY)
|
81
|
+
.set("secret_key", EMBULK_DYNAMODB_TEST_SECRET_KEY)
|
82
|
+
|
83
|
+
doTest(config)
|
84
|
+
}
|
85
|
+
|
86
|
+
@Test(expected = classOf[PartialExecutionException])
|
87
|
+
def setAuthMethod_Basic_NotSet() {
|
88
|
+
val config = embulk.newConfigLoader().fromYamlFile(
|
89
|
+
new File("src/test/resources/yaml/authMethodBasic_Error.yml"))
|
90
|
+
|
91
|
+
config.getNested("in")
|
92
|
+
.set("region", EMBULK_DYNAMODB_TEST_REGION)
|
93
|
+
.set("table", EMBULK_DYNAMODB_TEST_TABLE)
|
94
|
+
|
95
|
+
doTest(config)
|
96
|
+
}
|
97
|
+
|
98
|
+
@Test
|
99
|
+
def setAuthMethod_Env() {
|
100
|
+
val config = embulk.newConfigLoader().fromYamlFile(
|
101
|
+
new File("src/test/resources/yaml/authMethodEnv.yml"))
|
102
|
+
|
103
|
+
config.getNested("in")
|
104
|
+
.set("region", EMBULK_DYNAMODB_TEST_REGION)
|
105
|
+
.set("table", EMBULK_DYNAMODB_TEST_TABLE)
|
106
|
+
|
107
|
+
doTest(config)
|
108
|
+
}
|
109
|
+
|
110
|
+
@Test
|
111
|
+
def setAuthMethod_Profile() {
|
112
|
+
val config = embulk.newConfigLoader().fromYamlFile(
|
113
|
+
new File("src/test/resources/yaml/authMethodProfile.yml"))
|
114
|
+
|
115
|
+
config.getNested("in")
|
116
|
+
.set("region", EMBULK_DYNAMODB_TEST_REGION)
|
117
|
+
.set("table", EMBULK_DYNAMODB_TEST_TABLE)
|
118
|
+
.set("profile_name", EMBULK_DYNAMODB_TEST_PROFILE_NAME)
|
119
|
+
|
120
|
+
doTest(config)
|
121
|
+
}
|
122
|
+
|
123
|
+
@Test(expected = classOf[PartialExecutionException])
|
124
|
+
def setAuthMethod_Profile_NotExistProfileName() {
|
125
|
+
val config = embulk.newConfigLoader().fromYamlFile(
|
126
|
+
new File("src/test/resources/yaml/authMethodProfile.yml"))
|
127
|
+
|
128
|
+
config.getNested("in")
|
129
|
+
.set("region", EMBULK_DYNAMODB_TEST_REGION)
|
130
|
+
.set("table", EMBULK_DYNAMODB_TEST_TABLE)
|
131
|
+
.set("profile_name", "NotExistName")
|
132
|
+
|
133
|
+
doTest(config)
|
134
|
+
}
|
135
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-dynamodb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Higashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,27 +49,40 @@ files:
|
|
49
49
|
- LICENSE
|
50
50
|
- README.md
|
51
51
|
- build.gradle
|
52
|
+
- circle.yml
|
53
|
+
- config/checkstyle/checkstyle.xml
|
54
|
+
- config/checkstyle/default.xml
|
52
55
|
- gradle/wrapper/gradle-wrapper.jar
|
53
56
|
- gradle/wrapper/gradle-wrapper.properties
|
54
57
|
- gradlew
|
55
58
|
- gradlew.bat
|
56
59
|
- lib/embulk/input/dynamodb.rb
|
57
|
-
- src/main/scala/org/embulk/input/
|
58
|
-
- src/main/scala/org/embulk/input/
|
59
|
-
- src/main/scala/org/embulk/input/
|
60
|
-
- src/main/scala/org/embulk/input/
|
61
|
-
- src/main/scala/org/embulk/input/
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
60
|
+
- src/main/scala/org/embulk/input/dynamodb/AttributeValueHelper.scala
|
61
|
+
- src/main/scala/org/embulk/input/dynamodb/AwsCredentials.scala
|
62
|
+
- src/main/scala/org/embulk/input/dynamodb/DynamoDBUtil.scala
|
63
|
+
- src/main/scala/org/embulk/input/dynamodb/DynamodbInputPlugin.scala
|
64
|
+
- src/main/scala/org/embulk/input/dynamodb/Filter.scala
|
65
|
+
- src/main/scala/org/embulk/input/dynamodb/FilterConfig.scala
|
66
|
+
- src/main/scala/org/embulk/input/dynamodb/PluginTask.scala
|
67
|
+
- src/test/resources/json/test.json
|
68
|
+
- src/test/resources/json/test.template
|
69
|
+
- src/test/resources/yaml/authMethodBasic.yml
|
70
|
+
- src/test/resources/yaml/authMethodBasic_Error.yml
|
71
|
+
- src/test/resources/yaml/authMethodEnv.yml
|
72
|
+
- src/test/resources/yaml/authMethodProfile.yml
|
73
|
+
- src/test/resources/yaml/notSetAuthMethod.yml
|
74
|
+
- src/test/scala/org/embulk/input/dynamodb/AttributeValueHelperTest.scala
|
75
|
+
- src/test/scala/org/embulk/input/dynamodb/AwsCredentialsTest.scala
|
76
|
+
- classpath/aws-java-sdk-core-1.10.43.jar
|
77
|
+
- classpath/aws-java-sdk-dynamodb-1.10.43.jar
|
78
|
+
- classpath/aws-java-sdk-kms-1.10.43.jar
|
79
|
+
- classpath/aws-java-sdk-s3-1.10.43.jar
|
66
80
|
- classpath/commons-codec-1.6.jar
|
67
81
|
- classpath/commons-logging-1.1.3.jar
|
68
|
-
- classpath/embulk-input-dynamodb-0.0.
|
69
|
-
- classpath/httpclient-4.3.
|
70
|
-
- classpath/httpcore-4.3.
|
71
|
-
- classpath/
|
72
|
-
- classpath/scala-library-2.11.5.jar
|
82
|
+
- classpath/embulk-input-dynamodb-0.1.0.jar
|
83
|
+
- classpath/httpclient-4.3.6.jar
|
84
|
+
- classpath/httpcore-4.3.3.jar
|
85
|
+
- classpath/scala-library-2.11.7.jar
|
73
86
|
homepage: https://github.com/lulichn/embulk-input-dynamodb
|
74
87
|
licenses:
|
75
88
|
- MIT
|