Search in sources :

Example 1 with TagConfigurationSaveResponse

use of alien4cloud.rest.tags.TagConfigurationSaveResponse 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());
}
Also used : MetaPropConfiguration(alien4cloud.model.common.MetaPropConfiguration) TagConfigurationSaveResponse(alien4cloud.rest.tags.TagConfigurationSaveResponse) Given(cucumber.api.java.en.Given)

Aggregations

MetaPropConfiguration (alien4cloud.model.common.MetaPropConfiguration)1 TagConfigurationSaveResponse (alien4cloud.rest.tags.TagConfigurationSaveResponse)1 Given (cucumber.api.java.en.Given)1