Search in sources :

Example 1 with SettingType

use of eu.europa.ec.fisheries.schema.config.types.v1.SettingType in project UVMS-ExchangeModule-APP by UnionVMS.

the class PluginServiceBean method putConfigSettingsInAMap.

private Map<String, SettingType> putConfigSettingsInAMap(List<eu.europa.ec.fisheries.schema.config.types.v1.SettingType> settings) {
    Map<String, SettingType> settingTypeMap = new HashMap<>();
    if (settings != null && !settings.isEmpty()) {
        for (eu.europa.ec.fisheries.schema.config.types.v1.SettingType configSettingType : settings) {
            SettingType type = new SettingType();
            type.setKey(configSettingType.getKey());
            type.setValue(configSettingType.getValue());
            settingTypeMap.put(configSettingType.getKey(), type);
        }
    }
    return settingTypeMap;
}
Also used : HashMap(java.util.HashMap) SettingType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingType)

Example 2 with SettingType

use of eu.europa.ec.fisheries.schema.config.types.v1.SettingType in project UVMS-ExchangeModule-APP by UnionVMS.

the class ServiceMapper method toModel.

public static SettingType toModel(ServiceSetting entity) {
    SettingType type = new SettingType();
    type.setKey(entity.getSetting());
    type.setValue(entity.getValue());
    return type;
}
Also used : SettingType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingType)

Example 3 with SettingType

use of eu.europa.ec.fisheries.schema.config.types.v1.SettingType 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)

Example 4 with SettingType

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

the class SettingsRestIT method createTest.

/**
 * Creates the test.
 *
 * @throws Exception the exception
 */
@Test
public void createTest() throws Exception {
    SettingType settingType = createTestSettingType();
    assertNotNull(settingType);
}
Also used : SettingType(eu.europa.ec.fisheries.schema.config.types.v1.SettingType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 5 with SettingType

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

the class SettingsRestIT method deleteTest.

/**
 * Delete test.
 *
 * @throws Exception the exception
 */
@Test
public void deleteTest() throws Exception {
    SettingType settingType = createTestSettingType();
    assertNotNull(settingType);
    final HttpResponse response = Request.Delete(getBaseUrl() + "config/rest/settings/" + settingType.getId()).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
Also used : HttpResponse(org.apache.http.HttpResponse) SettingType(eu.europa.ec.fisheries.schema.config.types.v1.SettingType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Aggregations

SettingType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingType)9 SettingType (eu.europa.ec.fisheries.schema.config.types.v1.SettingType)5 Test (org.junit.Test)5 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)4 HttpResponse (org.apache.http.HttpResponse)4 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)3 ConfigServiceException (eu.europa.ec.fisheries.uvms.config.exception.ConfigServiceException)3 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)2 ExchangeServiceException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)2 HashMap (java.util.HashMap)2 SettingsCreateQuery (eu.europa.ec.fisheries.schema.config.types.v1.SettingsCreateQuery)1 ServiceResponseType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType)1 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)1 ExchangeMessageException (eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException)1 ExchangeModelMapperException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException)1 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)1 ArrayList (java.util.ArrayList)1