summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java10
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java3
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java2
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/NamePersister.java2
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java11
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java16
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java3
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java14
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java4
9 files changed, 33 insertions, 32 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java
index 98be9aa7..810480e9 100644
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java
+++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java
@@ -17,8 +17,7 @@
package org.onap.ccsdk.apps.blueprintsprocessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@@ -27,10 +26,7 @@ import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
-import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
/**
* SwaggerConfig
@@ -42,10 +38,6 @@ import java.util.Set;
@SuppressWarnings("unused")
@Deprecated
public class SwaggerConfig {
- private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
- new HashSet<>(Arrays.asList("application/json",
- "application/xml"));
- private static Logger log = LoggerFactory.getLogger(SwaggerConfig.class);
@Bean
public Docket api() {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
index 3798ee6d..4c34881a 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
@@ -75,8 +75,7 @@ public class ServiceTemplateRest {
@PostMapping(path = "/resource-assignment/generate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
- List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)
- throws BluePrintException {
+ List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent) {
return serviceTemplateService.generateResourceAssignments(templateContent);
}
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 1287a273..561273bf 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
@@ -3,6 +3,7 @@
* ONAP : CCSDK.apps
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +71,6 @@ public class Application extends SpringBootServletInitializer {
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
- System.out.println(beanName);
log.info(beanName);
}
log.info("################################");
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/NamePersister.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/NamePersister.java
index cd07a46e..1dd6cebb 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/NamePersister.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/NamePersister.java
@@ -36,7 +36,7 @@ public class NamePersister {
/**
* Persist the given name.
*/
- public void persist(GeneratedName name) throws Exception {
+ public void persist(GeneratedName name) {
repository.save(name);
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java
index 09a6e49b..181bb7a3 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 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
@@ -95,7 +97,7 @@ public abstract class PolicyReader implements PolicyFinder {
Map<String, ?> theModel = null;
if (namingModels != null) {
for (Map<String, ?> model : namingModels) {
- Object val = model.get("naming-type");
+ Object val = model.get(NAMING_TYPE);
if (val != null) {
if (namingType.equalsIgnoreCase(val.toString())) {
theModel = model;
@@ -106,7 +108,7 @@ public abstract class PolicyReader implements PolicyFinder {
if (theModel == null) {
namingType = relaxedNamingType(namingType);
for (Map<String, ?> model : namingModels) {
- Object val = model.get("naming-type");
+ Object val = model.get(NAMING_TYPE);
if (val != null) {
String relaxedVal = relaxedNamingType(val.toString());
if (namingType.equalsIgnoreCase(relaxedVal)) {
@@ -124,8 +126,6 @@ public abstract class PolicyReader implements PolicyFinder {
* Finds the naming-operation from the given naming-model.
*/
public static String namingOperation(Map<String, ?> namimgModel) {
- //String propValue = value(namimgModel, "name-operation");
- //return propValue;
return value(namimgModel, "name-operation");
}
@@ -162,7 +162,7 @@ public abstract class PolicyReader implements PolicyFinder {
* Finds the naming-type from the given naming-model.
*/
public static String namingType(Map<String, ?> namimgModelOrElement) {
- return value(namimgModelOrElement, "naming-type");
+ return value(namimgModelOrElement, NAMING_TYPE);
}
/**
@@ -299,7 +299,6 @@ public abstract class PolicyReader implements PolicyFinder {
Map<String, Object> getPolicy(String jsonString) throws Exception {
ObjectMapper mapper = new ObjectMapper();
- // Map<String, Object> jsonObject = mapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {});
return mapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {});
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java
index 526f67c1..f70b0633 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java
@@ -3,13 +3,14 @@
* ONAP : CCSDK.apps
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
@@ -20,15 +21,17 @@
package org.onap.ccsdk.apps.ms.neng.core.policy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Represents a sequence object in the policy, as a POJO.
*/
public class PolicySequence {
/**
- * The type of the policy sequence.
+ * The type of the policy sequence.
*/
- public enum Type {
- ALPHA, NUMERIC
+ public enum Type {
+ ALPHA, NUMERIC
}
private long startValue;
@@ -41,6 +44,8 @@ public class PolicySequence {
private String key;
private String value;
private Long lastReleaseSeqNumTried;
+ private Logger logger = LoggerFactory.getLogger(PolicySequence.class);
+
public long getStartValue() {
return startValue;
@@ -79,6 +84,7 @@ public class PolicySequence {
try {
this.maxValue = Long.valueOf(this.maxValueString, base);
} catch (Exception e) {
+ logger.error("Exception",e);
this.maxValue = null;
}
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
index 01c8324d..c5cabe51 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
@@ -115,7 +115,7 @@ public class SpringServiceImpl implements SpringService {
List<Map<String, String>> allElements = new ArrayList<>();
Map<String, Map<String, ?>> policyCache = new HashMap<>();
List<Map<String, String>> generatedNames = new ArrayList<>();
- List<String> earlierNamingTypes = new ArrayList<String>();
+ List<String> earlierNamingTypes = new ArrayList<>();
validateRequest(request);
if (request.getElements() != null && !request.getElements().isEmpty()) {
allElements.addAll(request.getElements());
@@ -226,6 +226,7 @@ public class SpringServiceImpl implements SpringService {
}
void validateRequest(NameGenRequest request) throws Exception {
+ // this method does nothing
}
private PolicyFinder findPolicyFinderImpl(NameGenRequest request) {
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java
index e52e0016..3746756e 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java
@@ -42,7 +42,9 @@ import org.springframework.web.bind.annotation.RequestBody;
public class RestServiceImpl implements RestService {
private static Logger log = Logger.getLogger(RestServiceImpl.class.getName());
private static final String INTERNAL_ERROR_MSG = "Internal error occured while processing the request.";
-
+ private static final String ERROR="error";
+
+
@Autowired SpringService service;
/**
@@ -67,11 +69,11 @@ public class RestServiceImpl implements RestService {
return buildResponse(resp);
} catch (NengException e) {
log.warning(e.getMessage());
- response.put("error", buildErrorResponse("NELGEN-0003", e.getMessage()));
+ response.put(ERROR, buildErrorResponse("NELGEN-0003", e.getMessage()));
return buildErrorResponse(response);
} catch (Exception e) {
log.warning(e.getMessage());
- response.put("error", buildErrorResponse("err-0500", INTERNAL_ERROR_MSG));
+ response.put(ERROR, buildErrorResponse("err-0500", INTERNAL_ERROR_MSG));
return buildErrorResponse(response);
}
}
@@ -88,11 +90,11 @@ public class RestServiceImpl implements RestService {
return buildResponse(resp);
} catch (NengException e) {
log.warning(e.getMessage());
- response.put("error", buildErrorResponse("NELGEN-0002", e.getMessage()));
+ response.put(ERROR, buildErrorResponse("NELGEN-0002", e.getMessage()));
return buildErrorResponse(response);
} catch (Exception e) {
log.warning(e.getMessage());
- response.put("error", buildErrorResponse("err-0500", INTERNAL_ERROR_MSG));
+ response.put(ERROR, buildErrorResponse("err-0500", INTERNAL_ERROR_MSG));
return buildErrorResponse(response);
}
}
@@ -120,7 +122,7 @@ public class RestServiceImpl implements RestService {
return buildResponse(response);
} catch (Exception e) {
log.warning(e.getMessage());
- response.put("error", buildErrorResponse("err-0500", e.getMessage()));
+ response.put(ERROR, buildErrorResponse("err-0500", e.getMessage()));
return buildErrorResponse(response);
}
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java
index e93675bf..b30ac0e6 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 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
@@ -74,7 +76,7 @@ public class PolicyFinderServiceImpl implements PolicyFinder {
if (response instanceof List) {
@SuppressWarnings("unchecked")
List<Map<String, Object>> policyList = (List<Map<String, Object>>) response;
- return ((policyList != null && policyList.size() > 0) ? policyList.get(0) : null);
+ return ((!policyList.isEmpty()) ? policyList.get(0) : null);
} else {
return null;
}