use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType 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.CapabilityListType 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.CapabilityListType in project UVMS-ExchangeModule-APP by UnionVMS.
the class MockData method getCapabilityList.
public static CapabilityListType getCapabilityList() {
CapabilityListType dto = new CapabilityListType();
CapabilityType capability = new CapabilityType();
capability.setType(CapabilityTypeType.POLLABLE);
capability.setValue("TRUE");
dto.getCapability().add(capability);
return dto;
}
use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType 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.CapabilityListType in project arctic-sea by 52North.
the class SensorMLEncoderv20 method createCapability.
private Capabilities createCapability(final SmlCapabilities capabilities) throws EncodingException {
Capabilities xbCapabilities = null;
if (capabilities.isSetAbstractDataComponents()) {
xbCapabilities = Capabilities.Factory.newInstance(getXmlOptions());
if (capabilities.isSetName()) {
xbCapabilities.setName(capabilities.getName());
}
CapabilityListType capabilityList = xbCapabilities.addNewCapabilityList();
if (capabilities.isSetCapabilities()) {
for (SmlCapability capability : capabilities.getCapabilities()) {
XmlObject encodeObjectToXml = encodeObjectToXmlSwe20(capability.getAbstractDataComponent());
Capability c = capabilityList.addNewCapability();
if (capability.isSetName()) {
c.setName(NcName.makeValid(capability.getName()));
} else if (capability.getAbstractDataComponent().isSetName()) {
capability.setName(NcName.makeValid(capability.getAbstractDataComponent().getName().getValue()));
} else {
capability.setName(NcName.makeValid(capability.getAbstractDataComponent().getDefinition()));
}
XmlObject substituteElement = XmlHelper.substituteElement(c.addNewAbstractDataComponent(), encodeObjectToXml);
substituteElement.set(encodeObjectToXml);
}
} else if (capabilities.isSetAbstractDataComponents()) {
for (SweAbstractDataComponent component : capabilities.getAbstractDataComponents()) {
XmlObject encodeObjectToXml = encodeObjectToXmlSwe20(component);
Capability capability = capabilityList.addNewCapability();
if (component.isSetName()) {
capability.setName(NcName.makeValid(component.getName().getValue()));
} else {
capability.setName(NcName.makeValid(component.getDefinition()));
}
XmlObject substituteElement = XmlHelper.substituteElement(capability.addNewAbstractDataComponent(), encodeObjectToXml);
substituteElement.set(encodeObjectToXml);
}
}
}
return xbCapabilities;
}
Aggregations