diff options
Diffstat (limited to 'services/activity-spec/activity-spec-web')
13 files changed, 43 insertions, 99 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/ActivitySpecs.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/ActivitySpecs.java index f6c5486b4d..03b20e00ca 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/ActivitySpecs.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/ActivitySpecs.java @@ -16,24 +16,13 @@ package org.onap.sdc.activityspec.api.rest; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.*; import org.onap.sdc.activityspec.api.rest.types.ActivitySpecActionRequestDto; import org.onap.sdc.activityspec.api.rest.types.ActivitySpecRequestDto; import org.springframework.validation.annotation.Validated; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java index aedb4edb5a..3b53686312 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java @@ -16,13 +16,12 @@ package org.onap.sdc.activityspec.api.rest.mapping; -import java.util.ArrayList; - import org.onap.sdc.activityspec.api.rest.types.ActivitySpecRequestDto; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.be.datatypes.ActivitySpecParameter; import org.openecomp.sdcrests.mapping.MappingBase; +import java.util.ArrayList; import java.util.Objects; import java.util.stream.Collectors; diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java index 0568ef1192..0857b158f9 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java @@ -16,12 +16,12 @@ package org.onap.sdc.activityspec.api.rest.mapping; -import java.util.Objects; - -import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.api.rest.types.ActivitySpecCreateResponse; +import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.openecomp.sdcrests.mapping.MappingBase; +import java.util.Objects; + public class MapActivitySpecToActivitySpecCreateResponse extends MappingBase<ActivitySpecEntity, ActivitySpecCreateResponse> { diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java index fb4fb18d38..787e0cbf00 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java @@ -16,9 +16,9 @@ package org.onap.sdc.activityspec.api.rest.mapping; +import org.onap.sdc.activityspec.api.rest.types.ActivitySpecGetResponse; import org.onap.sdc.activityspec.api.rest.types.ActivitySpecParameterDto; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; -import org.onap.sdc.activityspec.api.rest.types.ActivitySpecGetResponse; import org.openecomp.sdcrests.mapping.MappingBase; import java.util.Objects; diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapDtoToActivityParameter.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapDtoToActivityParameter.java index 051cbbd92d..e8ff470a6b 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapDtoToActivityParameter.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/mapping/MapDtoToActivityParameter.java @@ -16,8 +16,8 @@ package org.onap.sdc.activityspec.api.rest.mapping; -import org.onap.sdc.activityspec.be.datatypes.ActivitySpecParameter; import org.onap.sdc.activityspec.api.rest.types.ActivitySpecParameterDto; +import org.onap.sdc.activityspec.be.datatypes.ActivitySpecParameter; import org.openecomp.sdcrests.mapping.MappingBase; public class MapDtoToActivityParameter extends MappingBase<ActivitySpecParameterDto, ActivitySpecParameter> { diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java index 168f4ffb8e..cb88cac312 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java @@ -21,16 +21,11 @@ import org.onap.sdc.activityspec.api.rest.mapping.MapActivitySpecRequestDtoToAct import org.onap.sdc.activityspec.api.rest.mapping.MapActivitySpecToActivitySpecCreateResponse; import org.onap.sdc.activityspec.api.rest.mapping.MapActivitySpecToActivitySpecGetResponse; import org.onap.sdc.activityspec.api.rest.mapping.MapItemToListResponseDto; -import org.onap.sdc.activityspec.api.rest.types.ActivitySpecActionRequestDto; -import org.onap.sdc.activityspec.api.rest.types.ActivitySpecGetResponse; -import org.onap.sdc.activityspec.api.rest.types.ActivitySpecListResponseDto; -import org.onap.sdc.activityspec.api.rest.types.ActivitySpecRequestDto; -import org.onap.sdc.activityspec.api.rest.types.InternalEmptyObject; +import org.onap.sdc.activityspec.api.rest.types.*; import org.onap.sdc.activityspec.be.ActivitySpecManager; +import org.onap.sdc.activityspec.be.dao.impl.ActivitySpecDaoZusammenImpl; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.be.impl.ActivitySpecManagerImpl; -import org.onap.sdc.activityspec.api.rest.types.ActivitySpecCreateResponse; -import org.onap.sdc.activityspec.be.dao.impl.ActivitySpecDaoZusammenImpl; import org.openecomp.core.dao.UniqueValueDaoFactory; import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory; import org.openecomp.sdc.common.errors.CoreException; @@ -38,7 +33,6 @@ import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.versioning.ItemManagerFactory; import org.openecomp.sdc.versioning.VersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; - import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java index 9269eacbfd..93ee731b75 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java @@ -16,23 +16,18 @@ package org.onap.sdc.activityspec.api.server.filters; -import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import org.apache.commons.lang.StringUtils; +import org.onap.sdc.activityspec.utils.ActivitySpecConstant; +import org.openecomp.sdc.common.session.SessionContextProvider; +import org.openecomp.sdc.common.session.SessionContextProviderFactory; + +import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response.Status; - -import org.apache.commons.lang.StringUtils; -import org.onap.sdc.activityspec.utils.ActivitySpecConstant; -import org.openecomp.sdc.common.session.SessionContextProvider; -import org.openecomp.sdc.common.session.SessionContextProviderFactory; +import java.io.IOException; public class ActivitySpecSessionContextFilter implements Filter { diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/ActivitySpecManager.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/ActivitySpecManager.java index 6c1a4d0526..6ebefd2ff6 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/ActivitySpecManager.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/ActivitySpecManager.java @@ -16,12 +16,12 @@ package org.onap.sdc.activityspec.be; -import java.util.Collection; - import org.onap.sdc.activityspec.api.rest.types.ActivitySpecAction; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.openecomp.sdc.versioning.types.Item; +import java.util.Collection; + public interface ActivitySpecManager { ActivitySpecEntity createActivitySpec(ActivitySpecEntity activitySpecEntity); diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java index 9da4cd4835..c821ce69cc 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java @@ -22,7 +22,6 @@ import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.Action; import com.amdocs.zusammen.datatypes.item.ElementContext; import com.amdocs.zusammen.datatypes.item.Info; - import org.onap.sdc.activityspec.be.dao.ActivitySpecDao; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.be.datatypes.ActivitySpecData; diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImpl.java index 6853b855d2..442ce7ccca 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImpl.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImpl.java @@ -16,26 +16,13 @@ package org.onap.sdc.activityspec.be.impl; -import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified; -import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Deleted; -import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Deprecated; -import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Draft; - -import java.util.Collection; -import java.util.Collections; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Predicate; - import org.onap.sdc.activityspec.api.rest.types.ActivitySpecAction; -import org.onap.sdc.activityspec.be.dao.ActivitySpecDao; -import org.onap.sdc.activityspec.utils.ActivitySpecConstant; import org.onap.sdc.activityspec.be.ActivitySpecManager; +import org.onap.sdc.activityspec.be.dao.ActivitySpecDao; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.be.datatypes.ItemType; import org.onap.sdc.activityspec.errors.ActivitySpecNotFoundException; +import org.onap.sdc.activityspec.utils.ActivitySpecConstant; import org.openecomp.core.dao.UniqueValueDao; import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.sdc.common.errors.CoreException; @@ -51,12 +38,17 @@ import org.openecomp.sdc.versioning.dao.types.VersionStatus; import org.openecomp.sdc.versioning.types.Item; import org.openecomp.sdc.versioning.types.VersionCreationMethod; +import java.util.*; +import java.util.function.Predicate; + +import static org.openecomp.sdc.versioning.dao.types.VersionStatus.*; + public class ActivitySpecManagerImpl implements ActivitySpecManager { private static final Map<VersionStatus, VersionStatus> EXPECTED_PREV_STATUS; static { - EXPECTED_PREV_STATUS = new EnumMap<>(VersionStatus.class); + EXPECTED_PREV_STATUS = new EnumMap<VersionStatus, VersionStatus>(VersionStatus.class); EXPECTED_PREV_STATUS.put(Certified, Draft); EXPECTED_PREV_STATUS.put(Deprecated, Certified); EXPECTED_PREV_STATUS.put(Deleted, Deprecated); diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/errors/DefaultExceptionMapper.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/errors/DefaultExceptionMapper.java index 7d1b5b4b11..5fea77a4d3 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/errors/DefaultExceptionMapper.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/errors/DefaultExceptionMapper.java @@ -16,19 +16,19 @@ package org.onap.sdc.activityspec.errors; -import java.util.Set; +import org.codehaus.jackson.map.JsonMappingException; +import org.hibernate.validator.internal.engine.path.PathImpl; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; + import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.ext.ExceptionMapper; - -import org.codehaus.jackson.map.JsonMappingException; -import org.hibernate.validator.internal.engine.path.PathImpl; -import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; +import java.util.Set; public class DefaultExceptionMapper implements ExceptionMapper<Exception> { diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java index 9b7bb50c8b..8c759871ab 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java @@ -16,27 +16,13 @@ package org.onap.sdc.activityspec.be.dao.impl; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementConflict; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.ItemVersionConflict; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.*; import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; -import com.amdocs.zusammen.datatypes.item.Action; -import com.amdocs.zusammen.datatypes.item.ElementContext; -import com.amdocs.zusammen.datatypes.item.Info; -import com.amdocs.zusammen.datatypes.item.Item; -import com.amdocs.zusammen.datatypes.item.ItemVersion; -import com.amdocs.zusammen.datatypes.item.ItemVersionData; -import com.amdocs.zusammen.datatypes.item.ItemVersionStatus; -import com.amdocs.zusammen.datatypes.item.Resolution; +import com.amdocs.zusammen.datatypes.item.*; import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions; import com.amdocs.zusammen.datatypes.itemversion.Tag; - -import java.io.InputStream; - import org.onap.sdc.activityspec.be.dao.impl.ActivitySpecDaoZusammenImpl.InfoPropertyName; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.be.datatypes.ActivitySpecData; @@ -52,13 +38,8 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; +import java.io.InputStream; +import java.util.*; import java.util.stream.Collectors; import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext; diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImplTest.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImplTest.java index 21d1709537..abf0355c47 100644 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImplTest.java +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/onap/sdc/activityspec/be/impl/ActivitySpecManagerImplTest.java @@ -16,15 +16,12 @@ package org.onap.sdc.activityspec.be.impl; -import java.util.Arrays; -import java.util.Collection; - import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; -import org.onap.sdc.activityspec.be.dao.ActivitySpecDao; import org.onap.sdc.activityspec.api.rest.types.ActivitySpecAction; +import org.onap.sdc.activityspec.be.dao.ActivitySpecDao; import org.onap.sdc.activityspec.be.dao.types.ActivitySpecEntity; import org.onap.sdc.activityspec.be.datatypes.ActivitySpecParameter; import org.onap.sdc.activityspec.errors.ActivitySpecNotFoundException; @@ -43,15 +40,13 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.verify; -import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.ACTIVITY_SPEC_NOT_FOUND; -import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.INVALID_STATE; -import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.VERSION_ID_DEFAULT_VALUE; +import static org.mockito.Mockito.*; +import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.*; public class ActivitySpecManagerImplTest { |