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());
}
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());
}
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());
}
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())));
}
}
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());
}
Aggregations