aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST/src/test/java/org/onap
diff options
context:
space:
mode:
authorMichael Mokry <mm117s@att.com>2018-02-05 09:48:59 -0600
committerMichael Mokry <mm117s@att.com>2018-02-08 07:45:06 -0600
commitc5d97e8a9a6bea71f3be329a2e44bdbe5fe50882 (patch)
tree8db57c1406d2479e7624a2778dd5d518e874f59c /ONAP-PDP-REST/src/test/java/org/onap
parentc9039d15e8a84a9304fba40283a332a2a65ef854 (diff)
MS Model Input Validation
- Provides validation for MS policy input content body that matches the GUI validations when create/update MS policy from API - Added changes to satisfy review comments and updated copywright headers for modified and new files Change-Id: I02bfa639bffb48520badd0e4fa34eb36418547ae Issue-ID: POLICY-377 Signed-off-by: Michael Mokry <mm117s@att.com>
Diffstat (limited to 'ONAP-PDP-REST/src/test/java/org/onap')
-rw-r--r--ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java
index 8fea627c9..471f1a9a2 100644
--- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java
+++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-PDP-REST
* ================================================================================
- * 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.
@@ -168,9 +168,9 @@ public class PolicyEngineServicesTest {
mockMvc.perform(get("/getMetrics")).andExpect(status().isBadRequest());
mockMvc.perform(get("/getMetrics").header(CLIENTAUTHHEADER, "Basic 123")).andExpect(status().isUnauthorized());
//Service Tests.
- mockMvc.perform(get("/getMetrics").headers(headers).header(UUIDHEADER, "123")).andExpect(status().isOk());
- mockMvc.perform(get("/getMetrics").headers(headers).header(UUIDHEADER, UUID.randomUUID())).andExpect(status().isOk());
- mockMvc.perform(get("/getMetrics").headers(headers)).andExpect(status().isOk());
+ mockMvc.perform(get("/getMetrics").headers(headers).header(UUIDHEADER, "123")).andExpect(status().isBadRequest());
+ mockMvc.perform(get("/getMetrics").headers(headers).header(UUIDHEADER, UUID.randomUUID())).andExpect(status().isBadRequest());
+ mockMvc.perform(get("/getMetrics").headers(headers)).andExpect(status().isBadRequest());
}
@Test
@@ -699,9 +699,9 @@ public class PolicyEngineServicesTest {
.headers(headers)).andExpect(status().isBadRequest());
pep.setActionPerformer("PEP");
mockMvc.perform(put("/createPolicy").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
- .headers(headers)).andExpect(status().isInternalServerError());
+ .headers(headers)).andExpect(status().isBadRequest());
mockMvc.perform(put("/updatePolicy").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
- .headers(headers)).andExpect(status().isInternalServerError());
+ .headers(headers)).andExpect(status().isBadRequest());
// Checks for Decision Policy.
pep.setPolicyClass(PolicyClass.Decision);
mockMvc.perform(put("/createPolicy").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
@@ -743,7 +743,7 @@ public class PolicyEngineServicesTest {
.headers(headers)).andExpect(status().isBadRequest());
pep.setDictionaryJson("{\"test\":\"value\"}");
mockMvc.perform(put("/createDictionaryItem").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
- .headers(headers).header(UUIDHEADER, UUID.randomUUID())).andExpect(status().isInternalServerError());
+ .headers(headers).header(UUIDHEADER, UUID.randomUUID())).andExpect(status().isBadRequest());
pep.setDictionaryJson("test123");
mockMvc.perform(put("/updateDictionaryItem").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
.headers(headers).header(UUIDHEADER, "123")).andExpect(status().isBadRequest());
@@ -766,10 +766,10 @@ public class PolicyEngineServicesTest {
.headers(headers).header(UUIDHEADER, UUID.randomUUID().toString())).andExpect(status().isBadRequest());
pep.setDictionary("OnapName");
mockMvc.perform(post("/getDictionaryItems").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
- .headers(headers)).andExpect(status().isInternalServerError());
+ .headers(headers)).andExpect(status().isBadRequest());
pep.setRequestID(UUID.randomUUID());
mockMvc.perform(post("/getDictionaryItems").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON)
- .headers(headers)).andExpect(status().isInternalServerError());
+ .headers(headers)).andExpect(status().isBadRequest());
}
@Test