aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorHuabingZhao <zhao.huabing@zte.com.cn>2018-02-26 16:33:57 +0800
committerHuabingZhao <zhao.huabing@zte.com.cn>2018-02-26 16:34:14 +0800
commit342e59ba8f874e692fb508d975448e6d0abaf266 (patch)
tree3f2fb664d8a3bcdb79d0218125fb2f2a2cd9377a /src/test
parent97e4489fd90faf3addec24ebfe6ca87f191d99ec (diff)
Support HTTPS service registration
Issue-ID: MSB-147 Change-Id: I2fa11b7869cdc512a64497482e814970b701ce33 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java31
-rw-r--r--src/test/java/org/onap/msb/sdk/httpclient/msb/MSBServiceClientTest.java4
2 files changed, 17 insertions, 18 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;
diff --git a/src/test/java/org/onap/msb/sdk/httpclient/msb/MSBServiceClientTest.java b/src/test/java/org/onap/msb/sdk/httpclient/msb/MSBServiceClientTest.java
index 403e44b..5ee191b 100644
--- a/src/test/java/org/onap/msb/sdk/httpclient/msb/MSBServiceClientTest.java
+++ b/src/test/java/org/onap/msb/sdk/httpclient/msb/MSBServiceClientTest.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
@@ -39,7 +39,7 @@ public class MSBServiceClientTest {
"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\":\"\"}],\"metadata\":null}";
+ "{\"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\":\"\"}],\"metadata\":null,\"enable_ssl\":false}";
@Test
public void test_registration_update_true() throws RouteException {