() {
+ @Override
+ public Client call() throws Exception {
+ return initialize();
+ }
+ });
+ proxyfiedClient = (Client) Proxy.newProxyInstance(Client.class.getClassLoader(),
+ new Class[]{Client.class}, new GenericInvocationHandler(future));
+
+ } else {
+ client = initialize();
+ }
+ }
+
+
+ private Client initialize() throws Exception {
client = buildClient();
if (autoscan) {
computeMappings();
@@ -331,6 +354,8 @@ public void afterPropertiesSet() throws Exception {
initTemplates();
initMappings();
initAliases();
+
+ return client;
}
@Override
@@ -347,7 +372,7 @@ public void destroy() throws Exception {
@Override
public Client getObject() throws Exception {
- return client;
+ return async ? proxyfiedClient : client;
}
@Override
diff --git a/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchAbstractFactoryBean.java b/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchAbstractFactoryBean.java
index 5eef1358..77bec2fb 100644
--- a/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchAbstractFactoryBean.java
+++ b/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchAbstractFactoryBean.java
@@ -22,6 +22,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.FactoryBean;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.Map;
import java.util.Properties;
@@ -40,6 +41,10 @@ public abstract class ElasticsearchAbstractFactoryBean {
protected Properties properties;
+ protected boolean async = false;
+
+ protected ThreadPoolTaskExecutor taskExecutor;
+
/**
* Elasticsearch Settings file classpath URL (default : es.properties)
* Example :
@@ -94,5 +99,23 @@ public void setSettings(final Map settings) {
*/
public void setProperties(Properties properties) {
this.properties = properties;
+ }
+
+ /**
+ * Enable async initialization
+ *
+ * @param async
+ */
+ public void setAsync(boolean async) {
+ this.async = async;
+ }
+
+ /**
+ * Executor for async init mode
+ *
+ * @param taskExecutor
+ */
+ public void setTaskExecutor(ThreadPoolTaskExecutor taskExecutor) {
+ this.taskExecutor = taskExecutor;
}
}
diff --git a/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeFactoryBean.java b/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeFactoryBean.java
index 825d1d58..4747625c 100644
--- a/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeFactoryBean.java
+++ b/src/main/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeFactoryBean.java
@@ -19,6 +19,7 @@
package fr.pilato.spring.elasticsearch;
+import fr.pilato.spring.elasticsearch.proxy.GenericInvocationHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.elasticsearch.common.settings.ImmutableSettings;
@@ -28,6 +29,11 @@
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
+import org.springframework.util.Assert;
+
+import java.lang.reflect.Proxy;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
/**
* A {@link FactoryBean} implementation used to create a {@link Node} element
@@ -46,34 +52,28 @@ public class ElasticsearchNodeFactoryBean extends ElasticsearchAbstractFactoryBe
protected final Log logger = LogFactory.getLog(getClass());
private Node node;
+ private Node proxyfiedNode;
@Override
public void afterPropertiesSet() throws Exception {
- final NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder();
+ if (async) {
+ Assert.notNull(taskExecutor);
- if (null != settings && null == properties) {
- logger.warn("settings has been deprecated in favor of properties. See issue #15: https://github.com/dadoonet/spring-elasticsearch/issues/15.");
- nodeBuilder.getSettings().put(settings);
- }
+ Future nodeFuture = taskExecutor.submit(new Callable() {
+ @Override
+ public Node call() throws Exception {
+ return initialize();
+ }
+ });
+ proxyfiedNode = (Node) Proxy.newProxyInstance(Node.class.getClassLoader(),
+ new Class[]{Node.class}, new GenericInvocationHandler(nodeFuture));
- if (null != settingsFile && null == properties) {
- Settings settings = ImmutableSettings.settingsBuilder()
- .loadFromClasspath(this.settingsFile)
- .build();
- nodeBuilder.getSettings().put(settings);
+ } else {
+ node = initialize();
}
-
- if (null != properties) {
- nodeBuilder.getSettings().put(properties);
- }
-
- if (logger.isDebugEnabled()) logger.debug("Starting ElasticSearch node...");
- node = nodeBuilder.node();
- logger.info( "Node [" + node.settings().get("name") + "] for [" + node.settings().get("cluster.name") + "] cluster started..." );
- if (logger.isDebugEnabled()) logger.debug( " - data : " + node.settings().get("path.data") );
- if (logger.isDebugEnabled()) logger.debug( " - logs : " + node.settings().get("path.logs") );
}
+
@Override
public void destroy() throws Exception {
try {
@@ -86,7 +86,7 @@ public void destroy() throws Exception {
@Override
public Node getObject() throws Exception {
- return node;
+ return async ? proxyfiedNode : node;
}
@Override
@@ -99,4 +99,32 @@ public boolean isSingleton() {
return true;
}
+ private Node initialize() {
+ final NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder();
+
+ if (null != settings && null == properties) {
+ logger.warn("settings has been deprecated in favor of properties. See issue #15: https://github.com/dadoonet/spring-elasticsearch/issues/15.");
+ nodeBuilder.getSettings().put(settings);
+ }
+
+ if (null != settingsFile && null == properties) {
+ Settings settings = ImmutableSettings.settingsBuilder()
+ .loadFromClasspath(this.settingsFile)
+ .build();
+ nodeBuilder.getSettings().put(settings);
+ }
+
+ if (null != properties) {
+ nodeBuilder.getSettings().put(properties);
+ }
+
+ if (logger.isDebugEnabled()) logger.debug("Starting ElasticSearch node...");
+ node = nodeBuilder.node();
+ logger.info("Node [" + node.settings().get("name") + "] for [" + node.settings().get("cluster.name") + "] cluster started...");
+ if (logger.isDebugEnabled()) logger.debug(" - data : " + node.settings().get("path.data"));
+ if (logger.isDebugEnabled()) logger.debug(" - logs : " + node.settings().get("path.logs"));
+
+ return node;
+ }
+
}
diff --git a/src/main/java/fr/pilato/spring/elasticsearch/proxy/GenericInvocationHandler.java b/src/main/java/fr/pilato/spring/elasticsearch/proxy/GenericInvocationHandler.java
new file mode 100644
index 00000000..591baa5a
--- /dev/null
+++ b/src/main/java/fr/pilato/spring/elasticsearch/proxy/GenericInvocationHandler.java
@@ -0,0 +1,27 @@
+package fr.pilato.spring.elasticsearch.proxy;
+
+import org.springframework.util.ReflectionUtils;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.concurrent.Future;
+
+public class GenericInvocationHandler implements InvocationHandler {
+
+ private volatile T bean;
+ private Future nodeFuture;
+
+ public GenericInvocationHandler(Future nodeFuture) {
+ this.nodeFuture = nodeFuture;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (bean == null) {
+ bean = nodeFuture.get();
+ //release reference
+ nodeFuture = null;
+ }
+ return ReflectionUtils.invokeMethod(method, bean, args);
+ }
+}
diff --git a/src/main/java/fr/pilato/spring/elasticsearch/xml/ClientBeanDefinitionParser.java b/src/main/java/fr/pilato/spring/elasticsearch/xml/ClientBeanDefinitionParser.java
index 3c7c7a98..48d320e4 100644
--- a/src/main/java/fr/pilato/spring/elasticsearch/xml/ClientBeanDefinitionParser.java
+++ b/src/main/java/fr/pilato/spring/elasticsearch/xml/ClientBeanDefinitionParser.java
@@ -19,6 +19,8 @@
package fr.pilato.spring.elasticsearch.xml;
+import fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;
+import fr.pilato.spring.elasticsearch.ElasticsearchTransportClientFactoryBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -28,9 +30,6 @@
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
-import fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;
-import fr.pilato.spring.elasticsearch.ElasticsearchTransportClientFactoryBean;
-
public class ClientBeanDefinitionParser implements BeanDefinitionParser {
protected static final Log logger = LogFactory.getLog(ClientBeanDefinitionParser.class);
@@ -58,6 +57,9 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
String aliases = XMLParserUtil.getElementStringValue(element, "aliases");
String templates = XMLParserUtil.getElementStringValue(element, "templates");
+ String taskExecutor = XMLParserUtil.getElementStringValue(element, "taskExecutor");
+ String async = XMLParserUtil.getElementStringValue(element, "async");
+
// Checking bean definition
boolean isClientNode = (node != null && node.length() > 0);
boolean isEsNodesEmpty = (esNodes == null || esNodes.length() == 0);
@@ -77,13 +79,13 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
bdef.setBeanClass(ElasticsearchClientFactoryBean.class);
BeanDefinitionBuilder clientBuilder = startClientBuilder(ElasticsearchClientFactoryBean.class,
settingsFile, properties, forceMapping, forceTemplate, mergeMapping, mergeSettings, autoscan,
- classpathRoot, mappings, aliases, templates);
+ classpathRoot, mappings, aliases, templates, async, taskExecutor);
client = ClientBeanDefinitionParser.buildClientDef(clientBuilder, node);
} else {
bdef.setBeanClass(ElasticsearchTransportClientFactoryBean.class);
BeanDefinitionBuilder clientBuilder = startClientBuilder(ElasticsearchTransportClientFactoryBean.class,
settingsFile, properties, forceMapping, forceTemplate, mergeMapping, mergeSettings, autoscan,
- classpathRoot, mappings, aliases, templates);
+ classpathRoot, mappings, aliases, templates, async, taskExecutor);
client = ClientBeanDefinitionParser.buildTransportClientDef(clientBuilder, esNodes);
}
@@ -119,7 +121,7 @@ public static BeanDefinitionBuilder startClientBuilder(Class beanClass, String s
boolean forceMapping, boolean forceTemplate,
boolean mergeMapping, boolean mergeSettings,
boolean autoscan, String classpathRoot, String mappings,
- String aliases, String templates) {
+ String aliases, String templates, String async, String taskExecutor) {
BeanDefinitionBuilder nodeFactory = BeanDefinitionBuilder.rootBeanDefinition(beanClass);
if (settingsFile != null && settingsFile.length() > 0) {
logger.warn("settingsFile is deprecated. Use properties attribute instead. See issue #15: https://github.com/dadoonet/spring-elasticsearch/issues/15.");
@@ -145,6 +147,15 @@ public static BeanDefinitionBuilder startClientBuilder(Class beanClass, String s
if (templates != null && templates.length() > 0) {
nodeFactory.addPropertyValue("templates", templates);
}
+
+ if (async != null && async.length() > 0) {
+ nodeFactory.addPropertyValue("async", async);
+ }
+ if (taskExecutor != null && taskExecutor.length() > 0) {
+ nodeFactory.addPropertyReference("taskExecutor", taskExecutor);
+ }
+
+
return nodeFactory;
}
diff --git a/src/main/java/fr/pilato/spring/elasticsearch/xml/NodeBeanDefinitionParser.java b/src/main/java/fr/pilato/spring/elasticsearch/xml/NodeBeanDefinitionParser.java
index 1ce246f1..b63b6c34 100644
--- a/src/main/java/fr/pilato/spring/elasticsearch/xml/NodeBeanDefinitionParser.java
+++ b/src/main/java/fr/pilato/spring/elasticsearch/xml/NodeBeanDefinitionParser.java
@@ -19,6 +19,7 @@
package fr.pilato.spring.elasticsearch.xml;
+import fr.pilato.spring.elasticsearch.ElasticsearchNodeFactoryBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -28,8 +29,6 @@
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
-import fr.pilato.spring.elasticsearch.ElasticsearchNodeFactoryBean;
-
public class NodeBeanDefinitionParser implements BeanDefinitionParser {
protected static final Log logger = LogFactory.getLog(NodeBeanDefinitionParser.class);
@@ -41,9 +40,11 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
String name = element.getAttribute("name");
String settingsFile = element.getAttribute("settingsFile");
String properties = element.getAttribute("properties");
+ String taskExecutor = element.getAttribute("taskExecutor");
+ String async = element.getAttribute("async");
// Define NodeBeanDefinition
- BeanDefinition node = NodeBeanDefinitionParser.buildNodeDef(settingsFile, properties);
+ BeanDefinition node = NodeBeanDefinitionParser.buildNodeDef(settingsFile, properties, async, taskExecutor);
// Register NodeBeanDefinition
if (id != null && id.length() > 0) {
@@ -55,7 +56,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
return bdef;
}
- public static BeanDefinition buildNodeDef(String settingsFile, String properties) {
+ public static BeanDefinition buildNodeDef(String settingsFile, String properties, String async, String taskExecutor) {
BeanDefinitionBuilder nodeFactory = BeanDefinitionBuilder.rootBeanDefinition(ElasticsearchNodeFactoryBean.class);
if (settingsFile != null && settingsFile.length() > 0) {
logger.warn("settingsFile is deprecated. Use properties attribute instead. See issue #15: https://github.com/dadoonet/spring-elasticsearch/issues/15.");
@@ -64,6 +65,13 @@ public static BeanDefinition buildNodeDef(String settingsFile, String properties
if (properties != null && properties.length() > 0) {
nodeFactory.addPropertyReference("properties", properties);
}
+ if (async != null && async.length() > 0) {
+ nodeFactory.addPropertyValue("async", async);
+ }
+ if (taskExecutor != null && taskExecutor.length() > 0) {
+ nodeFactory.addPropertyReference("taskExecutor", taskExecutor);
+ }
+
return nodeFactory.getBeanDefinition();
}
diff --git a/src/main/resources/META-INF/spring.schemas b/src/main/resources/META-INF/spring.schemas
index 062a8364..ae39a7de 100644
--- a/src/main/resources/META-INF/spring.schemas
+++ b/src/main/resources/META-INF/spring.schemas
@@ -1 +1,2 @@
http\://www.pilato.fr/schema/elasticsearch/elasticsearch-0.2.xsd=fr/pilato/spring/elasticsearch/xml/elasticsearch-0.2.xsd
+http\://www.pilato.fr/schema/elasticsearch/elasticsearch-0.3.xsd=fr/pilato/spring/elasticsearch/xml/elasticsearch-0.3.xsd
diff --git a/src/main/resources/fr/pilato/spring/elasticsearch/xml/elasticsearch-0.3.xsd b/src/main/resources/fr/pilato/spring/elasticsearch/xml/elasticsearch-0.3.xsd
new file mode 100644
index 00000000..d028b3be
--- /dev/null
+++ b/src/main/resources/fr/pilato/spring/elasticsearch/xml/elasticsearch-0.3.xsd
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeClientTest.java b/src/test/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeClientTest.java
index d078a132..e1587349 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeClientTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/ElasticsearchNodeClientTest.java
@@ -19,12 +19,12 @@
package fr.pilato.spring.elasticsearch;
-import static org.junit.Assert.*;
-
import org.elasticsearch.client.Client;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchNodeClientTest extends AbstractESTest {
@Autowired Client client;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/annotation/AppConfig.java b/src/test/java/fr/pilato/spring/elasticsearch/annotation/AppConfig.java
index 0ad8e8d1..7d1bfd40 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/annotation/AppConfig.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/annotation/AppConfig.java
@@ -19,14 +19,13 @@
package fr.pilato.spring.elasticsearch.annotation;
+import fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;
+import fr.pilato.spring.elasticsearch.ElasticsearchNodeFactoryBean;
import org.elasticsearch.client.Client;
import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import fr.pilato.spring.elasticsearch.ElasticsearchClientFactoryBean;
-import fr.pilato.spring.elasticsearch.ElasticsearchNodeFactoryBean;
-
@Configuration
public class AppConfig {
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/annotation/ConfigurationTest.java b/src/test/java/fr/pilato/spring/elasticsearch/annotation/ConfigurationTest.java
index f5bb1e8f..82879ba5 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/annotation/ConfigurationTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/annotation/ConfigurationTest.java
@@ -20,7 +20,6 @@
package fr.pilato.spring.elasticsearch.annotation;
import junit.framework.Assert;
-
import org.elasticsearch.client.Client;
import org.elasticsearch.node.Node;
import org.junit.Test;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncClientTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncClientTest.java
new file mode 100644
index 00000000..6758626a
--- /dev/null
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncClientTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to David Pilato (the "Author") under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Author licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package fr.pilato.spring.elasticsearch.xml;
+
+import org.elasticsearch.client.Client;
+import org.elasticsearch.node.Node;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.lang.reflect.Proxy;
+
+import static org.junit.Assert.assertNotNull;
+
+
+public class ElasticsearchAsyncClientTest {
+ static protected ConfigurableApplicationContext ctx;
+
+ @BeforeClass
+ static public void setup() {
+ ctx = new ClassPathXmlApplicationContext("fr/pilato/spring/elasticsearch/xml/es-async-client.xml");
+ }
+
+ @AfterClass
+ static public void tearDown() {
+ if (ctx != null) {
+ ctx.close();
+ }
+ }
+
+ @Test
+ public void test_node_client() throws Exception {
+ Node node = ctx.getBean(Node.class);
+ try {
+ Proxy.getInvocationHandler(node);
+ throw new Exception("Must not be proxyfied");
+ } catch (IllegalArgumentException e) {
+ }
+
+ Client client = ctx.getBean(Client.class);
+ Assert.assertNotNull(Proxy.getInvocationHandler(client));
+
+ assertNotNull("Client must not be null...", client);
+ client.admin().cluster().prepareState().execute().get();
+ }
+}
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeAndClient4Test.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeAndClient4Test.java
new file mode 100644
index 00000000..3fd3a8be
--- /dev/null
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeAndClient4Test.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to David Pilato (the "Author") under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Author licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package fr.pilato.spring.elasticsearch.xml;
+
+import org.elasticsearch.client.Client;
+import org.elasticsearch.node.Node;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.lang.reflect.Proxy;
+import java.util.Map;
+
+
+public class ElasticsearchAsyncNodeAndClient4Test {
+ static protected ConfigurableApplicationContext ctx;
+
+ @BeforeClass
+ static public void setup() {
+ ctx = new ClassPathXmlApplicationContext("fr/pilato/spring/elasticsearch/xml/es-async-node-client4.xml");
+ }
+
+ @AfterClass
+ static public void tearDown() {
+ if (ctx != null) {
+ ctx.close();
+ }
+ }
+
+ @Test
+ public void test_node_client() throws Exception {
+ Node node = ctx.getBean(Node.class);
+ Assert.assertNotNull(Proxy.getInvocationHandler(node));
+
+ Map clientMap = ctx.getBeansOfType(Client.class);
+
+ for (Map.Entry entry : clientMap.entrySet()){
+ if (entry.getKey().contains("async")){
+ Assert.assertNotNull(Proxy.getInvocationHandler(entry.getValue()));
+ }else{
+ try {
+ Proxy.getInvocationHandler(entry.getValue());
+ throw new Exception("Must not be proxyfied");
+ } catch (IllegalArgumentException e) {
+ }
+ }
+ }
+ //wait
+ node.isClosed();
+ }
+}
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeAndClientTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeAndClientTest.java
new file mode 100644
index 00000000..a51e2642
--- /dev/null
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeAndClientTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to David Pilato (the "Author") under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Author licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package fr.pilato.spring.elasticsearch.xml;
+
+import org.elasticsearch.client.Client;
+import org.elasticsearch.node.Node;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.lang.reflect.Proxy;
+import java.util.concurrent.ExecutionException;
+
+import static org.junit.Assert.assertNotNull;
+
+
+public class ElasticsearchAsyncNodeAndClientTest {
+ static protected ConfigurableApplicationContext ctx;
+
+ @BeforeClass
+ static public void setup() {
+ ctx = new ClassPathXmlApplicationContext("fr/pilato/spring/elasticsearch/xml/es-async-node-client.xml");
+ }
+
+ @AfterClass
+ static public void tearDown() {
+ if (ctx != null) {
+ ctx.close();
+ }
+ }
+
+ @Test
+ public void test_node_client() throws ExecutionException, InterruptedException {
+ Node node = ctx.getBean(Node.class);
+ Assert.assertNotNull(Proxy.getInvocationHandler(node));
+ Client client = ctx.getBean("testNodeClient", Client.class);
+ Assert.assertNotNull(Proxy.getInvocationHandler(client));
+
+ assertNotNull("Client must not be null...", client);
+ client.admin().cluster().prepareState().execute().get();
+ }
+}
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeTest.java
new file mode 100644
index 00000000..ded99254
--- /dev/null
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchAsyncNodeTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to David Pilato (the "Author") under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Author licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package fr.pilato.spring.elasticsearch.xml;
+
+import org.elasticsearch.client.Client;
+import org.elasticsearch.node.Node;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.lang.reflect.Proxy;
+
+import static org.junit.Assert.assertNotNull;
+
+
+public class ElasticsearchAsyncNodeTest {
+ static protected ConfigurableApplicationContext ctx;
+
+ @BeforeClass
+ static public void setup() {
+ ctx = new ClassPathXmlApplicationContext("fr/pilato/spring/elasticsearch/xml/es-async-node.xml");
+ }
+
+ @AfterClass
+ static public void tearDown() {
+ if (ctx != null) {
+ ctx.close();
+ }
+ }
+
+ @Test
+ public void test_node_client() throws Exception {
+ Node node = ctx.getBean(Node.class);
+ Assert.assertNotNull(Proxy.getInvocationHandler(node));
+
+ Client client = ctx.getBean(Client.class);
+ try {
+ Proxy.getInvocationHandler(client);
+ throw new Exception("Must not be proxyfied");
+ } catch (IllegalArgumentException e) {
+ }
+
+
+ assertNotNull("Client must not be null...", client);
+ client.admin().cluster().prepareState().execute().get();
+ }
+}
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchClientNamespaceTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchClientNamespaceTest.java
index 08cc9b77..25eb89e4 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchClientNamespaceTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchClientNamespaceTest.java
@@ -19,9 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import org.elasticsearch.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,6 +26,9 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
public class ElasticsearchClientNamespaceTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingConventionTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingConventionTest.java
index ead65dcd..5ef48a5e 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingConventionTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingConventionTest.java
@@ -19,9 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData;
@@ -32,6 +29,9 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
public class ElasticsearchMappingConventionTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingMergeFailedTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingMergeFailedTest.java
index 832c26a5..97f9be6d 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingMergeFailedTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingMergeFailedTest.java
@@ -19,13 +19,13 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.*;
-
import org.elasticsearch.index.mapper.MergeMappingException;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertEquals;
+
/**
* We try to merge non merging mapping.
* An exception should be raised.
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingTest.java
index e16c955c..dbd1621b 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingTest.java
@@ -19,8 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-
import org.elasticsearch.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,6 +26,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchMappingTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingUsingCustomAnalyzersTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingUsingCustomAnalyzersTest.java
index 87d64392..87230094 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingUsingCustomAnalyzersTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchMappingUsingCustomAnalyzersTest.java
@@ -19,8 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.*;
-
import org.elasticsearch.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,6 +26,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchMappingUsingCustomAnalyzersTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchNodeNamespaceTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchNodeNamespaceTest.java
index 92b748e3..ce4d72b1 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchNodeNamespaceTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchNodeNamespaceTest.java
@@ -19,8 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.*;
-
import org.elasticsearch.node.Node;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,6 +26,9 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchNodeNamespaceTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings13Test.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings13Test.java
index 9ca8fdd6..dddbe8c4 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings13Test.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings13Test.java
@@ -19,8 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-
import org.elasticsearch.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,6 +26,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchSettings13Test {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings7Test.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings7Test.java
index 5a75a2c1..17cb196d 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings7Test.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettings7Test.java
@@ -19,8 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-
import org.elasticsearch.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,6 +26,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchSettings7Test {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsMergeFailedTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsMergeFailedTest.java
index 056d871d..e0b2c7a3 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsMergeFailedTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsMergeFailedTest.java
@@ -19,14 +19,14 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertEquals;
-
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertEquals;
+
/**
* We try to merge non merging settings.
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsTest.java
index 33beede7..a4c2de03 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchSettingsTest.java
@@ -19,8 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-
import org.elasticsearch.client.Client;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,6 +26,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertNotNull;
+
public class ElasticsearchSettingsTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchTransportClientNamespaceTest.java b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchTransportClientNamespaceTest.java
index 27ed8dff..cf14b85c 100644
--- a/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchTransportClientNamespaceTest.java
+++ b/src/test/java/fr/pilato/spring/elasticsearch/xml/ElasticsearchTransportClientNamespaceTest.java
@@ -19,11 +19,6 @@
package fr.pilato.spring.elasticsearch.xml;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
@@ -35,6 +30,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.*;
+
public class ElasticsearchTransportClientNamespaceTest {
static protected ConfigurableApplicationContext ctx;
diff --git a/src/test/resources/es-context.xml b/src/test/resources/es-context.xml
index 4c1df4d8..5aa46a50 100644
--- a/src/test/resources/es-context.xml
+++ b/src/test/resources/es-context.xml
@@ -11,12 +11,8 @@
governing permissions and limitations under the License. -->
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
@@ -40,4 +36,4 @@ http://www.springframework.org/schema/context http://www.springframework.org/sch
-
\ No newline at end of file
+
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-client.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-client.xml
new file mode 100644
index 00000000..6ef2786c
--- /dev/null
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-client.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node-client.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node-client.xml
new file mode 100644
index 00000000..c6e73627
--- /dev/null
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node-client.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node-client4.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node-client4.xml
new file mode 100644
index 00000000..6b3f609f
--- /dev/null
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node-client4.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node.xml
new file mode 100644
index 00000000..6df6e1eb
--- /dev/null
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-async-node.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-client-namespace-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-client-namespace-test-context.xml
index 957ee89a..a2b88311 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-client-namespace-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-client-namespace-test-context.xml
@@ -11,13 +11,11 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-convention-badclasspath-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-convention-badclasspath-test-context.xml
index d56b918c..0cd19355 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-convention-badclasspath-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-convention-badclasspath-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-convention-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-convention-test-context.xml
index e06c46bf..68162eb3 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-convention-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-convention-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-failed-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-failed-test-context.xml
index ef313eb0..bd24d27a 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-failed-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-failed-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-test-context.xml
index 25a80f2c..9ad527eb 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-mapping-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-namespace-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-namespace-test-context.xml
index b6f6ec77..0411035a 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-namespace-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-namespace-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-nodefortransportclient-namespace-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-nodefortransportclient-namespace-test-context.xml
index 59c92f0c..94fb7325 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-nodefortransportclient-namespace-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-nodefortransportclient-namespace-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-failed-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-failed-test-context.xml
index b54841d8..100db2fe 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-failed-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-failed-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-test-context.xml
index 71b6c467..0ff1b131 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings13-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings13-test-context.xml
index 959972f9..c6b32ea9 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings13-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings13-test-context.xml
@@ -11,14 +11,10 @@
governing permissions and limitations under the License. -->
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings21-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings21-test-context.xml
index 0430c7d3..5a898b3b 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings21-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings21-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings7-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings7-test-context.xml
index 3bf3e94d..3d84a25d 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings7-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-settings7-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-template-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-template-test-context.xml
index 9e9d9d2c..21e51f5c 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-template-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-template-test-context.xml
@@ -11,12 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-transport-client-namespace-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-transport-client-namespace-test-context.xml
index 474deadf..9badab5a 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-transport-client-namespace-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/es-transport-client-namespace-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->
diff --git a/src/test/resources/fr/pilato/spring/elasticsearch/xml/issue12-custom-analyzers-test-context.xml b/src/test/resources/fr/pilato/spring/elasticsearch/xml/issue12-custom-analyzers-test-context.xml
index 2c3f2cec..b46ddb28 100644
--- a/src/test/resources/fr/pilato/spring/elasticsearch/xml/issue12-custom-analyzers-test-context.xml
+++ b/src/test/resources/fr/pilato/spring/elasticsearch/xml/issue12-custom-analyzers-test-context.xml
@@ -11,13 +11,12 @@
governing permissions and limitations under the License. -->