aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/service/src/test
diff options
context:
space:
mode:
authorSteve Alphonse Siani <alphonse.steve.siani.djissitchi@ibm.com>2018-12-28 14:58:27 -0500
committerSteve Alphonse Siani <alphonse.steve.siani.djissitchi@ibm.com>2019-01-04 10:54:21 -0500
commitae235a33287834a5541c4914ab7f54e821d9731d (patch)
treeba5b046727c3e93cf329d5a46e29ff297ac0b61a /ms/controllerblueprints/modules/service/src/test
parent65691146cceb8ee483cd4003f5fcc6fda14c0f01 (diff)
1st drop integration with BluePrintCatalogService
Change-Id: I0824dcaf0a36e4616c12f3ac53530e6863bee290 Issue-ID: CCSDK-418 Signed-off-by: Steve Alphonse Siani <alphonse.steve.siani.djissitchi@ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/test')
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java (renamed from ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java)16
-rwxr-xr-xms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/CbaFileManagementServiceTest.java89
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java173
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java105
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java156
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java12
9 files changed, 18 insertions, 545 deletions
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java
index d6a71e01..0ce93b18 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java
@@ -16,21 +16,15 @@
package org.onap.ccsdk.apps.controllerblueprints.service;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.lang.System;
-import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelContentRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelRepository;
+import org.springframework.beans.factory.annotation.Autowired;
-public class ConfigModelServiceTest {
- private ConfigModelService configModelService;
+public class BlueprintModelServiceTest {
+ @Autowired
+ private BlueprintModelService blueprintModelService;
- @Test(expected = NullPointerException.class)
+ @Test
public void testGetInitialConfigModel() throws BluePrintException {
- Assert.assertEquals(null, configModelService.getInitialConfigModel(""));
}
}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/CbaFileManagementServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/CbaFileManagementServiceTest.java
deleted file mode 100755
index e3cea380..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/CbaFileManagementServiceTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright © 2018 IBM Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.service;
-import org.junit.*;
-import org.junit.runner.RunWith;
-import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.FileSystemUtils;
-import java.nio.file.Path;
-
-
-/**
- * CbaFileManagementServiceTest.java Purpose: Test the decompressing method of CbaCompressionService
- *
- * @author Vinal Patel
- * @version 1.0
- */
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = {TestApplication.class})
-public class CbaFileManagementServiceTest {
-
- @Value("${controllerblueprints.loadBlueprintsExamplesPath}")
- private String cbaPath;
- private String zipfile;
- private String directorypath;
- private Path zipfilepath;
-
- @Autowired
- CbaFileManagementService cbaCompressionService;
-
-
- /**
- *
- */
- @Before
- public void setUp() {
- try {
- zipfilepath = BluePrintFileUtils.Companion.getCbaStorageDirectory(cbaPath);
- } catch (Exception e) {
- e.printStackTrace();
- }
- zipfile = "CBA_Zip_Test.zip";
- directorypath = zipfilepath.resolve(zipfile.substring(0,zipfile.lastIndexOf("."))).toAbsolutePath().toString();
- }
- @After
- public void clenup() throws BluePrintException {
-
- try {
- //Delete the Zip file from the repository
- FileSystemUtils.deleteRecursively(BluePrintFileUtils.Companion.getBluePrintFile(directorypath, zipfilepath));
- }
- catch (Exception ex){
- throw new BluePrintException("Fail while cleaning up CBA saved!", ex);
- }
- }
-
- /**
- * @throws BluePrintException
- * Test will get success if it is able to decompress CBA file and returns the folder path
- */
- @Test
- public void testDecompressCBAFile_success() throws BluePrintException {
- Assert.assertEquals(directorypath,cbaCompressionService.decompressCBAFile(zipfile,zipfilepath));
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java
index e2bb4c5f..412e9606 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java
@@ -18,7 +18,9 @@ package org.onap.ccsdk.apps.controllerblueprints.service;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.junit.*;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java
index b70651fb..ed208db9 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java
@@ -16,14 +16,14 @@
package org.onap.ccsdk.apps.controllerblueprints.service.common;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.service.SchemaGeneratorService;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import java.io.File;
import java.nio.charset.Charset;
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
deleted file mode 100644
index 6be86fc3..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.service.rs;
-
-import org.junit.*;
-import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
-import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.util.List;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ConfigModelRestTest {
-
- private static EELFLogger log = EELFManager.getInstance().getLogger(ConfigModelRestTest.class);
-
- @Autowired
- ConfigModelRest configModelRest;
-
- ConfigModel configModel;
-
- String name = "vrr-test";
- String version = "1.0.0";
-
- @Before
- public void setUp() {
-
- }
-
-
- @After
- public void tearDown() {
- }
-
-
- @Test
- public void test01getInitialConfigModel() throws Exception {
- log.info("** test01getInitialConfigModel *****************");
-
- String name = "default_netconf";
- ConfigModel configModel = configModelRest.getInitialConfigModel(name);
- Assert.assertNotNull("Failed to get Initial Config Model , Return object is Null", configModel);
- Assert.assertNotNull("Failed to get Service Template Content ", configModel.getConfigModelContents());
- }
-
-
- @Deprecated
- @Test
- public void test02SaveServiceTemplate() throws Exception {
- log.info("************************ test02SaveServiceTemplate ******************");
-
-
- configModel = ConfigModelUtils.getConfigModel("load/blueprints/vrr-test");
-
- configModel = configModelRest.saveConfigModel(configModel);
- Assert.assertNotNull("Failed to ConfigModel, Return object is Null", configModel);
- Assert.assertNotNull("Failed to ConfigModel Id , Return ID object is Null", configModel.getId());
- Assert.assertNotNull("Failed to ConfigModel Content, Return object is Null",
- configModel.getConfigModelContents());
- Assert.assertEquals("Failed in validation of ConfigModel Content count,", 3,
- configModel.getConfigModelContents().size());
-
- ConfigModel dbconfigModel = configModelRest.getConfigModel(configModel.getId());
-
- log.info("************************ test02SaveServiceTemplate-2 ******************");
-
- dbconfigModel.getConfigModelContents().remove(2);
- dbconfigModel = configModelRest.saveConfigModel(dbconfigModel);
- log.info("Saved Config Model " + configModel.getId());
- Assert.assertNotNull("Failed to ConfigModel, Return object is Null", dbconfigModel);
- Assert.assertNotNull("Failed to ConfigModel Id ", dbconfigModel.getId());
- Assert.assertNotNull("Failed to ConfigModel Content",
- dbconfigModel.getConfigModelContents());
- Assert.assertEquals("Failed to Remove the ConfigModel Content,", 2,
- dbconfigModel.getConfigModelContents().size());
-
-
- }
-
-
- @Test
- public void test03PublishServiceTemplate() throws Exception {
- log.info("** test03PublishServiceTemplate *****************");
-
- ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
- log.info("Publishing Config Model " + configModel.getId());
- configModel = configModelRest.publishConfigModel(configModel.getId());
- Assert.assertNotNull("Failed to ConfigModel, Return object is Null", configModel);
- Assert.assertNotNull("Failed to ConfigModel Id ", configModel.getId());
- Assert.assertNotNull("Failed to ConfigModel Content", configModel.getConfigModelContents());
- Assert.assertEquals("Failed to update the publish indicator", "Y", configModel.getPublished());
- }
-
-
- @Deprecated
- @Test
- public void test04GetConfigModel() throws Exception {
- log.info("** test04GetConfigModel *****************");
-
- ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
- Assert.assertNotNull("Failed to get ConfigModel for the Name (" + configModel.getArtifactName() + ") and ("
- + configModel.getArtifactVersion() + ")", configModel);
- Assert.assertNotNull("Failed to get ConfigModel Id", configModel.getId());
-
- configModel = configModelRest.getConfigModel(configModel.getId());
- Assert.assertNotNull("Failed to get ConfigModel for the Id (" + configModel.getId() + ") ", configModel);
-
- }
-
- @Deprecated
- @Test
- public void test05GetCloneConfigModel() throws Exception {
- log.info("** test05GetCloneConfigModel *****************");
-
- ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
-
- Assert.assertNotNull("Failed to get ConfigModel for the Name (" + configModel.getArtifactName() + ") and ("
- + configModel.getArtifactVersion() + ")", configModel);
- Assert.assertNotNull("Failed to get ConfigModel Id", configModel.getId());
-
- configModel = configModelRest.getCloneConfigModel(configModel.getId());
- Assert.assertNotNull("Failed to get ConfigModel for the Id (" + configModel.getId() + ") ", configModel);
- }
-
-
- @Test
- public void test07SearchConfigModels() throws Exception {
- log.info("** test07SearchConfigModels *****************");
-
- List<ConfigModel> configModels = configModelRest.searchConfigModels("vrr-test");
- Assert.assertNotNull("Failed to search ConfigModel", configModels);
- Assert.assertTrue("Failed to search ConfigModel with count", configModels.size() > 0);
- // update the ServiceModelContent
- }
-
-
- @Test
- public void test08DeleteConfigModels() throws Exception {
- log.info("** test08DeleteConfigModels *****************");
-
- ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
- configModelRest.deleteConfigModel(configModel.getId());
-
- }
-
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
index d283377b..bf5db340 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
@@ -19,7 +19,9 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.junit.*;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
deleted file mode 100644
index 3818ae2e..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.service.rs;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-
-@Deprecated
-//@RunWith(SpringRunner.class)
-//@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"blueprints.load.initial-data=true"})
-//@ContextConfiguration(classes = {TestApplication.class})
-//@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ResourceDictionaryRestTest {
-
- private static EELFLogger log = EELFManager.getInstance().getLogger(ResourceDictionaryRestTest.class);
-
- @Autowired
- protected ResourceDictionaryRest resourceDictionaryRest;
-
- //@Test
- public void test01SaveDataDictionary() throws Exception {
- String definition = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("resourcedictionary/default_definition.json"),
- Charset.defaultCharset());
-
- ResourceDictionary dataDictionary = new ResourceDictionary();
- dataDictionary.setName("test-name");
- dataDictionary.setDefinition(JacksonUtils.readValue(definition, ResourceDefinition.class));
- dataDictionary.setDataType("string");
- dataDictionary.setDescription("Sample Resource Mapping");
- dataDictionary.setTags("test, ipaddress");
- dataDictionary.setUpdatedBy("xxxxxx@xxx.com");
-
- dataDictionary = resourceDictionaryRest.saveResourceDictionary(dataDictionary);
-
- Assert.assertNotNull("Failed to get Saved Resource Dictionary", dataDictionary);
- Assert.assertNotNull("Failed to get Saved Resource Dictionary, Id", dataDictionary.getName());
-
- ResourceDictionary dbDataDictionary =
- resourceDictionaryRest.getResourceDictionaryByName(dataDictionary.getName());
- Assert.assertNotNull("Failed to query Resource Dictionary for ID (" + dataDictionary.getName() + ")",
- dbDataDictionary);
- Assert.assertNotNull("Failed to query Resource Dictionary definition for ID (" + dataDictionary.getName() + ")",
- dbDataDictionary.getDefinition());
-
- log.trace("Saved Dictionary " + dbDataDictionary.getDefinition());
-
- }
-
- //@Test
- public void test02GetDataDictionary() throws Exception {
-
- ResourceDictionary dbResourceDictionary = resourceDictionaryRest.getResourceDictionaryByName("test-name");
- Assert.assertNotNull("Failed to query Resource Dictionary by Name", dbResourceDictionary);
-
- String tags = "ipaddress";
-
- List<ResourceDictionary> dbResourceDictionaries = resourceDictionaryRest.searchResourceDictionaryByTags(tags);
- Assert.assertNotNull("Failed to search ResourceDictionary by tags", dbResourceDictionaries);
- Assert.assertTrue("Failed to search searchResourceDictionaryByTags by tags by count",
- dbResourceDictionaries.size() > 0);
-
- List<String> names = new ArrayList<>();
- names.add("test-name");
- dbResourceDictionaries = resourceDictionaryRest.searchResourceDictionaryByNames(names);
- Assert.assertNotNull("Failed to search ResourceDictionary by Names", dbResourceDictionaries);
- Assert.assertTrue("Failed to search searchResourceDictionaryByNames by tags by count",
- dbResourceDictionaries.size() > 0);
-
- }
-
- //@Test
- public void test03GetResourceSourceMapping() {
- ResourceSourceMapping resourceSourceMapping = resourceDictionaryRest.getResourceSourceMapping();
- org.springframework.util.Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping");
- org.springframework.util.Assert.notNull(resourceSourceMapping.getResourceSourceMappings(), "Failed to get resource source mappings");
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
deleted file mode 100644
index 9c02d4cf..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.service.rs;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
-import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.service.controller.ModelTypeController;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
-import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.List;
-
-@Deprecated
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"blueprints.load.initial-data=true"})
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ServiceTemplateRestTest {
-
- private static EELFLogger log = EELFManager.getInstance().getLogger(ServiceTemplateRestTest.class);
- @Autowired
- ModelTypeController modelTypeRest;
-
- @Autowired
- private ServiceTemplateRest serviceTemplateRest;
-
- //@Test FIXME("Enable once Complete Enhancement Service Implemented")
- public void test02EnrichServiceTemplate() throws Exception {
- log.info("*********** test02EnrichServiceTemplate ***********************");
- String file = "src/test/resources/enhance/enhance-template.json";
-
- String serviceTemplateContent = FileUtils.readFileToString(new File(file), Charset.defaultCharset());
-
- ServiceTemplate serviceTemplate = JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
-
- serviceTemplate = serviceTemplateRest.enrichServiceTemplate(serviceTemplate);
-
- String enhancedFile = "src/test/resources/enhance/enhanced-template.json";
-
- FileUtils.write(new File(enhancedFile),
- JacksonUtils.getJson(serviceTemplate, true), Charset.defaultCharset());
-
- Assert.assertNotNull("Failed to get Enriched Blueprints, Return object is Null", serviceTemplate);
- Assert.assertNotNull("Failed to get Enriched Blueprints Data Type, Return object is Null",
- serviceTemplate.getDataTypes());
- Assert.assertNotNull("Failed to get Enriched Blueprints Node Type, Return object is Null",
- serviceTemplate.getNodeTypes());
- log.trace("Enriched Service Template :\n" + JacksonUtils.getJson(serviceTemplate, true));
- }
-
- //@Test FIXME("Enable once Complete Enhancement Service Implemented")
- public void test03ValidateServiceTemplate() throws Exception {
- log.info("*********** test03ValidateServiceTemplate *******************************************");
- String enhancedFile = "src/test/resources/enhance/enhanced-template.json";
- String serviceTemplateContent = FileUtils.readFileToString(new File(enhancedFile), Charset.defaultCharset());
-
- ServiceTemplate serviceTemplate =
- JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
-
- serviceTemplate = serviceTemplateRest.validateServiceTemplate(serviceTemplate);
-
- Assert.assertNotNull("Failed to validate Service Template, Return object is Null", serviceTemplate);
- Assert.assertNotNull("Failed to get Service Template Data Type, Return object is Null",
- serviceTemplate.getDataTypes());
- Assert.assertNotNull("Failed to get Service Template Node Type, Return object is Null",
- serviceTemplate.getNodeTypes());
-
- log.trace("Validated Service Template :\n" + JacksonUtils.getJson(serviceTemplate, true));
-
- }
-
-
- @Test
- public void test04GenerateResourceAssignments() throws Exception {
- log.info("*********** test04GenerateResourceAssignments *******************************************");
- ConfigModelContent baseConfigConfigModelContent = new ConfigModelContent();
- String baseConfigContent = FileUtils.readFileToString(new File("load/blueprints/vrr-test/Templates/base-config-template.vtl")
- , Charset.defaultCharset());
- baseConfigConfigModelContent.setName("base-config-template");
- baseConfigConfigModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);
- baseConfigConfigModelContent.setContent(baseConfigContent);
-
- List<ResourceAssignment> resourceAssignments =
- serviceTemplateRest.generateResourceAssignments(baseConfigConfigModelContent);
-
- Assert.assertNotNull("Failed to get ResourceAssignments, Return object is Null", resourceAssignments);
- Assert.assertTrue("Failed to get ResourceAssignments count", resourceAssignments.size() > 0);
-
- log.trace("Validated Service Template :\n" + JacksonUtils.getJson(resourceAssignments, true));
-
-
- }
-
- //@Test
- public void test05AutoMap() throws Exception {
- log.info("*********** test05AutoMap *******************************************");
-
- String resourceAssignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/resourcedictionary/automap.json"), Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment.class);
- AutoMapResponse autoMapResponse = serviceTemplateRest.autoMap(batchResourceAssignment);
-
- Assert.assertNotNull("Failed to get ResourceAssignments, Return object is Null",
- autoMapResponse.getResourceAssignments());
- Assert.assertNotNull("Failed to get Data Dictionary from ResourceAssignments",
- autoMapResponse.getDataDictionaries());
- Assert.assertTrue("Failed to get ResourceAssignments count",
- CollectionUtils.isNotEmpty(autoMapResponse.getDataDictionaries()));
-
- List<ResourceAssignment> autoMappedResourceAssignment = autoMapResponse.getResourceAssignments();
- autoMappedResourceAssignment.forEach(resourceAssignment -> {
- if ("sample-db-source".equals(resourceAssignment.getName())) {
- Assert.assertEquals("Failed to assign default first source", "db",
- resourceAssignment.getDictionarySource());
- }
- });
-
- }
-
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
index a5eb661a..16b2bc81 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
@@ -16,14 +16,12 @@
package org.onap.ccsdk.apps.controllerblueprints.service.validator;
-import static org.junit.Assert.*;
-
-import org.junit.*;
-import org.onap.ccsdk.apps.controllerblueprints.service.validator.ModelTypeValidator;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-
import com.fasterxml.jackson.databind.JsonNode;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
public class ModelTypeValidatorTest {