use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testEntityToModel.
// private void mockDaoToEntity() throws ExchangeDaoException {
// when(enumDao.getMyEntityEnum(any(MyEntityEnumSource.class))).thenReturn(MyEntityEnum.VALUE_1);
// }
@Test
public void testEntityToModel() throws ExchangeDaoException, ExchangeDaoMappingException {
Integer id = 1;
Service entity = MockData.getEntity(id);
List<ServiceCapability> capabilityList = new ArrayList<>();
entity.setServiceCapabilityList(capabilityList);
List<ServiceSetting> settingList = new ArrayList<>();
entity.setServiceSettingList(settingList);
// mockDaoToEntity();
ServiceType result = mapper.toServiceModel(entity);
assertSame(entity.getName(), result.getName());
assertSame(entity.getServiceClassName(), result.getServiceClassName());
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting in project UVMS-ExchangeModule-APP by UnionVMS.
the class MapperTest method testEntityAndModelToModel.
@Test
public void testEntityAndModelToModel() throws ExchangeDaoException, ExchangeDaoMappingException {
Service entity = MockData.getEntity(1);
List<ServiceCapability> capabilityList = new ArrayList<>();
entity.setServiceCapabilityList(capabilityList);
List<ServiceSetting> settingList = new ArrayList<>();
entity.setServiceSettingList(settingList);
// mockDaoToEntity();
ServiceType result = mapper.toServiceModel(entity);
assertSame(entity.getName(), result.getName());
assertSame(entity.getServiceClassName(), result.getServiceClassName());
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting 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.uvms.exchange.entity.serviceregistry.ServiceSetting in project UVMS-ExchangeModule-APP by UnionVMS.
the class ServiceMapper method toSettingEntity.
private static ServiceSetting toSettingEntity(Service parent, SettingType setting, String username) {
ServiceSetting entity = new ServiceSetting();
entity.setService(parent);
entity.setSetting(setting.getKey());
entity.setUpdatedTime(DateUtils.nowUTC().toDate());
entity.setUser(username);
entity.setValue(setting.getValue());
return entity;
}
use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting in project UVMS-ExchangeModule-APP by UnionVMS.
the class ServiceRegistryModelBean method getPluginSettings.
@Override
public List<SettingType> getPluginSettings(String serviceClassName) throws ExchangeModelException {
LOG.info("Get plugin settings:{}", serviceClassName);
List<SettingType> settings = new ArrayList<>();
try {
List<ServiceSetting> entityList = dao.getServiceSettings(serviceClassName);
for (ServiceSetting entity : entityList) {
settings.add(ServiceMapper.toModel(entity));
}
} catch (ExchangeDaoException e) {
LOG.error("[ Error when getting list. {}] {}", serviceClassName, e.getMessage());
throw new ExchangeModelException("[ Error when getting list. ]");
}
return settings;
}
Aggregations