Use random port in RmiInboundGatewayParserTests

https://build.spring.io/browse/INT-MASTER-1495/
This commit is contained in:
Artem Bilan
2019-04-15 09:45:00 -04:00
parent 17bd68c062
commit 0ad731df1d
2 changed files with 14 additions and 6 deletions

View File

@@ -16,20 +16,25 @@
<channel id="testErrorChannel"/>
<rmi:inbound-gateway id="gatewayWithDefaults" request-channel="testChannel" auto-startup="false"/>
<rmi:inbound-gateway id="gatewayWithDefaults" request-channel="testChannel" auto-startup="false"
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
<rmi:inbound-gateway id="gatewayWithCustomProperties" request-channel="testChannel"
expect-reply="false" request-timeout="123" reply-timeout="456" auto-startup="false"/>
expect-reply="false" request-timeout="123" reply-timeout="456" auto-startup="false"
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
<rmi:inbound-gateway id="gatewayWithHostAndErrorChannel" request-channel="testChannel" registry-host="localhost"
error-channel="testErrorChannel" auto-startup="false"/>
error-channel="testErrorChannel" auto-startup="false"
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
<rmi:inbound-gateway id="gatewayWithPort" request-channel="testChannel" registry-port="1234" auto-startup="false"/>
<rmi:inbound-gateway id="gatewayWithPort" request-channel="testChannel" auto-startup="false"
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
<rmi:inbound-gateway id="gatewayWithExecutorRef"
request-channel="testChannel"
remote-invocation-executor="invocationExecutor"
auto-startup="false"/>
auto-startup="false"
registry-port="#{T(org.springframework.integration.rmi.config.RmiInboundGatewayParserTests).PORT}"/>
<beans:bean id="invocationExecutor"
class="org.springframework.integration.rmi.config.StubRemoteInvocationExecutor"/>

View File

@@ -29,6 +29,7 @@ import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.SocketUtils;
/**
* @author Mark Fisher
@@ -39,6 +40,8 @@ import org.springframework.test.context.junit4.SpringRunner;
@DirtiesContext
public class RmiInboundGatewayParserTests {
public static final int PORT = SocketUtils.findAvailableTcpPort();
@Autowired
@Qualifier("testChannel")
private MessageChannel channel;
@@ -78,7 +81,7 @@ public class RmiInboundGatewayParserTests {
@Test
public void gatewayWithPort() {
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithPort");
assertThat(TestUtils.getPropertyValue(gateway, "registryPort")).isEqualTo(1234);
assertThat(TestUtils.getPropertyValue(gateway, "registryPort")).isEqualTo(PORT);
}
@Test