summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-02-17 00:55:15 +0000
committerliamfallon <liam.fallon@est.tech>2020-02-17 01:18:22 +0000
commit0e9285d3657b00f5737296924aa650a22efd1853 (patch)
treee0398ea72dbed8dee51950e5b1de47a4618b4c0b /main
parent86571f2d2b289edad0210d16ff7815578a118190 (diff)
Change return code checks in unit tests
The return codes issued by TOSCA handling in policy-models have been changed to be more correct. This change updates the unit tests in API to use thw new codes. Issue-ID: POLICY-1402 Change-Id: If9798e5fe28bd3f92576135b8c5a34fc456a4925 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'main')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
index 1a9b6535..0cca2ffc 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
@@ -245,6 +245,7 @@ public class TestApiRestServer {
@BeforeClass
public static void setupParameters() throws PfModelException, IOException {
providerParams = new PolicyModelsProviderParameters();
+ // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
providerParams.setDatabaseDriver("org.h2.Driver");
providerParams.setDatabaseUrl("jdbc:h2:mem:testdb");
providerParams.setDatabaseUser("policy");
@@ -338,7 +339,7 @@ public class TestApiRestServer {
Response rawResponse2 =
createResource(POLICYTYPES_TCA_POLICIES, "src/test/resources/policies/BadTestPolicy.yaml");
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse2.getStatus());
+ assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), rawResponse2.getStatus());
ErrorResponse errorResponse = rawResponse2.readEntity(ErrorResponse.class);
assertThat(errorResponse.getErrorMessage())
.contains("entity in incoming fragment does not equal existing entity");
@@ -346,8 +347,6 @@ public class TestApiRestServer {
@Test
public void testSimpleCreatePolicies() throws Exception {
- testCreatePolicyTypes();
-
for (String resrcName : TOSCA_POLICIES_RESOURCE_NAMES) {
Response rawResponse = createResource(POLICIES, resrcName);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
@@ -363,8 +362,8 @@ public class TestApiRestServer {
TextFileUtils.putStringAsTextFile(toscaPolicy, "src/test/resources/policies/BadTestPolicy.yaml");
Response rawResponse2 = createResource(POLICIES, "src/test/resources/policies/BadTestPolicy.yaml");
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse2.getStatus());
ErrorResponse errorResponse = rawResponse2.readEntity(ErrorResponse.class);
+ assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), rawResponse2.getStatus());
assertThat(errorResponse.getErrorMessage()).contains("policy type NULL:1.0.0 referenced in policy not found");
}