diff options
author | ayalaben <Ayala.Benzvi@Amdocs.Com> | 2018-02-18 10:03:22 +0200 |
---|---|---|
committer | ayalaben <ayala.benzvi@amdocs.com> | 2018-02-18 10:03:22 +0200 |
commit | aad2781298db9c48ef4be167709b905af39bf9e4 (patch) | |
tree | 76d1e2ea2c6827d8d31de7bc5faaded2a2cf62f6 /openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src | |
parent | 7866faac17505ef230f4e01c487a0b72621ee409 (diff) |
Flow Tests - delete item and Toggle
Change-Id: I73ed5fdc13891b3ad56ab5c8f00083bf8f7d13f3
Issue-ID: SDC-1034
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src')
2 files changed, 18 insertions, 0 deletions
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 @@ -45,6 +45,12 @@ public interface TogglzFeatures { @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") Response setFeatureState(@PathParam("featureName") String featureName, @PathParam("state") boolean 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 @@ -45,6 +45,18 @@ public class TogglzFeaturesImpl implements TogglzFeatures { } @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); FeatureState featureState = new FeatureState(feature,active); |