From 1a9139f93043e662fc7b132af2c7af2bd054d637 Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Thu, 30 Jan 2020 10:08:47 +0100 Subject: [PATCH] Removed one test policy type Change-Id: I7a23ed8ebef4feee12ceddabc09ef5c8a4468545 Issue-ID: NONRTRIC-107 Signed-off-by: PatrikBuhr --- .../config/PolicyControllerMockConfiguration.java | 35 +++++++------------ .../src/test/resources/anr-policy-instance.json | 8 ----- .../src/test/resources/anr-policy-schema.json | 40 ---------------------- .../org/oransc/policyagent/ApplicationTest.java | 2 +- .../resources/policy_types/anr-policy-schema.json | 40 ---------------------- 5 files changed, 14 insertions(+), 111 deletions(-) delete mode 100644 dashboard/webapp-backend/src/test/resources/anr-policy-instance.json delete mode 100644 dashboard/webapp-backend/src/test/resources/anr-policy-schema.json delete mode 100644 policy-agent/src/test/resources/policy_types/anr-policy-schema.json diff --git a/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/PolicyControllerMockConfiguration.java b/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/PolicyControllerMockConfiguration.java index e695b688..2268fe06 100644 --- a/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/PolicyControllerMockConfiguration.java +++ b/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/PolicyControllerMockConfiguration.java @@ -57,8 +57,8 @@ public class PolicyControllerMockConfiguration { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static com.google.gson.Gson gson = new GsonBuilder() // - .serializeNulls() // - .create(); // + .serializeNulls() // + .create(); // @Bean public PolicyAgentApi policyAgentApi() { @@ -76,7 +76,7 @@ public class PolicyControllerMockConfiguration { @Override public ResponseEntity putPolicy(String policyTypeIdString, String policyInstanceId, String json, - String ric) { + String ric) { database.putInstance(policyTypeIdString, policyInstanceId, json, ric); return new ResponseEntity<>("Policy was put successfully", HttpStatus.OK); } @@ -115,32 +115,23 @@ public class PolicyControllerMockConfiguration { class Database { Database() { - String schema = getStringFromFile("anr-policy-schema.json"); - PolicyType policy = new PolicyType("ANR", schema); - types.put("ANR", policy); - - schema = getStringFromFile("demo-policy-schema-1.json"); - policy = new PolicyType("type2", schema); - types.put("type2", policy); + String schema = getStringFromFile("demo-policy-schema-1.json"); + PolicyType policyType = new PolicyType("type2", schema); + types.put("type2", policyType); schema = getStringFromFile("demo-policy-schema-2.json"); - policy = new PolicyType("type3", schema); - types.put("type3", policy); + policyType = new PolicyType("type3", schema); + types.put("type3", policyType); schema = getStringFromFile("demo-policy-schema-3.json"); - policy = new PolicyType("type4", schema); - types.put("type4", policy); - try { - putInstance("ANR", "ANR-1", getStringFromFile("anr-policy-instance.json"), "ric_1"); - } catch (Exception e) { - // Nothing - } + policyType = new PolicyType("type4", schema); + types.put("type4", policyType); } private String getStringFromFile(String path) { try { - InputStream inputStream = - MethodHandles.lookup().lookupClass().getClassLoader().getResourceAsStream(path); + InputStream inputStream = MethodHandles.lookup().lookupClass().getClassLoader() + .getResourceAsStream(path); return new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n")); } catch (Exception e) { logger.error("Cannot read file :" + path, e); @@ -158,7 +149,7 @@ public class PolicyControllerMockConfiguration { void putInstance(String typeId, String instanceId, String instanceData, String ric) { PolicyInfo i = ImmutablePolicyInfo.builder().json(instanceData).lastModified(getTimeStampUTC()) - .id(instanceId).ric(ric).service("service").type(typeId).build(); + .id(instanceId).ric(ric).service("service").type(typeId).build(); instances.put(instanceId, i); } diff --git a/dashboard/webapp-backend/src/test/resources/anr-policy-instance.json b/dashboard/webapp-backend/src/test/resources/anr-policy-instance.json deleted file mode 100644 index 0d7315eb..00000000 --- a/dashboard/webapp-backend/src/test/resources/anr-policy-instance.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "servingCellNrcgi": "Cell1", - "neighborCellNrpci": "NCell1", - "neighborCellNrcgi": "Ncell1", - "flagNoHo": true, - "flagNoXn": true, - "flagNoRemove": true -} \ No newline at end of file diff --git a/dashboard/webapp-backend/src/test/resources/anr-policy-schema.json b/dashboard/webapp-backend/src/test/resources/anr-policy-schema.json deleted file mode 100644 index 6e0263d0..00000000 --- a/dashboard/webapp-backend/src/test/resources/anr-policy-schema.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ANR", - "description": "ANR Neighbour Cell Relation Policy", - "type": "object", - "properties": { - "servingCellNrcgi": { - "type": "string", - "description": "Serving Cell Identifier (NR CGI)" - }, - "neighborCellNrpci": { - "type": "string", - "description": "Neighbor Cell Identifier (NR PCI)" - }, - "neighborCellNrcgi": { - "type": "string", - "description": "Neighbor Cell Identifier (NR CGI)" - }, - "flagNoHo": { - "type": "boolean", - "description": "Flag for HANDOVER NOT ALLOWED" - }, - "flagNoXn": { - "type": "boolean", - "description": "Flag for Xn CONNECTION NOT ALLOWED" - }, - "flagNoRemove": { - "type": "boolean", - "description": "Flag for DELETION NOT ALLOWED" - } - }, - "required": [ - "servingCellNrcgi", - "neighborCellNrpci", - "neighborCellNrcgi", - "flagNoHo", - "flagNoXn", - "flagNoRemove" - ] -} \ No newline at end of file diff --git a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java index 3e5932f1..847cde19 100644 --- a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java @@ -180,7 +180,7 @@ public class ApplicationTest { System.out.println(rsp); assertThat(rsp).contains("kista_1"); - url = baseUrl() + "/rics?policyType=ANR"; + url = baseUrl() + "/rics?policyType=STD_PolicyModelUnconstrained_0.2.0"; rsp = this.restTemplate.getForObject(url, String.class); assertThat(rsp).isEqualTo("[]"); } diff --git a/policy-agent/src/test/resources/policy_types/anr-policy-schema.json b/policy-agent/src/test/resources/policy_types/anr-policy-schema.json deleted file mode 100644 index 6e0263d0..00000000 --- a/policy-agent/src/test/resources/policy_types/anr-policy-schema.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ANR", - "description": "ANR Neighbour Cell Relation Policy", - "type": "object", - "properties": { - "servingCellNrcgi": { - "type": "string", - "description": "Serving Cell Identifier (NR CGI)" - }, - "neighborCellNrpci": { - "type": "string", - "description": "Neighbor Cell Identifier (NR PCI)" - }, - "neighborCellNrcgi": { - "type": "string", - "description": "Neighbor Cell Identifier (NR CGI)" - }, - "flagNoHo": { - "type": "boolean", - "description": "Flag for HANDOVER NOT ALLOWED" - }, - "flagNoXn": { - "type": "boolean", - "description": "Flag for Xn CONNECTION NOT ALLOWED" - }, - "flagNoRemove": { - "type": "boolean", - "description": "Flag for DELETION NOT ALLOWED" - } - }, - "required": [ - "servingCellNrcgi", - "neighborCellNrpci", - "neighborCellNrcgi", - "flagNoHo", - "flagNoXn", - "flagNoRemove" - ] -} \ No newline at end of file -- 2.16.6