Commit 17a54316 authored by Yann Mombrun's avatar Yann Mombrun

Fix invalid configuration.xml after host addition

Also add a unit test that loads the whole configuration to prevent from
the above mentionned issue
parent 899674ba
......@@ -173,6 +173,7 @@
<property name="jmxUser" value="weblab" />
<property name="jmxPassword" value="weblab" />
<property name="jmxPort" value="1099" />
<property name="host" value="${karaf.host}" />
<property name="env">
<bean class="org.ow2.weblab.bundle.utils.ProcessUtils.Env">
<constructor-arg>
......@@ -194,6 +195,7 @@
<property name="jmxPort" value="${activemq.jmx.port}" />
<property name="binDirectory" value="${weblab.home}${activemq.path}/bin" />
<property name="port" value="${activemq.main.port}" />
<property name="host" value="${activemq.host}" />
<property name="env">
<bean class="org.ow2.weblab.bundle.utils.ProcessUtils.Env">
<constructor-arg>
......@@ -240,6 +242,7 @@
<property name="binDirectory" value="${weblab.home}${solr.path}/bin" />
<property name="zookeeperEnsemble" value="${solr.cloud.zk.ensemble}" />
<property name="dataDirectory" value="${weblab.data}/solr_node1" />
<property name="host" value="${solr1.host}" />
<!-- WARN this value is only set to check solr server is correctly running. Changing this value will not change port on which solr is listening -->
<!-- see -p options below -->
<property name="port" value="${solr1.http.port}" />
......
......@@ -118,6 +118,22 @@ In case something goes wrong, explains, as much as possible, where it failed and
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<outputFile>target/maven-filtered.properties</outputFile>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
......
......@@ -36,20 +36,30 @@ import org.springframework.core.io.FileSystemResource;
public class LauncherTest {
/**
* Try to read the configuration.xml file provided in bundle/conf folder.
*
* Rely on the configuration of properties plugin that generates a file maven-filtered.properties with the properties of the pom. This enable to resolve values like serverXXX.path that are
* replaced at packaging time.
*/
@Test
public void testConfigLoading() {
System.setProperty("weblab.home", PathUtils.getWebLabHome(""));
System.setProperty("weblab.conf", PathUtils.getWebLabHome("conf"));
System.setProperty("weblab.data", PathUtils.getWebLabHome("data"));
final DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
final XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
reader.loadBeanDefinitions(new FileSystemResource("src/test/resources/conf/configuration.xml"));
reader.loadBeanDefinitions(new FileSystemResource("../../conf/configuration.xml"));
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
if (factory.containsBean("properties")) {
cfg = factory.getBean("properties", PropertyPlaceholderConfigurer.class);
cfg.setIgnoreUnresolvablePlaceholders(true);
cfg.setIgnoreUnresolvablePlaceholders(false);
final FileSystemResource filterFile = new FileSystemResource("target/maven-filtered.properties");
Assert.assertTrue("Filter file " + filterFile.getFile() + " does not exists.", filterFile.getFile().exists());
cfg.setLocation(filterFile);
}
cfg.postProcessBeanFactory(factory);
......@@ -61,6 +71,7 @@ public class LauncherTest {
@Test
public void testPaths() throws IOException {
final String file = PathUtils.createPath("src", "test", "resources") + "cxf-servlet.xml";
final String replacement = "<constructor-arg value=\"test\"/>";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment