use of eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testModelToEntity.
@Test
public void testModelToEntity() throws ExchangeDaoException, ExchangeDaoMappingException {
Integer id = 1;
ServiceType model = MockData.getModel(id);
CapabilityListType capabilityListType = MockData.getCapabilityList();
SettingListType settingListType = MockData.getSettingList();
// mockDaoToEntity();
Service result = mapper.toServiceEntity(model, capabilityListType, settingListType, "TEST");
assertSame(model.getName(), result.getName());
assertSame(model.getServiceClassName(), result.getServiceClassName());
}
use of eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType in project UVMS-ExchangeModule-APP by UnionVMS.
the class ServiceMapper method toServiceModel.
public static ServiceResponseType toServiceModel(Service entity) {
ServiceResponseType model = new ServiceResponseType();
model.setDescription(entity.getDescription());
model.setName(entity.getName());
model.setServiceClassName(entity.getServiceClassName());
CapabilityListType capabilityList = toCapabilityListModel(entity.getServiceCapabilityList());
model.setCapabilityList(capabilityList);
model.setServiceResponseMessageName(entity.getServiceResponse());
model.setPluginType(entity.getType());
model.setSatelliteType(entity.getSatelliteType());
model.setStatus(mapStatus(entity.getStatus()));
model.setActive(entity.getActive());
SettingListType settingList = toSettingListModel(entity.getServiceSettingList());
model.setSettingList(settingList);
return model;
}
use of eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType in project UVMS-ExchangeModule-APP by UnionVMS.
the class DomainModelBeanTest method testCreateModel.
@Ignore
@Test
public void testCreateModel() throws ExchangeModelException, ExchangeDaoException, ExchangeDaoMappingException {
Long id = 1L;
ServiceType serviceType = MockData.getModel(id.intValue());
CapabilityListType capabilityListType = MockData.getCapabilityList();
SettingListType settingListType = MockData.getSettingList();
Service service = new Service();
service.setId(id);
service.setActive(false);
List<ServiceCapability> serviceCapabilityList = new ArrayList<>();
service.setServiceCapabilityList(serviceCapabilityList);
List<ServiceSetting> serviceSettingList = new ArrayList<>();
service.setServiceSettingList(serviceSettingList);
when(dao.getServiceByServiceClassName(any(String.class))).thenReturn(null);
// when(dao.updateService(any(Service.class))).thenReturn(service);
ServiceResponseType result = model.registerService(serviceType, capabilityListType, settingListType, "TEST");
// assertEquals(id.toString(), result.getId());
}
use of eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeServiceBean method upsertSettings.
@Override
public ServiceResponseType upsertSettings(String serviceClassName, SettingListType settingListType, String username) throws ExchangeServiceException {
LOG.info("Upsert settings in service layer: {} {} {}", serviceClassName, settingListType, username);
try {
ServiceResponseType updatedSettings = serviceRegistryModel.updatePluginSettings(serviceClassName, settingListType, username);
sendAuditLogMessageForUpdateService(compressServiceClassName(serviceClassName), username);
return updatedSettings;
} catch (ExchangeModelException e) {
throw new ExchangeServiceException(e.getMessage());
}
}
use of eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testUpsert.
@Test
public void testUpsert() {
String newValue = "NEW_VALUE";
Service entity = MockData.getEntity(1);
entity.setServiceCapabilityList(MockData.getEntityCapabilities(entity));
entity.setServiceSettingList(MockData.getEntitySettings(entity));
SettingListType updateSettings = new SettingListType();
SettingType updateSetting = new SettingType();
updateSetting.setKey(MockData.SETTING_KEY);
updateSetting.setValue(newValue);
updateSettings.getSetting().add(updateSetting);
List<ServiceSetting> list = mapper.mapSettingsList(entity, updateSettings, "TEST");
assertFalse(list.isEmpty());
for (ServiceSetting setting : list) {
assertSame(setting.getValue(), newValue);
}
SettingListType newSettings = new SettingListType();
SettingType newSetting = new SettingType();
newSetting.setKey("NEW.KEY");
newSetting.setValue("NEW.VALUE");
newSettings.getSetting().add(newSetting);
list = mapper.mapSettingsList(entity, newSettings, "TEST");
assertTrue(list.size() == 1);
}
Aggregations