aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-12-06 21:54:33 +0000
committerGerrit Code Review <gerrit@onap.org>2019-12-06 21:54:33 +0000
commit7f4f871ec1d43adacbb12dfd8ee93ebec8dc52d7 (patch)
tree600b029dbdf52a9799370054ec04bdc4d04e5457 /main/src/test
parent33c703a49d0af28cc4c4543ef9c4e982566fc308 (diff)
parent452aff5c6948064722836319530420419d40221f (diff)
Merge "Preloading native policy type for apex-pdp"
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java4
-rw-r--r--main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java36
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters.json3
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters_Https.json3
4 files changed, 6 insertions, 40 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 434185a6..8ede8815 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
@@ -704,7 +704,7 @@ public class TestApiRestServer {
Response rawResponse = readResource(POLICYTYPES, true, APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class);
- assertEquals(25, response.getPolicyTypes().size());
+ assertEquals(26, response.getPolicyTypes().size());
}
@Test
@@ -714,7 +714,7 @@ public class TestApiRestServer {
Response rawResponse = readResource(POLICYTYPES, true, APP_YAML);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class);
- assertEquals(25, response.getPolicyTypes().size());
+ assertEquals(26, response.getPolicyTypes().size());
}
@Test
diff --git a/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java b/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java
index bf728dd5..8adfacc5 100644
--- a/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java
+++ b/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java
@@ -24,15 +24,6 @@ package org.onap.policy.api.main.startstop;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.FileAttribute;
-import java.nio.file.attribute.PosixFilePermission;
-import java.nio.file.attribute.PosixFilePermissions;
-import java.util.Set;
-
import org.junit.Test;
import org.onap.policy.api.main.exception.PolicyApiException;
import org.onap.policy.api.main.exception.PolicyApiRuntimeException;
@@ -76,31 +67,4 @@ public class TestApiCommandLineArguments {
.hasMessageContaining(
"policy api configuration file \"src/test\\resources/filetest\\n\" does not exist");
}
-
- @Test
- public void testDirectoryValidateReadableFile() {
- apiCmdArgs.setConfigurationFilePath("src/test/resources/");
- assertThatThrownBy(
- apiCmdArgs::validate
- )
- .isInstanceOf(PolicyApiException.class)
- .hasMessageContaining("file \"src/test/resources/\" is not a normal file");
- }
-
- @Test
- public void testReadPermissionValidateReadableFile() throws IOException {
- String filepath = "src/test/resources/unreadablefile.json";
- Set<PosixFilePermission> notReadable = PosixFilePermissions.fromString("-wx-wx-wx");
- FileAttribute<?> permissions = PosixFilePermissions.asFileAttribute(notReadable);
- Path pathObj = Paths.get(filepath);
- Files.createFile(pathObj, permissions);
- apiCmdArgs.setConfigurationFilePath(filepath);
- assertThatThrownBy(
- apiCmdArgs::validate
- )
- .isInstanceOf(PolicyApiException.class)
- .hasMessageContaining(
- "file \"src/test/resources/unreadablefile.json\" is ureadable");
- Files.deleteIfExists(pathObj);
- }
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters.json b/main/src/test/resources/parameters/ApiConfigParameters.json
index bfb02f1e..d2479125 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters.json
@@ -36,6 +36,7 @@
"policytypes/onap.policies.Naming.yaml",
"policytypes/onap.policies.drools.Controller.yaml",
"policytypes/onap.policies.native.Drools.yaml",
- "policytypes/onap.policies.native.Xacml.yaml"
+ "policytypes/onap.policies.native.Xacml.yaml",
+ "policytypes/onap.policies.native.Apex.yaml"
]
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json
index d395e1fb..0f6fc65d 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json
@@ -37,6 +37,7 @@
"policytypes/onap.policies.Naming.yaml",
"policytypes/onap.policies.drools.Controller.yaml",
"policytypes/onap.policies.native.Drools.yaml",
- "policytypes/onap.policies.native.Xacml.yaml"
+ "policytypes/onap.policies.native.Xacml.yaml",
+ "policytypes/onap.policies.native.Apex.yaml"
]
}