Skip to content

Commit 0ad731d

Browse files
committed
Use random port in RmiInboundGatewayParserTests
https://build.spring.io/browse/INT-MASTER-1495/
1 parent 17bd68c commit 0ad731d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

spring-integration-rmi/src/test/java/org/springframework/integration/rmi/config/RmiInboundGatewayParserTests-context.xml

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,25 @@
1616

1717
<channel id="testErrorChannel"/>
1818

19-
<rmi:inbound-gateway id="gatewayWithDefaults" request-channel="testChannel" auto-startup="false"/>
19+
<rmi:inbound-gateway id="gatewayWithDefaults" request-channel="testChannel" auto-startup="false"
20+
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
2021

2122
<rmi:inbound-gateway id="gatewayWithCustomProperties" request-channel="testChannel"
22-
expect-reply="false" request-timeout="123" reply-timeout="456" auto-startup="false"/>
23+
expect-reply="false" request-timeout="123" reply-timeout="456" auto-startup="false"
24+
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
2325

2426
<rmi:inbound-gateway id="gatewayWithHostAndErrorChannel" request-channel="testChannel" registry-host="localhost"
25-
error-channel="testErrorChannel" auto-startup="false"/>
27+
error-channel="testErrorChannel" auto-startup="false"
28+
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
2629

27-
<rmi:inbound-gateway id="gatewayWithPort" request-channel="testChannel" registry-port="1234" auto-startup="false"/>
30+
<rmi:inbound-gateway id="gatewayWithPort" request-channel="testChannel" auto-startup="false"
31+
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
2832

2933
<rmi:inbound-gateway id="gatewayWithExecutorRef"
3034
request-channel="testChannel"
3135
remote-invocation-executor="invocationExecutor"
32-
auto-startup="false"/>
36+
auto-startup="false"
37+
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
3338

3439
<beans:bean id="invocationExecutor"
3540
class="org.springframework.integration.rmi.config.StubRemoteInvocationExecutor"/>

spring-integration-rmi/src/test/java/org/springframework/integration/rmi/config/RmiInboundGatewayParserTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.springframework.messaging.MessageChannel;
3030
import org.springframework.test.annotation.DirtiesContext;
3131
import org.springframework.test.context.junit4.SpringRunner;
32+
import org.springframework.util.SocketUtils;
3233

3334
/**
3435
* @author Mark Fisher
@@ -39,6 +40,8 @@
3940
@DirtiesContext
4041
public class RmiInboundGatewayParserTests {
4142

43+
public static final int PORT = SocketUtils.findAvailableTcpPort();
44+
4245
@Autowired
4346
@Qualifier("testChannel")
4447
private MessageChannel channel;
@@ -78,7 +81,7 @@ public void gatewayWithHost() {
7881
@Test
7982
public void gatewayWithPort() {
8083
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithPort");
81-
assertThat(TestUtils.getPropertyValue(gateway, "registryPort")).isEqualTo(1234);
84+
assertThat(TestUtils.getPropertyValue(gateway, "registryPort")).isEqualTo(PORT);
8285
}
8386

8487
@Test

0 commit comments

Comments
 (0)