diff options
Diffstat (limited to 'ms')
7 files changed, 133 insertions, 17 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java index a4eb2ae7..a1a9b9ca 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java @@ -63,6 +63,7 @@ public class DataBaseInitService { private ModelTypeService modelTypeService;
private ResourceDictionaryService resourceDictionaryService;
private ConfigModelService configModelService;
+ private String updateBySystem = "System";
@Value("${load.dataTypePath}")
private String dataTypePath;
@@ -105,8 +106,6 @@ public class DataBaseInitService { loadModelType();
loadResourceDictionary();
- // TODO("Enable after Multi file Service Template Repository implementation in place")
- //loadBlueprints();
}
private void loadModelType() {
@@ -188,6 +187,7 @@ public class DataBaseInitService { throw new BluePrintException("couldn't get dictionary from content information");
}
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());
}
}
@@ -223,6 +223,7 @@ public class DataBaseInitService { log.info("Loaded service template successfully: {}", fileName);
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("load config model " + fileName + " error : " + e.getMessage());
}
}
@@ -250,12 +251,13 @@ public class DataBaseInitService { modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(nodeKey);
modelType.setVersion(nodeType.getVersion());
- modelType.setUpdatedBy("System");
+ modelType.setUpdatedBy(updateBySystem);
modelType.setTags(nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + ","
+ nodeType.getDerivedFrom());
modelTypeService.saveModel(modelType);
log.trace("Loaded Node Type successfully : {}", file.getFilename());
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Node type loading error : " + file.getFilename() + ":" + e.getMessage());
}
}
@@ -274,12 +276,13 @@ public class DataBaseInitService { modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(dataKey);
modelType.setVersion(dataType.getVersion());
- modelType.setUpdatedBy("System");
+ modelType.setUpdatedBy(updateBySystem);
modelType.setTags(dataKey + "," + dataType.getDerivedFrom() + ","
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
modelTypeService.saveModel(modelType);
log.trace(" Loaded Data Type successfully : {}", file.getFilename());
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Data type loading error : " + file.getFilename() + ":" + e.getMessage());
}
}
@@ -298,12 +301,13 @@ public class DataBaseInitService { modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(dataKey);
modelType.setVersion(artifactType.getVersion());
- modelType.setUpdatedBy("System");
+ modelType.setUpdatedBy(updateBySystem);
modelType.setTags(dataKey + "," + artifactType.getDerivedFrom() + ","
+ BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
modelTypeService.saveModel(modelType);
log.trace("Loaded Artifact Type successfully : {}", file.getFilename());
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Artifact type loading error : " + file.getFilename() + ":" + e.getMessage());
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java index ae374a78..71904fb3 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java @@ -76,11 +76,10 @@ public class ConfigModelContent { @Override
public String toString() {
- String builder = "[" + "id = " + id +
+ return "[" + "id = " + id +
", name = " + name +
", contentType = " + contentType +
"]";
- return builder;
}
@Override
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java index fc2956be..95e551b1 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java @@ -81,7 +81,7 @@ public class ConfigModelRest { @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
- List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) {
return this.configModelService.searchConfigModels(tags);
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java index 0edc38a3..1287a273 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java @@ -42,7 +42,7 @@ import org.springframework.scheduling.annotation.EnableAsync; @EnableAsync public class Application extends SpringBootServletInitializer { - private Logger logger = LoggerFactory.getLogger(Application.class); + private Logger log = LoggerFactory.getLogger(Application.class); /** * Configures the application. @@ -65,14 +65,15 @@ public class Application extends SpringBootServletInitializer { @Bean public CommandLineRunner commandLineRunner(ApplicationContext ctx) { return args -> { - logger.info("################################"); - logger.info("Inspecting the beans provided by Spring Boot:"); + log.info("################################"); + log.info("Inspecting the beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { System.out.println(beanName); + log.info(beanName); } - logger.info("################################"); + log.info("################################"); }; } diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigRequest.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigRequest.java index e8bc555d..c233a28b 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigRequest.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigRequest.java @@ -29,10 +29,10 @@ import java.util.Map; public class GetConfigRequest implements Serializable { private static final long serialVersionUID = -8039686696076337053L; - Map<String, Object> configAttributes; - String configName; - String ecompName; - String policyName; + private static Map<String, Object> configAttributes; + private static String configName; + private static String ecompName; + private static String policyName; boolean unique; public Map<String, Object> getConfigAttributes() { diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponse.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponse.java index 9fe567f1..f8ea6e1e 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponse.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponse.java @@ -27,7 +27,7 @@ import java.io.Serializable; */ public class GetConfigResponse implements Serializable { private static final long serialVersionUID = -8039686696076337053L; - Object response; + private static Object response; public Object getResponse() { return response; diff --git a/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/PolicyEngineResponseTest.java b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/PolicyEngineResponseTest.java new file mode 100644 index 00000000..c6de216d --- /dev/null +++ b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/PolicyEngineResponseTest.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * 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.ms.vlantagapi.core.extinf.pm.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +public class PolicyEngineResponseTest { + + private PolicyEngineResponse policyEngineResponse; + + @Before + public void setUp() + { + policyEngineResponse= new PolicyEngineResponse(); + } + + @Test + public void testGetSetPolicyConfigMessage() + { + policyEngineResponse.setPolicyConfigMessage("policyConfigMessage"); + assertEquals("policyConfigMessage", policyEngineResponse.getPolicyConfigMessage()); + } + + @Test + public void testGetSetPolicyConfigStatus() + { + policyEngineResponse.setPolicyConfigStatus("PolicyConfigStatus"); + assertEquals("PolicyConfigStatus", policyEngineResponse.getPolicyConfigStatus()); + } + + @Test + public void testGetSetType() + { + policyEngineResponse.setType("Type"); + assertEquals("Type", policyEngineResponse.getType()); + } + + @Test + public void testGetSetPolicyName() + { + policyEngineResponse.setPolicyName("PolicyName"); + assertEquals("PolicyName", policyEngineResponse.getPolicyName()); + } + + @Test + public void testGetSetPolicyType() + { + policyEngineResponse.setPolicyType("PolicyType"); + assertEquals("PolicyType", policyEngineResponse.getPolicyType()); + } + + @Test + public void testGetSetPolicyVersion() + { + policyEngineResponse.setPolicyVersion("PolicyVersion"); + assertEquals("PolicyVersion", policyEngineResponse.getPolicyVersion()); + } + + @Test + public void testGetSetMatchingConditions() + { + HashMap<String, String> test= new HashMap<>(); + policyEngineResponse.setMatchingConditions(test); + assertEquals(test, policyEngineResponse.getMatchingConditions()); + } + + + @Test + public void testGetSetResponseAttributes() + { + HashMap<String, String> test= new HashMap<>(); + policyEngineResponse.setResponseAttributes(test); + assertEquals(test, policyEngineResponse.getResponseAttributes()); + } + + @Test + public void testGetSetProperty() + { + policyEngineResponse.setProperty("Property"); + assertEquals("Property", policyEngineResponse.getProperty()); + } + + @Test + public void testToString() + { + assertTrue(policyEngineResponse.toString() instanceof String); + } + + +} |