summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
authorottero <rodrigo.ottero@est.tech>2019-03-20 09:43:55 +0000
committerottero <rodrigo.ottero@est.tech>2019-03-20 09:43:55 +0000
commitbf3d8697baf3f6f29a29a5a8ec58294d30143dbc (patch)
tree53f493e53deb79fd5a1ae0935d636487fc307d36 /ms/controllerblueprints/modules
parentf24666c55d17ef296746ea103218d1c489380a00 (diff)
Deleting target directory before BP enhance test
The enhancement process reads a blueprint entry definition and creates the files describing the types used by it. At the end of the enhancement process, the blueprint files are copied to a directory. However, if it is not the first time the test is being run, the previous files won't be deleted beforehand. This does not represent a problem in case the blueprint has not added any extra file, but in the cases where a script is deleted, renamed or moved, the enhancement won't remove the old file. For test purposes, this is not a problem, but since the enhancement te- st is also used by developers to enhance their blueprints during deve- lopment, a small cleaning routine was added to remove the enhancement target directory before the operation starts, to avoid mistakes where a old version of a script is still being zipped as part of the blueprint Change-Id: I971f29f146b75d566a35cda0cb7a32a9a24be58e Issue-ID: CCSDK-926 Signed-off-by: ottero <rodrigo.ottero@est.tech>
Diffstat (limited to 'ms/controllerblueprints/modules')
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
index 48183f4c..e0ecf039 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
+import java.io.File
import java.nio.file.Paths
@RunWith(SpringRunner::class)
@@ -81,11 +82,20 @@ class BluePrintEnhancerServiceImplTest {
testComponentInvokeEnhancementAndValidation(basePath, "golden-enhance")
}
+ @Test
+ @Throws(Exception::class)
+ fun testCapabilityRestconfEnhancementAndValidation() {
+ val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_restconf"
+ testComponentInvokeEnhancementAndValidation(basePath, "capability_restconf-enhance")
+
+ }
private fun testComponentInvokeEnhancementAndValidation(basePath: String, targetDirName: String) {
val targetPath = Paths.get("target", targetDirName).toUri().path
+ deleteTargetDirectory(targetPath)
+
val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath)
Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext)
@@ -94,4 +104,9 @@ class BluePrintEnhancerServiceImplTest {
Assert.assertTrue("blueprint($basePath) validation failed ", valid)
}
+ private fun deleteTargetDirectory(targetPath: String) {
+ val targetDirectory = File(targetPath)
+ targetDirectory.deleteRecursively()
+ }
+
} \ No newline at end of file