diff options
author | Jerry Flood <jflood@att.com> | 2019-04-16 09:06:17 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-16 11:29:13 -0400 |
commit | b1ba8ef51edabee26acaf74e226eeb269297aec7 (patch) | |
tree | 54fcd741ae9b0f05ca1d438de1a4dbacf06cf1ac | |
parent | 134ae90b8d8f5b19d9915adbc9b1a70d8c27540e (diff) |
More checkstyle changes for Dublin
Issue-ID: OPTFRA-466
Change-Id: Ied602196284bf3aed56ff491a749f14503395c88
Signed-off-by: Jerry Flood <jflood@att.com>
84 files changed, 617 insertions, 734 deletions
diff --git a/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java index 842c70c..58a2850 100644 --- a/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java +++ b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java @@ -1,44 +1,30 @@ /*
- * 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
+ * ============LICENSE_START=======================================================================================
+ * Copyright (c) 2019 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.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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.
-*/
+ * ============LICENSE_END=========================================================================================
+ *
+ */
package org.onap.optf.cmso.liquibase;
import javax.sql.DataSource;
+import liquibase.integration.spring.SpringLiquibase;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
-import liquibase.integration.spring.SpringLiquibase;
/*
* Make sure following exceptions before build:
@@ -60,6 +46,11 @@ public class LiquibaseData { @Value("${changeLogFile}")
private String changeLogFile;
+ /**
+ * Liquibase.
+ *
+ * @return the spring liquibase
+ */
@Bean
public SpringLiquibase liquibase() {
SpringLiquibase liquibase = new SpringLiquibase();
diff --git a/cmso-optimizer/src/main/docker/extra-files/startService.sh b/cmso-optimizer/src/main/docker/extra-files/startService.sh index 6efd912..0549dfd 100644 --- a/cmso-optimizer/src/main/docker/extra-files/startService.sh +++ b/cmso-optimizer/src/main/docker/extra-files/startService.sh @@ -1,11 +1,28 @@ #!/bin/sh AUTHENTICATION=${AUTHENTICATION:-proprietary-auth} -JAVA_TRUSTSTORE=${JAVA_TRUSTSTORE:-etc/config/truststoreONAPall.jks} VM_ARGS="${VM_ARGS} -Dserver.local.startpath=${RESOURCES_HOME}" -VM_ARGS="${VM_ARGS} -Djavax.net.ssl.trustStore==${JAVA_TRUSTSTORE}" +if [ "${JAVA_TRUSTSTORE}" != ''] +then + VM_ARGS="${VM_ARGS} -Djavax.net.ssl.trustStore=${JAVA_TRUSTSTORE}" +fi + +if [ "${JAVA_TRUSTSTORE_PASSWORD}" != ''] +then + VM_ARGS="${VM_ARGS} -Djavax.net.ssl.trustStorePassword=${JAVA_TRUSTSTORE_PASSWORD}" +fi + +if [ "${SSL_KEYSTORE}" != '' ] +then + VM_ARGS="${VM_ARGS} -Dserver.ssl.key-store=${SSL_KEYSTORE}" +fi + +if [ "${SSL_KEYSTORE_PASSWORD}" != '' ] +then + VM_ARGS="${VM_ARGS} -Dserver.ssl.key-password=${SSL_KEYSTORE_PASSWORD}" +fi echo "VM_ARGS="${VM_ARGS} diff --git a/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java index fe6cea2..ccb7e56 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java @@ -65,7 +65,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); static { supportedMajorVersions.put("v1", "0"); @@ -73,7 +73,7 @@ public class MessageHeaders { } /** The Constant supportedMajorMinorVersions. */ - public static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); static { supportedMajorMinorVersions.add("v1.0"); @@ -81,10 +81,10 @@ public class MessageHeaders { } /** The Constant latestVersion. */ - public static final String latestVersion = "2.0.0"; + private static final String latestVersion = "2.0.0"; /** The Constant patchVersion. */ - public static final String patchVersion = "0"; + private static final String patchVersion = "0"; /** * From string. @@ -152,4 +152,20 @@ public class MessageHeaders { } return true; } + + public static Map<String, String> getSupportedmajorversions() { + return supportedMajorVersions; + } + + public static Set<String> getSupportedmajorminorversions() { + return supportedMajorMinorVersions; + } + + public static String getLatestversion() { + return latestVersion; + } + + public static String getPatchversion() { + return patchVersion; + } } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java index 7c6db2a..b42ff9c 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java @@ -230,7 +230,7 @@ public class OptimizerClient { apiResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage())); Observation.report(LogMessages.UNEXPECTED_RESPONSE, e, e.getMessage()); } finally { - if (process.isAlive()) { + if (process != null && process.isAlive()) { process.destroyForcibly(); } if (workingFolder.exists()) { diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java index 6724551..cfe23ba 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java @@ -76,7 +76,7 @@ public class OptimizerRequestManager { */ public OptimizerEngineResponse createOptimizerRequest(Request requestRow) { // - if (okToDispatch()) { + if (okToDispatch(false)) { Optimizer optimizer = getExistingOptmizer(requestRow.getUuid()); if (optimizer == null) { optimizer = new Optimizer(); @@ -146,11 +146,14 @@ public class OptimizerRequestManager { - private boolean okToDispatch() { - // TODO Auto-generated method stub - - // Will probably change to @Async on makeRequest to queue requests in a different thread. - return true; + private boolean okToDispatch(boolean checkDispatchability) { + if (checkDispatchability) { + // not yet implemented + return false; + } + else { + return true; + } } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java index c333651..ca6bdb3 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java @@ -21,7 +21,6 @@ package org.onap.optf.cmso.optimizer.clients.topology; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.att.eelf.i18n.EELFResourceManager; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; @@ -102,6 +101,7 @@ public class TopologyClient { topologyResponse.setStatus(TopologyRequestStatus.FAILED); topologyResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage())); Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); + return topologyResponse; } topologyRequest = new TopologyRequest(); topologyRequest.setRequestId(optimizerRequest.getRequestId()); diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java index e8fe5f0..3a13805 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java @@ -68,8 +68,8 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders(); String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString()); respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion); - respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestversion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchversion()); } catch (Exception e) { if (e instanceof WebApplicationException) { @@ -110,7 +110,7 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe } String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString()); if (minorVersion == null) { - minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion); + minorVersion = MessageHeaders.getSupportedmajorversions().get(majorVersion); headers.add(HeadersEnum.MinorVersion.toString(), minorVersion); } if (!MessageHeaders.validateMajorMinorVersion(majorVersion, minorVersion)) { diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java index 0e8b758..bec1de7 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java @@ -107,7 +107,7 @@ public class ChangeWindow implements Serializable { return true; } // end is before start or start is before end, cannot overlap - if (endstart == -1 || startend == 1) { + if (endstart < 0 || startend > 0) { return false; } return true; diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java index d2852d2..112b3a1 100644 --- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java +++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java @@ -36,6 +36,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java index 817c8de..50c9969 100644 --- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java +++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java @@ -50,7 +50,6 @@ public class PolicyManagerTest { @Test public void getPolicyByName() { - String policyName = "Weekday_00_06"; String result = "CMSO.Weekday_00_06,CMSO.Weekday_00_06,CMSO.Weekday_00_06,CMSO.Weekday_00_06,"; List<Policy> policies = policyManager.getSupportedPolicies(); @@ -60,6 +59,7 @@ public class PolicyManagerTest { } System.out.println(" String result = \"" + sb.toString() + "\";"); Assert.assertTrue(result.equals(sb.toString())); + String policyName = "Weekday_00_06"; Policy policy = policyManager.getPolicyForName(policyName); Assert.assertTrue(policy != null); TimeLimitAndVerticalTopology top = policyManager.getTimeLimitAndVerticalTopologyByName(policyName); diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java index f7d0939..84dbf54 100644 --- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java +++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java @@ -3,24 +3,25 @@ * Copyright (c) 2019 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 + * 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 + * + * 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. * ============LICENSE_END================================================= - * + * */ package org.onap.optf.cmso.service.rs; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import javax.servlet.http.HttpServletRequest; public class MockHttpServletRequest { diff --git a/cmso-service/etc/config/cmso.properties b/cmso-service/etc/config/cmso.properties index e9bec86..c28783a 100644 --- a/cmso-service/etc/config/cmso.properties +++ b/cmso-service/etc/config/cmso.properties @@ -44,7 +44,7 @@ spring.datasource.tomcat.initialSize=5 spring.datasource.tomcat.max-active=25
spring.datasource.tomcat.test-on-borrow=true
-spring.jpa.show-sql=true
+spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java b/cmso-service/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java index d77886e..c26abec 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java @@ -26,7 +26,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources;
-public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor {
+public class CmsoEnvironmentPostProcessor implements EnvironmentPostProcessor {
// TODO tested in ONAP springboot and this is called before all of the properties files have been
// loaded...
// perhaps there is a post post processor? Until this works. DB password will be in the clear in the
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/CMSQuartzConfiguration.java b/cmso-service/src/main/java/org/onap/optf/cmso/CmsoQuartzConfiguration.java index 6a8b0ca..e0cbeea 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/CMSQuartzConfiguration.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/CmsoQuartzConfiguration.java @@ -49,7 +49,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration
@ComponentScan({"org.onap.optf.cmso"})
@EnableTransactionManagement
-public class CMSQuartzConfiguration {
+public class CmsoQuartzConfiguration {
@Autowired
Environment env;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java index e632a6d..ac4b726 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java @@ -41,7 +41,7 @@ import org.onap.aaf.cadi.Permission; import org.onap.observations.Observation; import org.onap.optf.cmso.SpringProfiles; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; @@ -78,7 +78,7 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter { filterChain.doFilter(request, response); } else { Observation.report(LogMessages.UNAUTHORIZED); - ResponseFormatter.errorResponse(request, response, new CMSException( + ResponseFormatter.errorResponse(request, response, new CmsoException( LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); } } else { @@ -87,7 +87,7 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter { } catch (Exception e) { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); ResponseFormatter.errorResponse(request, response, - new CMSException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); + new CmsoException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); } } } diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java index 586822f..5a93481 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java @@ -42,7 +42,7 @@ import org.onap.observations.Observation; import org.onap.optf.cmso.Application; import org.onap.optf.cmso.SpringProfiles; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @@ -77,7 +77,8 @@ public class AafFilter extends OrderedRequestContextFilter { if (response.getStatus() == 401) { Observation.report(LogMessages.UNAUTHENTICATED); ResponseFormatter.errorResponse(request, response, - new CMSException(LogMessages.UNAUTHENTICATED.getStatus(), LogMessages.UNAUTHENTICATED, "")); + new CmsoException(LogMessages.UNAUTHENTICATED.getStatus(), + LogMessages.UNAUTHENTICATED, "")); } } diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java index e7ddcdf..b9c287f 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java @@ -33,12 +33,12 @@ package org.onap.optf.cmso.aaf; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; class ResponseFormatter { - static void errorResponse(HttpServletRequest request, HttpServletResponse response, CMSException error) + static void errorResponse(HttpServletRequest request, HttpServletResponse response, CmsoException error) throws IOException { response.setStatus(error.getStatus().getStatusCode()); response.getWriter().write(error.getRequestError().toString()); diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java index ec3804a..403178b 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java @@ -38,17 +38,17 @@ import java.io.Serializable; import java.util.ArrayList;
import java.util.List;
-public class CMSRequestError implements Serializable {
+public class CmsoRequestError implements Serializable {
private static final long serialVersionUID = 1L;
- private static EELFLogger log = EELFManager.getInstance().getLogger(CMSRequestError.class);
+ private static EELFLogger log = EELFManager.getInstance().getLogger(CmsoRequestError.class);
@JsonProperty
RequestError requestError;
- public CMSRequestError(String messageId, String text, List<String> variables) {
+ public CmsoRequestError(String messageId, String text, List<String> variables) {
requestError = new RequestError(messageId, text, variables);
}
- public CMSRequestError(String messageId, String text) {
+ public CmsoRequestError(String messageId, String text) {
requestError = new RequestError(messageId, text, new ArrayList<String>());
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/CMSStatusEnum.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/CmsoStatusEnum.java index d560f50..135e1f1 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/common/CMSStatusEnum.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/CmsoStatusEnum.java @@ -34,7 +34,7 @@ package org.onap.optf.cmso.common; /**
* The Enum CMSStatusEnum.
*/
-public enum CMSStatusEnum {
+public enum CmsoStatusEnum {
PendingSchedule("Pending Schedule",
"Schedule request as been accepted. Pending determination of recommended schedule."),
SchedulingFailed("Scheduling Failed", "Failed to determine recommended schedule."),
@@ -61,7 +61,7 @@ public enum CMSStatusEnum { private final String text;
private final String description;
- private CMSStatusEnum(String text, String description) {
+ private CmsoStatusEnum(String text, String description) {
this.text = text;
this.description = description;
}
@@ -82,8 +82,8 @@ public enum CMSStatusEnum { * @param text the text
* @return the CMS status enum
*/
- public CMSStatusEnum fromString(String text) {
- for (CMSStatusEnum e : CMSStatusEnum.values()) {
+ public CmsoStatusEnum fromString(String text) {
+ for (CmsoStatusEnum e : CmsoStatusEnum.values()) {
if (e.text.equals(text)) {
return e;
}
@@ -100,7 +100,7 @@ public enum CMSStatusEnum { public static void main(String[] argv) {
StringBuilder sb = new StringBuilder();
sb.append("<html><body><table border=\"1\">\n");
- for (CMSStatusEnum v : CMSStatusEnum.values()) {
+ for (CmsoStatusEnum v : CmsoStatusEnum.values()) {
sb.append("<tr><td>").append(v.text).append("</td><td>").append(v.description)
.append("</td></tr>\n");
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CMSAlreadyExistsException.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoAlreadyExistsException.java index d461e4f..f668a72 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CMSAlreadyExistsException.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoAlreadyExistsException.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -34,10 +34,10 @@ package org.onap.optf.cmso.common.exceptions; import javax.ws.rs.core.Response.Status;
import org.onap.optf.cmso.common.LogMessages;
-public class CMSAlreadyExistsException extends CMSException {
+public class CmsoAlreadyExistsException extends CmsoException {
private static final long serialVersionUID = 1L;
- public CMSAlreadyExistsException(String... args) {
+ public CmsoAlreadyExistsException(String... args) {
super(Status.CONFLICT, LogMessages.SCHEDULE_ALREADY_EXISTS, args);
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java index d59177f..b604b94 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java @@ -35,13 +35,13 @@ import com.att.eelf.i18n.EELFResourceManager; import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response.Status;
-import org.onap.optf.cmso.common.CMSRequestError;
+import org.onap.optf.cmso.common.CmsoRequestError;
import org.onap.optf.cmso.common.LogMessages;
-public class CMSException extends Exception {
+public class CmsoException extends Exception {
private static final long serialVersionUID = 1L;
- protected CMSRequestError requestError = null;
+ protected CmsoRequestError requestError = null;
private List<String> variables = new ArrayList<String>();
protected LogMessages messageCode;
protected Status status;
@@ -53,14 +53,14 @@ public class CMSException extends Exception { * @param messageCode the message code
* @param args the args
*/
- public CMSException(Status status, LogMessages messageCode, String... args) {
+ public CmsoException(Status status, LogMessages messageCode, String... args) {
super(EELFResourceManager.format(messageCode, args));
this.status = status;
this.messageCode = messageCode;
for (String arg : args) {
variables.add(arg);
}
- requestError = new CMSRequestError(messageCode.name(), getMessage(), variables);
+ requestError = new CmsoRequestError(messageCode.name(), getMessage(), variables);
}
public Status getStatus() {
@@ -75,7 +75,7 @@ public class CMSException extends Exception { return variables.toArray(new String[variables.size()]);
}
- public CMSRequestError getRequestError() {
+ public CmsoRequestError getRequestError() {
return requestError;
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CMSNotFoundException.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoNotFoundException.java index 2a46e21..39cb82f 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CMSNotFoundException.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoNotFoundException.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -34,10 +34,10 @@ package org.onap.optf.cmso.common.exceptions; import javax.ws.rs.core.Response.Status;
import org.onap.optf.cmso.common.LogMessages;
-public class CMSNotFoundException extends CMSException {
+public class CmsoNotFoundException extends CmsoException {
private static final long serialVersionUID = 1L;
- public CMSNotFoundException(String... args) {
+ public CmsoNotFoundException(String... args) {
super(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, args);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java index 435f11a..192258e 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java @@ -47,9 +47,9 @@ import org.onap.optf.cmso.common.LogMessages; import org.onap.optf.cmso.common.PropertiesManagement;
import org.onap.optf.cmso.eventq.DispatchedEventList;
import org.onap.optf.cmso.filters.CmsoClientFilters;
-import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.onap.optf.cmso.ticketmgt.TmClient;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
@@ -74,16 +74,16 @@ public class CmJob implements Job { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- CMSOClient vidClient;
+ CmsoClient vidClient;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDao;
+ ChangeManagementGroupDao cmGroupDao;
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
TmClient tmClient;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CMSOClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java index 2835b2f..c31c275 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CMSOClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java @@ -45,15 +45,15 @@ import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.onap.optf.cmso.ticketmgt.TmClient;
import org.onap.optf.cmso.wf.bean.WfChangeManagementResponse;
import org.onap.optf.cmso.wf.bean.WfVidCmResponse;
@@ -64,20 +64,20 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional;
@Component
-public class CMSOClient {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CMSOClient.class);
+public class CmsoClient {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(CmsoClient.class);
private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDao;
+ ChangeManagementGroupDao cmGroupDao;
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
@@ -135,7 +135,7 @@ public class CMSOClient { default: {
errors.error(LogMessages.UNEXPECTED_RESPONSE.toString(), "VID", response.getStatus(),
response.toString());
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(response.toString());
updateScheduleStatus(cmSchedule, schedule);
return;
@@ -145,19 +145,19 @@ public class CMSOClient { // No sense in retrying. These are time sensitive actions
catch (ResponseProcessingException e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(e.toString());
updateScheduleStatus(cmSchedule, schedule);
} catch (ProcessingException e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(e.toString());
updateScheduleStatus(cmSchedule, schedule);
}
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(e.toString());
updateScheduleStatus(cmSchedule, schedule);
}
@@ -168,7 +168,7 @@ public class CMSOClient { WfChangeManagementResponse resp = response.readEntity(WfChangeManagementResponse.class);
for (WfVidCmResponse cmResponse : resp.getCmResponses()) {
if (cmResponse.getVnfName().equals(cmSchedule.getVnfName())) {
- cmSchedule.setStatus(CMSStatusEnum.Triggered.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Triggered.toString());
cmSchedule.setDispatchTimeMillis(System.currentTimeMillis());
cmSchedule.setMsoRequestId(cmResponse.getOrchestratorRequestId());
// Push the state up to the schedule.
@@ -177,7 +177,7 @@ public class CMSOClient { return;
}
}
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage("Response did not contain vnfName=" + cmSchedule.getVnfName());
updateScheduleStatus(cmSchedule, schedule);
}
@@ -195,7 +195,7 @@ public class CMSOClient { if (rr != null) {
JsonNode requestId = rr.get("requestId");
if (requestId != null) {
- cmSchedule.setStatus(CMSStatusEnum.Triggered.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Triggered.toString());
cmSchedule.setDispatchTimeMillis(System.currentTimeMillis());
cmSchedule.setMsoRequestId(requestId.asText());
// Push the state up to the schedule.
@@ -205,7 +205,7 @@ public class CMSOClient { }
}
}
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(node.toString());
updateScheduleStatus(cmSchedule, schedule);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java index 3d987b1..ccbc430 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java @@ -39,14 +39,14 @@ import java.util.Date; import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementGroup;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.onap.optf.cmso.ticketmgt.TmClient;
import org.onap.optf.cmso.ticketmgt.bean.TmApprovalStatusEnum;
import org.onap.optf.cmso.ticketmgt.bean.TmChangeInfo;
@@ -69,16 +69,16 @@ public class DispatchJob { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- CMSOClient vidClient;
+ CmsoClient vidClient;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDao;
+ ChangeManagementGroupDao cmGroupDao;
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
TmClient tmClient;
@@ -102,7 +102,7 @@ public class DispatchJob { if (group != null) {
Schedule schedule = scheduleDao.findById(group.getSchedulesUuid()).orElse(null);
if (schedule != null) {
- schedule.setStatus(CMSStatusEnum.NotificationsInitiated.toString());
+ schedule.setStatus(CmsoStatusEnum.NotificationsInitiated.toString());
if (safeToDispatch(cmSchedule, schedule)) {
vidClient.dispatch(cmSchedule, schedule);
}
@@ -128,8 +128,8 @@ public class DispatchJob { // *******************************************************************
// Validate that the state is accurate.
// Another instance may have dispatched
- if (!cmSchedule.getStatus().equals(CMSStatusEnum.Scheduled.toString())
- && !cmSchedule.getStatus().equals(CMSStatusEnum.ScheduledImmediate.toString())) {
+ if (!cmSchedule.getStatus().equals(CmsoStatusEnum.Scheduled.toString())
+ && !cmSchedule.getStatus().equals(CmsoStatusEnum.ScheduledImmediate.toString())) {
log.info("Attempt to dispatch an event that is in the incorrect state scheduleId={0}, vnf={1}, status={2}",
schedule.getScheduleId(), cmSchedule.getVnfName(), cmSchedule.getStatus());
return false;
@@ -161,7 +161,7 @@ public class DispatchJob { String message = "Attempt to schedule immediate when immmediate scheduling is disabled: "
+ cmSchedule.getVnfName();
log.info(message);
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(message);
updateScheduleStatus(cmSchedule, schedule);
return false;
@@ -182,7 +182,7 @@ public class DispatchJob { cmSchedule.getVnfName(), new Date(now).toString(), new Date(startMillis).toString());
log.info(message);
- cmSchedule.setStatus(CMSStatusEnum.PastDue.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.PastDue.toString());
cmSchedule.setStatusMessage(message);
updateScheduleStatus(cmSchedule, schedule);
return false;
@@ -243,7 +243,7 @@ public class DispatchJob { cmSchedule.getVnfName(), cmSchedule.getTmChangeId());
errors.error(message);
}
- cmSchedule.setStatus(CMSStatusEnum.SchedulingFailed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.SchedulingFailed.toString());
cmSchedule.setStatusMessage(message);
updateScheduleStatus(cmSchedule, schedule);
return false;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java index 7816f72..2ae0913 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java @@ -35,7 +35,7 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager;
import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.LogMessages;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@@ -55,7 +55,7 @@ public class CmQuartzJob extends QuartzJobBean { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- CMSQueueJob qqJob;
+ CmsoQueueJob qqJob;
// This is not called directly. Using @Autowired to ensure that startup
// Runs before the fist invocation of executeInternal
@@ -63,10 +63,9 @@ public class CmQuartzJob extends QuartzJobBean { CmQuartzJobStartup startup;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Override
- @Transactional
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
Mdc.quartzJobBegin(context);
debug.debug(LogMessages.CM_QUARTZ_JOB, "Entered");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJobStartup.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJobStartup.java index add1478..dfb9fc5 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJobStartup.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJobStartup.java @@ -35,7 +35,7 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager;
import java.net.InetAddress;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -55,7 +55,7 @@ public class CmQuartzJobStartup { private static EELFLogger log = EELFManager.getInstance().getLogger(CmQuartzJobStartup.class);
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
private AtomicBoolean started = new AtomicBoolean(false);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmsoQueueJob.java index cb0ca87..de85e2c 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmsoQueueJob.java @@ -35,11 +35,11 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager;
import java.util.Date;
import java.util.List;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.dispatcher.CmJob;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Trigger;
@@ -60,11 +60,11 @@ import org.springframework.transaction.annotation.Transactional; * memory....
*/
@Component
-public class CMSQueueJob {
+public class CmsoQueueJob {
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
SchedulerFactoryBean qsScheduler;
@@ -86,7 +86,7 @@ public class CMSQueueJob { long now = System.currentTimeMillis();
Long endTime = now + (interval * lookahead);
List<ChangeManagementSchedule> schedules =
- cmScheduleDao.findByStatusAndEndTime(CMSStatusEnum.Scheduled.toString(), endTime);
+ cmScheduleDao.findByStatusAndEndTime(CmsoStatusEnum.Scheduled.toString(), endTime);
if (schedules.size() == 0) {
return false;
}
@@ -99,12 +99,12 @@ public class CMSQueueJob { } catch (org.quartz.SchedulerException e) {
debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
// WIll keep trying until it goes Past due
- schedule.setStatus(CMSStatusEnum.Scheduled.toString());
+ schedule.setStatus(CmsoStatusEnum.Scheduled.toString());
schedule.setDispatcherInstance("");
updateScheduleStatus(schedule);
} catch (Exception e) {
debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- schedule.setStatus(CMSStatusEnum.Scheduled.toString());
+ schedule.setStatus(CmsoStatusEnum.Scheduled.toString());
schedule.setDispatcherInstance("");
updateScheduleStatus(schedule);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoContainerFilters.java b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoContainerFilters.java index d62f5c2..e52df57 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoContainerFilters.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoContainerFilters.java @@ -72,8 +72,8 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders(); String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString()); respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion); - respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestversion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchversion()); } catch (Exception e) { if (e instanceof WebApplicationException) { @@ -114,7 +114,7 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe } String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString()); if (minorVersion == null) { - minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion); + minorVersion = MessageHeaders.getSupportedmajorversions().get(majorVersion); headers.add(HeadersEnum.MinorVersion.toString(), minorVersion); } if (!MessageHeaders.validateMajorMinorVersion(majorVersion, minorVersion)) { diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java b/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java index b62cce2..d671768 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java @@ -69,7 +69,7 @@ public class MessageHeaders { }
/** The Constant supportedMajorVersions. */
- public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>();
+ private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>();
static {
supportedMajorVersions.put("v1", "0");
@@ -77,7 +77,7 @@ public class MessageHeaders { }
/** The Constant supportedMajorMinorVersions. */
- public static final Set<String> supportedMajorMinorVersions = new HashSet<String>();
+ private static final Set<String> supportedMajorMinorVersions = new HashSet<String>();
static {
supportedMajorMinorVersions.add("v1.0");
@@ -85,10 +85,10 @@ public class MessageHeaders { }
/** The Constant latestVersion. */
- public static final String latestVersion = "2.0.0";
+ private static final String latestVersion = "2.0.0";
/** The Constant patchVersion. */
- public static final String patchVersion = "0";
+ private static final String patchVersion = "0";
/**
* From string.
@@ -156,4 +156,20 @@ public class MessageHeaders { }
return true;
}
+
+ public static Map<String, String> getSupportedmajorversions() {
+ return supportedMajorVersions;
+ }
+
+ public static Set<String> getSupportedmajorminorversions() {
+ return supportedMajorMinorVersions;
+ }
+
+ public static String getLatestversion() {
+ return latestVersion;
+ }
+
+ public static String getPatchversion() {
+ return patchVersion;
+ }
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDao.java index 9e4b546..48d489d 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDao.java @@ -39,7 +39,7 @@ import org.onap.optf.cmso.model.ApprovalType; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ApprovalTypeDAO extends PagingAndSortingRepository<ApprovalType, UUID> {
+public interface ApprovalTypeDao extends PagingAndSortingRepository<ApprovalType, UUID> {
Optional<ApprovalType> findById(UUID id);
ApprovalType save(ApprovalType persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDao.java index 976a57f..945d9ed 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDao.java @@ -40,7 +40,7 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementChangeWindowDAO
+public interface ChangeManagementChangeWindowDao
extends PagingAndSortingRepository<ChangeManagementChangeWindow, UUID> {
Optional<ChangeManagementChangeWindow> findById(UUID id);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDao.java index 7dabf5e..9fae8bf 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDao.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -34,7 +34,7 @@ package org.onap.optf.cmso.model.dao; import java.util.List;
import org.onap.optf.cmso.model.ChangeManagementDetail;
-public interface ChangeManagementDetailDAO {
+public interface ChangeManagementDetailDao {
List<ChangeManagementDetail> searchScheduleDetails(String where, int limit);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDaoImpl.java index 2543c77..03b05d4 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDaoImpl.java @@ -39,7 +39,7 @@ import org.onap.optf.cmso.model.ChangeManagementDetail; import org.springframework.stereotype.Repository;
@Repository
-public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO {
+public class ChangeManagementDetailDaoImpl implements ChangeManagementDetailDao {
@PersistenceContext
private EntityManager manager;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDao.java index 7694d8d..b4bcaf0 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDao.java @@ -39,7 +39,7 @@ import org.onap.optf.cmso.model.ChangeManagementGroup; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementGroupDAO extends PagingAndSortingRepository<ChangeManagementGroup, UUID> {
+public interface ChangeManagementGroupDao extends PagingAndSortingRepository<ChangeManagementGroup, UUID> {
Optional<ChangeManagementGroup> findById(UUID id);
ChangeManagementGroup save(ChangeManagementGroup persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDao.java index 8741587..172221a 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDao.java @@ -41,7 +41,7 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<ChangeManagementSchedule, UUID> {
+public interface ChangeManagementScheduleDao extends PagingAndSortingRepository<ChangeManagementSchedule, UUID> {
@Override Optional<ChangeManagementSchedule> findById(UUID id);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDao.java index 75299a1..e9d7e1e 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDao.java @@ -37,7 +37,7 @@ import java.util.UUID; import org.onap.optf.cmso.model.DomainData;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface DomainDataDAO extends PagingAndSortingRepository<DomainData, UUID> {
+public interface DomainDataDao extends PagingAndSortingRepository<DomainData, UUID> {
Optional<DomainData> findById(UUID id);
DomainData save(DomainData persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ElementDataDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ElementDataDao.java index dada4e1..8a05a4c 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ElementDataDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ElementDataDao.java @@ -36,7 +36,7 @@ import java.util.UUID; import org.onap.optf.cmso.model.ElementData; import org.springframework.data.repository.PagingAndSortingRepository; -public interface ElementDataDAO extends PagingAndSortingRepository<ElementData, UUID> { +public interface ElementDataDao extends PagingAndSortingRepository<ElementData, UUID> { @Override Optional<ElementData> findById(UUID id); diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDao.java index 3fabd63..8d62256 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDao.java @@ -37,7 +37,7 @@ import java.util.UUID; import org.onap.optf.cmso.model.ScheduleApproval;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ScheduleApprovalDAO extends PagingAndSortingRepository<ScheduleApproval, UUID> {
+public interface ScheduleApprovalDao extends PagingAndSortingRepository<ScheduleApproval, UUID> {
Optional<ScheduleApproval> findById(UUID id);
ScheduleApproval save(ScheduleApproval persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDao.java index 14d3143..f73ed96 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDao.java @@ -42,7 +42,7 @@ import org.springframework.data.jpa.repository.Lock; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, UUID> {
+public interface ScheduleDao extends PagingAndSortingRepository<Schedule, UUID> {
Optional<Schedule> findById(UUID id);
Schedule save(Schedule persited);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDao.java index f974eb5..14a9a13 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDao.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -34,7 +34,7 @@ package org.onap.optf.cmso.model.dao; import java.util.List;
import org.onap.optf.cmso.model.ScheduleQuery;
-public interface ScheduleQueryDAO {
+public interface ScheduleQueryDao {
List<ScheduleQuery> searchSchedules(String where, int limit);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDaoImpl.java index b5a6e57..7b2def6 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDaoImpl.java @@ -39,7 +39,7 @@ import org.onap.optf.cmso.model.ScheduleQuery; import org.springframework.stereotype.Repository;
@Repository
-public class ScheduleQueryDAOImpl implements ScheduleQueryDAO {
+public class ScheduleQueryDaoImpl implements ScheduleQueryDao {
@PersistenceContext
private EntityManager manager;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java index 898339a..269c4b5 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java @@ -45,13 +45,13 @@ import javax.ws.rs.core.Response; import org.onap.observations.Mdc; import org.onap.observations.Observation; import org.onap.optf.cmso.common.BasicAuthenticatorFilter; -import org.onap.optf.cmso.common.CMSStatusEnum; +import org.onap.optf.cmso.common.CmsoStatusEnum; import org.onap.optf.cmso.common.LogMessages; import org.onap.optf.cmso.common.PropertiesManagement; import org.onap.optf.cmso.filters.CmsoClientFilters; import org.onap.optf.cmso.model.DomainData; import org.onap.optf.cmso.model.Schedule; -import org.onap.optf.cmso.model.dao.ScheduleDAO; +import org.onap.optf.cmso.model.dao.ScheduleDao; import org.onap.optf.cmso.optimizer.model.OptimizerElementInfo; import org.onap.optf.cmso.optimizer.model.OptimizerRequest; import org.onap.optf.cmso.optimizer.model.OptimizerResponse; @@ -72,7 +72,7 @@ public class CmsoOptimizerClient { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger(); @Autowired - ScheduleDAO scheduleDao; + ScheduleDao scheduleDao; @Autowired Environment env; @@ -93,10 +93,10 @@ public class CmsoOptimizerClient { try { // Ensure that only one cmso is requsting this call to optimizer Schedule schedule = scheduleDao.lockOne(uuid); - if (schedule.getStatus().equals(CMSStatusEnum.PendingSchedule.toString())) { + if (schedule.getStatus().equals(CmsoStatusEnum.PendingSchedule.toString())) { scheduleNewOptimization(schedule); } - if (schedule.getStatus().equals(CMSStatusEnum.OptimizationInProgress.toString())) { + if (schedule.getStatus().equals(CmsoStatusEnum.OptimizationInProgress.toString())) { pollOptimizer(schedule); } return; @@ -121,7 +121,7 @@ public class CmsoOptimizerClient { // message, try the next one. We don't want bad data to // if (schedule.getOptimizerAttemptsToSchedule() >= maxAttempts) { - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerMessage("Maximum number of attempts exceeded " + maxAttempts); updateScheduleStatus(schedule); return; @@ -134,7 +134,7 @@ public class CmsoOptimizerClient { } } catch (Exception e) { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerMessage("Unexpected exception: " + e.getMessage()); updateScheduleStatus(schedule); return; @@ -168,7 +168,7 @@ public class CmsoOptimizerClient { // schedule.setOptimizerTransactionId(cmReq.getRequestId()); schedule.setOptimizerDateTimeMillis(System.currentTimeMillis()); - schedule.setStatus(CMSStatusEnum.OptimizationInProgress.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationInProgress.toString()); updateScheduleStatus(schedule); debug.debug("optimizer url / user: " + optimizerurl + " / " + username); debug.debug("optimizer Request: " + new ObjectMapper().writeValueAsString(cmReq)); @@ -193,7 +193,7 @@ public class CmsoOptimizerClient { schedule.setOptimizerStatus("HTTP Status: " + response.getStatus()); String message = response.readEntity(String.class); schedule.setOptimizerMessage(message); - schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString()); + schedule.setStatus(CmsoStatusEnum.ScheduleFailed.toString()); // Need to understand the cause of this error. May be teh same as optimizer // down. int tries = schedule.getOptimizerAttemptsToSchedule(); @@ -209,7 +209,7 @@ public class CmsoOptimizerClient { schedule.setOptimizerDateTimeMillis(System.currentTimeMillis()); int tries = schedule.getOptimizerAttemptsToSchedule(); tries++; - schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString()); + schedule.setStatus(CmsoStatusEnum.ScheduleFailed.toString()); schedule.setOptimizerAttemptsToSchedule(tries); String message = response.readEntity(String.class); schedule.setOptimizerMessage(message); @@ -223,7 +223,7 @@ public class CmsoOptimizerClient { } catch (ResponseProcessingException e) { schedule.setOptimizerDateTimeMillis(System.currentTimeMillis()); schedule.setOptimizerStatus("Failed to parse optimizer response"); - schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString()); + schedule.setStatus(CmsoStatusEnum.ScheduleFailed.toString()); // Need to understand the cause of this error. May be teh same as optimizer down. int tries = schedule.getOptimizerAttemptsToSchedule(); tries++; @@ -235,7 +235,7 @@ public class CmsoOptimizerClient { } catch (ProcessingException e) { // Don't track number of retries on IO error (optimizer is down) schedule.setOptimizerDateTimeMillis(System.currentTimeMillis()); - schedule.setStatus(CMSStatusEnum.PendingSchedule.toString()); + schedule.setStatus(CmsoStatusEnum.PendingSchedule.toString()); updateScheduleStatus(schedule); /// Cannot connect to optimizer Observation.report(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage()); @@ -264,7 +264,7 @@ public class CmsoOptimizerClient { } Long now = System.currentTimeMillis(); if (now > schedule.getOptimizerDateTimeMillis() + (timeout * 1000)) { - schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString()); + schedule.setStatus(CmsoStatusEnum.ScheduleFailed.toString()); updateScheduleStatus(schedule); return; } @@ -299,7 +299,7 @@ public class CmsoOptimizerClient { schedule.setOptimizerStatus("HTTP Status: " + response.getStatus()); String message = response.readEntity(String.class); schedule.setOptimizerMessage(message); - schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString()); + schedule.setStatus(CmsoStatusEnum.ScheduleFailed.toString()); updateScheduleStatus(schedule); Observation.report(LogMessages.OPTIMIZER_EXCEPTION, message); } @@ -308,7 +308,7 @@ public class CmsoOptimizerClient { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); schedule.setOptimizerDateTimeMillis(System.currentTimeMillis()); schedule.setOptimizerMessage(e.getMessage()); - schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString()); + schedule.setStatus(CmsoStatusEnum.ScheduleFailed.toString()); updateScheduleStatus(schedule); } } @@ -336,7 +336,7 @@ public class CmsoOptimizerClient { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse message. Format changed?"); schedule.setOptimizerStatus("Failed to parse optimizer request"); schedule.setOptimizerDateTimeMillis(System.currentTimeMillis()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); scheduleDao.save(schedule); } return null; diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerHandler.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerHandler.java index cb658bb..7b1dd58 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerHandler.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerHandler.java @@ -33,17 +33,17 @@ import java.util.List; import java.util.Map; import javax.ws.rs.core.Response.Status; import org.onap.observations.Observation; -import org.onap.optf.cmso.common.CMSStatusEnum; +import org.onap.optf.cmso.common.CmsoStatusEnum; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.model.ChangeManagementGroup; import org.onap.optf.cmso.model.ChangeManagementSchedule; import org.onap.optf.cmso.model.Schedule; -import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO; -import org.onap.optf.cmso.model.dao.ScheduleDAO; +import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDao; +import org.onap.optf.cmso.model.dao.ChangeManagementDetailDao; +import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao; +import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao; +import org.onap.optf.cmso.model.dao.ScheduleDao; import org.onap.optf.cmso.optimizer.model.OptimizerResponse; import org.onap.optf.cmso.optimizer.model.OptimizerScheduleInfo; import org.onap.optf.cmso.optimizer.model.ScheduledElement; @@ -63,19 +63,19 @@ public class CmsoOptimizerHandler { Environment env; @Autowired - ChangeManagementScheduleDAO cmScheduleDao; + ChangeManagementScheduleDao cmScheduleDao; @Autowired - ScheduleDAO scheduleDao; + ScheduleDao scheduleDao; @Autowired - ChangeManagementGroupDAO cmGroupDao; + ChangeManagementGroupDao cmGroupDao; @Autowired - ChangeManagementChangeWindowDAO cmChangeWindowDao; + ChangeManagementChangeWindowDao cmChangeWindowDao; @Autowired - ChangeManagementDetailDAO cmDetailsDao; + ChangeManagementDetailDao cmDetailsDao; /** * Handle optimizer response. @@ -88,7 +88,7 @@ public class CmsoOptimizerHandler { // Note that transaction ID and schedule ID are currently the same value. String id = response.getRequestId(); - CMSStatusEnum status = CMSStatusEnum.PendingApproval.fromString(schedule.getStatus()); + CmsoStatusEnum status = CmsoStatusEnum.PendingApproval.fromString(schedule.getStatus()); debug.debug("Status at time of optimizer status is " + status.toString() + " for " + id); switch (status) { // PendingSchedule may be a valid status in the cases where SNIRO async call @@ -100,8 +100,8 @@ public class CmsoOptimizerHandler { scheduleDao.save(schedule); break; default: - throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR, - CMSStatusEnum.OptimizationInProgress.toString(), schedule.getStatus().toString()); + throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR, + CmsoStatusEnum.OptimizationInProgress.toString(), schedule.getStatus().toString()); } } catch (Exception e) { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); @@ -118,7 +118,7 @@ public class CmsoOptimizerHandler { saveSchedules(response, schedule); break; case FAILED: - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); break; case PENDING_OPTIMIZER: case PENDING_TICKETS: @@ -129,20 +129,20 @@ public class CmsoOptimizerHandler { break; } scheduleDao.save(schedule); - } catch (CMSException e) { + } catch (CmsoException e) { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerStatus(e.getStatus().toString()); schedule.setOptimizerMessage(e.getLocalizedMessage()); } catch (Exception e) { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerStatus("Exception"); schedule.setOptimizerMessage(e.getLocalizedMessage()); } } - private void saveSchedules(OptimizerResponse response, Schedule schedule) throws CMSException { + private void saveSchedules(OptimizerResponse response, Schedule schedule) throws CmsoException { // TODO: Persist the list of schedules in the DB @@ -153,12 +153,12 @@ public class CmsoOptimizerHandler { OptimizerScheduleInfo osi = chooseSchedule(schedules); if (osi == null) { - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerMessage("No schedules returned for COMPLETED status"); return; } if (osi.getScheduledElements().size() == 0) { - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerMessage("No elements scheduled for COMPLETED status"); return; } @@ -174,7 +174,7 @@ public class CmsoOptimizerHandler { cmScheduleDao.findOneByScheduleUuidGroupIdAndVnfName(schedule.getUuid(), groupId, vnfName); cms.setStartTimeMillis(element.getStartTime().getTime()); cms.setFinishTimeMillis(element.getEndTime().getTime()); - cms.setStatus(CMSStatusEnum.PendingApproval.toString()); + cms.setStatus(CmsoStatusEnum.PendingApproval.toString()); cmScheduleDao.save(cms); } if (osi.getUnScheduledElements() != null) { @@ -183,7 +183,7 @@ public class CmsoOptimizerHandler { String vnfName = element.getElementId(); ChangeManagementSchedule cms = cmScheduleDao.findOneByScheduleUuidGroupIdAndVnfName(schedule.getUuid(), groupId, vnfName); - cms.setStatus(CMSStatusEnum.NotScheduled.toString()); + cms.setStatus(CmsoStatusEnum.NotScheduled.toString()); cmScheduleDao.save(cms); } @@ -193,7 +193,7 @@ public class CmsoOptimizerHandler { for (ChangeManagementGroup cmg : updatedGroups.values()) { cmGroupDao.save(cmg); } - schedule.setStatus(CMSStatusEnum.PendingApproval.toString()); + schedule.setStatus(CmsoStatusEnum.PendingApproval.toString()); } private void updateGroup(ScheduledElement element, List<ChangeManagementGroup> groups, @@ -214,7 +214,7 @@ public class CmsoOptimizerHandler { } } if (cmg == null) { - throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.MISSING_VALID_GROUP_FOR_ELEMENT, + throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.MISSING_VALID_GROUP_FOR_ELEMENT, element.getElementId()); } Long elementStartTime = element.getStartTime().getTime(); diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java index 0021c0d..e5bbd52 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java @@ -44,13 +44,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.DomainsEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@@ -71,7 +71,7 @@ public class OptimizerQuartzJob extends QuartzJobBean { private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
PropertiesManagement pm;
@@ -96,12 +96,12 @@ public class OptimizerQuartzJob extends QuartzJobBean { // schedule the request and update the status to PendingSchedule
// and update the state to OptimizationInProgress
List<Schedule> schedules = scheduleDao.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
- CMSStatusEnum.PendingSchedule.toString());
+ CmsoStatusEnum.PendingSchedule.toString());
for (Schedule s : schedules) {
scheduleOptimization(s);
}
List<Schedule> inProgressSchedules = scheduleDao.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
- CMSStatusEnum.OptimizationInProgress.toString());
+ CmsoStatusEnum.OptimizationInProgress.toString());
for (Schedule s : inProgressSchedules) {
scheduleOptimization(s);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerRequest.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoOptimizerRequest.java index e9e80c4..05ab753 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerRequest.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoOptimizerRequest.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -31,7 +31,7 @@ package org.onap.optf.cmso.optimizer.bean;
-public class CMOptimizerRequest {
+public class CmsoOptimizerRequest {
/*
*
@@ -39,35 +39,35 @@ public class CMOptimizerRequest { * "2017-02-15T00:00:00+05:00", "endTime": "2017-02-18T23:59:00+05:00",
* "normalDurationInSecs": 60, "additionalDurationInSecs": 0, // for backout
* "concurrencyLimit": 10, "policyId": ["SNIRO.TimeLimitAndVerticalTopology"],
- * "vnfDetails": [{ “node�: "satmo415vbc", “groupId�: “group1�//optional }, {
- * “node�: "satmo415vbc", “groupId�: “group1�//optional }] }, "requestInfo": {
- * “transactionId�: �__TRANSACTIONID__�, //logging "requestId":
- * "CM-<__SCHEDULE ID__>", "sourceId": "cm-portal", “optimizer�: [“scheduling�],
+ * "vnfDetails": [{ “node�?: "satmo415vbc", “groupId�?: “group1�?//optional }, {
+ * “node�?: "satmo415vbc", “groupId�?: “group1�?//optional }] }, "requestInfo": {
+ * “transactionId�?: �?__TRANSACTIONID__�?, //logging "requestId":
+ * "CM-<__SCHEDULE ID__>", "sourceId": "cm-portal", “optimizer�?: [“scheduling�?],
* "callbackUrl": "http://callbackurl.onap.org:8080/callback" } }
*
*/
- private CMSchedulingInfo schedulingInfo;
- private CMRequestInfo requestInfo;
+ private CmsoSchedulingInfo schedulingInfo;
+ private CmsoRequestInfo requestInfo;
- public CMOptimizerRequest() {
- schedulingInfo = new CMSchedulingInfo();
- requestInfo = new CMRequestInfo();
+ public CmsoOptimizerRequest() {
+ schedulingInfo = new CmsoSchedulingInfo();
+ requestInfo = new CmsoRequestInfo();
}
- public CMSchedulingInfo getSchedulingInfo() {
+ public CmsoSchedulingInfo getSchedulingInfo() {
return schedulingInfo;
}
- public void setSchedulingInfo(CMSchedulingInfo schedulingInfo) {
+ public void setSchedulingInfo(CmsoSchedulingInfo schedulingInfo) {
this.schedulingInfo = schedulingInfo;
}
- public CMRequestInfo getRequestInfo() {
+ public CmsoRequestInfo getRequestInfo() {
return requestInfo;
}
- public void setRequestInfo(CMRequestInfo requestInfo) {
+ public void setRequestInfo(CmsoRequestInfo requestInfo) {
this.requestInfo = requestInfo;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoOptimizerResponse.java index 6dd7bdf..1660866 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoOptimizerResponse.java @@ -36,7 +36,7 @@ import io.swagger.annotations.ApiModelProperty; @ApiModel(value = "Response from schedule optimizer",
description = "Asynchronous response to schedule oprimizer request.")
-public class CMOptimizerResponse {
+public class CmsoOptimizerResponse {
/*
*
@@ -69,9 +69,9 @@ public class CMOptimizerResponse { private String description;
@ApiModelProperty(value = "List of schedules returned, one per group. Only 1 group supported at this time.")
- private CMSchedule[] schedule;
+ private CmsoSchedule[] schedule;
- public CMOptimizerResponse() {}
+ public CmsoOptimizerResponse() {}
public String getTransactionId() {
return transactionId;
@@ -113,11 +113,11 @@ public class CMOptimizerResponse { this.status = status;
}
- public CMSchedule[] getSchedule() {
+ public CmsoSchedule[] getSchedule() {
return schedule;
}
- public void setSchedule(CMSchedule[] schedule) {
+ public void setSchedule(CmsoSchedule[] schedule) {
this.schedule = schedule;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMRequestInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoRequestInfo.java index 5d8ee69..dd74db2 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMRequestInfo.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoRequestInfo.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -31,14 +31,14 @@ package org.onap.optf.cmso.optimizer.bean;
-public class CMRequestInfo {
+public class CmsoRequestInfo {
private String transactionId;
private String requestId;
private String sourceId;
private String[] optimizer;
private String callbackUrl;
- public CMRequestInfo() {}
+ public CmsoRequestInfo() {}
public String getTransactionId() {
return transactionId;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMSchedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoSchedule.java index 184e782..0d56fbd 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMSchedule.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoSchedule.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -34,14 +34,14 @@ package org.onap.optf.cmso.optimizer.bean; import java.util.ArrayList;
import java.util.List;
-public class CMSchedule {
+public class CmsoSchedule {
private String groupId;
private String startTime;
private String finishTime;
private String latestInstanceStartTime;
private List<String> node;
- public CMSchedule() {
+ public CmsoSchedule() {
node = new ArrayList<String>();
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMSchedulingInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoSchedulingInfo.java index 5e86dd7..840cbb7 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMSchedulingInfo.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoSchedulingInfo.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -31,7 +31,7 @@ package org.onap.optf.cmso.optimizer.bean;
-public class CMSchedulingInfo {
+public class CmsoSchedulingInfo {
private String scheduleId;
private String startTime;
private String endTime;
@@ -39,9 +39,9 @@ public class CMSchedulingInfo { private int additionalDurationInSecs;
private int concurrencyLimit;
private String[] policyId;
- private CMVnfDetails[] vnfDetails;
+ private CmsoVnfDetails[] vnfDetails;
- public CMSchedulingInfo() {}
+ public CmsoSchedulingInfo() {}
public String getScheduleId() {
return scheduleId;
@@ -99,11 +99,11 @@ public class CMSchedulingInfo { this.policyId = policyId;
}
- public CMVnfDetails[] getVnfDetails() {
+ public CmsoVnfDetails[] getVnfDetails() {
return vnfDetails;
}
- public void setVnfDetails(CMVnfDetails[] vnfDetails) {
+ public void setVnfDetails(CmsoVnfDetails[] vnfDetails) {
this.vnfDetails = vnfDetails;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMVnfDetails.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoVnfDetails.java index 4da1ab1..4ee6053 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMVnfDetails.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CmsoVnfDetails.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * 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.
@@ -31,13 +31,13 @@ package org.onap.optf.cmso.optimizer.bean;
-public class CMVnfDetails {
+public class CmsoVnfDetails {
private String node;
private String groupId;
- public CMVnfDetails() {}
+ public CmsoVnfDetails() {}
- public CMVnfDetails(String groupId) {
+ public CmsoVnfDetails(String groupId) {
this.groupId = groupId;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java index 816a80e..faea625 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java @@ -35,19 +35,19 @@ import java.util.Map; import java.util.UUID;
import javax.ws.rs.core.Response.Status;
import org.onap.optf.cmso.common.ApprovalStatusEnum;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
-import org.onap.optf.cmso.common.exceptions.CMSAlreadyExistsException;
-import org.onap.optf.cmso.common.exceptions.CMSException;
-import org.onap.optf.cmso.common.exceptions.CMSNotFoundException;
+import org.onap.optf.cmso.common.exceptions.CmsoAlreadyExistsException;
+import org.onap.optf.cmso.common.exceptions.CmsoException;
+import org.onap.optf.cmso.common.exceptions.CmsoNotFoundException;
import org.onap.optf.cmso.model.ApprovalType;
import org.onap.optf.cmso.model.DomainData;
import org.onap.optf.cmso.model.Schedule;
import org.onap.optf.cmso.model.ScheduleApproval;
-import org.onap.optf.cmso.model.dao.ApprovalTypeDAO;
-import org.onap.optf.cmso.model.dao.DomainDataDAO;
-import org.onap.optf.cmso.model.dao.ScheduleApprovalDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ApprovalTypeDao;
+import org.onap.optf.cmso.model.dao.DomainDataDao;
+import org.onap.optf.cmso.model.dao.ScheduleApprovalDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.onap.optf.cmso.service.rs.models.ApprovalMessage;
import org.onap.optf.cmso.service.rs.models.v2.OptimizedScheduleMessage;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,24 +58,24 @@ public class BaseSchedulerServiceImpl { private static EELFLogger log = EELFManager.getInstance().getLogger(BaseSchedulerServiceImpl.class);
@Autowired
- protected ScheduleDAO scheduleDao;
+ protected ScheduleDao scheduleDao;
@Autowired
- DomainDataDAO domainDataDao;
+ DomainDataDao domainDataDao;
@Autowired
- ApprovalTypeDAO approvalTypeDao;
+ ApprovalTypeDao approvalTypeDao;
@Autowired
- ScheduleApprovalDAO scheduleApprovalDao;
+ ScheduleApprovalDao scheduleApprovalDao;
protected Schedule validateAndAddScheduleRequest(OptimizedScheduleMessage scheduleMessage,
- List<DomainData> domainData) throws CMSException {
+ List<DomainData> domainData) throws CmsoException {
messageValidations(scheduleMessage);
Schedule sch = scheduleDao.findByDomainScheduleId(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());
if (sch != null) {
- throw new CMSAlreadyExistsException(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());
+ throw new CmsoAlreadyExistsException(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());
}
sch = new Schedule();
sch.setUuid(UUID.randomUUID());
@@ -90,7 +90,7 @@ public class BaseSchedulerServiceImpl { sch.setScheduleName(scheduleMessage.getScheduleName());
sch.setOptimizerAttemptsToSchedule(0);
sch.setScheduleInfo(scheduleMessage.getSchedulingData().toString());
- sch.setStatus(CMSStatusEnum.PendingSchedule.toString());
+ sch.setStatus(CmsoStatusEnum.PendingSchedule.toString());
scheduleDao.save(sch);
for (DomainData dd : domainData) {
dd.setUuid(UUID.randomUUID());
@@ -101,51 +101,51 @@ public class BaseSchedulerServiceImpl { return sch;
}
- private void messageValidations(OptimizedScheduleMessage scheduleMessage) throws CMSException {
+ private void messageValidations(OptimizedScheduleMessage scheduleMessage) throws CmsoException {
if (scheduleMessage.getScheduleName() == null || scheduleMessage.getScheduleName().equals("")) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "schedulerName", "");
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "schedulerName", "");
}
if (scheduleMessage.getUserId() == null || scheduleMessage.getUserId().equals("")) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "userId", "");
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "userId", "");
}
}
- protected void deleteScheduleRequest(String domain, String scheduleId) throws CMSException {
+ protected void deleteScheduleRequest(String domain, String scheduleId) throws CmsoException {
Schedule sch = scheduleDao.findByDomainScheduleId(domain, scheduleId);
if (sch == null) {
- throw new CMSNotFoundException(domain, scheduleId);
+ throw new CmsoNotFoundException(domain, scheduleId);
}
- CMSStatusEnum currentStatus = CMSStatusEnum.Completed.fromString(sch.getStatus());
+ CmsoStatusEnum currentStatus = CmsoStatusEnum.Completed.fromString(sch.getStatus());
sch.setDeleteDateTimeMillis(System.currentTimeMillis());
switch (currentStatus) {
case Scheduled:
// TODO CLose all tickets....
- sch.setStatus(CMSStatusEnum.Cancelled.toString());
+ sch.setStatus(CmsoStatusEnum.Cancelled.toString());
break;
case NotificationsInitiated:
- throw new CMSException(Status.NOT_ACCEPTABLE, LogMessages.CANNOT_CANCEL_IN_PROGRESS);
+ throw new CmsoException(Status.NOT_ACCEPTABLE, LogMessages.CANNOT_CANCEL_IN_PROGRESS);
default:
- sch.setStatus(CMSStatusEnum.Deleted.toString());
+ sch.setStatus(CmsoStatusEnum.Deleted.toString());
}
scheduleDao.save(sch);
}
protected Schedule processApproval(Schedule sch, String domain, ApprovalMessage approvalMessage)
- throws CMSException {
+ throws CmsoException {
String scheduleId = sch.getScheduleId();
ApprovalType approvalType =
approvalTypeDao.findByDomainAndType(domain, approvalMessage.getApprovalType().toString());
if (approvalType == null) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "approvalType",
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "approvalType",
approvalMessage.getApprovalType().toString());
}
- if (!sch.getStatus().equals(CMSStatusEnum.PendingApproval.toString())) {
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.NOT_PENDING_APPROVAL, domain, scheduleId,
+ if (!sch.getStatus().equals(CmsoStatusEnum.PendingApproval.toString())) {
+ throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.NOT_PENDING_APPROVAL, domain, scheduleId,
sch.getStatus());
}
if (approvalMessage.getApprovalUserId() == null || approvalMessage.getApprovalUserId().equals("")) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "userId");
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "userId");
}
ScheduleApproval sa = null;
// only 1 approval per user....
@@ -171,10 +171,10 @@ public class BaseSchedulerServiceImpl { sch.addScheduleApproval(sa);
scheduleDao.save(sch);
if (sa.getStatus().equals(ApprovalStatusEnum.Rejected.toString())) {
- sch.setStatus(CMSStatusEnum.Rejected.toString());
+ sch.setStatus(CmsoStatusEnum.Rejected.toString());
} else {
if (allApprovalsReceived(sch, sa)) {
- sch.setStatus(CMSStatusEnum.Accepted.toString());
+ sch.setStatus(CmsoStatusEnum.Accepted.toString());
}
}
scheduleDao.save(sch);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java index 2e9ade3..442abe3 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response.Status; import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.onap.optf.cmso.common.LogMessages;
-import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.onap.optf.cmso.common.exceptions.CmsoException;
import org.onap.optf.cmso.model.DomainData;
/**
@@ -102,12 +102,12 @@ public class CmQueryParameters { * @param urlName the url name
* @param values the values
* @return the string
- * @throws CMSException the CMS exception
+ * @throws CmsoException the CMS exception
*/
- public static String buildClause(String urlName, List<String> values) throws CMSException {
+ public static String buildClause(String urlName, List<String> values) throws CmsoException {
QueryColumns qc = getQueryColumn(urlName);
if (qc == null) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.UNDEFINED_FILTER_ATTRIBUTE, urlName);
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.UNDEFINED_FILTER_ATTRIBUTE, urlName);
}
if (qc.type == Date.class) {
return formatDate(urlName, values, qc);
@@ -169,7 +169,7 @@ public class CmQueryParameters { return clause.toString();
}
- private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CMSException {
+ private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CmsoException {
List<String> clauses = new ArrayList<String>();
for (String value : values) {
String[] dates = value.split(",");
@@ -181,7 +181,7 @@ public class CmQueryParameters { formatDatePair(qc, dates[0].trim(), "", clauses);
break;
default:
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, value);
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, value);
}
}
StringBuilder clause = new StringBuilder();
@@ -197,7 +197,7 @@ public class CmQueryParameters { }
private static void formatDatePair(QueryColumns qc, String lowDate, String highDate, List<String> clauses)
- throws CMSException {
+ throws CmsoException {
StringBuilder clause = new StringBuilder();
DateTime date1 = null;
DateTime date2 = null;
@@ -222,12 +222,12 @@ public class CmQueryParameters { }
}
- private static DateTime convertDate(String utcDate, String urlName) throws CMSException {
+ private static DateTime convertDate(String utcDate, String urlName) throws CmsoException {
DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
if (dateTime != null) {
return dateTime;
}
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
}
// public static void main(String argv[])
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleService.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleService.java index 9874ea8..6236adb 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleService.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleService.java @@ -43,7 +43,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; import org.onap.optf.cmso.service.rs.models.v2.OptimizedScheduleMessage; @Api("CMSO Optimized Schedule API") @@ -59,7 +59,7 @@ public interface CmsoOptimizedScheduleService { @ApiResponses( value = {@ApiResponse(code = 202, message = "Schedule request accepted for optimization."), @ApiResponse(code = 409, message = "Schedule request already exists for this schedule id.", - response = CMSRequestError.class), + response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error")}) public Response createScheduleRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleServiceImpl.java index 290d21e..2b6a928 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleServiceImpl.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import org.onap.observations.Observation; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.service.rs.models.v2.OptimizedScheduleMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -63,7 +63,7 @@ public class CmsoOptimizedScheduleServiceImpl extends CommonServiceImpl implemen try { createSchedule(scheduleMessage, scheduleId, request); response = Response.accepted().build(); - } catch (CMSException e) { + } catch (CmsoException e) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallback.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallback.java index d6cefb6..b6b81e6 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallback.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallback.java @@ -43,7 +43,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse; +import org.onap.optf.cmso.optimizer.bean.CmsoOptimizerResponse; @Api("CMSO Optimized Schedule API") @Path("/{apiVersion}") @@ -59,6 +59,6 @@ public interface CmsoOptimizerCallback { @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response sniroCallback( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, - @ApiParam(value = "Return schedules > lastScheduleId") CMOptimizerResponse reponse); + @ApiParam(value = "Return schedules > lastScheduleId") CmsoOptimizerResponse reponse); } diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java index 6a7b1b3..ffe00c5 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java @@ -46,20 +46,20 @@ import javax.ws.rs.core.UriInfo; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.ISODateTimeFormat; -import org.onap.optf.cmso.common.CMSStatusEnum; +import org.onap.optf.cmso.common.CmsoStatusEnum; import org.onap.optf.cmso.common.DomainsEnum; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; -import org.onap.optf.cmso.common.exceptions.CMSNotFoundException; +import org.onap.optf.cmso.common.exceptions.CmsoException; +import org.onap.optf.cmso.common.exceptions.CmsoNotFoundException; import org.onap.optf.cmso.model.ChangeManagementGroup; import org.onap.optf.cmso.model.ChangeManagementSchedule; import org.onap.optf.cmso.model.Schedule; -import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO; -import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse; -import org.onap.optf.cmso.optimizer.bean.CMSchedule; +import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDao; +import org.onap.optf.cmso.model.dao.ChangeManagementDetailDao; +import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao; +import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao; +import org.onap.optf.cmso.optimizer.bean.CmsoOptimizerResponse; +import org.onap.optf.cmso.optimizer.bean.CmsoSchedule; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -80,16 +80,16 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen @Autowired - ChangeManagementScheduleDAO cmScheduleDao; + ChangeManagementScheduleDao cmScheduleDao; @Autowired - ChangeManagementGroupDAO cmGroupDao; + ChangeManagementGroupDao cmGroupDao; @Autowired - ChangeManagementChangeWindowDAO cmChangeWindowDao; + ChangeManagementChangeWindowDao cmChangeWindowDao; @Autowired - ChangeManagementDetailDAO cmDetailsDaoO; + ChangeManagementDetailDao cmDetailsDaoO; /** * Sniro callback. @@ -100,7 +100,7 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen */ @Override @Transactional - public Response sniroCallback(String apiVersion, CMOptimizerResponse sniroResponse) { + public Response sniroCallback(String apiVersion, CmsoOptimizerResponse sniroResponse) { Response response = null; log.info(LogMessages.PROCESS_OPTIMIZER_CALLBACK, "Received", request.getRemoteAddr(), ""); log.info(LogMessages.OPTIMIZER_REQUEST, "Callback received", sniroResponse.getTransactionId(), @@ -123,11 +123,11 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen Schedule schedule = scheduleDao.lockOneByTransactionId(transactionId); if (schedule == null) { - throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(), + throw new CmsoNotFoundException(DomainsEnum.ChangeManagement.toString(), "(OptimizerTransactionID=" + transactionId + ")"); } - CMSStatusEnum status = CMSStatusEnum.PendingApproval.fromString(schedule.getStatus()); + CmsoStatusEnum status = CmsoStatusEnum.PendingApproval.fromString(schedule.getStatus()); debug.debug("Status at time of SNIRO callback is " + status.toString()); switch (status) { // PendingSchedule may be a valid status in the cases where SNIRO async call @@ -140,10 +140,10 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen response = Response.ok().build(); break; default: - throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR, - CMSStatusEnum.OptimizationInProgress.toString(), schedule.getStatus().toString()); + throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR, + CmsoStatusEnum.OptimizationInProgress.toString(), schedule.getStatus().toString()); } - } catch (CMSException e) { + } catch (CmsoException e) { errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); } catch (Exception e) { @@ -153,25 +153,25 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen return response; } - private void processSniroResponse(CMOptimizerResponse sniroResponse, Schedule schedule) { + private void processSniroResponse(CmsoOptimizerResponse sniroResponse, Schedule schedule) { try { schedule.setOptimizerReturnDateTimeMillis(System.currentTimeMillis()); schedule.setOptimizerStatus(sniroResponse.getRequestState()); schedule.setOptimizerMessage(sniroResponse.getDescription()); String scheduleId = sniroResponse.getScheduleId(); ObjectMapper om = new ObjectMapper(); - CMSchedule[] scheduleArray = sniroResponse.getSchedule(); + CmsoSchedule[] scheduleArray = sniroResponse.getSchedule(); if (scheduleArray != null && scheduleArray.length > 0) { String scheduleString = om.writeValueAsString(scheduleArray); schedule.setSchedule(scheduleString); log.debug("scheduleId={0} schedule={1}", scheduleId, scheduleString); - for (CMSchedule sniroSchedule : sniroResponse.getSchedule()) { + for (CmsoSchedule sniroSchedule : sniroResponse.getSchedule()) { String groupId = sniroSchedule.getGroupId(); DateTime finishTime = convertDate(sniroSchedule.getFinishTime(), "finishTime"); DateTime startTime = convertDate(sniroSchedule.getStartTime(), "startTime"); ChangeManagementGroup group = cmGroupDao.findOneBySchedulesIdGroupId(schedule.getUuid(), groupId); if (group == null) { - throw new CMSException(Status.PRECONDITION_FAILED, + throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.CHANGE_MANAGEMENT_GROUP_NOT_FOUND, schedule.getScheduleId(), groupId); } group.setStartTimeMillis(startTime.getMillis()); @@ -189,19 +189,19 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen processNode(schedule, group, node, startAndFinishTimeMap); } } - schedule.setStatus(CMSStatusEnum.PendingApproval.toString()); + schedule.setStatus(CmsoStatusEnum.PendingApproval.toString()); } else { debug.debug("scheduleId={0} schedule=null status={1} ", scheduleId, schedule.getOptimizerStatus()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); } - } catch (CMSException e) { + } catch (CmsoException e) { errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerStatus(e.getStatus().toString()); schedule.setOptimizerMessage(e.getLocalizedMessage()); } catch (Exception e) { errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); - schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString()); + schedule.setStatus(CmsoStatusEnum.OptimizationFailed.toString()); schedule.setOptimizerStatus("Exception"); schedule.setOptimizerMessage(e.getLocalizedMessage()); } @@ -216,10 +216,10 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen * @param totalDuration the total duration * @param nodeList the node list * @param startAndFinishTimeMap the start and finish time map - * @throws CMSException the CMS exception + * @throws CmsoException the CMS exception */ public static void makeMap(Long startTime, Long latestInstanceStartTime, int concurrencyLimit, long totalDuration, - List<String> nodeList, Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException { + List<String> nodeList, Map<String, Map<String, Long>> startAndFinishTimeMap) throws CmsoException { Long nextStartTime = null; Long nextFinishTime = null; for (int nodeNumber = 0; nodeNumber < nodeList.size(); nodeNumber++) { @@ -231,7 +231,7 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen nextStartTime = nextStartTime + totalDuration; } if (nextStartTime > latestInstanceStartTime) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_ALLOCATE_VNF_TIMESLOTS, + throw new CmsoException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_ALLOCATE_VNF_TIMESLOTS, startTime.toString(), latestInstanceStartTime.toString(), String.valueOf(totalDuration), String.valueOf(concurrencyLimit), String.valueOf(nodeList.size())); } @@ -247,17 +247,17 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen } private void processNode(Schedule schedule, ChangeManagementGroup group, String node, - Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException { + Map<String, Map<String, Long>> startAndFinishTimeMap) throws CmsoException { Map<String, Long> map = startAndFinishTimeMap.get(node); ChangeManagementSchedule detail = cmScheduleDao.findOneByGroupUuidAndVnfName(group.getUuid(), node); if (detail == null) { - throw new CMSException(Status.NOT_FOUND, LogMessages.UNABLE_TO_LOCATE_SCHEDULE_DETAIL, + throw new CmsoException(Status.NOT_FOUND, LogMessages.UNABLE_TO_LOCATE_SCHEDULE_DETAIL, schedule.getScheduleId(), group.getGroupId(), node); } detail.setStartTimeMillis(map.get("startTime")); detail.setFinishTimeMillis(map.get("finishTime")); detail.setVnfId(""); - detail.setStatus(CMSStatusEnum.PendingApproval.toString()); + detail.setStatus(CmsoStatusEnum.PendingApproval.toString()); cmScheduleDao.save(detail); } @@ -267,9 +267,9 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen * @param utcDate the utc date * @param attrName the attr name * @return the date time - * @throws CMSException the CMS exception + * @throws CmsoException the CMS exception */ - public static DateTime convertDate(String utcDate, String attrName) throws CMSException { + public static DateTime convertDate(String utcDate, String attrName) throws CmsoException { try { DateTime dateTime = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC().parseDateTime(utcDate); if (dateTime != null) { @@ -278,7 +278,7 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen } catch (Exception e) { debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); } - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate); } /** @@ -287,9 +287,9 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen * @param utcDate the utc date * @param attrName the attr name * @return the date time - * @throws CMSException the CMS exception + * @throws CmsoException the CMS exception */ - public static DateTime convertIsoDate(String utcDate, String attrName) throws CMSException { + public static DateTime convertIsoDate(String utcDate, String attrName) throws CmsoException { try { DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate); if (dateTime != null) { @@ -298,7 +298,7 @@ public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen } catch (Exception e) { debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); } - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate); } } diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoService.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoService.java index d9b338e..bf28b1c 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoService.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoService.java @@ -49,7 +49,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; import org.onap.optf.cmso.model.Schedule; import org.onap.optf.cmso.service.rs.models.ApprovalMessage; import org.onap.optf.cmso.service.rs.models.CmDetailsMessage; @@ -66,7 +66,7 @@ public interface CmsoService { @ApiOperation(value = "", notes = "Returns a list of Scheduler Requests based upon the filter criteria.", response = Schedule.class, responseContainer = "List") @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 404, message = "No records found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No records found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response searchScheduleRequests( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @@ -92,7 +92,7 @@ public interface CmsoService { @ApiResponses( value = {@ApiResponse(code = 202, message = "Schedule request accepted for optimization."), @ApiResponse(code = 409, message = "Schedule request already exists for this schedule id.", - response = CMSRequestError.class), + response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error")}) public Response createScheduleRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @@ -108,7 +108,7 @@ public interface CmsoService { @Produces({MediaType.APPLICATION_JSON}) @ApiOperation(value = "", notes = "Cancels the schedule request for scheduleId") @ApiResponses(value = {@ApiResponse(code = 204, message = "Delete successful"), - @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No record found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error")}) public Response deleteScheduleRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @@ -153,7 +153,7 @@ public interface CmsoService { @ApiOperation(value = "", notes = "Returns a list of Schedule request details based upon the filter criteria.", response = CmDetailsMessage.class, responseContainer = "List") @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 404, message = "No records found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No records found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response searchScheduleRequestDetails( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java index 7ffd606..b9d0b60 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java @@ -49,21 +49,21 @@ import org.joda.time.DateTime; import org.onap.observations.Observation; import org.onap.optf.cmso.common.DomainsEnum; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; -import org.onap.optf.cmso.common.exceptions.CMSNotFoundException; -import org.onap.optf.cmso.eventq.CMSQueueJob; +import org.onap.optf.cmso.common.exceptions.CmsoException; +import org.onap.optf.cmso.common.exceptions.CmsoNotFoundException; +import org.onap.optf.cmso.eventq.CmsoQueueJob; import org.onap.optf.cmso.model.ChangeManagementDetail; import org.onap.optf.cmso.model.ChangeManagementGroup; import org.onap.optf.cmso.model.ChangeManagementSchedule; import org.onap.optf.cmso.model.Schedule; import org.onap.optf.cmso.model.ScheduleQuery; -import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO; -import org.onap.optf.cmso.model.dao.ElementDataDAO; -import org.onap.optf.cmso.model.dao.ScheduleDAO; -import org.onap.optf.cmso.model.dao.ScheduleQueryDAO; +import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDao; +import org.onap.optf.cmso.model.dao.ChangeManagementDetailDao; +import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao; +import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao; +import org.onap.optf.cmso.model.dao.ElementDataDao; +import org.onap.optf.cmso.model.dao.ScheduleDao; +import org.onap.optf.cmso.model.dao.ScheduleQueryDao; import org.onap.optf.cmso.service.rs.models.ApprovalMessage; import org.onap.optf.cmso.service.rs.models.ChangeWindowMessage; import org.onap.optf.cmso.service.rs.models.CmDetailsMessage; @@ -90,31 +90,31 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger(); @Autowired - CMSQueueJob qqJob; + CmsoQueueJob qqJob; @Autowired Environment env; @Autowired - ChangeManagementScheduleDAO cmScheduleDao; + ChangeManagementScheduleDao cmScheduleDao; @Autowired - ChangeManagementGroupDAO cmGroupDao; + ChangeManagementGroupDao cmGroupDao; @Autowired - ChangeManagementChangeWindowDAO cmChangeWindowDao; + ChangeManagementChangeWindowDao cmChangeWindowDao; @Autowired - ChangeManagementDetailDAO cmDetailsDao; + ChangeManagementDetailDao cmDetailsDao; @Autowired - ScheduleQueryDAO scheduleQueryDao; + ScheduleQueryDao scheduleQueryDao; @Autowired - ScheduleDAO scheduleDao; + ScheduleDao scheduleDao; @Autowired - ElementDataDAO elementDataDao; + ElementDataDao elementDataDao; @Autowired TmClient tmClient; @@ -139,7 +139,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { // buildWhere(qp, where); List<ScheduleQuery> list = scheduleQueryDao.searchSchedules(where.toString(), maxRows); if (list == null || !list.iterator().hasNext()) { - throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, + throw new CmsoException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, DomainsEnum.ChangeManagement.toString(), scheduleId); } Iterator<ScheduleQuery> iter = list.iterator(); @@ -159,7 +159,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { } } response = Response.ok(schedules.toArray(new Schedule[schedules.size()])).build(); - } catch (CMSException e) { + } catch (CmsoException e) { Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); } catch (Exception e) { @@ -183,7 +183,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { OptimizedScheduleMessage osm = adaptScheduleMessage(scheduleMessage); createSchedule(osm, scheduleId, request); response = Response.accepted().build(); - } catch (CMSException e) { + } catch (CmsoException e) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); @@ -198,7 +198,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { } private OptimizedScheduleMessage adaptScheduleMessage(CmsoMessage sm) - throws CMSException, JsonParseException, JsonMappingException, IOException { + throws CmsoException, JsonParseException, JsonMappingException, IOException { OptimizedScheduleMessage osm = new OptimizedScheduleMessage(); osm.setScheduleId(sm.getScheduleId()); osm.setDomain(sm.getDomain()); @@ -220,7 +220,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { osm.setCommonData(dd); CmsoInfo sinfo = sm.getSchedulingInfo(); if (sinfo == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "schedulingInfo"); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "schedulingInfo"); } SchedulingData sd = new SchedulingData(); osm.setSchedulingData(sd); @@ -236,7 +236,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { List<VnfDetailsMessage> details = sinfo.getVnfDetails(); if (details == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "vnfDetails"); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "vnfDetails"); } List<ChangeWindow> windows = new ArrayList<>(); List<ElementInfo> elements = new ArrayList<>(); @@ -265,7 +265,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { } private Object getRequestFromCallbackData(String node, String value) - throws CMSException, JsonParseException, JsonMappingException, IOException { + throws CmsoException, JsonParseException, JsonMappingException, IOException { ObjectMapper om = new ObjectMapper(); JsonNode json = om.readValue(value, JsonNode.class); JsonNode details = json.get("requestDetails"); @@ -277,7 +277,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { return request; } } - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "CallbackData", ""); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "CallbackData", ""); } @Override @@ -288,12 +288,12 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { try { Schedule schedule = scheduleDao.findByDomainScheduleId(DomainsEnum.ChangeManagement.toString(), scheduleId); if (schedule == null) { - throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(), scheduleId); + throw new CmsoNotFoundException(DomainsEnum.ChangeManagement.toString(), scheduleId); } deleteChangeManagement(schedule); deleteScheduleRequest(DomainsEnum.ChangeManagement.toString(), scheduleId); response = Response.noContent().build(); - } catch (CMSException e) { + } catch (CmsoException e) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); @@ -315,11 +315,11 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { try { schedule = scheduleDao.findByDomainScheduleId(DomainsEnum.ChangeManagement.toString(), scheduleId); if (schedule == null) { - throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, + throw new CmsoException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, DomainsEnum.ChangeManagement.toString(), scheduleId); } response = Response.ok().entity(schedule).build(); - } catch (CMSException e) { + } catch (CmsoException e) { Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); } catch (Exception e) { @@ -342,11 +342,11 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { String domain = DomainsEnum.ChangeManagement.toString(); Schedule sch = scheduleDao.findByDomainScheduleId(domain, scheduleId); if (sch == null) { - throw new CMSNotFoundException(domain, scheduleId); + throw new CmsoNotFoundException(domain, scheduleId); } processApproveScheduleRequest(sch, approval, sch.getDomainData()); response = Response.noContent().build(); - } catch (CMSException e) { + } catch (CmsoException e) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); @@ -388,7 +388,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { buildWhere(qp, where); List<ChangeManagementDetail> list = cmDetailsDao.searchScheduleDetails(where.toString(), maxRows); if (list == null || !list.iterator().hasNext()) { - throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, + throw new CmsoException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, DomainsEnum.ChangeManagement.toString(), scheduleId); } Iterator<ChangeManagementDetail> iter = list.iterator(); @@ -399,7 +399,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { schedules.add(msg); } response = Response.ok(schedules.toArray(new CmDetailsMessage[schedules.size()])).build(); - } catch (CMSException e) { + } catch (CmsoException e) { Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage()); response = Response.status(e.getStatus()).entity(e.getRequestError()).build(); } catch (Exception e) { @@ -411,7 +411,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { return response; } - private void buildWhere(MultivaluedMap<String, String> qp, StringBuilder where) throws CMSException { + private void buildWhere(MultivaluedMap<String, String> qp, StringBuilder where) throws CmsoException { String delim = " where "; for (String urlName : qp.keySet()) { List<String> values = qp.get(urlName); diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CommonServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CommonServiceImpl.java index 750d0a7..e4dec7c 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CommonServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CommonServiceImpl.java @@ -39,24 +39,24 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response.Status; import org.onap.optf.cmso.common.ApprovalStatusEnum; import org.onap.optf.cmso.common.ApprovalTypesEnum; -import org.onap.optf.cmso.common.CMSStatusEnum; +import org.onap.optf.cmso.common.CmsoStatusEnum; import org.onap.optf.cmso.common.DomainsEnum; import org.onap.optf.cmso.common.LogMessages; -import org.onap.optf.cmso.common.exceptions.CMSException; -import org.onap.optf.cmso.eventq.CMSQueueJob; +import org.onap.optf.cmso.common.exceptions.CmsoException; +import org.onap.optf.cmso.eventq.CmsoQueueJob; import org.onap.optf.cmso.model.ChangeManagementChangeWindow; import org.onap.optf.cmso.model.ChangeManagementGroup; import org.onap.optf.cmso.model.ChangeManagementSchedule; import org.onap.optf.cmso.model.DomainData; import org.onap.optf.cmso.model.ElementData; import org.onap.optf.cmso.model.Schedule; -import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO; -import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO; -import org.onap.optf.cmso.model.dao.ElementDataDAO; -import org.onap.optf.cmso.model.dao.ScheduleDAO; -import org.onap.optf.cmso.model.dao.ScheduleQueryDAO; +import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDao; +import org.onap.optf.cmso.model.dao.ChangeManagementDetailDao; +import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao; +import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao; +import org.onap.optf.cmso.model.dao.ElementDataDao; +import org.onap.optf.cmso.model.dao.ScheduleDao; +import org.onap.optf.cmso.model.dao.ScheduleQueryDao; import org.onap.optf.cmso.service.rs.models.ApprovalMessage; import org.onap.optf.cmso.service.rs.models.v2.ChangeWindow; import org.onap.optf.cmso.service.rs.models.v2.ElementInfo; @@ -75,31 +75,31 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger(); @Autowired - CMSQueueJob qqJob; + CmsoQueueJob qqJob; @Autowired Environment env; @Autowired - ChangeManagementScheduleDAO cmScheduleDao; + ChangeManagementScheduleDao cmScheduleDao; @Autowired - ChangeManagementGroupDAO cmGroupDao; + ChangeManagementGroupDao cmGroupDao; @Autowired - ChangeManagementChangeWindowDAO cmChangeWindowDao; + ChangeManagementChangeWindowDao cmChangeWindowDao; @Autowired - ChangeManagementDetailDAO cmDetailsDao; + ChangeManagementDetailDao cmDetailsDao; @Autowired - ScheduleQueryDAO scheduleQueryDao; + ScheduleQueryDao scheduleQueryDao; @Autowired - ScheduleDAO scheduleDao; + ScheduleDao scheduleDao; @Autowired - ElementDataDAO elementDataDao; + ElementDataDao elementDataDao; @Autowired TmClient tmClient; @@ -109,13 +109,13 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { protected void createSchedule(OptimizedScheduleMessage scheduleMessage, String scheduleId, - HttpServletRequest request) throws CMSException, JsonProcessingException { + HttpServletRequest request) throws CmsoException, JsonProcessingException { if (!scheduleMessage.getDomain().equals(DomainsEnum.ChangeManagement.toString())) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "domain", + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "domain", scheduleMessage.getDomain()); } if (scheduleMessage.getScheduleId() == null || !scheduleMessage.getScheduleId().equals(scheduleId)) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "schedulerId", + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "schedulerId", scheduleMessage.getScheduleId()); } // Force the name to be = to the ID because there is no way fot the provide a @@ -145,56 +145,56 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { * Returns whether this is an immediate request. */ private boolean validate(OptimizedScheduleMessage scheduleMessage, Map<String, List<ElementInfo>> groups) - throws CMSException { + throws CmsoException { SchedulingData info = scheduleMessage.getSchedulingData(); boolean immediate = true; if (info == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_PARSE_SCHEDULING_INFO); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_PARSE_SCHEDULING_INFO); } if (info.getAdditionalDurationInSeconds() == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "additionalDurationInSeconds"); } if (info.getNormalDurationInSeconds() == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "normalDurationInSeconds"); } if (info.getAdditionalDurationInSeconds() < 0) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "additionalDurationInSeconds", + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "additionalDurationInSeconds", info.getAdditionalDurationInSeconds().toString()); } if (info.getNormalDurationInSeconds() < 1) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "normalDurationInSeconds", + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "normalDurationInSeconds", info.getNormalDurationInSeconds().toString()); } if (info.getChangeWindows() != null && info.getChangeWindows().size() > 0) { for (ChangeWindow cw : info.getChangeWindows()) { immediate = false; if (cw.getStartTime() == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "startTime"); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "startTime"); } if (cw.getEndTime() == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "endTime"); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "endTime"); } Date start = cw.getStartTime(); Date end = cw.getEndTime(); if (!end.after(start)) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_CHANGE_WINDOW, start.toString(), + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_CHANGE_WINDOW, start.toString(), end.toString()); } } if (info.getConcurrencyLimit() == null) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "concurrencyLimit"); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "concurrencyLimit"); } if (info.getConcurrencyLimit() < 1) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "concurrencyLimit", + throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "concurrencyLimit", info.getConcurrencyLimit().toString()); } } if (info.getElements() == null || info.getElements().size() == 0) { - throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "elements"); + throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "elements"); } for (ElementInfo element : info.getElements()) { @@ -213,7 +213,7 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { } private void createChangeManagement(Schedule schedule, OptimizedScheduleMessage scheduleMessage, - Map<String, List<ElementInfo>> groups) throws CMSException { + Map<String, List<ElementInfo>> groups) throws CmsoException { SchedulingData schedulingInfo = scheduleMessage.getSchedulingData(); for (String groupId : groups.keySet()) { @@ -240,7 +240,7 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { cms.setUuid(UUID.randomUUID()); cms.setChangeManagementGroupUuid(cmg.getUuid()); cms.setVnfName(element.getElementId()); - cms.setStatus(CMSStatusEnum.PendingSchedule.toString()); + cms.setStatus(CmsoStatusEnum.PendingSchedule.toString()); cms.setRequest(element.getRequest().toString()); cmScheduleDao.save(cms); // Save elementData @@ -266,7 +266,7 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { } private void createChangeManagementImmediate(Schedule schedule, OptimizedScheduleMessage scheduleMessage, - Map<String, List<ElementInfo>> groups) throws CMSException, JsonProcessingException { + Map<String, List<ElementInfo>> groups) throws CmsoException, JsonProcessingException { SchedulingData schedulingInfo = scheduleMessage.getSchedulingData(); for (String groupId : groups.keySet()) { ChangeManagementGroup cmg = new ChangeManagementGroup(); @@ -286,33 +286,33 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { cms.setChangeManagementGroupUuid(cmg.getUuid()); cms.setVnfName(element.getElementId()); cms.setRequest(element.getRequest().toString()); - cms.setStatus(CMSStatusEnum.PendingApproval.toString()); + cms.setStatus(CmsoStatusEnum.PendingApproval.toString()); cmScheduleDao.save(cms); } - schedule.setStatus(CMSStatusEnum.PendingApproval.toString()); + schedule.setStatus(CmsoStatusEnum.PendingApproval.toString()); scheduleDao.save(schedule); } } - protected void deleteChangeManagement(Schedule schedule) throws CMSException { + protected void deleteChangeManagement(Schedule schedule) throws CmsoException { List<ChangeManagementGroup> cmgs = cmGroupDao.findBySchedulesId(schedule.getUuid()); for (ChangeManagementGroup cmg : cmgs) { List<ChangeManagementSchedule> schedules = cmScheduleDao.findByChangeManagementGroupId(cmg.getUuid()); for (ChangeManagementSchedule s : schedules) { - CMSStatusEnum currentState = CMSStatusEnum.Completed.fromString(s.getStatus()); + CmsoStatusEnum currentState = CmsoStatusEnum.Completed.fromString(s.getStatus()); switch (currentState) { case Scheduled: if (s.getTmChangeId() != null && !s.getTmChangeId().equals("")) { tmClient.cancelTicket(schedule, s, s.getTmChangeId()); } - s.setStatus(CMSStatusEnum.Cancelled.toString()); + s.setStatus(CmsoStatusEnum.Cancelled.toString()); break; case Triggered: // Too late... break; default: - s.setStatus(CMSStatusEnum.Deleted.toString()); + s.setStatus(CmsoStatusEnum.Deleted.toString()); } cmScheduleDao.save(s); } @@ -324,7 +324,7 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { // Marshall commonData into DB DomainData // No validation. // - private List<DomainData> marshallDomainData(OptimizedScheduleMessage scheduleMessage) throws CMSException { + private List<DomainData> marshallDomainData(OptimizedScheduleMessage scheduleMessage) throws CmsoException { List<NameValue> domainData = scheduleMessage.getCommonData(); List<DomainData> domainDataList = new ArrayList<DomainData>(); for (NameValue nameValue : domainData) { @@ -341,19 +341,19 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { protected void processApproveScheduleRequest(Schedule sch, ApprovalMessage approval, List<DomainData> domainData) - throws CMSException { + throws CmsoException { sch = scheduleDao.lockOne(sch.getUuid()); String domain = DomainsEnum.ChangeManagement.toString(); processApproval(sch, domain, approval); - if (sch.getStatus().equals(CMSStatusEnum.Accepted.toString())) { + if (sch.getStatus().equals(CmsoStatusEnum.Accepted.toString())) { openTickets(sch, domainData); } - if (sch.getStatus().equals(CMSStatusEnum.Rejected.toString())) { - updateChangeManagementSchedules(sch, CMSStatusEnum.ApprovalRejected); + if (sch.getStatus().equals(CmsoStatusEnum.Rejected.toString())) { + updateChangeManagementSchedules(sch, CmsoStatusEnum.ApprovalRejected); } } - private void openTickets(Schedule sch, List<DomainData> domainData) throws CMSException { + private void openTickets(Schedule sch, List<DomainData> domainData) throws CmsoException { debug.debug("Entered openTickets scheduleId=" + sch.getScheduleId()); Integer maxvnfsperticket = env.getProperty("tm.vnfs.per.ticket", Integer.class, 1); @@ -379,7 +379,7 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { } private void openTicketForList(Schedule schedule, ChangeManagementGroup group, List<ChangeManagementSchedule> list, - List<DomainData> domainData) throws CMSException { + List<DomainData> domainData) throws CmsoException { List<String> vnfNames = new ArrayList<>(); for (ChangeManagementSchedule cms : list) { vnfNames.add(cms.getVnfName()); @@ -396,18 +396,18 @@ public class CommonServiceImpl extends BaseSchedulerServiceImpl { cms.setTmApprovalStatus(TmApprovalStatusEnum.Approved.toString()); // cms.setStatus(CMSStatusEnum.PendingApproval.toString()); if (cms.getStartTimeMillis() == null) { - cms.setStatus(CMSStatusEnum.ScheduledImmediate.toString()); + cms.setStatus(CmsoStatusEnum.ScheduledImmediate.toString()); } else { - cms.setStatus(CMSStatusEnum.Scheduled.toString()); + cms.setStatus(CmsoStatusEnum.Scheduled.toString()); } cmScheduleDao.save(cms); } - schedule.setStatus(CMSStatusEnum.Scheduled.toString()); + schedule.setStatus(CmsoStatusEnum.Scheduled.toString()); scheduleDao.save(schedule); } - private void updateChangeManagementSchedules(Schedule sch, CMSStatusEnum approvalrejected) { + private void updateChangeManagementSchedules(Schedule sch, CmsoStatusEnum approvalrejected) { debug.debug("Entered updateChangeManagementSchedules"); List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesId(sch.getUuid()); for (ChangeManagementGroup group : groups) { diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java index 79094d3..c6728fd 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java @@ -37,7 +37,7 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import org.onap.optf.cmso.model.dao.ApprovalTypeDAO;
+import org.onap.optf.cmso.model.dao.ApprovalTypeDao;
import org.onap.optf.cmso.optimizer.CmsoOptimizerClient;
import org.onap.optf.cmso.service.rs.models.HealthCheckComponent;
import org.onap.optf.cmso.service.rs.models.HealthCheckMessage;
@@ -69,7 +69,7 @@ public class HealthCheckImpl implements HealthCheck { CmsoOptimizerClient optimizerClient;
@Autowired
- ApprovalTypeDAO approvalTypeDao;
+ ApprovalTypeDao approvalTypeDao;
@Autowired
Environment env;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java deleted file mode 100644 index d39798f..0000000 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java +++ /dev/null @@ -1,121 +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.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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.optf.cmso.service.rs.models;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * The persistent class for the approval_types database table.
- *
- */
-@ApiModel(value = "Change Management Scheduling Info", description = "Details of schedule being requested")
-public class CMSInfo implements Serializable {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CMSInfo.class);
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "Expected duration (in seconds) of a successful execution of a single VNF change.")
- private Integer normalDurationInSeconds;
-
- @ApiModelProperty(
- value = "Additional duration (in seconds) to be added to support backout of an unsuccessful VNF change.")
- private Integer additionalDurationInSeconds;
-
- @ApiModelProperty(value = "Maximum number of VNF changes to schedule concurrently")
- private Integer concurrencyLimit;
-
- @ApiModelProperty(
- value = "Name of schedule optimization policy used by the"
- + " change management cmso optimizer to determine available time slot")
- private String policyId;
-
- @ApiModelProperty(value = "Lists of the VNFs to be changed and the desired change windows")
- private List<VnfDetailsMessage> vnfDetails;
-
- @Override
- public String toString() {
- ObjectMapper mapper = new ObjectMapper();
- try {
- return mapper.writeValueAsString(this);
- } catch (JsonProcessingException e) {
- log.debug("Error in toString()", e);
- }
- return "";
- }
-
- public Integer getNormalDurationInSeconds() {
- return normalDurationInSeconds;
- }
-
- public void setNormalDurationInSeconds(Integer normalDurationInSeconds) {
- this.normalDurationInSeconds = normalDurationInSeconds;
- }
-
- public Integer getAdditionalDurationInSeconds() {
- return additionalDurationInSeconds;
- }
-
- public void setAdditionalDurationInSeconds(Integer additionalDurationInSeconds) {
- this.additionalDurationInSeconds = additionalDurationInSeconds;
- }
-
- public Integer getConcurrencyLimit() {
- return concurrencyLimit;
- }
-
- public void setConcurrencyLimit(Integer concurrencyLimit) {
- this.concurrencyLimit = concurrencyLimit;
- }
-
- public String getPolicyId() {
- return policyId;
- }
-
- public void setPolicyId(String policyId) {
- this.policyId = policyId;
- }
-
- public List<VnfDetailsMessage> getVnfDetails() {
- return vnfDetails;
- }
-
- public void setVnfDetails(List<VnfDetailsMessage> vnfDetails) {
- this.vnfDetails = vnfDetails;
- }
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java deleted file mode 100644 index 9e236e2..0000000 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java +++ /dev/null @@ -1,73 +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.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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.optf.cmso.service.rs.models;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.ApiModel;
-import java.io.Serializable;
-import org.onap.optf.cmso.common.LogMessages;
-
-/**
- * The persistent class for the approval_types database table.
- *
- */
-@ApiModel
-public class CMSMessage extends ScheduleMessage implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
- private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
-
- private CMSInfo schedulingInfo;
-
- @Override
- public CMSInfo getSchedulingInfo() {
- // TODO Auto-generated method stub
- return schedulingInfo;
- }
-
- @Override
- public void setSchedulingInfo(Object info) {
- ObjectMapper mapper = new ObjectMapper();
- try {
- String jsonString = mapper.writeValueAsString(info);
- schedulingInfo = mapper.readValue(jsonString, CMSInfo.class);
- } catch (Exception e) {
- debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- }
-
- }
-
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java index e760b85..a5960f5 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java @@ -44,14 +44,14 @@ import javax.ws.rs.core.Response; import org.onap.observations.Mdc;
import org.onap.observations.Observation;
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.onap.optf.cmso.service.rs.models.HealthCheckComponent;
import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse;
import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse.MsoStatus;
@@ -66,13 +66,13 @@ public class MsoStatusClient { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupdao;
+ ChangeManagementGroupDao cmGroupdao;
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
Environment env;
@@ -146,18 +146,18 @@ public class MsoStatusClient { switch (msoStatus) {
case COMPLETE:
cmSchedule.setExecutionCompletedTimeMillis(finishTime);
- cmSchedule.setStatus(CMSStatusEnum.Completed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Completed.toString());
break;
case FAILED:
cmSchedule.setExecutionCompletedTimeMillis(finishTime);
- cmSchedule.setStatus(CMSStatusEnum.Failed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Failed.toString());
break;
case UNKNOWN:
default:
}
} else {
// Do not keep polling...
- cmSchedule.setStatus(CMSStatusEnum.Error.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Error.toString());
cmSchedule.setMsoStatus("Bad Response");
cmSchedule.setMsoMessage("Unable to parse :" + respString);
@@ -167,21 +167,21 @@ public class MsoStatusClient { break;
case 404: { // Not found
// Do not keep polling...
- cmSchedule.setStatus(CMSStatusEnum.Failed.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Failed.toString());
cmSchedule.setMsoStatus("Not found");
cmSchedule.setMsoMessage("Call to MSO Failed :" + response.toString());
}
break;
case 400: { // Bad request
// Do not keep polling...
- cmSchedule.setStatus(CMSStatusEnum.Error.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Error.toString());
cmSchedule.setMsoStatus("Bad Request");
cmSchedule.setMsoMessage("Call to MSO Failed :" + response.toString());
}
break;
case 500:
default: {
- cmSchedule.setStatus(CMSStatusEnum.Error.toString());
+ cmSchedule.setStatus(CmsoStatusEnum.Error.toString());
cmSchedule.setMsoStatus("Failed");
cmSchedule.setMsoMessage("Call to MSO Failed :" + response.toString());
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java index 0a4c2f2..bfb7bb6 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java @@ -32,7 +32,7 @@ import java.util.UUID; import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -57,7 +57,7 @@ public class MsoStatusJob implements Job { MsoStatusClient mso;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
Environment env;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java index 9eacfd1..3de62e0 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java @@ -51,8 +51,8 @@ import org.onap.optf.cmso.common.PropertiesManagement; import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -73,10 +73,10 @@ public class ScheduleStatusJob implements Job { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
PropertiesManagement pm;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java index c8cae12..1864da7 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java @@ -56,13 +56,13 @@ import org.onap.optf.cmso.common.BasicAuthenticatorFilter; import org.onap.optf.cmso.common.CmHelpers;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
-import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.onap.optf.cmso.common.exceptions.CmsoException;
import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.ChangeManagementGroup;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.DomainData;
import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
import org.onap.optf.cmso.service.rs.models.CmDomainDataEnum;
import org.onap.optf.cmso.service.rs.models.HealthCheckComponent;
import org.onap.optf.cmso.ticketmgt.TmEndpoints.Endpoint;
@@ -89,7 +89,7 @@ public class TmClient { PropertiesManagement pm;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
BuildCreateRequest buildCreateRequest;
@@ -105,10 +105,10 @@ public class TmClient { * @param vnfNames the vnf names
* @param domainData the domain data
* @return the string
- * @throws CMSException the CMS exception
+ * @throws CmsoException the CMS exception
*/
public String createChangeTicket(Schedule schedule, ChangeManagementGroup group, List<String> vnfNames,
- List<DomainData> domainData) throws CMSException {
+ List<DomainData> domainData) throws CmsoException {
String changeId = "";
String workflowName = CmHelpers.getDomainData(domainData, CmDomainDataEnum.WorkflowName);
@@ -129,10 +129,10 @@ public class TmClient { * @param changeId the change id
* @param closureCode the closure code
* @param closingComments the closing comments
- * @throws CMSException the CMS exception
+ * @throws CmsoException the CMS exception
*/
public void closeTicket(Schedule schedule, ChangeManagementGroup group, List<ChangeManagementSchedule> cmSchedules,
- String changeId, ClosureCode closureCode, String closingComments) throws CMSException {
+ String changeId, ClosureCode closureCode, String closingComments) throws CmsoException {
Map<String, Object> variables =
getCloseVariables(schedule, group, cmSchedules, changeId, closureCode, closingComments);
JsonNode closeChangeRecord = buildCreateRequest.createCloseCancelChangeRecord(variables);
@@ -146,9 +146,9 @@ public class TmClient { * @param schedule the schedule
* @param cms the cms
* @param changeId the change id
- * @throws CMSException the CMS exception
+ * @throws CmsoException the CMS exception
*/
- public void cancelTicket(Schedule schedule, ChangeManagementSchedule cms, String changeId) throws CMSException {
+ public void cancelTicket(Schedule schedule, ChangeManagementSchedule cms, String changeId) throws CmsoException {
Map<String, Object> variables = getCancelVariables(schedule, changeId);
JsonNode cancelChangeRecord = buildCreateRequest.createCancelChangeRecord(variables);
debug.debug("cancelChangeRecord=" + cancelChangeRecord.toString());
@@ -161,9 +161,9 @@ public class TmClient { * @param schedule the schedule
* @param cms the cms
* @param changeId the change id
- * @throws CMSException the CMS exception
+ * @throws CmsoException the CMS exception
*/
- public void updateTicket(Schedule schedule, ChangeManagementSchedule cms, String changeId) throws CMSException {
+ public void updateTicket(Schedule schedule, ChangeManagementSchedule cms, String changeId) throws CmsoException {
Map<String, Object> variables = getUpdateVariables(schedule, changeId);
JsonNode updateChangeRecord = buildCreateRequest.createUpdateChangeRecord(variables);
debug.debug("updateChangeRecord=" + updateChangeRecord.toString());
@@ -269,7 +269,7 @@ public class TmClient { }
private void postCloseChangeTicket(JsonNode closeChangeRecord, String scheduleId, String changeId)
- throws CMSException {
+ throws CmsoException {
Map<String, String> mdcSave = Mdc.save();
try {
Response response = null;
@@ -290,7 +290,7 @@ public class TmClient { if (!isAlreadyClosed(respString)) {
Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),
response.toString() + " : " + respString);
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET,
+ throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET,
scheduleId, changeId, respString);
}
}
@@ -299,13 +299,13 @@ public class TmClient { String message = response.readEntity(String.class);
Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),
response.toString() + " : " + message);
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET,
+ throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET,
scheduleId, changeId, message);
}
}
} catch (ProcessingException e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET, scheduleId,
+ throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET, scheduleId,
changeId, e.toString());
} finally {
Mdc.restore(mdcSave);
@@ -411,7 +411,7 @@ public class TmClient { }
- private String postCreateChangeTicket(JsonNode createChangeRecord, String scheduleId) throws CMSException {
+ private String postCreateChangeTicket(JsonNode createChangeRecord, String scheduleId) throws CmsoException {
String changeId = null;
Map<String, String> mdcSave = Mdc.save();
try {
@@ -435,7 +435,7 @@ public class TmClient { } else {
Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),
response.toString() + " : " + "Response is empty");
- throw new CMSException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
+ throw new CmsoException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
scheduleId, "Response is empty");
}
}
@@ -444,13 +444,13 @@ public class TmClient { String message = response.readEntity(String.class);
Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),
response.toString() + " : " + message);
- throw new CMSException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
+ throw new CmsoException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
scheduleId, message);
}
}
} catch (ProcessingException e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- throw new CMSException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET, scheduleId,
+ throw new CmsoException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET, scheduleId,
e.toString());
} finally {
Mdc.restore(mdcSave);
@@ -459,7 +459,7 @@ public class TmClient { }
private String postUpdateChangeTicket(JsonNode updateChangeRecord, String scheduleId, String changeId)
- throws CMSException {
+ throws CmsoException {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("vtm.url") + env.getProperty("vtm.updatePath");
@@ -480,13 +480,13 @@ public class TmClient { String message = response.readEntity(String.class);
Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),
response.toString() + " : " + message);
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_UPDATE_CHANGE_TICKET,
+ throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_UPDATE_CHANGE_TICKET,
scheduleId, changeId, message);
}
}
} catch (ProcessingException e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_UPDATE_CHANGE_TICKET, scheduleId,
+ throw new CmsoException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_UPDATE_CHANGE_TICKET, scheduleId,
changeId, e.toString());
} finally {
Mdc.restore(mdcSave);
@@ -495,7 +495,7 @@ public class TmClient { }
- private Response tmPost(Endpoint ep, Object request, String scheduleId) throws CMSException {
+ private Response tmPost(Endpoint ep, Object request, String scheduleId) throws CmsoException {
Response response = null;
List<String> endpoints = new ArrayList<>();
String url = tmEndpoints.getEndpoint(ep, endpoints);
@@ -525,12 +525,12 @@ public class TmClient { Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());
url = tmEndpoints.getNextEndpoint(ep, endpoints);
if (url == null || !tryNextUrl(e)) {
- throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
scheduleId, e.getMessage());
}
} catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());
- throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,
scheduleId, e.getMessage());
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java index a7ae5ed..4ace561 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java @@ -37,15 +37,15 @@ import java.util.Map; import java.util.Set;
import java.util.UUID;
import javax.transaction.Transactional;
-import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.CmsoStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
-import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.onap.optf.cmso.common.exceptions.CmsoException;
import org.onap.optf.cmso.model.ChangeManagementGroup;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDao;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDao;
+import org.onap.optf.cmso.model.dao.ScheduleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -80,13 +80,13 @@ public class TmStatusClient { Environment env;
@Autowired
- ScheduleDAO scheduleDao;
+ ScheduleDao scheduleDao;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDao;
+ ChangeManagementScheduleDao cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDao;
+ ChangeManagementGroupDao cmGroupDao;
@Autowired
TmClient tmClient;
@@ -103,8 +103,8 @@ public class TmStatusClient { // Multiple cmso instance support - re-get the record with a Schedule lock
UUID uuid = UUID.fromString(id);
Schedule sch = scheduleDao.lockOne(uuid);
- if (!sch.getStatus().equals(CMSStatusEnum.NotificationsInitiated.toString())) {
- debug.debug(sch.getScheduleId() + " is no longer in " + CMSStatusEnum.NotificationsInitiated.toString()
+ if (!sch.getStatus().equals(CmsoStatusEnum.NotificationsInitiated.toString())) {
+ debug.debug(sch.getScheduleId() + " is no longer in " + CmsoStatusEnum.NotificationsInitiated.toString()
+ " : it is " + sch.getStatus());
// Attempt at avoiding race condition in a load balance env. ?
return;
@@ -135,10 +135,10 @@ public class TmStatusClient { }
//
if (groupStatus.containsKey(GroupAuditStatus.CompletedWithErrors)) {
- sch.setStatus(CMSStatusEnum.CompletedWithError.toString());
+ sch.setStatus(CmsoStatusEnum.CompletedWithError.toString());
}
if (groupStatus.containsKey(GroupAuditStatus.Completed)) {
- sch.setStatus(CMSStatusEnum.Completed.toString());
+ sch.setStatus(CmsoStatusEnum.Completed.toString());
}
scheduleDao.save(sch);
} catch (Exception e) {
@@ -149,7 +149,7 @@ public class TmStatusClient { }
}
- private void processGroup(Schedule sch, ChangeManagementGroup group) throws CMSException {
+ private void processGroup(Schedule sch, ChangeManagementGroup group) throws CmsoException {
debug.debug("{Processing status of " + sch.getScheduleId() + " group=" + group.getGroupId());
// Get status of all VNFs within a ticket within the group (Tickets will not
// span groups)
@@ -161,7 +161,7 @@ public class TmStatusClient { for (ChangeManagementSchedule cmSchedule : cmSchedules) {
String status = cmSchedule.getStatus();
String tmStatus = cmSchedule.getTmStatus();
- CMSStatusEnum cmsStatus = CMSStatusEnum.Completed.fromString(status);
+ CmsoStatusEnum cmsStatus = CmsoStatusEnum.Completed.fromString(status);
switch (cmsStatus) {
case Scheduled:
case Triggered:
@@ -241,7 +241,7 @@ public class TmStatusClient { allNames.add(vnfName);
String status = cmSchedule.getStatus();
String tmStatus = cmSchedule.getTmStatus();
- CMSStatusEnum cmsStatus = CMSStatusEnum.Completed.fromString(status);
+ CmsoStatusEnum cmsStatus = CmsoStatusEnum.Completed.fromString(status);
switch (cmsStatus) {
case Scheduled:
case Triggered:
@@ -307,7 +307,7 @@ public class TmStatusClient { private void closeTheTicket(Schedule sch, ChangeManagementGroup group, String changeId,
List<ChangeManagementSchedule> list, ClosureCode closureCode, String closingComments)
- throws CMSException {
+ throws CmsoException {
debug.debug("Closing ticket " + changeId + ":" + closureCode);
try {
tmClient.closeTicket(sch, group, list, changeId, closureCode, closingComments);
@@ -315,7 +315,7 @@ public class TmStatusClient { cms.setTmStatus("Closed");
cmScheduleDao.save(cms);
}
- } catch (CMSException e) {
+ } catch (CmsoException e) {
throw e;
}
diff --git a/cmso-ticketmgt/pom.xml b/cmso-ticketmgt/pom.xml index 1274360..88dce59 100644 --- a/cmso-ticketmgt/pom.xml +++ b/cmso-ticketmgt/pom.xml @@ -22,7 +22,7 @@ <version>1.0.1-SNAPSHOT</version> </parent> - <groupId>org.onap.optf.cmso.tcketmgt</groupId> + <groupId>org.onap.optf.cmso.ticketmgt</groupId> <artifactId>cmso-ticketmgt</artifactId> <packaging>jar</packaging> diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java index f140aec..e968728 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java @@ -69,7 +69,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); static { supportedMajorVersions.put("v1", "0"); @@ -77,7 +77,7 @@ public class MessageHeaders { } /** The Constant supportedMajorMinorVersions. */ - public static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); static { supportedMajorMinorVersions.add("v1.0"); @@ -85,10 +85,10 @@ public class MessageHeaders { } /** The Constant latestVersion. */ - public static final String latestVersion = "2.0.0"; + private static final String latestVersion = "2.0.0"; /** The Constant patchVersion. */ - public static final String patchVersion = "0"; + private static final String patchVersion = "0"; /** * From string. @@ -156,4 +156,20 @@ public class MessageHeaders { } return true; } + + public static Map<String, String> getSupportedmajorversions() { + return supportedMajorVersions; + } + + public static Set<String> getSupportedmajorminorversions() { + return supportedMajorMinorVersions; + } + + public static String getLatestversion() { + return latestVersion; + } + + public static String getPatchversion() { + return patchVersion; + } } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java index eb9ddad..2426a5c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java @@ -40,7 +40,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources; -public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor { +public class CmsoEnvironmentPostProcessor implements EnvironmentPostProcessor { // TODO tested in ONAP springboot and this is called before all of the properties files have been // loaded... // perhaps there is a post post processor? Until this works. DB password will be in the clear in the diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java index 4ba7d48..ba28a2d 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java @@ -36,16 +36,16 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; -public class CMSRequestError implements Serializable { +public class CmsoRequestError implements Serializable { private static final long serialVersionUID = 1L; @JsonProperty RequestError requestError; - public CMSRequestError(String messageId, String text, List<String> variables) { + public CmsoRequestError(String messageId, String text, List<String> variables) { requestError = new RequestError(messageId, text, variables); } - public CMSRequestError(String messageId, String text) { + public CmsoRequestError(String messageId, String text) { requestError = new RequestError(messageId, text, new ArrayList<String>()); } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java index e8b5e03..c80cd56 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java @@ -36,12 +36,12 @@ import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response.Status; import org.onap.observations.ObservationInterface; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; -public class CMSException extends Exception { +public class CmsoException extends Exception { private static final long serialVersionUID = 1L; - protected CMSRequestError requestError = null; + protected CmsoRequestError requestError = null; private List<String> variables = new ArrayList<String>(); protected ObservationInterface messageCode; protected Status status; @@ -53,14 +53,14 @@ public class CMSException extends Exception { * @param messageCode the message code * @param args the args */ - public CMSException(Status status, ObservationInterface messageCode, String... args) { + public CmsoException(Status status, ObservationInterface messageCode, String... args) { super(EELFResourceManager.format(messageCode, args)); this.status = status; this.messageCode = messageCode; for (String arg : args) { variables.add(arg); } - requestError = new CMSRequestError(messageCode.name(), getMessage(), variables); + requestError = new CmsoRequestError(messageCode.name(), getMessage(), variables); } public Status getStatus() { @@ -75,7 +75,7 @@ public class CMSException extends Exception { return variables.toArray(new String[variables.size()]); } - public CMSRequestError getRequestError() { + public CmsoRequestError getRequestError() { return requestError; } } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CmsoEnvironmentPostProcessor.java index d955e75..1230591 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CmsoEnvironmentPostProcessor.java @@ -40,7 +40,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources; -public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor { +public class CmsoEnvironmentPostProcessor implements EnvironmentPostProcessor { // TODO tested in ONAP springboot and this is called before all of the properties files have been // loaded... // perhaps there is a post post processor? Until this works. DB password will be in the clear in the diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java index c4fe51a..1cbf19c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java @@ -44,7 +44,7 @@ import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; -import org.onap.optf.ticketmgt.filters.CMSOContainerFilters; +import org.onap.optf.ticketmgt.filters.CmsoContainerFilters; import org.onap.optf.ticketmgt.service.rs.AdminToolImpl; import org.onap.optf.ticketmgt.service.rs.AvailabilityInterfaceImpl; import org.onap.optf.ticketmgt.service.rs.HealthCheckImpl; @@ -91,7 +91,7 @@ public class JerseyConfiguration extends ResourceConfig { // TODO: Examine which logging features to enable register(new LoggingFeature(log)); - register(CMSOContainerFilters.class); + register(CmsoContainerFilters.class); } /** diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java index ffbd94e..ea044a4 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java @@ -26,7 +26,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.ticketmgt.SpringProfiles; import org.onap.optf.ticketmgt.common.LogMessages; import org.springframework.beans.factory.annotation.Value; @@ -69,7 +69,7 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter { if (!request.isUserInRole(permission)) { Observation.report(LogMessages.UNAUTHORIZED); ResponseFormatter.errorResponse(request, response, - new CMSException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); + new CmsoException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); } else { filterChain.doFilter(request, response); } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java index c0c8106..1f27fee 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse; import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.ticketmgt.Application; import org.onap.optf.ticketmgt.SpringProfiles; import org.onap.optf.ticketmgt.common.LogMessages; @@ -67,7 +67,7 @@ public class AafFilter extends OrderedRequestContextFilter { cadiFilter.doFilter(request, response, filterChain); if (response.getStatus() >= 400 && response.getStatus() < 500) { Observation.report(LogMessages.UNAUTHENTICATED); - ResponseFormatter.errorResponse(request, response, new CMSException( + ResponseFormatter.errorResponse(request, response, new CmsoException( LogMessages.UNAUTHENTICATED.getStatus(), LogMessages.UNAUTHENTICATED, "")); } } else { diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java index b9b222c..156b3ce 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java @@ -23,12 +23,12 @@ package org.onap.optf.ticketmgt.aaf; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; class ResponseFormatter { - static void errorResponse(HttpServletRequest request, HttpServletResponse response, CMSException error) + static void errorResponse(HttpServletRequest request, HttpServletResponse response, CmsoException error) throws IOException { response.setStatus(error.getStatus().getStatusCode()); response.getWriter().write(error.getRequestError().toString()); diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoClientFilters.java index 54b1b38..ac1569c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoClientFilters.java @@ -49,7 +49,7 @@ import org.springframework.stereotype.Component; // @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component -public class CMSOClientFilters implements ClientRequestFilter, ClientResponseFilter { +public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFilter { private static String appId = "cmso"; diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoContainerFilters.java index 4f6b8e7..5b73a85 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoContainerFilters.java @@ -55,7 +55,7 @@ import org.springframework.stereotype.Component; @Priority(1) @Provider @Component -public class CMSOContainerFilters implements ContainerRequestFilter, ContainerResponseFilter { +public class CmsoContainerFilters implements ContainerRequestFilter, ContainerResponseFilter { @Context @@ -73,8 +73,8 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders(); String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString()); respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion); - respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestversion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchversion()); } catch (Exception e) { if (e instanceof WebApplicationException) { @@ -115,7 +115,7 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe } String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString()); if (minorVersion == null) { - minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion); + minorVersion = MessageHeaders.getSupportedmajorversions().get(majorVersion); headers.add(HeadersEnum.MinorVersion.toString(), minorVersion); } if (!MessageHeaders.validateMajorMinorVersion(majorVersion, minorVersion)) { diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java index 3360927..df23f7d 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java @@ -45,7 +45,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsRequest; import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsResponse; import org.springframework.web.bind.annotation.PathVariable; @@ -72,7 +72,7 @@ public interface AvailabilityInterface { + "optimizer will begin to poll the request until COMPLETED.", response = ActiveTicketsResponse.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response getActiveTickets( @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable( @@ -92,7 +92,7 @@ public interface AvailabilityInterface { + "receipt of the response.", response = ActiveTicketsResponse.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 404, message = "Not found.", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "Not found.", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response pollActiveTickets( @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable( @@ -111,7 +111,7 @@ public interface AvailabilityInterface { + " treat Not found reponse on as normal.", response = ActiveTicketsResponse.class) @ApiResponses(value = {@ApiResponse(code = 204, message = "OK"), - @ApiResponse(code = 404, message = "Not found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "Not found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response deleteActiveTicketsRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable( diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java index 16346bf..60a517b 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java @@ -47,7 +47,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; import org.onap.optf.ticketmgt.service.rs.models.TicketData; @Api("Ticket Management") @@ -61,7 +61,7 @@ public interface TicketManagement { @ApiOperation(value = "Fetch Ticket", notes = "Returns ticket information for the provided ticket id.", response = TicketData.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No record found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response fetchTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @ApiParam(value = "Unique ticket identifier") @PathParam("id") String id); @@ -74,7 +74,7 @@ public interface TicketManagement { @ApiResponses(value = { @ApiResponse(code = 200, message = "Ticket Created. Ticket Id returned.", response = TicketData.class), - @ApiResponse(code = 400, message = "Bad request.", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request.", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response createTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @ApiParam(value = "Data for creating a ticket") TicketData ticketData); @@ -85,7 +85,7 @@ public interface TicketManagement { @Produces({MediaType.APPLICATION_JSON}) @ApiOperation(value = "Update Ticket", notes = "Updates a ticket to the passed data") @ApiResponses(value = {@ApiResponse(code = 204, message = "Ticket Updated."), - @ApiResponse(code = 400, message = "Bad request.", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request.", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response updateTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @ApiParam(value = "Data for updating a ticket") TicketData ticketData); @@ -96,8 +96,8 @@ public interface TicketManagement { @Produces({MediaType.APPLICATION_JSON}) @ApiOperation(value = "Cancel the ticket", notes = "Cancels the ticket.") @ApiResponses(value = {@ApiResponse(code = 204, message = "Delete successful"), - @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class), - @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No record found", response = CmsoRequestError.class), + @ApiResponse(code = 400, message = "Bad request", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response deleteScheduleRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @@ -113,7 +113,7 @@ public interface TicketManagement { @ApiOperation(value = "Search Tickets", notes = "Returns a list of based upon the filter criteria.", response = TicketData.class, responseContainer = "List") @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response searchTcikets( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, diff --git a/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java index fe6cea2..ccb7e56 100644 --- a/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java @@ -65,7 +65,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); static { supportedMajorVersions.put("v1", "0"); @@ -73,7 +73,7 @@ public class MessageHeaders { } /** The Constant supportedMajorMinorVersions. */ - public static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); static { supportedMajorMinorVersions.add("v1.0"); @@ -81,10 +81,10 @@ public class MessageHeaders { } /** The Constant latestVersion. */ - public static final String latestVersion = "2.0.0"; + private static final String latestVersion = "2.0.0"; /** The Constant patchVersion. */ - public static final String patchVersion = "0"; + private static final String patchVersion = "0"; /** * From string. @@ -152,4 +152,20 @@ public class MessageHeaders { } return true; } + + public static Map<String, String> getSupportedmajorversions() { + return supportedMajorVersions; + } + + public static Set<String> getSupportedmajorminorversions() { + return supportedMajorMinorVersions; + } + + public static String getLatestversion() { + return latestVersion; + } + + public static String getPatchversion() { + return patchVersion; + } } diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoContainerFilters.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoContainerFilters.java index 2418aec..2729613 100644 --- a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoContainerFilters.java +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoContainerFilters.java @@ -68,8 +68,8 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders(); String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString()); respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion); - respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestversion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchVersion()); } catch (Exception e) { if (e instanceof WebApplicationException) { @@ -110,7 +110,7 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe } String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString()); if (minorVersion == null) { - minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion); + minorVersion = MessageHeaders.getSupportedmajorversions().get(majorVersion); headers.add(HeadersEnum.MinorVersion.toString(), minorVersion); } if (!MessageHeaders.validateMajorMinorVersion(majorVersion, minorVersion)) { |