From 342e59ba8f874e692fb508d975448e6d0abaf266 Mon Sep 17 00:00:00 2001 From: HuabingZhao Date: Mon, 26 Feb 2018 16:33:57 +0800 Subject: Support HTTPS service registration Issue-ID: MSB-147 Change-Id: I2fa11b7869cdc512a64497482e814970b701ce33 Signed-off-by: HuabingZhao --- .../org/onap/msb/sdk/discovery/MSBServiceTest.java | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/test/java/org/onap/msb/sdk/discovery/MSBServiceTest.java') 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 nodes=new HashSet(); - NodeInfo node=new NodeInfo(); + + Set nodes = new HashSet(); + 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; -- cgit 1.2.3-korg