|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -47,6 +47,19 @@ public class UnboundIdContainerTests {
@@ -47,6 +47,19 @@ public class UnboundIdContainerTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void afterPropertiesSetWhenPortIsZeroThenRandomPortIsSelected() throws Exception { |
|
|
|
|
UnboundIdContainer server = new UnboundIdContainer("dc=springframework,dc=org", null); |
|
|
|
|
server.setPort(0); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
server.afterPropertiesSet(); |
|
|
|
|
assertThat(server.getPort()).isNotEqualTo(0); |
|
|
|
|
} finally { |
|
|
|
|
server.destroy(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<Integer> getDefaultPorts(int count) throws IOException { |
|
|
|
|
List<ServerSocket> connections = new ArrayList<>(); |
|
|
|
|
List<Integer> availablePorts = new ArrayList<>(count); |
|
|
|
|
|