/*
 * Licensed to scrutmydocs.org (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 org.scrutmydocs.webapp.test;

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 AppTestConfig {
	
	
	@Bean
	public Node esNode() throws Exception {
		ElasticsearchNodeFactoryBean factory = new ElasticsearchNodeFactoryBean();
		factory.setSettingsFile("es-test.properties");
		factory.afterPropertiesSet();
		return factory.getObject();
	}

	@Bean
	public Client esClient() throws Exception {
		ElasticsearchClientFactoryBean factory = new ElasticsearchClientFactoryBean();
		factory.setNode(esNode());
		factory.afterPropertiesSet();
		return factory.getObject();
		}


}

@@ -932,16 +932,137 @@
 .Node;%0D%0A
+import org.scrutmydocs.webapp.configuration.ScrutMyDocsProperties;%0D%0Aimport org.scrutmydocs.webapp.util.PropertyScanner;%0D%0A
 import o
@@ -1312,16 +1312,48 @@
 ean;%0D%0A%0D%0A
+import java.util.Properties;%0D%0A%0D%0A
 @Configu
@@ -1394,188 +1394,490 @@
  %7B%0D%0A
-%09%0D%0A%09%0D%0A%09@Bean%0D%0A%09public Node esNode() throws Exception %7B%0D%0A%09%09ElasticsearchNodeFactoryBean factory = new ElasticsearchNodeFactoryBean();%0D%0A%09%09factory.setSettingsFile(%22es-test.properties%22
+%0D%0A    @Bean%0D%0A    public ScrutMyDocsProperties smdProperties() throws Exception %7B%0D%0A        ScrutMyDocsProperties smdProperties = PropertyScanner.scanPropertyFile();%0D%0A        return smdProperties;%0D%0A    %7D%0D%0A%0D%0A%09@Bean%0D%0A%09public Node esNode() throws Exception %7B%0D%0A%09%09ElasticsearchNodeFactoryBean factory = new ElasticsearchNodeFactoryBean();%0D%0A        Properties props = new Properties();%0D%0A        props.put(%22esproperties%22, %22classpath:es-test.properties%22);%0D%0A        factory.setProperties(props
 );%0D%0A
@@ -2180,15 +2180,13 @@
 );%0D%0A
-%09%09%7D%0D%0A%0D%0A
+    %7D
 %0D%0A%7D%0D

Fix failing test with Dropbox river