use of alien4cloud.model.common.MetaPropConfiguration in project alien4cloud by alien4cloud.
the class TagConfigurationStepDefinitions method I_load_several_configuration_tags.
@Given("^I load several configuration tags$")
public void I_load_several_configuration_tags() throws Throwable {
String tagConfigurationsJson = FileUtil.readTextFile(Paths.get(CONFIGURATION_TAGS));
List<MetaPropConfiguration> tagsArray = JsonUtil.readObject(tagConfigurationsJson);
// registering all configuration tags
for (Object tag : tagsArray) {
// register in ES
MetaPropConfiguration tagObject = JsonUtil.readObject(JsonUtil.toString(tag), MetaPropConfiguration.class);
String tagConfigurationJson = JsonUtil.toString(tagObject);
String response = Context.getRestClientInstance().postJSon("/rest/v1/metaproperties", tagConfigurationJson);
TagConfigurationSaveResponse tagReceived = JsonUtil.read(response, TagConfigurationSaveResponse.class).getData();
// register in context
tagObject.setId(tagReceived.getId());
Context.getInstance().registerConfigurationTag(tagObject.getName(), tagObject);
}
Assert.assertNotNull(Context.getInstance().getConfigurationTags());
}
use of alien4cloud.model.common.MetaPropConfiguration in project alien4cloud by alien4cloud.
the class PropertiesDefinitionsSteps method I_fill_the_value_for_tag.
@When("^I fill the value \"([^\"]*)\" for \"([^\"]*)\" tag to check$")
public void I_fill_the_value_for_tag(String value, String configurationTagName) throws Throwable {
MetaPropConfiguration tag = Context.getInstance().getConfigurationTag(configurationTagName);
PropertyValidationRequest propertyCheckRequest = new PropertyValidationRequest(value, configurationTagName, tag, null);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/properties/check", JsonUtil.toString(propertyCheckRequest)));
}
use of alien4cloud.model.common.MetaPropConfiguration in project alien4cloud by alien4cloud.
the class TagConfigurationController method removeConfiguration.
@ApiOperation(value = "Remove tag configuration.")
@RequestMapping(value = "/{tagConfigurationId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
@Audit
public RestResponse<Void> removeConfiguration(@PathVariable String tagConfigurationId) {
MetaPropConfiguration configuration = dao.findById(MetaPropConfiguration.class, tagConfigurationId);
if (configuration == null) {
throw new NotFoundException("Configuration is not found");
}
switch(configuration.getTarget().toString()) {
case "application":
removeMetaPropertyFromResources(Application.class, dao, configuration);
break;
case "location":
removeMetaPropertyFromResources(Location.class, dao, configuration);
break;
// TODO : case environment
default:
break;
}
dao.delete(MetaPropConfiguration.class, tagConfigurationId);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.common.MetaPropConfiguration in project alien4cloud by alien4cloud.
the class TagConfigurationStepDefinitions method I_delete_the_tag_configuration.
@When("^I delete the tag configuration \"([^\"]*)\"$")
public void I_delete_the_tag_configuration(String tagName) throws Throwable {
// delete in ES
MetaPropConfiguration tagConfiguration = Context.getInstance().getConfigurationTags().get(tagName);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().delete("/rest/v1/metaproperties/" + tagConfiguration.getId()));
// delete in context
Context.getInstance().getConfigurationTags().remove(tagName);
}
use of alien4cloud.model.common.MetaPropConfiguration in project alien4cloud by alien4cloud.
the class TagConfigurationStepDefinitions method The_tag_configuration_must_not_exist_in_ALIEN.
@Then("^The tag configuration \"([^\"]*)\" must not exist in ALIEN$")
public void The_tag_configuration_must_not_exist_in_ALIEN(String tagName) throws Throwable {
// not present in the context only
MetaPropConfiguration tagConfiguration = Context.getInstance().getConfigurationTags().get(tagName);
Assert.assertNull(tagConfiguration);
}
Aggregations