Search in sources :

Example 1 with SettingsCreateQuery

use of eu.europa.ec.fisheries.schema.config.types.v1.SettingsCreateQuery in project UVMS-Docker by UnionVMS.

the class SettingsRestIT method createTestSettingType.

/**
 * Creates the test setting type.
 *
 * @return the setting type
 * @throws Exception the exception
 */
private SettingType createTestSettingType() throws Exception {
    SettingsCreateQuery settingsCreateQuery = new SettingsCreateQuery();
    settingsCreateQuery.setModuleName("audit");
    SettingType settingType = new SettingType();
    settingType.setDescription("SettingsRestIt" + UUID.randomUUID().toString());
    settingType.setGlobal(false);
    settingType.setKey("audit.key.SettingsRestIt." + UUID.randomUUID().toString());
    settingType.setValue(UUID.randomUUID().toString());
    settingsCreateQuery.setSetting(settingType);
    final HttpResponse response = Request.Post(getBaseUrl() + "config/rest/settings").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(settingsCreateQuery).getBytes()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
    settingType.setId(Long.valueOf("" + dataMap.get("id")));
    return settingType;
}
Also used : HttpResponse(org.apache.http.HttpResponse) SettingType(eu.europa.ec.fisheries.schema.config.types.v1.SettingType) SettingsCreateQuery(eu.europa.ec.fisheries.schema.config.types.v1.SettingsCreateQuery)

Aggregations

SettingType (eu.europa.ec.fisheries.schema.config.types.v1.SettingType)1 SettingsCreateQuery (eu.europa.ec.fisheries.schema.config.types.v1.SettingsCreateQuery)1 HttpResponse (org.apache.http.HttpResponse)1