refactor util.xcontent to common.xcontent in groovy cliet
This commit is contained in:
parent
e846ed6465
commit
abde45bb82
|
@ -48,7 +48,7 @@ import org.elasticsearch.client.action.terms.TermsRequestBuilder
|
|||
import org.elasticsearch.client.internal.InternalClient
|
||||
import org.elasticsearch.common.xcontent.XContentType
|
||||
import org.elasticsearch.groovy.client.action.GActionFuture
|
||||
import org.elasticsearch.groovy.util.xcontent.GXContentBuilder
|
||||
import org.elasticsearch.groovy.common.xcontent.GXContentBuilder
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse
|
|||
import org.elasticsearch.client.IndicesAdminClient
|
||||
import org.elasticsearch.client.internal.InternalClient
|
||||
import org.elasticsearch.groovy.client.action.GActionFuture
|
||||
import org.elasticsearch.groovy.util.xcontent.GXContentBuilder
|
||||
import org.elasticsearch.groovy.common.xcontent.GXContentBuilder
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.groovy.util.xcontent
|
||||
package org.elasticsearch.groovy.common.xcontent
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentFactory
|
||||
import org.elasticsearch.common.xcontent.XContentType
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.groovy.node
|
|||
import org.elasticsearch.common.settings.ImmutableSettings
|
||||
import org.elasticsearch.common.settings.Settings
|
||||
import org.elasticsearch.common.settings.loader.JsonSettingsLoader
|
||||
import org.elasticsearch.groovy.util.xcontent.GXContentBuilder
|
||||
import org.elasticsearch.groovy.common.xcontent.GXContentBuilder
|
||||
import org.elasticsearch.node.Node
|
||||
import org.elasticsearch.node.internal.InternalNode
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.groovy.util.xcontent
|
||||
package org.elasticsearch.groovy.common.xcontent
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
|
@ -95,42 +95,12 @@ class GXContentBuilderTests extends GroovyTestCase {
|
|||
assertEquals '{"foo":[{"bar":"hello"}]}', result.toString()
|
||||
}
|
||||
|
||||
void testRootElementList() {
|
||||
def builder = new GXContentBuilder()
|
||||
|
||||
def results = ['one', 'two', 'three']
|
||||
|
||||
def result = builder.buildAsString {
|
||||
for (b in results) {
|
||||
element b
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals '["one","two","three"]', result.toString()
|
||||
|
||||
result = builder.buildAsString {
|
||||
results
|
||||
}
|
||||
|
||||
assertEquals '["one","two","three"]', result.toString()
|
||||
|
||||
}
|
||||
|
||||
void testExampleFromReferenceGuide() {
|
||||
def builder = new GXContentBuilder()
|
||||
|
||||
def results = ['one', 'two', 'three']
|
||||
|
||||
def result = builder.buildAsString {
|
||||
for (b in results) {
|
||||
element title: b
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals '[{"title":"one"},{"title":"two"},{"title":"three"}]', result.toString()
|
||||
|
||||
|
||||
result = builder.buildAsString {
|
||||
books = results.collect {
|
||||
[title: it]
|
||||
}
|
|
@ -54,7 +54,7 @@ class SimpleActionsTests {
|
|||
|
||||
@Test
|
||||
void testSimpleOperations() {
|
||||
def value1 = new org.elasticsearch.groovy.util.xcontent.GXContentBuilder().buildAsString {
|
||||
def value1 = new org.elasticsearch.groovy.common.xcontent.GXContentBuilder().buildAsString {
|
||||
something = "test"
|
||||
}
|
||||
println value1
|
||||
|
|
Loading…
Reference in New Issue