embulk-input-datastore 0.1.1 → 0.1.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53505b8a02cac9d813abb07a6781f48efcada3b0
|
4
|
+
data.tar.gz: 971f8c945301c7d4be69a67a400f6eefead29179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 081ca0244210c7fd2f3d36750fb0fa0ef7eef24d35ae0ef32ce588fecbdacb9c53a0eacf732ad325e8982876f55305f92b18b6947690360709477b5b1ba7e55a
|
7
|
+
data.tar.gz: 207f15f6cb3b6027a84e303d22d5415299af847f126a348837a7c82213cd77fb9367c44805acf98d7c940fbce636fa525ad7e9394f411af417bb6633b9d828bc
|
data/gradle.properties
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version=0.1.
|
1
|
+
version=0.1.2
|
@@ -8,6 +8,7 @@ import org.embulk.config.ConfigDiff
|
|
8
8
|
import org.embulk.config.ConfigSource
|
9
9
|
import org.embulk.config.TaskSource
|
10
10
|
import org.embulk.spi.*
|
11
|
+
import org.embulk.spi.json.JsonParser
|
11
12
|
import org.embulk.spi.type.Types
|
12
13
|
import org.msgpack.value.ValueFactory
|
13
14
|
import java.io.FileInputStream
|
@@ -17,8 +18,13 @@ class DatastoreInputPlugin(doLogging: Boolean = true) : InputPlugin {
|
|
17
18
|
// number of run() method calls
|
18
19
|
private val TASK_COUNT = 1
|
19
20
|
|
20
|
-
private val logger = if (doLogging) {
|
21
|
+
private val logger = if (doLogging) {
|
22
|
+
Exec.getLogger(javaClass)
|
23
|
+
} else {
|
24
|
+
null
|
25
|
+
}
|
21
26
|
private val b64encoder = Base64.getEncoder()
|
27
|
+
private val jsonParser = JsonParser()
|
22
28
|
|
23
29
|
override fun transaction(config: ConfigSource,
|
24
30
|
control: InputPlugin.Control): ConfigDiff {
|
@@ -65,7 +71,7 @@ class DatastoreInputPlugin(doLogging: Boolean = true) : InputPlugin {
|
|
65
71
|
logger?.debug(entity.toString())
|
66
72
|
|
67
73
|
|
68
|
-
val json = when(entity) {
|
74
|
+
val json = when (entity) {
|
69
75
|
is FullEntity<*> -> entityToJsonObject(entity)
|
70
76
|
is ProjectionEntity -> entityToJsonObject(entity)
|
71
77
|
else -> null
|
@@ -77,7 +83,7 @@ class DatastoreInputPlugin(doLogging: Boolean = true) : InputPlugin {
|
|
77
83
|
logger?.error("Unexpected result type")
|
78
84
|
}
|
79
85
|
|
80
|
-
pageBuilder.setJson(col,
|
86
|
+
pageBuilder.setJson(col, jsonParser.parse(json))
|
81
87
|
pageBuilder.addRecord()
|
82
88
|
}
|
83
89
|
|
@@ -113,4 +113,28 @@ object DatastoreInputPluginSpec : Spek({
|
|
113
113
|
}
|
114
114
|
}
|
115
115
|
}
|
116
|
+
|
117
|
+
describe("getGQLResultMode()") {
|
118
|
+
val plugin = DatastoreInputPlugin(false)
|
119
|
+
|
120
|
+
val method = plugin::class.memberFunctions.find { it.name == "getGQLResultMode" }
|
121
|
+
val accesibleMethod = method!!.let {
|
122
|
+
it.isAccessible = true
|
123
|
+
it
|
124
|
+
}
|
125
|
+
|
126
|
+
on("SELECT * query") {
|
127
|
+
it("should returns FullEntity") {
|
128
|
+
val resultMode = accesibleMethod.call(plugin, "SELECT * FROM myKind") as Query.ResultType<*>
|
129
|
+
assertEquals(Query.ResultType.ENTITY, resultMode)
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
on("SELECT non-* query") {
|
134
|
+
it("should returns ProjecttionEntity") {
|
135
|
+
val resultMode = accesibleMethod.call(plugin, "SELECT myProp FROM myKind") as Query.ResultType<*>
|
136
|
+
assertEquals(Query.ResultType.PROJECTION_ENTITY, resultMode)
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
116
140
|
})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-datastore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- syucream
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,7 +61,7 @@ files:
|
|
61
61
|
- classpath/commons-codec-1.3.jar
|
62
62
|
- classpath/commons-logging-1.1.1.jar
|
63
63
|
- classpath/datastore-v1-proto-client-1.6.0.jar
|
64
|
-
- classpath/embulk-input-datastore-0.1.
|
64
|
+
- classpath/embulk-input-datastore-0.1.2.jar
|
65
65
|
- classpath/error_prone_annotations-2.2.0.jar
|
66
66
|
- classpath/gax-1.23.0.jar
|
67
67
|
- classpath/gax-httpjson-0.40.0.jar
|