/** {@inheritDoc} */ @Override public Map<String, Feature> readGroup(String groupName) { return target.readGroup(groupName); }
/** * TDD. */ @Test(expected = IllegalArgumentException.class) public void testReadGroupNull() throws Exception { // Given // When testedStore.readGroup(null); // Then, expected error... }
/** * TDD. */ @Test(expected = IllegalArgumentException.class) public void testReadGroupEmpty() throws Exception { // Given // When testedStore.readGroup(""); // Then, expected error... }
/** {@inheritDoc} */ @Override public Map<String, Feature> readGroup(String groupName) { // Cache cannot help you return getTargetFeatureStore().readGroup(groupName); }
/** * Convenient method to work on groupd : Here enabling * * @return http response. */ @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value= "Read information about a group", response=Response.class) @ApiResponses({ @ApiResponse(code = 200, message= "Information about target group"), @ApiResponse(code = 404, message= "Group not found") }) public Response read(@PathParam("groupName") String groupName) { Feature[] storeContent = getFeatureStore().readGroup(groupName).values().toArray(new Feature[0]); return Response.ok(featureArrayToJson(storeContent)).build(); }
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; }
/** * TDD. */ @Test(expected = GroupNotFoundException.class) public void testReadGroupDoesnotExist() { // Given assertFf4j.assertThatGroupDoesNotExist(G_DOESNOTEXIST); // When testedStore.readGroup(G_DOESNOTEXIST); // Then, expect error }
/** * Check Group Size * * @param expected * expected value for size * @param groupName * target groupName * @return current object */ public final AssertFf4j assertThatGroupHasSize(int expected, String groupName) { assertThatGroupExist(groupName); Assert.assertEquals(expected, ff4j.getFeatureStore().readGroup(groupName).size()); waitSomeSeconds(); return this; }
/** * TDD. */ @Test(expected = GroupNotFoundException.class) public void testRemoveLastFeatureOfGroupDeleteGroup() { // Given assertFf4j.assertThatGroupExist(G0); assertFf4j.assertThatGroupHasSize(1, G0); // When testedStore.removeFromGroup(F2, G0); // Then assertFf4j.assertThatGroupDoesNotExist(G0); // Expected error testedStore.readGroup(G0); }
/** * TDD. */ @Test public void testReadGroup() { // Given assertFf4j.assertThatGroupExist(G1); assertFf4j.assertThatFeatureExist(F3); assertFf4j.assertThatFeatureExist(F4); testedStore.addToGroup(F3, G1); testedStore.addToGroup(F4, G1); assertFf4j.assertThatFeatureIsInGroup(F3, G1); assertFf4j.assertThatFeatureIsInGroup(F4, G1); // When Map<String, Feature> group = testedStore.readGroup(G1); // Then Assert.assertEquals(2, group.size()); Assert.assertTrue(group.containsKey(F3)); Assert.assertTrue(group.containsKey(F4)); }