From aad2781298db9c48ef4be167709b905af39bf9e4 Mon Sep 17 00:00:00 2001 From: ayalaben Date: Sun, 18 Feb 2018 10:03:22 +0200 Subject: Flow Tests - delete item and Toggle Change-Id: I73ed5fdc13891b3ad56ab5c8f00083bf8f7d13f3 Issue-ID: SDC-1034 Signed-off-by: ayalaben --- .../org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java | 6 ++++++ .../sdcrests/togglz/rest/services/TogglzFeaturesImpl.java | 12 ++++++++++++ 2 files changed, 18 insertions(+) (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java index 74009f6965..64c558f291 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java @@ -44,6 +44,12 @@ public interface TogglzFeatures { Response getFeatures(); + @PUT + @Path("/state/{state}") + @ApiOperation(value = "Update feature toggle state for all features") + Response setAllFeatures(@PathParam("state") boolean state); + + @PUT @Path("/{featureName}/state/{state}") @ApiOperation(value = "Update feature toggle state") 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 657c42833f..d62dd4add1 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 @@ -44,6 +44,18 @@ public class TogglzFeaturesImpl implements TogglzFeatures { return Response.ok(featureSetDto).build(); } + @Override + public Response setAllFeatures(boolean active) { + FeatureSetDto featureSetDto = new FeatureSetDto(); + new MapToggleableFeatureToDto().doMapping(Arrays.asList(ToggleableFeature.values()), featureSetDto); + featureSetDto.getFeatures().forEach(featureDto -> { + Feature feature = new NamedFeature(featureDto.getName()); + FeatureState featureState = new FeatureState(feature,active); + FeatureContext.getFeatureManager().setFeatureState(featureState); + }); + return Response.ok().build(); + } + @Override public Response setFeatureState(String featureName, boolean active) { Feature feature = new NamedFeature(featureName); -- cgit 1.2.3-korg