diff options
author | mmis <michael.morris@ericsson.com> | 2018-03-22 14:20:46 +0000 |
---|---|---|
committer | mmis <michael.morris@ericsson.com> | 2018-03-22 15:36:03 +0000 |
commit | 5c4675e5f6f7fe9b8d9e87976ac5f603ff61c268 (patch) | |
tree | 6bcecde682b32cc55405a0131725ec7eb84a58c8 /controlloop/common/simulators/src/test | |
parent | 51619118d5148d10e9232d44b507a503c5b777e5 (diff) |
Removed checkstyle warnings
Removed checkstyle warnings in:
policy/controlloop/common/guard
policy/controlloop/common/msb
policy/controlloop/simulators
including renaming of the following classes:
MSBServiceFactory -> MsbServiceFactory
MSBServiceManager -> MsbServiceManager
MSBServiceException -> MsbServiceException
Issue-ID: POLICY-705
Change-Id: I11d62a74fcb77e764121df119cb0bd9b844b485b
Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'controlloop/common/simulators/src/test')
4 files changed, 236 insertions, 228 deletions
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java index 86168e899..89208d2c6 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * simulators * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,70 +45,73 @@ import org.onap.policy.rest.RESTManager; public class AaiSimulatorTest { - @BeforeClass - public static void setUpSimulator() { - LoggerUtil.setLevel("ROOT", "INFO"); - LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); - try { - Util.buildAaiSim(); - } catch (final Exception e) { - fail(e.getMessage()); + /** + * Set up test class. + */ + @BeforeClass + public static void setUpSimulator() { + LoggerUtil.setLevel("ROOT", "INFO"); + LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); + try { + Util.buildAaiSim(); + } catch (final Exception e) { + fail(e.getMessage()); + } } - } - @AfterClass - public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); - } + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } - @Test - public void testGet() { - final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID( - "http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass", - UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792"); - assertNotNull(response); - assertNotNull(response.getRelationshipList()); - } + @Test + public void testGet() { + final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID( + "http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass", + UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792"); + assertNotNull(response); + assertNotNull(response.getRelationshipList()); + } - @Test - public void testPost() { - final AAINQRequest request = new AAINQRequest(); - final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters(); - final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery(); - tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469")); - tempQueryParameters.setNamedQuery(tempNamedQuery); - request.setQueryParameters(tempQueryParameters); - Map<String, String> tempInnerMap = new HashMap<>(); - tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1"); - Map<String, Map<String, String>> tempOuterMap = new HashMap<>(); - tempOuterMap.put("vserver", tempInnerMap); - List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>(); - tempInstanceFilter.add(tempOuterMap); - AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters(); - tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.setInstanceFilters(tempInstanceFilters); + @Test + public void testPost() { + final AAINQRequest request = new AAINQRequest(); + final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters(); + final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery(); + tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469")); + tempQueryParameters.setNamedQuery(tempNamedQuery); + request.setQueryParameters(tempQueryParameters); + Map<String, String> tempInnerMap = new HashMap<>(); + tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1"); + Map<String, Map<String, String>> tempOuterMap = new HashMap<>(); + tempOuterMap.put("vserver", tempInnerMap); + List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>(); + tempInstanceFilter.add(tempOuterMap); + AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters(); + tempInstanceFilters.setInstanceFilter(tempInstanceFilter); + request.setInstanceFilters(tempInstanceFilters); - AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", - request, UUID.randomUUID()); - assertNotNull(response); - assertNotNull(response.getInventoryResponseItems()); + AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", + "testPass", request, UUID.randomUUID()); + assertNotNull(response); + assertNotNull(response.getInventoryResponseItems()); - tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087")); - tempQueryParameters.setNamedQuery(tempNamedQuery); - request.setQueryParameters(tempQueryParameters); - tempInnerMap = new HashMap<>(); - tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb"); - tempOuterMap = new HashMap<>(); - tempOuterMap.put("generic-vnf", tempInnerMap); - tempInstanceFilter = new LinkedList<>(); - tempInstanceFilter.add(tempOuterMap); - tempInstanceFilters = new AAINQInstanceFilters(); - tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.setInstanceFilters(tempInstanceFilters); + tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087")); + tempQueryParameters.setNamedQuery(tempNamedQuery); + request.setQueryParameters(tempQueryParameters); + tempInnerMap = new HashMap<>(); + tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb"); + tempOuterMap = new HashMap<>(); + tempOuterMap.put("generic-vnf", tempInnerMap); + tempInstanceFilter = new LinkedList<>(); + tempInstanceFilter.add(tempOuterMap); + tempInstanceFilters = new AAINQInstanceFilters(); + tempInstanceFilters.setInstanceFilter(tempInstanceFilter); + request.setInstanceFilters(tempInstanceFilters); - response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, - UUID.randomUUID()); - assertNotNull(response); - assertNotNull(response.getInventoryResponseItems()); - } + response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, + UUID.randomUUID()); + assertNotNull(response); + assertNotNull(response.getInventoryResponseItems()); + } } diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java index ea13ec445..9522e55da 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * simulators * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ package org.onap.policy.simulators; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -28,48 +32,48 @@ import org.onap.policy.drools.utils.LoggerUtil; import org.onap.policy.rest.RESTManager; import org.onap.policy.rest.RESTManager.Pair; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - public class GuardSimulatorTest { - @BeforeClass - public static void setupSimulator() { - LoggerUtil.setLevel("ROOT", "INFO"); - LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); - try { - org.onap.policy.simulators.Util.buildGuardSim(); - } catch (Exception e) { - fail(e.getMessage()); - } - } - - @AfterClass - public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); - } - - @Test - public void testGuard() { - String request = makeRequest("test_actor_id", "test_op_id", "test_target", "test_clName"); - String url = "http://localhost:" + Util.GUARDSIM_SERVER_PORT + "/pdp/api/getDecision"; - Pair<Integer, String> response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); - assertNotNull(response); - assertNotNull(response.a); - assertNotNull(response.b); - assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.b); - - request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard"); - response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); - assertNotNull(response); + /** + * Set up test class. + */ + @BeforeClass + public static void setupSimulator() { + LoggerUtil.setLevel("ROOT", "INFO"); + LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); + try { + org.onap.policy.simulators.Util.buildGuardSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + + @Test + public void testGuard() { + String request = makeRequest("test_actor_id", "test_op_id", "test_target", "test_clName"); + String url = "http://localhost:" + Util.GUARDSIM_SERVER_PORT + "/pdp/api/getDecision"; + Pair<Integer, String> response = + new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); + assertNotNull(response); + assertNotNull(response.a); + assertNotNull(response.b); + assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.b); + + request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard"); + response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); + assertNotNull(response); assertNotNull(response.a); assertNotNull(response.b); assertEquals("{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}", response.b); - } - - private static String makeRequest (String actor, String recipe, String target, String clName) { - return "{\"decisionAttributes\": {\"actor\": \"" + actor + "\", \"recipe\": \"" + recipe + "\"" + } + + private static String makeRequest(String actor, String recipe, String target, String clName) { + return "{\"decisionAttributes\": {\"actor\": \"" + actor + "\", \"recipe\": \"" + recipe + "\"" + ", \"target\": \"" + target + "\", \"clname\": \"" + clName + "\"}, \"onapName\": \"PDPD\"}"; - } + } } diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 8ea0062cc..edc942bbe 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * simulators * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,103 +46,104 @@ import org.onap.policy.so.util.Serialization; public class SoSimulatorTest { - @BeforeClass - public static void setUpSimulator() { - LoggerUtil.setLevel("ROOT", "INFO"); - LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); - try { - Util.buildSoSim(); - } catch (final Exception e) { - fail(e.getMessage()); + /** + * Set up test class. + */ + @BeforeClass + public static void setUpSimulator() { + LoggerUtil.setLevel("ROOT", "INFO"); + LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); + try { + Util.buildSoSim(); + } catch (final Exception e) { + fail(e.getMessage()); + } } - } - @AfterClass - public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); - } + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } - /** - * Create dummy SO request for TestResponse() junit - */ - private SORequest createTestRequest() { + /** + * Create dummy SO request for TestResponse() junit. + */ + private SORequest createTestRequest() { - // Construct SO Request - final SORequest request = new SORequest(); - request.setRequestId(UUID.randomUUID()); - request.setRequestDetails(new SORequestDetails()); - request.getRequestDetails().setModelInfo(new SOModelInfo()); - request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); - request.getRequestDetails().setRequestInfo(new SORequestInfo()); - request.getRequestDetails().setRequestParameters(new SORequestParameters()); - request.getRequestDetails().getRequestParameters().setUserParams(null); - // - // cloudConfiguration - // - request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW"); - request.getRequestDetails().getCloudConfiguration().setTenantId("1015548"); - // - // modelInfo - // - request.getRequestDetails().getModelInfo().setModelType("vfModule"); - request.getRequestDetails().getModelInfo().setModelInvariantId("f32568ec-2f1c-458a-864b-0593d53d141a"); - request.getRequestDetails().getModelInfo().setModelVersionId("69615025-879d-4f0d-afe3-b7d1a7eeed1f"); - request.getRequestDetails().getModelInfo().setModelName("C15ce9e1E9144c8fB8bb..dnsscaling..module-1"); - request.getRequestDetails().getModelInfo().setModelVersion("1.0"); - // - // requestInfo - // - request.getRequestDetails().getRequestInfo().setInstanceName( - "vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8"); - request.getRequestDetails().getRequestInfo().setSource("POLICY"); - request.getRequestDetails().getRequestInfo().setSuppressRollback(false); - request.getRequestDetails().getRequestInfo().setRequestorId("policy"); - // - // relatedInstanceList - // - final SORelatedInstanceListElement relatedInstanceListElement1 = - new SORelatedInstanceListElement(); - final SORelatedInstanceListElement relatedInstanceListElement2 = - new SORelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); - // - relatedInstanceListElement1.getRelatedInstance().setInstanceId("cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5"); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelInvariantId( - "4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersionId( - "5c996219-b2e2-4c76-9b43-7e8672a33c1d"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("8330e932-2a23-4943-8606"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("1.0"); - // - relatedInstanceListElement2.getRelatedInstance().setInstanceId("594e2fe0-48b8-41ff-82e2-3d4bab69b192"); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( - "033a32ed-aa65-4764-a736-36f2942f1aa0"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId( - "d4d072dc-4e21-4a03-9524-628985819a8e"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName("c15ce9e1-e914-4c8f-b8bb"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelCustomizationName( - "c15ce9e1-e914-4c8f-b8bb 1"); - // - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); + // Construct SO Request + final SORequest request = new SORequest(); + request.setRequestId(UUID.randomUUID()); + request.setRequestDetails(new SORequestDetails()); + request.getRequestDetails().setModelInfo(new SOModelInfo()); + request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); + request.getRequestDetails().setRequestInfo(new SORequestInfo()); + request.getRequestDetails().setRequestParameters(new SORequestParameters()); + request.getRequestDetails().getRequestParameters().setUserParams(null); + // + // cloudConfiguration + // + request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW"); + request.getRequestDetails().getCloudConfiguration().setTenantId("1015548"); + // + // modelInfo + // + request.getRequestDetails().getModelInfo().setModelType("vfModule"); + request.getRequestDetails().getModelInfo().setModelInvariantId("f32568ec-2f1c-458a-864b-0593d53d141a"); + request.getRequestDetails().getModelInfo().setModelVersionId("69615025-879d-4f0d-afe3-b7d1a7eeed1f"); + request.getRequestDetails().getModelInfo().setModelName("C15ce9e1E9144c8fB8bb..dnsscaling..module-1"); + request.getRequestDetails().getModelInfo().setModelVersion("1.0"); + // + // requestInfo + // + request.getRequestDetails().getRequestInfo() + .setInstanceName("vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8"); + request.getRequestDetails().getRequestInfo().setSource("POLICY"); + request.getRequestDetails().getRequestInfo().setSuppressRollback(false); + request.getRequestDetails().getRequestInfo().setRequestorId("policy"); + // + // relatedInstanceList + // + final SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); + final SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); + // + relatedInstanceListElement1.getRelatedInstance().setInstanceId("cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5"); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo() + .setModelInvariantId("4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo() + .setModelVersionId("5c996219-b2e2-4c76-9b43-7e8672a33c1d"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("8330e932-2a23-4943-8606"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("1.0"); + // + relatedInstanceListElement2.getRelatedInstance().setInstanceId("594e2fe0-48b8-41ff-82e2-3d4bab69b192"); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelInvariantId("033a32ed-aa65-4764-a736-36f2942f1aa0"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelVersionId("d4d072dc-4e21-4a03-9524-628985819a8e"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName("c15ce9e1-e914-4c8f-b8bb"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelCustomizationName("c15ce9e1-e914-4c8f-b8bb 1"); + // + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); - return request; - } + return request; + } - @Test - public void testResponse() { - final String request = Serialization.gsonPretty.toJson(this.createTestRequest()); - final Pair<Integer, String> httpDetails = new RESTManager().post( - "http://localhost:6667/serviceInstances/v5/12345/vnfs/12345/vfModules", "username", - "password", new HashMap<>(), "application/json", request); - assertNotNull(httpDetails); - final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); - assertNotNull(response); - } + @Test + public void testResponse() { + final String request = Serialization.gsonPretty.toJson(this.createTestRequest()); + final Pair<Integer, String> httpDetails = + new RESTManager().post("http://localhost:6667/serviceInstances/v5/12345/vnfs/12345/vfModules", + "username", "password", new HashMap<>(), "application/json", request); + assertNotNull(httpDetails); + final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); + assertNotNull(response); + } } diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java index 4c29331bf..d26cee321 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * simulators * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,42 +38,42 @@ import org.onap.policy.vfc.util.Serialization; public class VfcSimulatorTest { - @BeforeClass - public static void setUpSimulator() { - LoggerUtil.setLevel("ROOT", "INFO"); - LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); - try { - Util.buildVfcSim(); - } catch (final Exception e) { - fail(e.getMessage()); + /** + * Set up test class. + */ + @BeforeClass + public static void setUpSimulator() { + LoggerUtil.setLevel("ROOT", "INFO"); + LoggerUtil.setLevel("org.eclipse.jetty", "WARN"); + try { + Util.buildVfcSim(); + } catch (final Exception e) { + fail(e.getMessage()); + } } - } - @AfterClass - public static void tearDownSimulator() { - HttpServletServer.factory.destroy(); - } + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } - @Test - public void testPost() { - final Pair<Integer, String> httpDetails = - new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", - "password", new HashMap<String, String>(), "application/json", "Some Request Here"); - assertNotNull(httpDetails); - assertTrue(httpDetails.a == 202); - final VFCResponse response = - Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class); - assertNotNull(response); - } + @Test + public void testPost() { + final Pair<Integer, String> httpDetails = + new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", + new HashMap<String, String>(), "application/json", "Some Request Here"); + assertNotNull(httpDetails); + assertTrue(httpDetails.a == 202); + final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class); + assertNotNull(response); + } - @Test - public void testGet() { - final Pair<Integer, String> httpDetails = - new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", - new HashMap<String, String>()); - assertNotNull(httpDetails); - final VFCResponse response = - Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class); - assertNotNull(response); - } + @Test + public void testGet() { + final Pair<Integer, String> httpDetails = new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", + "username", "password", new HashMap<String, String>()); + assertNotNull(httpDetails); + final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class); + assertNotNull(response); + } } |