Search in sources :

Example 1 with ServiceCapability

use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability 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());
}
Also used : ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) ArrayList(java.util.ArrayList) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) ServiceCapability(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability) ServiceSetting(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting) Test(org.junit.Test)

Example 2 with ServiceCapability

use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability 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());
}
Also used : ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) ArrayList(java.util.ArrayList) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) ServiceCapability(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability) ServiceSetting(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting) Test(org.junit.Test)

Example 3 with ServiceCapability

use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability in project UVMS-ExchangeModule-APP by UnionVMS.

the class ServiceMapper method toCapabilityEntity.

private static ServiceCapability toCapabilityEntity(Service parent, CapabilityType capability, String username) {
    ServiceCapability entity = new ServiceCapability();
    entity.setService(parent);
    entity.setCapability(capability.getType());
    entity.setUpdatedBy(username);
    entity.setUpdatedTime(DateUtils.nowUTC().toDate());
    entity.setValue(capability.getValue());
    return entity;
}
Also used : ServiceCapability(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)

Example 4 with ServiceCapability

use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability 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());
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) ArrayList(java.util.ArrayList) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) ServiceCapability(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability) SettingListType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType) ServiceSetting(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with ServiceCapability

use of eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability in project UVMS-ExchangeModule-APP by UnionVMS.

the class MockData method getEntityCapabilities.

public static List<ServiceCapability> getEntityCapabilities(Service parent) {
    List<ServiceCapability> list = new ArrayList<>();
    ServiceCapability capability = new ServiceCapability();
    capability.setCapability(CapabilityTypeType.POLLABLE);
    capability.setService(parent);
    capability.setValue("TRUE");
    list.add(capability);
    return list;
}
Also used : ArrayList(java.util.ArrayList) ServiceCapability(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)

Aggregations

ServiceCapability (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)9 ArrayList (java.util.ArrayList)6 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)4 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)4 ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)3 Test (org.junit.Test)3 ExchangeDaoException (eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException)2 CapabilityListType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType)1 CapabilityType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityType)1 ServiceResponseType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType)1 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)1 NoEntityFoundException (eu.europa.ec.fisheries.uvms.exchange.exception.NoEntityFoundException)1 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)1 EntityExistsException (javax.persistence.EntityExistsException)1 NoResultException (javax.persistence.NoResultException)1 DateTime (org.joda.time.DateTime)1 Ignore (org.junit.Ignore)1