diff options
author | Jerry Flood <jflood@att.com> | 2019-04-19 07:09:34 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-19 10:07:39 -0400 |
commit | 9407eccc5c8347c7c92d2f25590d8867213107aa (patch) | |
tree | cf97b388f99b64bac36e60ac95147fd933380116 | |
parent | ee1816bf02d5f76548b78c46c39537ec8c1d23b0 (diff) |
Rename classes to avoid duplicates
Copy jacoco exec files for upload to sonar
Handle ending midnight in time window
Issue-ID: OPTFRA-474
Change-Id: Id5df25e404a08e039537e4eb987838835ee12f11
Signed-off-by: Jerry Flood <jflood@att.com>
50 files changed, 171 insertions, 189 deletions
diff --git a/cmso-optimizer/data/policies/AllDayEveryDay.json b/cmso-optimizer/data/policies/AllDayEveryDay.json index b2f794d..8a744df 100644 --- a/cmso-optimizer/data/policies/AllDayEveryDay.json +++ b/cmso-optimizer/data/policies/AllDayEveryDay.json @@ -25,7 +25,7 @@ "timeRange": [ { "start_time": "00:00:00+00:00", - "end_time": "23:59:59+00:00" + "end_time": "24:00:00+00:00" } ] }, @@ -34,7 +34,7 @@ "timeRange": [ { "start_time": "00:00:00+00:00", - "end_time": "23:59:59+00:00" + "end_time": "24:00:00+00:00" } ] } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java deleted file mode 100644 index 5f873e3..0000000 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java +++ /dev/null @@ -1,65 +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; - -import java.util.HashMap; -import java.util.Map; -import org.onap.optf.cmso.common.PropertiesManagement; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.env.EnvironmentPostProcessor; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.MutablePropertySources; - -/** - * The Class CMSEnvironmentPostProcessor. - */ -public class CmsoEnvironmentPostProcessor implements EnvironmentPostProcessor { - // 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 - /** - * Post process environment. - * - * @param environment the environment - * @param application the application - */ - // proeprties files. - @Override - public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { - String pwd = environment.getProperty("cmso.database.password"); - if (pwd != null) { - pwd = PropertiesManagement.getDecryptedValue(pwd); - Map<String, Object> map = new HashMap<String, Object>(); - map.put("spring.datasource.password", pwd); - MapPropertySource propertySource = new MapPropertySource("abc", map); - MutablePropertySources proeprtySources = environment.getPropertySources(); - proeprtySources.addLast(propertySource); - } - } - -} diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/CmsoEnvironmentPostProcessor.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/CmsoEnvironmentPostProcessor.java index 5e425d0..bb47567 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/CmsoEnvironmentPostProcessor.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/CmsoEnvironmentPostProcessor.java @@ -28,7 +28,7 @@ package org.onap.optf.cmso.optimizer; import java.util.HashMap; import java.util.Map; -import org.onap.optf.cmso.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.common.PropertiesManagement; import org.springframework.boot.SpringApplication; import org.springframework.boot.env.EnvironmentPostProcessor; import org.springframework.core.env.ConfigurableEnvironment; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafAuthorizationFilter.java index ba9aa6d..230c0a0 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafAuthorizationFilter.java @@ -24,7 +24,7 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import java.io.IOException; import java.util.List; @@ -34,10 +34,10 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.aaf.cadi.CadiWrap; import org.onap.aaf.cadi.Permission; -import org.onap.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.SpringProfiles; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafFilter.java index 246c396..015305a 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafFilter.java @@ -24,7 +24,7 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import java.io.IOException; import java.util.Properties; @@ -34,11 +34,11 @@ import javax.servlet.http.HttpServletRequest; 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.CmsoException; import org.onap.optf.cmso.optimizer.Application; import org.onap.optf.cmso.optimizer.SpringProfiles; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafPerm.java index db58156..f2a95ea 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafPerm.java @@ -24,7 +24,7 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import java.util.HashSet; import java.util.Set; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafSecurityConfig.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafSecurityConfig.java index 38e9af4..1e44433 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafSecurityConfig.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafSecurityConfig.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import org.onap.optf.cmso.optimizer.SpringProfiles; import org.springframework.context.annotation.ComponentScan; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafUserRole.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRole.java index 65decec..859c3ed 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafUserRole.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRole.java @@ -24,7 +24,7 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import java.util.ArrayList; import java.util.List; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafUserRoleProperties.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRoleProperties.java index 171a11f..037c54e 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/AafUserRoleProperties.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRoleProperties.java @@ -24,7 +24,7 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import java.io.File; import java.io.FileInputStream; @@ -35,9 +35,9 @@ import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import org.onap.aaf.cadi.Permission; import org.onap.aaf.cadi.aaf.AAFPermission; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.SpringProfiles; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.core.env.Environment; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/FilterPriority.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/FilterPriority.java index bfafbd8..0b22e99 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/FilterPriority.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/FilterPriority.java @@ -24,7 +24,7 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import org.springframework.core.Ordered; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/ResponseFormatter.java index 518814e..be8656d 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/ResponseFormatter.java @@ -24,12 +24,12 @@ * limitations under the License. ******************************************************************************/ -package org.onap.optf.cmso.aaf; +package org.onap.optf.cmso.optimizer.aaf; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.onap.optf.cmso.common.exceptions.CmsoException; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; class ResponseFormatter { diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java index 58d3355..dcc5e54 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java @@ -25,10 +25,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.availability.policies.model.Policy; import org.onap.optf.cmso.optimizer.availability.policies.model.TimeLimitAndVerticalTopology; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java index 81a848e..b3829c3 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java @@ -37,11 +37,11 @@ import java.util.List; import java.util.Set; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.availability.policies.model.AllowedPeriodicTime; import org.onap.optf.cmso.optimizer.availability.policies.model.TimeLimitAndVerticalTopology; import org.onap.optf.cmso.optimizer.availability.policies.model.TimeRange; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.ChangeWindow; /** @@ -128,7 +128,7 @@ public class RecurringWindows { if (ranges.size() == 0) { TimeRange range = new TimeRange(); range.setStartTime("00:00:00+00:00"); - range.setEndTime("23:59:59+00:00"); + range.setEndTime("24:00:00+00:00"); ranges.add(range); } StringBuilder rdata = new StringBuilder(); @@ -204,6 +204,11 @@ public class RecurringWindows { private static Instant getInstanceFromTime(String timeIn, Instant cwStartInstant) { Instant instant = null; Instant date = cwStartInstant.truncatedTo(ChronoUnit.DAYS); + // Handle ending midnight + if (timeIn.startsWith("24:00:00")) { + timeIn = "00:00:00+00:00"; + date = date.plus(1, ChronoUnit.DAYS); + } LocalDate epoch = LocalDate.ofEpochDay(0); try { OffsetTime offset = OffsetTime.parse(timeIn); diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/ElementAvailability.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/ElementAvailability.java index ac5d2e7..f2193bb 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/ElementAvailability.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/ElementAvailability.java @@ -122,6 +122,7 @@ public class ElementAvailability extends ElementWindowMapping { if (optimizerRequest.getAdditionalDuration() != null) { duration += optimizerRequest.getAdditionalDuration(); } + duration = duration * 1000; for (String elementId : nodeInfo.keySet()) { TopologyElementInfo info = nodeInfo.get(elementId); 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 b42ff9c..88570e8 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 @@ -36,9 +36,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.commons.io.IOUtils; -import org.onap.observations.Observation; -import org.onap.optf.cmso.common.PropertiesManagement; -import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.availability.policies.PolicyManager; import org.onap.optf.cmso.optimizer.availability.policies.model.TimeLimitAndVerticalTopology; import org.onap.optf.cmso.optimizer.clients.optimizer.models.OptimizerEngineResponse; @@ -51,12 +48,15 @@ import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsRespon import org.onap.optf.cmso.optimizer.clients.topology.TopologyRequestManager; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.model.Optimizer; import org.onap.optf.cmso.optimizer.model.Request; import org.onap.optf.cmso.optimizer.model.Ticket; import org.onap.optf.cmso.optimizer.model.Topology; import org.onap.optf.cmso.optimizer.model.dao.OptimizerDao; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; import org.onap.optf.cmso.optimizer.service.rs.models.PolicyInfo; import org.springframework.beans.factory.annotation.Autowired; 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 cfe23ba..e3a4ef8 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 @@ -22,7 +22,6 @@ package org.onap.optf.cmso.optimizer.clients.optimizer; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Optional; import java.util.UUID; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.clients.optimizer.models.OptimizerEngineResponse; import org.onap.optf.cmso.optimizer.clients.optimizer.models.OptimizerEngineResponse.OptimizerEngineResponseStatus; import org.onap.optf.cmso.optimizer.clients.optimizer.models.OptimizerResults; @@ -36,6 +35,7 @@ import org.onap.optf.cmso.optimizer.model.Response; import org.onap.optf.cmso.optimizer.model.dao.OptimizerDao; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; import org.onap.optf.cmso.optimizer.model.dao.ResponseDao; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse.OptimizeScheduleStatus; @@ -76,7 +76,7 @@ public class OptimizerRequestManager { */ public OptimizerEngineResponse createOptimizerRequest(Request requestRow) { // - if (okToDispatch(false)) { + if (okToDispatch()) { Optimizer optimizer = getExistingOptmizer(requestRow.getUuid()); if (optimizer == null) { optimizer = new Optimizer(); @@ -146,14 +146,12 @@ public class OptimizerRequestManager { - private boolean okToDispatch(boolean checkDispatchability) { - if (checkDispatchability) { + private boolean okToDispatch() { + if (env.getProperty("ok.to.dispatch.check", Boolean.class, true)) { // not yet implemented - return false; - } - else { return true; } + return false; } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/models/OptimizerResponseUtility.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/models/OptimizerResponseUtility.java index 595bc0d..a156619 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/models/OptimizerResponseUtility.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/models/OptimizerResponseUtility.java @@ -24,8 +24,8 @@ import java.io.FileInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.introspector.Property; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java index 21f0d76..1ba21e0 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java @@ -39,10 +39,6 @@ import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; -import org.onap.observations.Observation; -import org.onap.optf.cmso.common.BasicAuthenticatorFilter; -import org.onap.optf.cmso.common.PropertiesManagement; -import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.clients.common.models.ElementCriteria; import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsRequest; import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsResponse; @@ -52,14 +48,17 @@ import org.onap.optf.cmso.optimizer.clients.topology.models.ConstraintElements; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyElementInfo; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyPolicyInfo; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse; +import org.onap.optf.cmso.optimizer.common.BasicAuthenticatorFilter; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.filters.CmsoClientFilters; import org.onap.optf.cmso.optimizer.model.Request; import org.onap.optf.cmso.optimizer.model.Ticket; import org.onap.optf.cmso.optimizer.model.Topology; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; import org.onap.optf.cmso.optimizer.model.dao.TicketDao; -import org.onap.optf.cmso.optimizer.service.rs.models.ElementInfo; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; import org.onap.optf.cmso.optimizer.service.rs.models.PolicyInfo; import org.springframework.beans.factory.annotation.Autowired; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java index 85ff950..df892b3 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java @@ -21,12 +21,9 @@ package org.onap.optf.cmso.optimizer.clients.ticketmgt; import java.util.Optional; import java.util.UUID; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsResponse; -import org.onap.optf.cmso.optimizer.common.LogMessages; import org.onap.optf.cmso.optimizer.model.Request; import org.onap.optf.cmso.optimizer.model.Ticket; -import org.onap.optf.cmso.optimizer.model.Topology; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; import org.onap.optf.cmso.optimizer.model.dao.TicketDao; import org.springframework.beans.factory.annotation.Autowired; 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 ca6bdb3..6229185 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 @@ -33,21 +33,21 @@ import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; -import org.onap.observations.Observation; -import org.onap.optf.cmso.common.BasicAuthenticatorFilter; -import org.onap.optf.cmso.common.PropertiesManagement; -import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.clients.common.models.ElementCriteria; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyPolicyInfo; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyRequest; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse.TopologyRequestStatus; +import org.onap.optf.cmso.optimizer.common.BasicAuthenticatorFilter; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.filters.CmsoClientFilters; import org.onap.optf.cmso.optimizer.model.Request; import org.onap.optf.cmso.optimizer.model.Topology; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; import org.onap.optf.cmso.optimizer.model.dao.TopologyDao; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.ElementInfo; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; import org.onap.optf.cmso.optimizer.service.rs.models.PolicyInfo; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/BasicAuthenticatorFilter.java index 4c85246..00a2971 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/BasicAuthenticatorFilter.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.optf.cmso.common; +package org.onap.optf.cmso.optimizer.common; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/CmsoRequestError.java index d56a992..0627b50 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/CmsoRequestError.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.optf.cmso.common; +package org.onap.optf.cmso.optimizer.common; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java index f8d23eb..77c057c 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java @@ -35,7 +35,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import javax.ws.rs.core.Response.Status; import org.apache.log4j.Level; -import org.onap.observations.ObservationInterface; +import org.onap.optf.cmso.optimizer.observations.ObservationInterface; /** * The Enum LogMessages. diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/PropertiesManagement.java index 79a0a79..4b68176 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/PropertiesManagement.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.optf.cmso.common; +package org.onap.optf.cmso.optimizer.common; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java index b61ec08..04b69b7 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java @@ -25,8 +25,6 @@ import java.util.List; import java.util.Optional; import java.util.UUID; import javax.ws.rs.core.Response.Status; -import org.onap.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.clients.optimizer.OptimizerRequestManager; import org.onap.optf.cmso.optimizer.clients.optimizer.models.OptimizerEngineResponse; import org.onap.optf.cmso.optimizer.clients.ticketmgt.TicketMgtRequestManager; @@ -34,10 +32,12 @@ import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsRespon import org.onap.optf.cmso.optimizer.clients.topology.TopologyRequestManager; import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.model.Request; import org.onap.optf.cmso.optimizer.model.Response; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; import org.onap.optf.cmso.optimizer.model.dao.ResponseDao; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.ChangeWindow; import org.onap.optf.cmso.optimizer.service.rs.models.ElementInfo; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java index a83437f..f780390 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java @@ -24,14 +24,14 @@ * limitations under the License. */ -package org.onap.optf.cmso.common.exceptions; +package org.onap.optf.cmso.optimizer.exceptions; import com.att.eelf.i18n.EELFResourceManager; 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.CmsoRequestError; +import org.onap.optf.cmso.optimizer.common.CmsoRequestError; +import org.onap.optf.cmso.optimizer.observations.ObservationInterface; /** * The Class CMSException. diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java index fffd53e..07bca5b 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java @@ -27,18 +27,17 @@ package org.onap.optf.cmso.optimizer.filters; import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; - import java.io.IOException; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.client.ClientResponseFilter; import javax.ws.rs.core.MultivaluedMap; -import org.onap.observations.Mdc; -import org.onap.observations.MessageHeaders; -import org.onap.observations.MessageHeaders.HeadersEnum; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.observations.Mdc; +import org.onap.optf.cmso.optimizer.observations.MessageHeaders; +import org.onap.optf.cmso.optimizer.observations.MessageHeaders.HeadersEnum; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.slf4j.MDC; import org.springframework.stereotype.Component; 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 3a13805..5a236f9 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 @@ -40,11 +40,11 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.ext.Provider; -import org.onap.observations.Mdc; -import org.onap.observations.MessageHeaders; -import org.onap.observations.MessageHeaders.HeadersEnum; -import org.onap.observations.Observation; import org.onap.optf.cmso.optimizer.common.LogMessages; +import org.onap.optf.cmso.optimizer.observations.Mdc; +import org.onap.optf.cmso.optimizer.observations.MessageHeaders; +import org.onap.optf.cmso.optimizer.observations.MessageHeaders.HeadersEnum; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.springframework.stereotype.Component; @Priority(1) @@ -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.getLatestversion()); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchversion()); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestVersion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchVersion()); } catch (Exception e) { if (e instanceof WebApplicationException) { diff --git a/cmso-optimizer/src/main/java/org/onap/observations/Mdc.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java index 5dea5aa..66834fa 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/Mdc.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.observations; +package org.onap.optf.cmso.optimizer.observations; import static com.att.eelf.configuration.Configuration.MDC_BEGIN_TIMESTAMP; import static com.att.eelf.configuration.Configuration.MDC_END_TIMESTAMP; @@ -49,7 +49,7 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response.StatusType; -import org.onap.observations.MessageHeaders.HeadersEnum; +import org.onap.optf.cmso.optimizer.observations.MessageHeaders.HeadersEnum; import org.slf4j.MDC; /** diff --git a/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/MessageHeaders.java index ccb7e56..1c40196 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/MessageHeaders.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.observations; +package org.onap.optf.cmso.optimizer.observations; import java.util.HashMap; import java.util.HashSet; @@ -65,7 +65,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + public 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. */ - private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + public static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); static { supportedMajorMinorVersions.add("v1.0"); @@ -81,10 +81,10 @@ public class MessageHeaders { } /** The Constant latestVersion. */ - private static final String latestVersion = "2.0.0"; + public static final String latestVersion = "2.0.0"; /** The Constant patchVersion. */ - private static final String patchVersion = "0"; + public static final String patchVersion = "0"; /** * From string. @@ -119,6 +119,14 @@ public class MessageHeaders { return latestVersion; } + public static Map<String, String> getSupportedmajorversions() { + return supportedMajorVersions; + } + + public static Set<String> getSupportedmajorminorversions() { + return supportedMajorMinorVersions; + } + /** * Validate major version. * @@ -152,20 +160,4 @@ 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/observations/Observation.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java index 05fe983..cb36e40 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/Observation.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.observations; +package org.onap.optf.cmso.optimizer.observations; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/cmso-optimizer/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationInterface.java index 0dce93d..2b4ff58 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/ObservationInterface.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationInterface.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.observations; +package org.onap.optf.cmso.optimizer.observations; import com.att.eelf.i18n.EELFResolvableErrorEnum; import javax.ws.rs.core.Response.Status; diff --git a/cmso-optimizer/src/main/java/org/onap/observations/ObservationObject.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java index f1c1277..60ba2a1 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/ObservationObject.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java @@ -24,7 +24,7 @@ * limitations under the License. */ -package org.onap.observations; +package org.onap.optf.cmso.optimizer.observations; import com.att.eelf.i18n.EELFResolvableErrorEnum; import com.att.eelf.i18n.EELFResourceManager; diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java index 7b4859d..93da842 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java @@ -32,7 +32,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.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.common.PropertiesManagement; import org.springframework.stereotype.Controller; @Controller diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterface.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterface.java index 27a368f..d5cbac4 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterface.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterface.java @@ -26,11 +26,6 @@ package org.onap.optf.cmso.optimizer.service.rs; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; @@ -40,13 +35,18 @@ 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.CmsoRequestError; +import org.onap.optf.cmso.optimizer.common.CmsoRequestError; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse; import org.onap.optf.cmso.optimizer.service.rs.models.PolicyInfo; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Api("Optimizer Interface") @Path("/{apiVersion}") diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java index b475861..17260f1 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java @@ -34,11 +34,11 @@ 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.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.common.LogMessages; import org.onap.optf.cmso.optimizer.core.OptimizerManager; +import org.onap.optf.cmso.optimizer.exceptions.CmsoException; import org.onap.optf.cmso.optimizer.model.dao.RequestDao; +import org.onap.optf.cmso.optimizer.observations.Observation; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse; import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse.OptimizeScheduleStatus; 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 bec1de7..5b52963 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 @@ -140,7 +140,7 @@ public class ChangeWindow implements Serializable { Instant startInstant = startTime.toInstant(); Instant endInstant = endTime.toInstant(); Instant testStart = test.getStartTime().toInstant().plusMillis(startTimeZoneOffset);; - Instant testEnd = test.getEndTime().toInstant().plusMillis(startTimeZoneOffset);; + Instant testEnd = test.getEndTime().toInstant().plusMillis(endTimeZoneOffset);; if (!testStart.isBefore(startInstant) && !testEnd.isAfter(endInstant)) { return true; diff --git a/cmso-optimizer/src/main/resources/META-INF/spring.factories b/cmso-optimizer/src/main/resources/META-INF/spring.factories index c0b4a01..a2c386a 100644 --- a/cmso-optimizer/src/main/resources/META-INF/spring.factories +++ b/cmso-optimizer/src/main/resources/META-INF/spring.factories @@ -1 +1 @@ -org.springframework.boot.env.EnvironmentPostProcessor=org.onap.optf.cmso.CmsoEnvironmentPostProcessor
\ No newline at end of file +org.springframework.boot.env.EnvironmentPostProcessor=org.onap.optf.cmso.optimizer.CmsoEnvironmentPostProcessor
\ No newline at end of file diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java index d772650..a10114e 100644 --- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java +++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java @@ -23,7 +23,6 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.TimeZone; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -56,7 +55,7 @@ public class RecurringWindowsTest { @Test public void getAvailabilityWindowsForPolicies() { - getAvailabilityWindowsForPolicy("AllDayEveryDay", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 5); + getAvailabilityWindowsForPolicy("AllDayEveryDay", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 1); getAvailabilityWindowsForPolicy("Weekday_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 3); getAvailabilityWindowsForPolicy("EveryDay_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 5); getAvailabilityWindowsForPolicy("Weekend_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 3); diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java index f91fc54..f5adb6f 100644 --- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java +++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java @@ -19,7 +19,7 @@ package org.onap.optf.cmso.utilities; -import org.onap.optf.cmso.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.common.PropertiesManagement; /** * The Class PropertiesAdmin. diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties index fcda8bd..d2f3cb9 100644 --- a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties +++ b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties @@ -28,7 +28,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ### -spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:3306/optimizer?createDatabaseIfNotExist=true +spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:${DB_PORT}/optimizer?createDatabaseIfNotExist=true spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.username=root spring.datasource.password=beer diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties index babc736..9ff8213 100644 --- a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties +++ b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties @@ -19,7 +19,7 @@ ### ### MySQL DB. -spring.datasource.url=jdbc:mariadb://${DB_HOST}:3306/optimizer +spring.datasource.url=jdbc:mariadb://${DB_HOST}:${DB_PORT}/optimizer spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.username=root spring.datasource.password=beer diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh b/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh index 0db6f1f..b8b8d3b 100644 --- a/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh +++ b/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh @@ -7,7 +7,7 @@ unzip org.jacoco.agent-0.8.2.jar cp org.jacoco.agent-0.8.2/jacocoagent.jar . ls -l -VM_ARGS="${VM_ARGS} -javaagent:./jacocoagent.jar=destfile=/share/logs/jacoco.exec,dumponexit=true,jmx=true,append=true,output=file,includes=org.onap.optf.cmso.*" +VM_ARGS="${VM_ARGS} -javaagent:./jacocoagent.jar=destfile=/share/logs/optimizer.jacoco.exec,dumponexit=true,jmx=true,append=true,output=file,includes=org.onap.*" echo "VM_ARGS=${VM_ARGS}" diff --git a/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties b/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties index 3602577..ff3dab5 100644 --- a/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties +++ b/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------- -# 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. @@ -17,7 +17,7 @@ # # # Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?); +# 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 # @@ -32,7 +32,7 @@ ### ### MySQL DB. -spring.datasource.url=jdbc:mariadb://${DB_HOST}:3306/cmso +spring.datasource.url=jdbc:mariadb://${DB_HOST}:${DB_PORT}/cmso spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.username=root spring.datasource.password=beer diff --git a/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties b/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties index b8c850e..05baa58 100644 --- a/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties +++ b/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties @@ -28,7 +28,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ### -spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:3306/cmso?createDatabaseIfNotExist=true +spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:${DB_PORT}/cmso?createDatabaseIfNotExist=true spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.username=root spring.datasource.password=beer diff --git a/cmso-sonar/docker/integration/docker-compose.yml b/cmso-sonar/docker/integration/docker-compose.yml index 5c2f173..e0c81f9 100644 --- a/cmso-sonar/docker/integration/docker-compose.yml +++ b/cmso-sonar/docker/integration/docker-compose.yml @@ -5,7 +5,7 @@ services: image: mariadb:10.1.11 volumes: - "/var/lib/mysql" - - "../mariadb/conf1:/etc/mysql/conf.d:ro" + - "./mariadb/conf1:/etc/mysql/conf.d:ro" environment: - MYSQL_ROOT_PASSWORD=beer ports: @@ -20,6 +20,7 @@ services: - mariadb environment: - DB_HOST=mariadb + - DB_PORT=3306 entrypoint: "bash -x /share/etc/startDbinitService.sh" db-init-opt: @@ -31,6 +32,7 @@ services: - mariadb environment: - DB_HOST=mariadb + - DB_PORT=3306 entrypoint: "bash -x /share/etc/startDbinitService.sh" @@ -47,6 +49,7 @@ services: - "8080:8080" environment: - DB_HOST=mariadb + - DB_PORT=3306 - OPTIMIZER_URL=http://cmso-optimizer:7997/optimizer/v1/optimize/schedule - OPTIMIZER_HEALTH_URL=http://cmso-optimizer:7997/optimizer/v1/health?checkInterfaces=true @@ -83,6 +86,7 @@ services: - "7997:7997" environment: - DB_HOST=mariadb + - DB_PORT=3306 - TOPOLOGY_HOST=cmso-topology - TICKETMGT_HOST=cmso-ticketmgt @@ -96,7 +100,7 @@ services: environment: - GLOBAL_SCHEDULER_URL=http://cmso-service:8080 - GLOBAL_OPTIMIZER_URL=http://cmso-optimizer:7997 - - CMSO_STARTUP_WAIT_TIME=600s + - CMSO_STARTUP_WAIT_TIME=20m - TAGS=-i ete - OUTPUT=-d /share working_dir: /opt/cmso-robot diff --git a/cmso-sonar/docker/integration/ete_test.sh b/cmso-sonar/docker/integration/ete_test.sh index 0d86fef..5c38fa2 100755 --- a/cmso-sonar/docker/integration/ete_test.sh +++ b/cmso-sonar/docker/integration/ete_test.sh @@ -3,28 +3,28 @@ docker-compose up >up.txt 2>&1 & ### Wait for robot to finish sleep 240 -docker exec cmso-service_cmso-robot_1 ls +docker exec integration_cmso-robot_1 ls while [ $? -ne 1 ]; do sleep 60 - docker exec cmso-service_cmso-robot_1 ls + docker exec integration_cmso-robot_1 ls done ### Shut down java with to give time to write the jacoco_exec file -docker exec cmso-service_cmso-service_1 pkill java -docker exec cmso-service_cmso-optimizer_1 pkill java +docker exec integration_cmso-service_1 pkill java +docker exec integration_cmso-optimizer_1 pkill java sleep 10 ### wait for cmso containers to exit and jacoco files written -docker exec cmso-service_cmso-service_1 ls +docker exec integration_cmso-service_1 ls while [ $? -ne 1 ]; do sleep 60 - docker exec cmso-service_cmso-service_1 ls + docker exec integration_cmso-service_1 ls done -docker exec cmso-service_cmso-optimizer_1 ls +docker exec integration_cmso-optimizer_1 ls while [ $? -ne 1 ]; do sleep 60 - docker exec cmso-service_cmso-optimizer_1 ls + docker exec integration_cmso-optimizer_1 ls done cat up.txt diff --git a/cmso-sonar/pom.xml b/cmso-sonar/pom.xml index a46add5..5811df7 100644 --- a/cmso-sonar/pom.xml +++ b/cmso-sonar/pom.xml @@ -55,7 +55,7 @@ <docker.skip.push>false</docker.skip.push>
<docker.skip.tag>false</docker.skip.tag>
<skip.staging.artifacts>false</skip.staging.artifacts>
-
+ <skipIntegrationTests>true</skipIntegrationTests>
</properties>
<dependencies>
<dependency>
@@ -88,6 +88,13 @@ </executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <skipITs>${skipIntegrationTests}</skipITs>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
@@ -98,6 +105,7 @@ <goal>report</goal>
</goals>
<configuration>
+ <skip>${skipIntegrationTests}</skip>
<dataFile>${project.basedir}/target/code-coverage/service.jacoco.exec</dataFile>
<outputDirectory>${project.basedir}/target/site/service-it</outputDirectory>
<includes>
@@ -111,6 +119,27 @@ </excludes>
</configuration>
</execution>
+ <execution>
+ <id>post-integration-test2</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <skip>${skipIntegrationTests}</skip>
+ <dataFile>${project.basedir}/target/code-coverage/optimizer.jacoco.exec</dataFile>
+ <outputDirectory>${project.basedir}/target/site/optimizer-it</outputDirectory>
+ <includes>
+ <include>optimizer/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/gen/**</exclude>
+ <exclude>**/generated-sources/**</exclude>
+ <exclude>**/yang-gen/**</exclude>
+ <exclude>**/pax/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
diff --git a/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java b/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java index d90d85d..063a9b4 100644 --- a/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java +++ b/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java @@ -48,6 +48,7 @@ public class IT_FullIntegrationTest { System.out.println("stderr=" + stderr); copyJacocoFiles(); copyClassFiles(); + copyForSonar(); } catch (Exception e) { e.printStackTrace(); } finally { @@ -57,6 +58,27 @@ public class IT_FullIntegrationTest { } } + private void copyForSonar() throws IOException { + String[] jacocoFiles = env.getProperty("copy.jacoco.for.sonar").split(","); + for (String jacocoFile : jacocoFiles) { + String[] parts = jacocoFile.split("\\|"); + if (parts.length == 2) { + File source = new File(parts[0]); + File dest = new File(parts[1]); + if (source.exists() && source.isFile() && dest.getParentFile().isDirectory()) { + Path srcFile = Paths.get(source.getAbsolutePath()); + Path dstFile = Paths.get(dest.getAbsolutePath()); + Files.copy(srcFile, dstFile, StandardCopyOption.REPLACE_EXISTING); + } else { + System.out.println("Skipping " + jacocoFile); + } + } else { + System.out.println("Skipping " + jacocoFile); + } + + } + } + private void copyClassFiles() throws IOException { File dest = new File(env.getProperty("jacoco.exec.classes")); dest.mkdirs(); diff --git a/cmso-sonar/src/test/resources/integration.properties b/cmso-sonar/src/test/resources/integration.properties index 7d2f84c..48957a0 100644 --- a/cmso-sonar/src/test/resources/integration.properties +++ b/cmso-sonar/src/test/resources/integration.properties @@ -1,5 +1,7 @@ base.path=./ jacoco.exec.dest=target/code-coverage jacoco.exec.classes=target/classes -source.classes.folders=service|../cmso-service/target/classes,optimizer -jacoco.exec.source.files=docker/integration/cmso-service/logs/service.jacoco.exec,docker/integration/cmso-service/logs/optimizer.jacoco.exec
\ No newline at end of file +source.classes.folders=service|../cmso-service/target/classes,optimizer|../cmso-optimizer/target/classes +jacoco.exec.source.files=docker/integration/cmso-service/logs/service.jacoco.exec,docker/integration/cmso-optimizer/logs/optimizer.jacoco.exec + +copy.jacoco.for.sonar=docker/integration/cmso-service/logs/service.jacoco.exec|../cmso-service/target/jacoco-it.exec,docker/integration/cmso-optimizer/logs/optimizer.jacoco.exec|../cmso-optimizer/target/jacoco-it.exec
\ No newline at end of file |