use of org.ff4j.services.domain.FeatureApiBean in project ff4j by ff4j.
the class FeatureStoreServices method getAllFeatures.
public Collection<FeatureApiBean> getAllFeatures() {
List<FeatureApiBean> features;
Map<String, Feature> featureMap = ff4j.getFeatureStore().readAll();
if (CollectionUtils.isEmpty(featureMap)) {
features = new ArrayList<FeatureApiBean>(0);
} else {
features = new ArrayList<FeatureApiBean>(featureMap.size());
for (Feature feature : featureMap.values()) {
features.add(new FeatureApiBean(feature));
}
}
return features;
}
use of org.ff4j.services.domain.FeatureApiBean in project ff4j by ff4j.
the class GroupServices method getFeaturesByGroup.
public Collection<FeatureApiBean> getFeaturesByGroup(String groupName) {
featureValidator.assertGroupExist(groupName);
Collection<Feature> features = ff4j.getFeatureStore().readGroup(groupName).values();
Collection<FeatureApiBean> featureApiBeans = new ArrayList<FeatureApiBean>();
if (!CollectionUtils.isEmpty(features)) {
for (Feature feature : features) {
featureApiBeans.add(new FeatureApiBean(feature));
}
}
return featureApiBeans;
}
use of org.ff4j.services.domain.FeatureApiBean in project ff4j by ff4j.
the class FeatureStepDef method the_user_gets_the_response_with_response_code_as_and_content_as_and.
@Then("^the user gets the response with response code as (\\d+) and content as \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\"$")
public void the_user_gets_the_response_with_response_code_as_and_content_as_and(int responseCode, String expectedUid, String expectedEnabled, String expectedDescription, String expectedGroup, String expectedPermissions) throws Throwable {
assertStatus(responseCode);
FeatureApiBean featureApiBean = new FeatureApiBean();
featureApiBean.setUid(expectedUid);
featureApiBean.setEnable(Boolean.valueOf(expectedEnabled));
featureApiBean.setDescription(expectedDescription);
featureApiBean.setGroup(expectedGroup);
featureApiBean.setPermissions(Arrays.asList(expectedPermissions.split(",")));
assertJsonResponse(new Gson().toJson(featureApiBean));
}
use of org.ff4j.services.domain.FeatureApiBean in project ff4j by ff4j.
the class FeatureServicesStepDef method the_user_gets_the_response_as_and.
@Then("^the user gets the response as \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\"$")
public void the_user_gets_the_response_as_and(String expectedUid, String expectedEnabled, String expectedDescription, String expectedGroup, String expectedPermissions) throws Throwable {
Feature expectedFeature = new Feature(expectedUid, Boolean.valueOf(expectedEnabled), expectedDescription, expectedGroup, Arrays.asList(expectedPermissions.split(",")));
FeatureApiBean expectedFeatureApiBean = new FeatureApiBean(expectedFeature);
assertThat(actualResponse).isEqualToComparingFieldByField(expectedFeatureApiBean);
}
use of org.ff4j.services.domain.FeatureApiBean in project ff4j by ff4j.
the class FeatureServicesStepDef method the_user_gets_the_response_as.
@Then("^the user gets the response as$")
public void the_user_gets_the_response_as(String expectedResponse) throws Throwable {
FeatureApiBean featureApiBean = GSON.fromJson(expectedResponse, FeatureApiBean.class);
assertThat(actualResponse).isEqualToComparingOnlyGivenFields(featureApiBean);
}
Aggregations