Commit 2b8bc3fb by Dennis Schulte

Fix HazelcastTest with proper network-config for CI

parent c8a27d08
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-spring</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId> <artifactId>bootstrap</artifactId>
</dependency> </dependency>
......
...@@ -33,6 +33,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; ...@@ -33,6 +33,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
import org.springframework.boot.test.TestRestTemplate; import org.springframework.boot.test.TestRestTemplate;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -51,19 +52,21 @@ public class AdminApplicationHazelcastTest { ...@@ -51,19 +52,21 @@ public class AdminApplicationHazelcastTest {
@Configuration @Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
@EnableAdminServer @EnableAdminServer
@ImportResource("classpath:hazelcast-test.xml")
public static class TestAdminApplication { public static class TestAdminApplication {
} }
private RestTemplate template = new TestRestTemplate(); private RestTemplate template = new TestRestTemplate();
private EmbeddedWebApplicationContext instance1; private EmbeddedWebApplicationContext instance1;
private EmbeddedWebApplicationContext instance2; private EmbeddedWebApplicationContext instance2;
@Before @Before
public void setup() { public void setup() throws InterruptedException {
System.setProperty("hazelcast.wait.seconds.before.join", "0");
instance1 = (EmbeddedWebApplicationContext) SpringApplication.run(TestAdminApplication.class, new String[] { instance1 = (EmbeddedWebApplicationContext) SpringApplication.run(TestAdminApplication.class, new String[] {
"--server.port=0", "--spring.jmx.enabled=false" }); "--server.port=0", "--spring.jmx.enabled=false", "--spring.boot.admin.hazelcast.enable=true" });
instance2 = (EmbeddedWebApplicationContext) SpringApplication.run(TestAdminApplication.class, new String[] { instance2 = (EmbeddedWebApplicationContext) SpringApplication.run(TestAdminApplication.class, new String[] {
"--server.port=0", "--spring.jmx.enabled=false" }); "--server.port=0", "--spring.jmx.enabled=false", "--spring.boot.admin.hazelcast.enable=true" });
} }
@After @After
...@@ -73,7 +76,6 @@ public class AdminApplicationHazelcastTest { ...@@ -73,7 +76,6 @@ public class AdminApplicationHazelcastTest {
} }
@Test @Test
@Ignore("Testcase does not work properly in all environments, so it's ignored in the build.")
public void test() { public void test() {
Application app = new Application("http://127.0.0.1", "Hazelcast Test"); Application app = new Application("http://127.0.0.1", "Hazelcast Test");
Application app2 = new Application("http://127.0.0.1:2", "Hazelcast Test"); Application app2 = new Application("http://127.0.0.1:2", "Hazelcast Test");
......
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring-3.3.xsd">
<hz:config id="hazelcastConfig">
<hz:network port="5701">
<hz:join>
<hz:multicast enabled="false"/>
<hz:tcp-ip enabled="true">
<hz:member>localhost</hz:member>
</hz:tcp-ip>
</hz:join>
</hz:network>
</hz:config>
</beans>
\ No newline at end of file
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