summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java2
-rw-r--r--catalog-be/pom.xml18
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/TogglingBusinessLogic.java72
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TogglingServlet.java168
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepository.java3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleConfiguration.java52
-rw-r--r--catalog-be/src/main/resources/application-context.xml3
-rw-r--r--catalog-be/src/main/resources/config/features.properties1
-rw-r--r--catalog-be/src/main/webapp/WEB-INF/web.xml137
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepositoryTest.java1
-rw-r--r--catalog-dao/pom.xml6
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java20
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java1
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java12
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEventTest.java7
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServletTest.java2
-rw-r--r--common-be/pom.xml20
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java (renamed from catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/ToggleableFeature.java)16
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java (renamed from openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java)7
-rw-r--r--common-be/src/main/resources/feature.properties0
-rw-r--r--onboarding/pom.xml2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml7
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml90
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java9
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java3
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/test/java/org/openecomp/TogglzFeatureRestTest.java2
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java444
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java2
-rw-r--r--pom.xml2
33 files changed, 706 insertions, 475 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java
index 017126e86b..8ea53003e9 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java
@@ -34,7 +34,7 @@ public class UtilsTest {
@Test
public void testBuildOkResponse() throws Exception {
- int status = 0;
+ int status = 200;
Object entity = null;
Map<String, String> additionalHeaders = null;
Response result;
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml
index 47650bd8c7..d0a0f95f8a 100644
--- a/catalog-be/pom.xml
+++ b/catalog-be/pom.xml
@@ -36,6 +36,18 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>togglz-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.rabbitmq</groupId>
+ <artifactId>amqp-client</artifactId>
+ <version>3.3.1</version>
+ </dependency>
+
<!--JSON and YAML Parsing-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@@ -104,6 +116,12 @@
</exclusions>
</dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>common-be</artifactId>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/TogglingBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/TogglingBusinessLogic.java
new file mode 100644
index 0000000000..538f565917
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/TogglingBusinessLogic.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.components.impl;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.operations.api.IElementOperation;
+import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation;
+import org.openecomp.sdc.be.model.operations.api.IGroupOperation;
+import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation;
+import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.togglz.core.Feature;
+import org.togglz.core.context.FeatureContext;
+import org.togglz.core.repository.FeatureState;
+import org.togglz.core.util.NamedFeature;
+
+@Component("togglingBusinessLogic")
+public class TogglingBusinessLogic extends BaseBusinessLogic {
+
+ @Autowired
+ public TogglingBusinessLogic(IElementOperation elementDao, IGroupOperation groupOperation,
+ IGroupInstanceOperation groupInstanceOperation, IGroupTypeOperation groupTypeOperation,
+ InterfaceOperation interfaceOperation, InterfaceLifecycleOperation interfaceLifecycleTypeOperation,
+ ArtifactsOperations artifactToscaOperation) {
+ super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, interfaceOperation,
+ interfaceLifecycleTypeOperation, artifactToscaOperation);
+ }
+
+ public Map<String, Boolean> getAllFeatureStates() {
+ return Arrays.stream(ToggleableFeature.values()).collect(Collectors.toMap(Enum::name,
+ ToggleableFeature::isActive));
+ }
+
+ public boolean getFeatureState(String featureName) {
+ return ToggleableFeature.valueOf(featureName).isActive();
+ }
+
+ public void setAllFeatures(boolean state) {
+ Arrays.asList(ToggleableFeature.values())
+ .forEach(toggleableFeature -> updateFeatureState(toggleableFeature.name(), state));
+ }
+
+ public void updateFeatureState(String featureName, boolean state) {
+ Feature feature = new NamedFeature(featureName);
+ FeatureState featureState = new FeatureState(feature, state);
+ FeatureContext.getFeatureManager().setFeatureState(featureState);
+ }
+}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TogglingServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TogglingServlet.java
new file mode 100644
index 0000000000..df53919b59
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TogglingServlet.java
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.servlets;
+
+import com.jcabi.aspects.Loggable;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.servers.Server;
+import io.swagger.v3.oas.annotations.servers.Servers;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.tags.Tags;
+import java.util.Map;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.components.impl.TogglingBusinessLogic;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ServletUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
+import org.openecomp.sdc.common.log.wrappers.Logger;
+
+@Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
+@Path("/v1/catalog/toggle")
+@Tags({@Tag(name = "SDC Internal APIs")})
+@Servers({@Server(url = "/sdc2/rest")})
+@Singleton
+public class TogglingServlet extends AbstractValidationsServlet {
+
+ private final TogglingBusinessLogic togglingBusinessLogic;
+
+ @Inject
+ public TogglingServlet(UserBusinessLogic userBusinessLogic, ComponentInstanceBusinessLogic componentInstanceBL,
+ ComponentsUtils componentsUtils, ServletUtils servletUtils, ResourceImportManager resourceImportManager,
+ TogglingBusinessLogic togglingBusinessLogic) {
+ super(userBusinessLogic, componentInstanceBL, componentsUtils, servletUtils, resourceImportManager);
+ this.togglingBusinessLogic = togglingBusinessLogic;
+ }
+
+ private static final Logger log = Logger.getLogger(TogglingServlet.class);
+ private static final String ALL_FEATURES_STATES_WERE_SET_SUCCESSFULLY = "All features states were set successfully";
+ private static final String START_HANDLE_REQUEST_OF = "Start handle request of {}";
+ private static final String FEATURE_STATE_WAS_UPDATED_SUCCESSFULLY = "Feature state was updated successfully";
+
+
+ @GET
+ @Path("/")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Get all Toggleable features", method = "GET", summary = "Returns list of toggleable features", responses = {
+ @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = javax.ws.rs.core.Response.class)))),
+ @ApiResponse(responseCode = "200", description = "Success"),
+ @ApiResponse(responseCode = "403", description = "Restricted operation"),
+ @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
+ @ApiResponse(responseCode = "404", description = "Toggleable features not found")})
+ public Response getAllFeatures(@Context final HttpServletRequest request) {
+ String url = request.getMethod() + " " + request.getRequestURI();
+ log.debug(START_HANDLE_REQUEST_OF, url);
+
+ try {
+ Map<String, Boolean> features = togglingBusinessLogic.getAllFeatureStates();
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), features);
+ } catch (Exception e) {
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
+ }
+ }
+
+ @GET
+ @Path("/{featureName}/state")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Get Toggleable feature state", method = "GET", summary = "Returns one toggleable feature state", responses = {
+ @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = javax.ws.rs.core.Response.class)))),
+ @ApiResponse(responseCode = "200", description = "Success"),
+ @ApiResponse(responseCode = "403", description = "Restricted operation"),
+ @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
+ @ApiResponse(responseCode = "404", description = "Toggleable feature not found")})
+ public Response getToggleableFeature(@PathParam("featureName") String featureName, @Context final HttpServletRequest request) {
+ String url = request.getMethod() + " " + request.getRequestURI();
+ log.debug(START_HANDLE_REQUEST_OF, url);
+
+ try {
+ boolean featureState = togglingBusinessLogic.getFeatureState(featureName);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), featureState);
+ } catch (Exception e) {
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
+ }
+ }
+
+ @PUT
+ @Path("/state/{state}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Update all feature toggle state", method = "PUT", summary = "Update all feature status", responses = {
+ @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = javax.ws.rs.core.Response.class)))),
+ @ApiResponse(responseCode = "200", description = "Success"),
+ @ApiResponse(responseCode = "403", description = "Restricted operation"),
+ @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
+ @ApiResponse(responseCode = "404", description = "Toggleable features not found")})
+ public Response setAllFeatures(@PathParam("state") boolean state, @Context final HttpServletRequest request) {
+ String url = request.getMethod() + " " + request.getRequestURI();
+ log.debug(START_HANDLE_REQUEST_OF, url);
+
+ try {
+ togglingBusinessLogic.setAllFeatures(state);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), ALL_FEATURES_STATES_WERE_SET_SUCCESSFULLY);
+ } catch (Exception e) {
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
+ }
+ }
+
+ @PUT
+ @Path("/{featureName}/state/{state}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Update feature toggle state", method = "PUT", summary = "Update feature status", responses = {
+ @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = javax.ws.rs.core.Response.class)))),
+ @ApiResponse(responseCode = "200", description = "Success"),
+ @ApiResponse(responseCode = "403", description = "Restricted operation"),
+ @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
+ @ApiResponse(responseCode = "404", description = "Toggleable features not found")})
+ public Response updateFeatureState(@PathParam("featureName") String featureName,
+ @PathParam("state") boolean state, @Context final HttpServletRequest request) {
+ String url = request.getMethod() + " " + request.getRequestURI();
+ log.debug("(get) Start handle request of {}", url);
+
+ try {
+ togglingBusinessLogic.updateFeatureState(featureName, state);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), FEATURE_STATE_WAS_UPDATED_SUCCESSFULLY);
+ } catch (Exception e) {
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
+ }
+ }
+
+
+}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepository.java b/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepository.java
index a67bf4b9f4..5e2f416159 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepository.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepository.java
@@ -24,7 +24,6 @@ import com.google.common.annotations.VisibleForTesting;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
import org.openecomp.sdc.be.dao.cassandra.FeatureToggleDao;
import org.openecomp.sdc.be.resources.data.togglz.FeatureToggleEvent;
-import org.openecomp.sdc.be.resources.data.togglz.ToggleableFeature;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
import org.togglz.core.Feature;
@@ -38,7 +37,7 @@ import java.util.stream.Collectors;
@Component
public class CassandraCustomStateRepository implements StateRepository {
- private final static Logger logger = Logger.getLogger(CassandraCustomStateRepository.class);
+ private static final Logger logger = Logger.getLogger(CassandraCustomStateRepository.class);
private final FeatureToggleDao featureToggleDao;
public CassandraCustomStateRepository(FeatureToggleDao featureToggleDao) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleConfiguration.java b/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleConfiguration.java
deleted file mode 100644
index 52bbf86c6e..0000000000
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.togglz;
-
-import org.openecomp.sdc.be.resources.data.togglz.ToggleableFeature;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.togglz.core.Feature;
-import org.togglz.core.manager.TogglzConfig;
-import org.togglz.core.repository.StateRepository;
-import org.togglz.core.repository.cache.CachingStateRepository;
-import org.togglz.core.user.SimpleFeatureUser;
-import org.togglz.core.user.UserProvider;
-
-@Component
-public class ToggleConfiguration implements TogglzConfig {
- @Autowired
- private CassandraCustomStateRepository cassandraCustomStateRepository;
-
- @Override
- public Class<? extends Feature> getFeatureClass() {
- return ToggleableFeature.class;
- }
-
- @Override
- public StateRepository getStateRepository() {
- return new CachingStateRepository(cassandraCustomStateRepository, 10000);
- }
-
- @Override
- public UserProvider getUserProvider() {
- return () -> new SimpleFeatureUser("admin", true);
- }
-} \ No newline at end of file
diff --git a/catalog-be/src/main/resources/application-context.xml b/catalog-be/src/main/resources/application-context.xml
index ca36de1168..403debfb08 100644
--- a/catalog-be/src/main/resources/application-context.xml
+++ b/catalog-be/src/main/resources/application-context.xml
@@ -14,7 +14,8 @@
org.openecomp.sdc.be.servlets,
org.openecomp.sdc.be.externalapi.servlet,
org.openecomp.sdc.be.components.scheduledtasks,
- org.openecomp.sdc.be.facade.operations">
+ org.openecomp.sdc.be.facade.operations,
+ org.openecomp.sdc.be.components.impl">
</context:component-scan>
<bean class="org.openecomp.sdc.be.dao.config.DAOSpringConfig"/>
diff --git a/catalog-be/src/main/resources/config/features.properties b/catalog-be/src/main/resources/config/features.properties
new file mode 100644
index 0000000000..488a78fa81
--- /dev/null
+++ b/catalog-be/src/main/resources/config/features.properties
@@ -0,0 +1 @@
+HEALING=false \ No newline at end of file
diff --git a/catalog-be/src/main/webapp/WEB-INF/web.xml b/catalog-be/src/main/webapp/WEB-INF/web.xml
index 9991e30a86..23a08319ff 100644
--- a/catalog-be/src/main/webapp/WEB-INF/web.xml
+++ b/catalog-be/src/main/webapp/WEB-INF/web.xml
@@ -20,10 +20,10 @@
org.openecomp.sdc.be.filters.BeServletFilter,
org.openecomp.sdc.be.filters.ComponentsAvailabilityFilter,
org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature,
- org.openecomp.sdc.be.servlets.exception.DefaultExceptionMapper,
+ org.openecomp.sdc.be.servlets.exception.DefaultExceptionMapper,
org.openecomp.sdc.be.servlets.exception.ComponentExceptionMapper,
org.openecomp.sdc.be.servlets.exception.ConstraintViolationExceptionMapper,
- org.openecomp.sdc.be.servlets.exception.StorageExceptionMapper,
+ org.openecomp.sdc.be.servlets.exception.StorageExceptionMapper,
org.openecomp.sdc.be.view.MixinModelWriter,
org.openecomp.sdc.config.ObjectMapperProvider
</param-value>
@@ -81,29 +81,29 @@
<async-supported>true</async-supported>
</servlet>
-<!-- <filter>-->
-<!-- <filter-name>CadiAuthFilter</filter-name>-->
-<!-- <filter-class>org.onap.portalsdk.core.onboarding.crossapi.CadiAuthFilter</filter-class>-->
-<!-- <init-param>-->
-<!-- <param-name>cadi_prop_files</param-name>-->
-<!-- &lt;!&ndash; Add Absolute path of cadi.properties &ndash;&gt;-->
-<!-- <param-value>etc/cadi.properties</param-value>-->
-<!-- </init-param>-->
-<!-- &lt;!&ndash;Add param values with comma delimited values &ndash;&gt;-->
-<!-- &lt;!&ndash; for example /api/v3/*,/auxapi/*&ndash;&gt;-->
-<!-- <init-param>-->
-<!-- <param-name>include_url_endpoints</param-name>-->
-<!-- <param-value>/api/v3/roles,/api/v3/user/*,/api/v3/user/*/roles,/api/v3/users,/api/v3/sessionTimeOuts,/api/v3/updateSessionTimeOuts</param-value>-->
-<!-- </init-param>-->
-<!-- <init-param>-->
-<!-- <param-name>exclude_url_endpoints</param-name>-->
-<!-- <param-value>/api/v3/analytics,/api/v3/storeAnalytics</param-value>-->
-<!-- </init-param>-->
-<!-- </filter>-->
-<!-- <filter-mapping>-->
-<!-- <filter-name>CadiAuthFilter</filter-name>-->
-<!-- <url-pattern>/api/v3/*</url-pattern>-->
-<!-- </filter-mapping>-->
+ <!-- <filter>-->
+ <!-- <filter-name>CadiAuthFilter</filter-name>-->
+ <!-- <filter-class>org.onap.portalsdk.core.onboarding.crossapi.CadiAuthFilter</filter-class>-->
+ <!-- <init-param>-->
+ <!-- <param-name>cadi_prop_files</param-name>-->
+ <!-- &lt;!&ndash; Add Absolute path of cadi.properties &ndash;&gt;-->
+ <!-- <param-value>etc/cadi.properties</param-value>-->
+ <!-- </init-param>-->
+ <!-- &lt;!&ndash;Add param values with comma delimited values &ndash;&gt;-->
+ <!-- &lt;!&ndash; for example /api/v3/*,/auxapi/*&ndash;&gt;-->
+ <!-- <init-param>-->
+ <!-- <param-name>include_url_endpoints</param-name>-->
+ <!-- <param-value>/api/v3/roles,/api/v3/user/*,/api/v3/user/*/roles,/api/v3/users,/api/v3/sessionTimeOuts,/api/v3/updateSessionTimeOuts</param-value>-->
+ <!-- </init-param>-->
+ <!-- <init-param>-->
+ <!-- <param-name>exclude_url_endpoints</param-name>-->
+ <!-- <param-value>/api/v3/analytics,/api/v3/storeAnalytics</param-value>-->
+ <!-- </init-param>-->
+ <!-- </filter>-->
+ <!-- <filter-mapping>-->
+ <!-- <filter-name>CadiAuthFilter</filter-name>-->
+ <!-- <url-pattern>/api/v3/*</url-pattern>-->
+ <!-- </filter-mapping>-->
<servlet>
<servlet-name>ViewStatusMessages</servlet-name>
@@ -151,10 +151,10 @@
<!--<async-supported>true</async-supported>-->
<!--</filter>-->
-<!-- <filter>-->
-<!-- <filter-name>gatewayFilter</filter-name>-->
-<!-- <filter-class>org.openecomp.sdc.be.filters.GatewayFilter</filter-class>-->
-<!-- </filter>-->
+ <!-- <filter>-->
+ <!-- <filter-name>gatewayFilter</filter-name>-->
+ <!-- <filter-class>org.openecomp.sdc.be.filters.GatewayFilter</filter-class>-->
+ <!-- </filter>-->
<filter>
<filter-name>gatewayFilter</filter-name>
@@ -173,35 +173,35 @@
<url-pattern>/sdc/*</url-pattern>
</filter-mapping>
-<!-- <filter>-->
-<!-- <filter-name>beRestrictionAccessFilter</filter-name>-->
-<!-- <filter-class>-->
-<!-- org.springframework.web.filter.DelegatingFilterProxy-->
-<!-- </filter-class>-->
-<!-- <init-param>-->
-<!-- <param-name>targetFilterLifecycle</param-name>-->
-<!-- <param-value>true</param-value>-->
-<!-- </init-param>-->
-<!-- </filter>-->
-<!-- <filter-mapping>-->
-<!-- <filter-name>beRestrictionAccessFilter</filter-name>-->
-<!-- <url-pattern>/sdc2/rest/*</url-pattern>-->
-<!-- </filter-mapping>-->
-
-<!-- <filter>-->
-<!-- <filter-name>CADI</filter-name>-->
-<!-- <filter-class>org.openecomp.sdc.be.filters.BeCadiServletFilter</filter-class>-->
-<!-- <init-param>-->
-<!-- <param-name>cadi_prop_files</param-name>-->
-<!-- <param-value>etc/cadi.properties</param-value>-->
-<!-- </init-param>-->
-<!-- </filter>-->
-
-<!-- <filter-mapping>-->
-<!-- <filter-name>CADI</filter-name>-->
-<!-- <url-pattern>/sdc/*</url-pattern>-->
-<!-- <url-pattern>/sdc2/rest/*</url-pattern>-->
-<!-- </filter-mapping>-->
+ <!-- <filter>-->
+ <!-- <filter-name>beRestrictionAccessFilter</filter-name>-->
+ <!-- <filter-class>-->
+ <!-- org.springframework.web.filter.DelegatingFilterProxy-->
+ <!-- </filter-class>-->
+ <!-- <init-param>-->
+ <!-- <param-name>targetFilterLifecycle</param-name>-->
+ <!-- <param-value>true</param-value>-->
+ <!-- </init-param>-->
+ <!-- </filter>-->
+ <!-- <filter-mapping>-->
+ <!-- <filter-name>beRestrictionAccessFilter</filter-name>-->
+ <!-- <url-pattern>/sdc2/rest/*</url-pattern>-->
+ <!-- </filter-mapping>-->
+
+ <!-- <filter>-->
+ <!-- <filter-name>CADI</filter-name>-->
+ <!-- <filter-class>org.openecomp.sdc.be.filters.BeCadiServletFilter</filter-class>-->
+ <!-- <init-param>-->
+ <!-- <param-name>cadi_prop_files</param-name>-->
+ <!-- <param-value>etc/cadi.properties</param-value>-->
+ <!-- </init-param>-->
+ <!-- </filter>-->
+
+ <!-- <filter-mapping>-->
+ <!-- <filter-name>CADI</filter-name>-->
+ <!-- <url-pattern>/sdc/*</url-pattern>-->
+ <!-- <url-pattern>/sdc2/rest/*</url-pattern>-->
+ <!-- </filter-mapping>-->
<filter>
<filter-name>reqValidationFilter</filter-name>
@@ -224,14 +224,19 @@
<exception-type>java.lang.RuntimeException</exception-type>
<location>/sdc2/rest/v1/catalog/handleException/</location>
</error-page>
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:application-context.xml</param-value>
- </context-param>
-
- <listener>
- <listener-class>org.openecomp.sdc.be.listen.BEAppContextListener</listener-class>
- </listener>
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>classpath:application-context.xml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.togglz.core.manager.TogglzConfig</param-name>
+ <param-value>org.openecomp.sdc.be.togglz.TogglzConfiguration</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.openecomp.sdc.be.listen.BEAppContextListener</listener-class>
+ </listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepositoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepositoryTest.java
index 7786f6ef91..2560c04202 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepositoryTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/togglz/CassandraCustomStateRepositoryTest.java
@@ -29,7 +29,6 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
import org.openecomp.sdc.be.dao.cassandra.FeatureToggleDao;
import org.openecomp.sdc.be.resources.data.togglz.FeatureToggleEvent;
-import org.openecomp.sdc.be.resources.data.togglz.ToggleableFeature;
import org.togglz.core.Feature;
import org.togglz.core.repository.FeatureState;
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index 06cb1e81a0..d1d9b349ae 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -356,6 +356,12 @@ Modifications copyright (c) 2018 Nokia
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-testing</artifactId>
+ <version>${togglz.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java
index e74556ab14..c0a066346d 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/heal/HealJanusGraphDao.java
@@ -28,6 +28,7 @@ import org.openecomp.sdc.be.dao.jsongraph.heal.HealVersion;
import org.openecomp.sdc.be.dao.jsongraph.heal.HealVersionBuilder;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
public class HealJanusGraphDao implements HealGraphDao<JanusGraphVertex, GraphEdgeLabels> {
@@ -41,18 +42,23 @@ public class HealJanusGraphDao implements HealGraphDao<JanusGraphVertex, GraphEd
public JanusGraphVertex performGraphReadHealing(JanusGraphVertex childVertex, GraphEdgeLabels graphEdgeLabels) {
final Integer healingVersionInt = (Integer) childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty()).orElse(HealConstants.DEFAULT_HEAL_VERSION);
HealVersion<Integer> healingVersion = HealVersionBuilder.build(healingVersionInt);
- healingPipelineDao.getHealersForVertex(graphEdgeLabels.name(), healingVersion).forEach(heal -> healGraphVertex(childVertex, heal));
- childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty(), healingPipelineDao.getCurrentHealVersion().getVersion());
+ healingPipelineDao.getHealersForVertex(graphEdgeLabels.name(), healingVersion)
+ .forEach(heal -> healGraphVertex(childVertex, heal));
+ childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty(),
+ healingPipelineDao.getCurrentHealVersion().getVersion());
+
return childVertex;
}
private JanusGraphVertex healGraphVertex(JanusGraphVertex childVertex, Heal<JanusGraphVertex> heal) {
- heal.healData(childVertex);
- final HealVersion<Integer> healVersion = heal.fromVersion();
- HealVersion newerVersion = HealVersionBuilder.build(healVersion.getVersion() + 1);
- childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty(), newerVersion);
- heal.healData(childVertex);
+ if(ToggleableFeature.HEALING.isActive()) {
+ heal.healData(childVertex);
+ final HealVersion<Integer> healVersion = heal.fromVersion();
+ HealVersion<Integer> newerVersion = HealVersionBuilder.build(healVersion.getVersion() + 1);
+ childVertex.property(GraphPropertyEnum.HEALING_VERSION.getProperty(), newerVersion);
+ heal.healData(childVertex);
+ }
return childVertex;
}
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java
index 501b421bd5..ed5a5a0b37 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java
@@ -26,6 +26,7 @@ import com.datastax.driver.mapping.annotations.Table;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.togglz.core.Feature;
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java
index c0d9e4644c..f079ddd186 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/HealingPipelineDaoTest.java
@@ -22,6 +22,8 @@ import org.janusgraph.graphdb.relations.StandardVertexProperty;
import org.janusgraph.graphdb.types.system.EmptyVertex;
import org.janusgraph.graphdb.types.system.ImplicitKey;
import java.util.HashMap;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
@@ -36,11 +38,21 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import java.util.Map;
import java.util.Optional;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
+import org.togglz.testing.TestFeatureManager;
+import org.togglz.testing.TestFeatureManagerProvider;
import static org.junit.Assert.*;
public class HealingPipelineDaoTest {
+ @Before
+ public void enableToggleableFeatures(){
+ TestFeatureManager manager = new TestFeatureManager(ToggleableFeature.class);
+ manager.enableAll();
+ TestFeatureManagerProvider.setFeatureManager(manager);
+ }
+
@Test
public void shouldUpgrade() {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEventTest.java
index 53bf27d9f9..9675e3a734 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEventTest.java
@@ -20,15 +20,16 @@
package org.openecomp.sdc.be.resources.data.togglz;
-import org.junit.Test;
-import org.togglz.core.repository.FeatureState;
-
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
+import org.junit.Test;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
+import org.togglz.core.repository.FeatureState;
+
public class FeatureToggleEventTest {
private final String strategyId = "123456";
private final String param1 = "param1";
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServletTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServletTest.java
index 616e658d3e..2aadddbeac 100644
--- a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServletTest.java
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServletTest.java
@@ -40,7 +40,7 @@ import static org.openecomp.sdc.common.api.Constants.HEALTH_CHECK_SERVICE_ATTR;
public class FeHealthCheckServletTest {
private final FeHealthCheckServlet healthCheckServlet = new FeHealthCheckServlet();
- private final Response response = Response.status(200).entity("Ok").build();
+ private final Response response = Response.ok().entity("Ok").build();
@Mock
private HealthCheckService healthCheckService;
diff --git a/common-be/pom.xml b/common-be/pom.xml
index 2005537798..175b3877ef 100644
--- a/common-be/pom.xml
+++ b/common-be/pom.xml
@@ -166,13 +166,19 @@
<version>${togglz.version}</version>
</dependency>
- <!-- Togglz for testing -->
- <dependency>
- <groupId>org.togglz</groupId>
- <artifactId>togglz-testing</artifactId>
- <version>${togglz.version}</version>
- <scope>test</scope>
- </dependency>
+ <!-- Togglz for testing -->
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-testing</artifactId>
+ <version>${togglz.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-core</artifactId>
+ <version>${togglz.version}</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/ToggleableFeature.java b/common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java
index 2fd2c80b02..b2697235b8 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/ToggleableFeature.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,17 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.resources.data.togglz;
+package org.openecomp.sdc.be.togglz;
+import java.util.Arrays;
import org.togglz.core.Feature;
import org.togglz.core.annotation.Label;
import org.togglz.core.context.FeatureContext;
-import java.util.Arrays;
+public enum ToggleableFeature implements Feature {
+ @Label("Default Feature")
+ DEFAULT_FEATURE,
-public enum ToggleableFeature implements Feature{
- @Label("Default feature")
- DEFAULT_FEATURE;
+ @Label("Healing")
+ HEALING;
public static Feature getFeatureByName(String featureName) {
return Arrays.stream(values()).
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java b/common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java
index 8b58e5a5ac..830449ca9e 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.common.togglz;
+package org.openecomp.sdc.be.togglz;
import org.togglz.core.Feature;
import org.togglz.core.manager.TogglzConfig;
@@ -30,6 +30,9 @@ import org.togglz.core.user.UserProvider;
import java.io.File;
public class TogglzConfiguration implements TogglzConfig {
+
+ private static final String TOGGLZ_FILE_LOCATION = "/tmp/features.properties";
+
@Override
public Class<? extends Feature> getFeatureClass() {
return ToggleableFeature.class;
@@ -37,7 +40,7 @@ public class TogglzConfiguration implements TogglzConfig {
@Override
public StateRepository getStateRepository() {
- return new FileBasedStateRepository(new File("/tmp/features.properties"));
+ return new FileBasedStateRepository(new File(TOGGLZ_FILE_LOCATION));
}
@Override
diff --git a/common-be/src/main/resources/feature.properties b/common-be/src/main/resources/feature.properties
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/common-be/src/main/resources/feature.properties
diff --git a/onboarding/pom.xml b/onboarding/pom.xml
index c86cca4ef8..fb04f8ac13 100644
--- a/onboarding/pom.xml
+++ b/onboarding/pom.xml
@@ -74,7 +74,7 @@
<commons.io.version>2.5</commons.io.version>
<commons.lang.version>2.6</commons.lang.version>
<commons.lang3.version>3.4</commons.lang3.version>
- <cxf.version>3.1.16</cxf.version>
+ <cxf.version>3.3.6</cxf.version>
<datastax.cassandra.version>3.8.0</datastax.cassandra.version>
<easymock.version>3.4</easymock.version>
<groovy.version>2.4.8</groovy.version>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml
index 7668337396..6a6dd0aa73 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml
@@ -72,7 +72,7 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
- <version>2.0.1</version>
+ <version>${ws.rs.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
@@ -144,6 +144,11 @@
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
</dependencies>
<!-- Should be removed once TogglZ usage in pom files is fixed -->
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
index 2b1b9893b3..1e41ed246c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
@@ -13,7 +13,7 @@
<context-param>
<param-name>org.togglz.core.manager.TogglzConfig</param-name>
- <param-value>org.openecomp.sdc.common.togglz.TogglzConfiguration</param-value>
+ <param-value>org.openecomp.sdc.be.togglz.TogglzConfiguration</param-value>
</context-param>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml
index 2d26276316..fb523705a5 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml
@@ -14,48 +14,54 @@
<dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${ws.rs.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.framework.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>${javax.inject.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-common-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>togglz-rest-types</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-common-rest</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- CXF -->
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxrs</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>${javax.inject.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-common-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>togglz-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- CXF -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <artifactId>common-be</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java
index 7fe65427e9..c6fbed672e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java
@@ -15,15 +15,14 @@
*/
package org.openecomp.sdcrests.togglz.rest.mapping;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
-import org.openecomp.sdcrests.mapping.MappingBase;
-import org.openecomp.sdcrests.togglz.types.FeatureDto;
-import org.openecomp.sdcrests.togglz.types.FeatureSetDto;
-
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.togglz.types.FeatureDto;
+import org.openecomp.sdcrests.togglz.types.FeatureSetDto;
public class MapToggleableFeatureToDto extends MappingBase<Collection<ToggleableFeature>, FeatureSetDto> {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
index d62dd4add1..4777d0a656 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
@@ -15,12 +15,11 @@
*/
package org.openecomp.sdcrests.togglz.rest.services;
-
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdcrests.togglz.rest.TogglzFeatures;
import org.openecomp.sdcrests.togglz.rest.mapping.MapToggleableFeatureToDto;
import org.openecomp.sdcrests.togglz.types.FeatureDto;
import org.openecomp.sdcrests.togglz.types.FeatureSetDto;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.togglz.core.Feature;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/test/java/org/openecomp/TogglzFeatureRestTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/test/java/org/openecomp/TogglzFeatureRestTest.java
index 8035f11eec..9b9eed15fc 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/test/java/org/openecomp/TogglzFeatureRestTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/test/java/org/openecomp/TogglzFeatureRestTest.java
@@ -22,7 +22,7 @@ package org.openecomp;
import com.google.common.collect.Sets;
import org.junit.Test;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdcrests.togglz.rest.TogglzFeatures;
import org.openecomp.sdcrests.togglz.rest.mapping.MapToggleableFeatureToDto;
import org.openecomp.sdcrests.togglz.rest.services.TogglzFeaturesImpl;
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
deleted file mode 100644
index 440a5083fb..0000000000
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.common.togglz;
-
-import org.togglz.core.Feature;
-import org.togglz.core.annotation.Label;
-import org.togglz.core.context.FeatureContext;
-
-public enum ToggleableFeature implements Feature {
-
- @Label("Default Feature")
- DEFAULT_FEATURE;
-
- public boolean isActive() {
- return FeatureContext.getFeatureManager().isActive(this);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java
index 39ee8b7b3c..71dfeb9f53 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java
@@ -37,7 +37,6 @@ import org.onap.sdc.tosca.datatypes.model.RelationshipTemplate;
import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.onap.sdc.tosca.datatypes.model.CapabilityDefinition;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.heat.datatypes.HeatBoolean;
import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
index cae53f5695..31dbb21a4c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -16,6 +16,20 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.translator.TestUtils.getErrorAsString;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipInputStream;
import org.apache.commons.collections4.MapUtils;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -24,27 +38,16 @@ import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.TestUtils;
import org.togglz.testing.TestFeatureManager;
import org.togglz.testing.TestFeatureManagerProvider;
-import java.io.*;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipInputStream;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.sdc.translator.TestUtils.getErrorAsString;
-
public class BaseFullTranslationTest {
@@ -88,8 +91,7 @@ public class BaseFullTranslationTest {
}
try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
- BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis)) {
+ BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) {
TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis);
}
assertEquals(0, expectedResultFileNameSet.size());
@@ -105,8 +107,8 @@ public class BaseFullTranslationTest {
MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
"Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
- .withId("Validation Error")
- .withCategory(ErrorCategory.APPLICATION).build());
+ .withId("Validation Error").withCategory(ErrorCategory.APPLICATION)
+ .build());
}
return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
index 5e5bda3997..42f4cfdfd5 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
@@ -16,6 +16,33 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.common.utils.SdcCommon.MANIFEST_NAME;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateComputeConnectivityIn;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateComputeConnectivityOut;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateDependsOnInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateGetAttr;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateGroupsInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedConsolidationDataNodeTemplateIds;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortConnectivityIn;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortConnectivityOut;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortsInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateVolumeInConsolidationData;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipInputStream;
import org.apache.commons.collections4.MapUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -25,272 +52,253 @@ import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.heat.datatypes.manifest.FileData;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile;
-import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.TestUtils;
import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
-import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.*;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ComputeTemplateConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.FileComputeConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.FilePortConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
import org.openecomp.sdc.translator.services.heattotosca.TranslationService;
import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
import org.togglz.testing.TestFeatureManager;
import org.togglz.testing.TestFeatureManagerProvider;
-import java.io.*;
-import java.net.URL;
-import java.util.*;
-import java.util.zip.ZipInputStream;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.sdc.common.utils.SdcCommon.MANIFEST_NAME;
-import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.*;
-
public class BaseResourceTranslationTest {
- protected String inputFilesPath;
- protected String outputFilesPath;
- TranslationContext translationContext;
+ protected String inputFilesPath;
+ protected String outputFilesPath;
+ TranslationContext translationContext;
- private TranslationService translationService;
- private byte[] translatedZipFile;
+ private TranslationService translationService;
+ private byte[] translatedZipFile;
- private Map<String, byte[]> expectedResultMap = new HashMap<>();
- private Set<String> expectedResultFileNameSet = new HashSet<>();
+ private Map<String, byte[]> expectedResultMap = new HashMap<>();
+ private Set<String> expectedResultFileNameSet = new HashSet<>();
- protected static TestFeatureManager manager;
+ protected static TestFeatureManager manager;
- @BeforeClass
- public static void enableToggleableFeatures(){
- manager = new TestFeatureManager(ToggleableFeature.class);
- manager.enableAll();
- TestFeatureManagerProvider.setFeatureManager(manager);
- }
+ @BeforeClass
+ public static void enableToggleableFeatures() {
+ manager = new TestFeatureManager(ToggleableFeature.class);
+ manager.enableAll();
+ TestFeatureManagerProvider.setFeatureManager(manager);
+ }
- @Before
- public void setUp() throws IOException {
- initTranslatorAndTranslate();
- }
+ @Before
+ public void setUp() throws IOException {
+ initTranslatorAndTranslate();
+ }
- protected void initTranslatorAndTranslate() throws IOException {
- translationService = new TranslationService();
- translationContext = new TranslationContext();
- translatedZipFile = translateZipFile();
- }
+ protected void initTranslatorAndTranslate() throws IOException {
+ translationService = new TranslationService();
+ translationContext = new TranslationContext();
+ translatedZipFile = translateZipFile();
+ }
- protected void testTranslation() throws IOException {
+ protected void testTranslation() throws IOException {
- URL url = BaseResourceTranslationTest.class.getResource(outputFilesPath);
+ URL url = BaseResourceTranslationTest.class.getResource(outputFilesPath);
- String path = url.getPath();
- File pathFile = new File(path);
- File[] files = pathFile.listFiles();
- Assert.assertNotNull("manifest files is empty", files);
- for (File expectedFile : files) {
- expectedResultFileNameSet.add(expectedFile.getName());
- try (FileInputStream input = new FileInputStream(expectedFile)) {
- expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
- }
- }
+ String path = url.getPath();
+ File pathFile = new File(path);
+ File[] files = pathFile.listFiles();
+ Assert.assertNotNull("manifest files is empty", files);
+ for (File expectedFile : files) {
+ expectedResultFileNameSet.add(expectedFile.getName());
+ try (FileInputStream input = new FileInputStream(expectedFile)) {
+ expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
+ }
+ }
- try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
- BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis)) {
- TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis);
+ try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
+ BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) {
+ TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis);
+ }
+ assertEquals(0, expectedResultFileNameSet.size());
}
- assertEquals(0, expectedResultFileNameSet.size());
- }
-
- private byte[] translateZipFile() throws IOException {
- URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
- String path = inputFilesUrl.getPath();
- addFilesToTranslator(translationContext, path);
- TranslatorOutput translatorOutput = translationService.translateHeatFiles(translationContext);
- Assert.assertNotNull(translatorOutput);
- if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
- MessageContainerUtil
- .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
- "Error in validation " + TestUtils.getErrorAsString(translatorOutput.getErrorMessages()))
- .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build());
+
+ private byte[] translateZipFile() throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
+ String path = inputFilesUrl.getPath();
+ addFilesToTranslator(translationContext, path);
+ TranslatorOutput translatorOutput = translationService.translateHeatFiles(translationContext);
+ Assert.assertNotNull(translatorOutput);
+ if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
+ MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "Error in validation " + TestUtils.getErrorAsString(translatorOutput.getErrorMessages()))
+ .withId("Validation Error").withCategory(ErrorCategory.APPLICATION)
+ .build());
+ }
+
+ return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
+
}
-
- return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
-
- }
- private void addFilesToTranslator(TranslationContext translationContext, String path)
- throws IOException {
- File manifestFile = new File(path);
- File[] files = manifestFile.listFiles();
- byte[] fileContent;
+ private void addFilesToTranslator(TranslationContext translationContext, String path) throws IOException {
+ File manifestFile = new File(path);
+ File[] files = manifestFile.listFiles();
+ byte[] fileContent;
- Assert.assertNotNull("manifest files is empty", files);
+ Assert.assertNotNull("manifest files is empty", files);
- for (File file : files) {
+ for (File file : files) {
- try (FileInputStream fis = new FileInputStream(file)) {
+ try (FileInputStream fis = new FileInputStream(file)) {
- fileContent = FileUtils.toByteArray(fis);
+ fileContent = FileUtils.toByteArray(fis);
- if (file.getName().equals(MANIFEST_NAME)) {
- addManifest(translationContext, fileContent);
- } else {
- String validationFilename = "validationOutput.json";
- String zipFilename = "VSP.zip";
- if (!file.getName().equals(zipFilename) && (!file.getName().equals(validationFilename))) {
- addFile(translationContext, file.getName(), fileContent);
- }
+ if (file.getName().equals(MANIFEST_NAME)) {
+ addManifest(translationContext, fileContent);
+ } else {
+ String validationFilename = "validationOutput.json";
+ String zipFilename = "VSP.zip";
+ if (!file.getName().equals(zipFilename) && (!file.getName().equals(validationFilename))) {
+ addFile(translationContext, file.getName(), fileContent);
+ }
+ }
+ }
}
- }
}
- }
-
- private static void addManifest(TranslationContext translationContext,
- byte[] content) {
- ManifestContent manifestData = JsonUtil.json2Object(new String(content), ManifestContent.class);
- ManifestFile manifest = new ManifestFile();
- manifest.setName(MANIFEST_NAME);
- manifest.setContent(manifestData);
- translationContext.setManifest(manifest);
- translationContext.addFile(MANIFEST_NAME, content);
- addFilesFromManifestToTranslationContextManifestFilesMap(translationContext, manifestData
- .getData());
- }
-
- private static void addFile(TranslationContext translationContext,
- String name, byte[] content) {
- translationContext.addFile(name, content);
- }
-
- private static void addFilesFromManifestToTranslationContextManifestFilesMap(
- TranslationContext translationContext, List<FileData> fileDataListFromManifest) {
- for (FileData fileFromManfiest : fileDataListFromManifest) {
- translationContext.addManifestFile(fileFromManfiest.getFile(), fileFromManfiest.getType());
+
+ private static void addManifest(TranslationContext translationContext, byte[] content) {
+ ManifestContent manifestData = JsonUtil.json2Object(new String(content), ManifestContent.class);
+ ManifestFile manifest = new ManifestFile();
+ manifest.setName(MANIFEST_NAME);
+ manifest.setContent(manifestData);
+ translationContext.setManifest(manifest);
+ translationContext.addFile(MANIFEST_NAME, content);
+ addFilesFromManifestToTranslationContextManifestFilesMap(translationContext, manifestData.getData());
+ }
+
+ private static void addFile(TranslationContext translationContext, String name, byte[] content) {
+ translationContext.addFile(name, content);
}
- }
-
- void validateNodeTemplateIdInNestedConsolidationData(){
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
- (expectedResultMap);
- Assert.assertNotNull(consolidationData);
- validateNestedConsolidationDataNodeTemplateIds(consolidationData,expectedServiceTemplateModels);
- }
-
- protected void validateComputeTemplateConsolidationData(ConsolidationDataValidationType
- validationType,
- String testName) {
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
- (expectedResultMap);
- Assert.assertNotNull(consolidationData);
- Assert.assertNotNull(consolidationData.getComputeConsolidationData());
- Set<String> serviceTemplateFileNames = consolidationData.getComputeConsolidationData()
- .getAllServiceTemplateFileNames();
- Assert.assertNotNull(serviceTemplateFileNames);
- for(String serviceTemplateName : serviceTemplateFileNames){
- Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
- ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get
- (serviceTemplateName);
- FileComputeConsolidationData fileComputeConsolidationData = consolidationData
- .getComputeConsolidationData().getFileComputeConsolidationData(serviceTemplateName);
- Assert.assertNotNull(fileComputeConsolidationData);
- Set<String> computeTypes = fileComputeConsolidationData.getAllComputeTypes();
- Assert.assertNotNull(computeTypes);
- for(String computeType : computeTypes) {
- TypeComputeConsolidationData typeComputeConsolidationData = fileComputeConsolidationData
- .getTypeComputeConsolidationData(computeType);
- Assert.assertNotNull(typeComputeConsolidationData);
-
- Collection<String> computeNodeTemplateIds = typeComputeConsolidationData
- .getAllComputeNodeTemplateIds();
- Assert.assertNotNull(computeNodeTemplateIds);
- Assert.assertNotEquals(computeNodeTemplateIds.size(), 0);
-
- for(String computeNodeTemplateId : computeNodeTemplateIds) {
- ComputeTemplateConsolidationData computeTemplateConsolidationData =
- typeComputeConsolidationData.getComputeTemplateConsolidationData
- (computeNodeTemplateId);
- switch(validationType){
- case VALIDATE_GROUP:
- validateGroupsInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData, expectedServiceTemplate);
- break;
- case VALIDATE_PORT:
- validatePortsInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData,
- expectedServiceTemplate);
- break;
- case VALIDATE_VOLUME:
- validateVolumeInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData, expectedServiceTemplate, testName);
- break;
- case VALIDATE_CONNECTIVITY:
- validateComputeConnectivityIn(computeTemplateConsolidationData,
- expectedServiceTemplate);
- validateComputeConnectivityOut(computeNodeTemplateId, computeTemplateConsolidationData,
- expectedServiceTemplate);
- break;
- case VALIDATE_DEPENDS_ON:
- validateDependsOnInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData,
- expectedServiceTemplate, testName);
- break;
- }
+
+ private static void addFilesFromManifestToTranslationContextManifestFilesMap(TranslationContext translationContext,
+ List<FileData> fileDataListFromManifest) {
+ for (FileData fileFromManfiest : fileDataListFromManifest) {
+ translationContext.addManifestFile(fileFromManfiest.getFile(), fileFromManfiest.getType());
+ }
+ }
+
+ void validateNodeTemplateIdInNestedConsolidationData() {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates(expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ validateNestedConsolidationDataNodeTemplateIds(consolidationData, expectedServiceTemplateModels);
+ }
+
+ protected void validateComputeTemplateConsolidationData(ConsolidationDataValidationType validationType,
+ String testName) {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates(expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ Assert.assertNotNull(consolidationData.getComputeConsolidationData());
+ Set<String> serviceTemplateFileNames =
+ consolidationData.getComputeConsolidationData().getAllServiceTemplateFileNames();
+ Assert.assertNotNull(serviceTemplateFileNames);
+ for (String serviceTemplateName : serviceTemplateFileNames) {
+ Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
+ ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get(serviceTemplateName);
+ FileComputeConsolidationData fileComputeConsolidationData = consolidationData.getComputeConsolidationData()
+ .getFileComputeConsolidationData(
+ serviceTemplateName);
+ Assert.assertNotNull(fileComputeConsolidationData);
+ Set<String> computeTypes = fileComputeConsolidationData.getAllComputeTypes();
+ Assert.assertNotNull(computeTypes);
+ for (String computeType : computeTypes) {
+ TypeComputeConsolidationData typeComputeConsolidationData =
+ fileComputeConsolidationData.getTypeComputeConsolidationData(computeType);
+ Assert.assertNotNull(typeComputeConsolidationData);
+
+ Collection<String> computeNodeTemplateIds = typeComputeConsolidationData.getAllComputeNodeTemplateIds();
+ Assert.assertNotNull(computeNodeTemplateIds);
+ Assert.assertNotEquals(computeNodeTemplateIds.size(), 0);
+
+ for (String computeNodeTemplateId : computeNodeTemplateIds) {
+ ComputeTemplateConsolidationData computeTemplateConsolidationData =
+ typeComputeConsolidationData.getComputeTemplateConsolidationData(computeNodeTemplateId);
+ switch (validationType) {
+ case VALIDATE_GROUP:
+ validateGroupsInConsolidationData(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_PORT:
+ validatePortsInConsolidationData(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_VOLUME:
+ validateVolumeInConsolidationData(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate, testName);
+ break;
+ case VALIDATE_CONNECTIVITY:
+ validateComputeConnectivityIn(computeTemplateConsolidationData, expectedServiceTemplate);
+ validateComputeConnectivityOut(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_DEPENDS_ON:
+ validateDependsOnInConsolidationData(computeNodeTemplateId,
+ computeTemplateConsolidationData, expectedServiceTemplate, testName);
+ break;
+ }
+ }
+ }
}
- }
}
- }
protected void validateGetAttribute(String testName) {
validateGetAttr(translationContext, testName);
}
- protected void validateNestedTemplateConsolidationData(String testName){
- validateNestedConsolidationData(translationContext, testName);
- }
-
- void validatePortTemplateConsolidationData() {
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
- (expectedResultMap);
- Assert.assertNotNull(consolidationData);
- Assert.assertNotNull(consolidationData.getPortConsolidationData());
- Set<String> serviceTemplateFileNames = consolidationData.getPortConsolidationData()
- .getAllServiceTemplateFileNames();
- Assert.assertNotNull(serviceTemplateFileNames);
- for(String serviceTemplateName : serviceTemplateFileNames){
- Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
- ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get
- (serviceTemplateName);
- FilePortConsolidationData filePortConsolidationData = consolidationData
- .getPortConsolidationData().getFilePortConsolidationData(serviceTemplateName);
- Assert.assertNotNull(filePortConsolidationData);
-
- Set<String> portNodeTemplateIds = filePortConsolidationData.getAllPortNodeTemplateIds();
- Assert.assertNotNull(portNodeTemplateIds);
- Assert.assertNotEquals(portNodeTemplateIds.size(), 0);
-
- for(String portNodeTemplateId : portNodeTemplateIds) {
- PortTemplateConsolidationData portTemplateConsolidationData =
- filePortConsolidationData.getPortTemplateConsolidationData(portNodeTemplateId);
- switch(ConsolidationDataValidationType.VALIDATE_CONNECTIVITY){
- case VALIDATE_CONNECTIVITY:
- validatePortConnectivityIn(portTemplateConsolidationData,expectedServiceTemplate);
- validatePortConnectivityOut(portNodeTemplateId, portTemplateConsolidationData, expectedServiceTemplate);
- break;
+ protected void validateNestedTemplateConsolidationData(String testName) {
+ validateNestedConsolidationData(translationContext, testName);
+ }
+
+ void validatePortTemplateConsolidationData() {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates(expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ Assert.assertNotNull(consolidationData.getPortConsolidationData());
+ Set<String> serviceTemplateFileNames =
+ consolidationData.getPortConsolidationData().getAllServiceTemplateFileNames();
+ Assert.assertNotNull(serviceTemplateFileNames);
+ for (String serviceTemplateName : serviceTemplateFileNames) {
+ Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
+ ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get(serviceTemplateName);
+ FilePortConsolidationData filePortConsolidationData =
+ consolidationData.getPortConsolidationData().getFilePortConsolidationData(serviceTemplateName);
+ Assert.assertNotNull(filePortConsolidationData);
+
+ Set<String> portNodeTemplateIds = filePortConsolidationData.getAllPortNodeTemplateIds();
+ Assert.assertNotNull(portNodeTemplateIds);
+ Assert.assertNotEquals(portNodeTemplateIds.size(), 0);
+
+ for (String portNodeTemplateId : portNodeTemplateIds) {
+ PortTemplateConsolidationData portTemplateConsolidationData =
+ filePortConsolidationData.getPortTemplateConsolidationData(portNodeTemplateId);
+ switch (ConsolidationDataValidationType.VALIDATE_CONNECTIVITY) {
+ case VALIDATE_CONNECTIVITY:
+ validatePortConnectivityIn(portTemplateConsolidationData, expectedServiceTemplate);
+ validatePortConnectivityOut(portNodeTemplateId, portTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ }
+ }
}
- }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java
index b19c822d11..1d6e6b1a9e 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java
@@ -24,7 +24,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
import org.togglz.testing.TestFeatureManagerProvider;
diff --git a/pom.xml b/pom.xml
index 59b597b1b2..d29852dae3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@ Modifications copyright (c) 2018-2019 Nokia
<onap.logging.version>1.6.1</onap.logging.version>
<commons.collections.version>4.1</commons.collections.version>
- <ws.rs.version>2.0.1</ws.rs.version>
+ <ws.rs.version>2.1</ws.rs.version>
<jetty.version>9.4.18.v20190429</jetty.version>