@Test
public void testCRUDConfig() throws Exception {
MemoryConfigurationManager defaultValueConfigurationManager = InjectHelper.instanceWithName(MemoryConfigurationManager.class, "default-value");
defaultValueConfigurationManager.setParametersForPath("",new ArrayList<ConfigurationParameter>());
ConfigurationParameter myBooleanConfig = new ConfigurationParameterEntity();
myBooleanConfig.setId("somebooleanconfig");
myBooleanConfig.setType(ConfigurationParameter.Type.BOOLEAN);
myBooleanConfig.setValue("true");
ConfigurationParameter p = Client.create(config).resource(HOSTURL+"/configurations").type(MediaType.APPLICATION_JSON).post(ConfigurationParameter.class,myBooleanConfig);
assert p!=null;
assert p.getType().equals(ConfigurationParameter.Type.BOOLEAN);
assert p.getValue().equals("true");
p = Client.create(config).resource(HOSTURL+"/configurations/"+p.getId()).accept(MediaType.APPLICATION_JSON).get(ConfigurationParameter.class);
assert p!=null;
assert p.getType().equals(ConfigurationParameter.Type.BOOLEAN);
assert p.getValue().equals("true");
ConfigurationParameter myNumberConfig = new ConfigurationParameterEntity();
myNumberConfig.setId("somenumberconfig");
myNumberConfig.setType(ConfigurationParameter.Type.INTEGER);
myNumberConfig.setValue("42");
p = Client.create(config).resource(HOSTURL+"/configurations").type(MediaType.APPLICATION_JSON).post(ConfigurationParameter.class,myNumberConfig);
assert p!=null;
assert p.getType().equals(ConfigurationParameter.Type.INTEGER);
assert p.getValue().equals("42");
p = Client.create(config).resource(HOSTURL+"/configurations/"+p.getId()).accept(MediaType.APPLICATION_JSON).get(ConfigurationParameter.class);
assert p!=null;
assert p.getType().equals(ConfigurationParameter.Type.INTEGER);
assert p.getValue().equals("42");
ConfigurationParameter myStringConfig = new ConfigurationParameterEntity();
myStringConfig.setId("somestringconfig");
myStringConfig.setType(ConfigurationParameter.Type.STRING);
myStringConfig.setValue("hello");
p = Client.create(config).resource(HOSTURL+"/configurations").type(MediaType.APPLICATION_JSON).post(ConfigurationParameter.class,myStringConfig);
assert p!=null;
assert p.getType().equals(ConfigurationParameter.Type.STRING);
assert p.getValue().equals("hello");
p = Client.create(config).resource(HOSTURL+"/configurations/"+p.getId()).accept(MediaType.APPLICATION_JSON).get(ConfigurationParameter.class);