From abde45bb82d6d653b557fef94a590af04f95dce2 Mon Sep 17 00:00:00 2001 From: kimchy Date: Sun, 20 Jun 2010 08:53:45 +0300 Subject: [PATCH] refactor util.xcontent to common.xcontent in groovy cliet --- .../groovy/client/GClient.groovy | 2 +- .../groovy/client/GIndicesAdminClient.groovy | 2 +- .../xcontent/GXContentBuilder.groovy | 2 +- .../groovy/node/GNodeBuilder.groovy | 4 +-- .../xcontent/GXContentBuilderTests.groovy | 32 +------------------ .../test/client/SimpleActionsTests.groovy | 2 +- 6 files changed, 7 insertions(+), 37 deletions(-) rename plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/{util => common}/xcontent/GXContentBuilder.groovy (99%) rename plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/{util => common}/xcontent/GXContentBuilderTests.groovy (84%) diff --git a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy index 2706b790558..1522d8063ac 100644 --- a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy +++ b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy @@ -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) diff --git a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GIndicesAdminClient.groovy b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GIndicesAdminClient.groovy index 2bc147580e5..03f3536dd8f 100644 --- a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GIndicesAdminClient.groovy +++ b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GIndicesAdminClient.groovy @@ -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) diff --git a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/util/xcontent/GXContentBuilder.groovy b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy similarity index 99% rename from plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/util/xcontent/GXContentBuilder.groovy rename to plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy index 70ebe83a301..ac30b1eb3d8 100644 --- a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/util/xcontent/GXContentBuilder.groovy +++ b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy @@ -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 diff --git a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/node/GNodeBuilder.groovy b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/node/GNodeBuilder.groovy index b5f6f8fbd36..a559de0326c 100644 --- a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/node/GNodeBuilder.groovy +++ b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/node/GNodeBuilder.groovy @@ -22,12 +22,12 @@ 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 /** - * The node builder allow to build a {@link GNode} instance. + * The node builder allow to build a {@link GNode} instance. * * @author kimchy (shay.banon) */ diff --git a/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/util/xcontent/GXContentBuilderTests.groovy b/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilderTests.groovy similarity index 84% rename from plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/util/xcontent/GXContentBuilderTests.groovy rename to plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilderTests.groovy index 0a5999bf3a7..c0e71f51c63 100644 --- a/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/util/xcontent/GXContentBuilderTests.groovy +++ b/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilderTests.groovy @@ -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] } diff --git a/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/test/client/SimpleActionsTests.groovy b/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/test/client/SimpleActionsTests.groovy index 89e6ec7ef41..8df14452d87 100644 --- a/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/test/client/SimpleActionsTests.groovy +++ b/plugins/client/groovy/src/test/groovy/org/elasticsearch/groovy/test/client/SimpleActionsTests.groovy @@ -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