Search in sources :

Example 1 with ServiceType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType 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 2 with ServiceType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType 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 3 with ServiceType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType 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());
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) SettingListType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType) Test(org.junit.Test)

Example 4 with ServiceType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType in project UVMS-ExchangeModule-APP by UnionVMS.

the class RegistryBusEventListener method onMessage.

@Override
public void onMessage(Message message) {
    TextMessage textMessage = (TextMessage) message;
    ServiceType settings = null;
    try {
        ExchangeRegistryBaseRequest request = JAXBMarshaller.unmarshallTextMessage(textMessage, ExchangeRegistryBaseRequest.class);
        LOG.info("Eventbus listener for Exchange Registry (ExchangeModelConstants.EXCHANGE_REGISTER_SERVICE): {} {}", ExchangeModelConstants.EXCHANGE_REGISTER_SERVICE, request);
        switch(request.getMethod()) {
            case REGISTER_SERVICE:
                RegisterServiceRequest regReq = JAXBMarshaller.unmarshallTextMessage(textMessage, RegisterServiceRequest.class);
                settings = regReq.getService();
                registerServiceEvent.fire(new PluginMessageEvent(textMessage));
                break;
            case UNREGISTER_SERVICE:
                UnregisterServiceRequest unRegReq = JAXBMarshaller.unmarshallTextMessage(textMessage, UnregisterServiceRequest.class);
                settings = unRegReq.getService();
                unregisterServiceEvent.fire(new PluginMessageEvent(textMessage));
                break;
            default:
                LOG.error("[ Not implemented method consumed: {} ]", request.getMethod());
                throw new ExchangeMessageException("[ Not implemented method consumed: " + request.getMethod() + " ]");
        }
    } catch (ExchangeMessageException | ExchangeModelMarshallException | NullPointerException e) {
        LOG.error("[ Error when receiving message on topic in exchange: {}] {}", message, e);
        errorEvent.fire(new PluginMessageEvent(textMessage, settings, ExchangePluginResponseMapper.mapToPluginFaultResponse(FaultCode.EXCHANGE_TOPIC_MESSAGE.getCode(), "Error when receiving message in exchange " + e.getMessage())));
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) UnregisterServiceRequest(eu.europa.ec.fisheries.schema.exchange.registry.v1.UnregisterServiceRequest) RegisterServiceRequest(eu.europa.ec.fisheries.schema.exchange.registry.v1.RegisterServiceRequest) ExchangeMessageException(eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException) PluginMessageEvent(eu.europa.ec.fisheries.uvms.exchange.message.event.carrier.PluginMessageEvent) TextMessage(javax.jms.TextMessage) ExchangeRegistryBaseRequest(eu.europa.ec.fisheries.schema.exchange.registry.v1.ExchangeRegistryBaseRequest)

Example 5 with ServiceType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType 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)

Aggregations

ArrayList (java.util.ArrayList)8 ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)7 Test (org.junit.Test)7 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)5 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)5 ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)5 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)4 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)4 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)4 CapabilityListType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType)3 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)3 ServiceCapability (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)3 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)3 HashMap (java.util.HashMap)3 List (java.util.List)3 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)3 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)3 Map (java.util.Map)2 ServiceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType)1