aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java')
-rw-r--r--src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java b/src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java
index e214bf1..98103e0 100644
--- a/src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java
+++ b/src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2018 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -43,7 +43,7 @@ public class MSBServiceTest {
"http://127.0.0.1:10081/api/microservices/v1/services/aai/version/v8";
private static final String MOCK_REG_SERVICE_JSON =
- "{\"serviceName\":\"aai\",\"version\":\"v8\",\"url\":\"/aai/v8\",\"protocol\":\"REST\",\"visualRange\":\"1\",\"lb_policy\":\"\",\"path\":\"/aai/v8\",\"nodes\":[{\"ip\":\"10.74.44.1\",\"port\":\"8443\",\"ttl\":\"20\"}],\"metadata\":[{\"key\":\"key1\",\"value\":\"value1\"}]}";
+ "{\"serviceName\":\"aai\",\"version\":\"v8\",\"url\":\"/aai/v8\",\"protocol\":\"REST\",\"visualRange\":\"1\",\"lb_policy\":\"\",\"path\":\"/aai/v8\",\"nodes\":[{\"ip\":\"10.74.44.1\",\"port\":\"8443\",\"ttl\":\"20\"}],\"metadata\":[{\"key\":\"key1\",\"value\":\"value1\"}],\"enable_ssl\":false}";
@Test
public void test_registration_update_true() throws RouteException {
@@ -114,17 +114,16 @@ public class MSBServiceTest {
MSBService msbService = new MSBService();
msbService.cancelMicroServiceInfo(msbAddress, "aai", "v8", "10.74.44.1", "8443");
}
-
+
@Test
- public void test_healthCheckbyTTL(){
- try{
- PowerMockito.mockStatic(HttpClientUtil.class);
- MSBService msbService = new MSBService();
- msbService.healthCheckbyTTL("127.0.0.1:10081","aai", "v8", "10.74.44.1", "8443");
- }
- catch (Exception e) {
- Assert.assertTrue(e instanceof RouteException);
- }
+ public void test_healthCheckbyTTL() {
+ try {
+ PowerMockito.mockStatic(HttpClientUtil.class);
+ MSBService msbService = new MSBService();
+ msbService.healthCheckbyTTL("127.0.0.1:10081", "aai", "v8", "10.74.44.1", "8443");
+ } catch (Exception e) {
+ Assert.assertTrue(e instanceof RouteException);
+ }
}
private MicroServiceFullInfo mockMicroServiceFullInfo(MicroServiceInfo info) {
@@ -136,9 +135,9 @@ public class MSBServiceTest {
serviceInfo.setVisualRange(info.getVisualRange());
serviceInfo.setLb_policy(info.getLb_policy());
serviceInfo.setPath(info.getPath());
-
- Set<NodeInfo> nodes=new HashSet<NodeInfo>();
- NodeInfo node=new NodeInfo();
+
+ Set<NodeInfo> nodes = new HashSet<NodeInfo>();
+ NodeInfo node = new NodeInfo();
node.setCreated_at(new Date());
node.setExpiration(new Date());
node.setIp("10.74.44.1");
@@ -147,7 +146,7 @@ public class MSBServiceTest {
node.setStatus("1");
node.setTtl("20");
node.setUpdated_at(new Date());
-
+
nodes.add(node);
serviceInfo.setNodes(nodes);
return serviceInfo;