summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/core/src/test
diff options
context:
space:
mode:
authorDan Timoney <dt5972@att.com>2018-09-04 15:14:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-04 15:14:26 +0000
commitbae35a20cafabf78672db065e41f4018c619e863 (patch)
tree63488f05bb8164764a273ca45e5c8893ff1a7956 /ms/controllerblueprints/modules/core/src/test
parent5aac0d09bd6e03657538cb87252c079baa67b810 (diff)
parent62cc10e56d33d0399f810c556470f3ad39361ae7 (diff)
Merge "Controller Blueprints Microservice"
Diffstat (limited to 'ms/controllerblueprints/modules/core/src/test')
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt10
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt51
2 files changed, 56 insertions, 5 deletions
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
index 081f4fe3..88aea919 100644
--- a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
@@ -28,30 +28,30 @@ import kotlin.test.assertNotNull
*/
class BluePrintRepoFileServiceTest {
- val basePath = "load/model_type"
+ private val basePath = "load/model_type"
private val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)
@Test
fun testGetDataType() {
- val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")
+ val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")?.block()
assertNotNull(dataType, "Failed to get DataType from repo")
}
@Test
fun testGetNodeType() {
- val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")
+ val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")?.block()
assertNotNull(nodeType, "Failed to get NodeType from repo")
}
@Test
fun testGetArtifactType() {
- val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")
+ val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")?.block()
assertNotNull(nodeType, "Failed to get ArtifactType from repo")
}
@Test(expected = FileNotFoundException::class)
fun testModelNotFound() {
- val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found")
+ val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found")?.block()
assertNotNull(dataType, "Failed to get DataType from repo")
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
new file mode 100644
index 00000000..d13caa52
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import com.att.eelf.configuration.EELFLogger
+import com.att.eelf.configuration.EELFManager
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import java.io.FileNotFoundException
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+class JacksonReactorUtilsTest {
+ private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
+ @Test
+ fun testReadValues() {
+
+ val serviceTemplate = JacksonReactorUtils.readValueFromFile("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json",
+ ServiceTemplate::class.java).block()
+
+ assertNotNull(serviceTemplate, "Failed to simple transform Service Template")
+ assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance")
+
+ val jsonContent = JacksonReactorUtils.getJson(serviceTemplate!!, true).block()
+ assertNotNull(jsonContent, "Failed to get json content")
+
+ val jsonNode = JacksonReactorUtils.jsonNodeFromFile("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json")
+ .block()
+ assertNotNull(jsonContent, "Failed to get json Node")
+ }
+
+ @Test(expected = FileNotFoundException::class)
+ fun testReadValuesFailure() {
+ JacksonReactorUtils.jsonNodeFromFile("load/blueprints/not-found.json")
+ .block()
+ }
+} \ No newline at end of file