|
@@ -7,6 +7,9 @@ import static org.junit.Assert.assertTrue; |
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Comparator; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.Set; |
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
import com.jd.blockchain.utils.net.NetworkAddress; |
|
|
import com.jd.blockchain.utils.net.NetworkAddress; |
|
@@ -32,10 +35,19 @@ public class GatewayConfigPropertiesTest { |
|
|
Set<NetworkAddress> networkAddresses = configProps.masterPeerAddresses(); |
|
|
Set<NetworkAddress> networkAddresses = configProps.masterPeerAddresses(); |
|
|
assertEquals(2, networkAddresses.size()); |
|
|
assertEquals(2, networkAddresses.size()); |
|
|
|
|
|
|
|
|
for(NetworkAddress networkAddress : networkAddresses) { |
|
|
|
|
|
|
|
|
List<NetworkAddress> networkAddressList = new ArrayList<>(networkAddresses); |
|
|
|
|
|
networkAddressList.sort(new Comparator<NetworkAddress>() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public int compare(NetworkAddress o1, NetworkAddress o2) { |
|
|
|
|
|
return o1.getPort() - o2.getPort(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
int index = 0; |
|
|
|
|
|
for(NetworkAddress networkAddress : networkAddressList) { |
|
|
assertEquals("127.0.0.1", networkAddress.getHost()); |
|
|
assertEquals("127.0.0.1", networkAddress.getHost()); |
|
|
assertEquals(12000, networkAddress.getPort()); |
|
|
|
|
|
|
|
|
assertEquals(12000 + index, networkAddress.getPort()); |
|
|
assertTrue(networkAddress.isSecure()); |
|
|
assertTrue(networkAddress.isSecure()); |
|
|
|
|
|
index ++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
assertEquals("http://127.0.0.1:10001", configProps.dataRetrievalUrl()); |
|
|
assertEquals("http://127.0.0.1:10001", configProps.dataRetrievalUrl()); |
|
|