use of org.geotoolkit.sml.xml.v101.SystemType in project arctic-sea by 52North.
the class SensorMLEncoderV101Test method should_encode_single_contact_responsibleParty.
@Test
public void should_encode_single_contact_responsibleParty() throws EncodingException {
final SensorML sensorML = new SensorML();
final System system = new System();
sensorML.addMember(system);
final SmlResponsibleParty responsibleParty = createResponsibleParty("");
system.addContact(responsibleParty);
final SystemType xbSystem = encodeSystem(sensorML);
assertThat(xbSystem.sizeOfContactArray(), is(1));
assertThat(xbSystem.getContactArray(0).getContactList().getMemberArray(0).isSetResponsibleParty(), is(true));
final ResponsibleParty xbResponsibleParty = xbSystem.getContactArray(0).getContactList().getMemberArray(0).getResponsibleParty();
checkResponsibleParty(responsibleParty, xbResponsibleParty);
}
use of org.geotoolkit.sml.xml.v101.SystemType in project arctic-sea by 52North.
the class SensorMLEncoderV101Test method should_encode_multiple_contacts_in_contactList.
@Test
public void should_encode_multiple_contacts_in_contactList() throws EncodingException {
final SensorML sensorML = new SensorML();
final System system = new System();
sensorML.addMember(system);
final SmlPerson contact1 = createPerson("1");
final SmlPerson contact2 = createPerson("2");
system.addContact(contact1);
system.addContact(contact2);
final SystemType xbSystem = encodeSystem(sensorML);
assertThat(xbSystem.sizeOfContactArray(), is(1));
assertThat(xbSystem.getContactArray(0).isSetContactList(), is(true));
final ContactList xbContactList = xbSystem.getContactArray(0).getContactList();
assertThat(xbContactList.sizeOfMemberArray(), is(2));
final Member member = xbContactList.getMemberArray(0);
final Member member2 = xbContactList.getMemberArray(1);
assertThat(member.isSetPerson(), is(true));
assertThat(member2.isSetPerson(), is(true));
if (member.getPerson().getName().equals(contact1.getName())) {
checkPerson(contact1, member.getPerson());
checkPerson(contact2, member2.getPerson());
} else {
checkPerson(contact1, member2.getPerson());
checkPerson(contact2, member.getPerson());
}
}
use of org.geotoolkit.sml.xml.v101.SystemType in project arctic-sea by 52North.
the class SensorMLEncoderV101Test method encodeSystem.
private SystemType encodeSystem(final SensorML sensorMl) throws EncodingException {
final XmlObject encodedSml = sensorMLEncoderv101.encode(sensorMl);
assertThat(encodedSml, instanceOf(SensorMLDocument.class));
final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSml = ((SensorMLDocument) encodedSml).getSensorML();
assertThat(xbSml.getMemberArray().length, is(1));
assertThat(xbSml.getMemberArray()[0].getProcess(), instanceOf(SystemType.class));
return (SystemType) xbSml.getMemberArray()[0].getProcess();
}
use of org.geotoolkit.sml.xml.v101.SystemType in project arctic-sea by 52North.
the class SensorMLEncoderv101 method createSensorMLDescription.
protected SensorMLDocument createSensorMLDescription(final SensorML smlSensorDesc) throws EncodingException {
final SensorMLDocument sensorMLDoc = SensorMLDocument.Factory.newInstance(getXmlOptions());
final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML = sensorMLDoc.addNewSensorML();
xbSensorML.setVersion(SensorMLConstants.VERSION_V101);
if (smlSensorDesc.isSetMembers()) {
for (final AbstractProcess sml : smlSensorDesc.getMembers()) {
if (sml instanceof System) {
final SystemType xbSystem = (SystemType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_SYSTEM), SystemType.type);
final System smlSystem = (System) sml;
addAbstractProcessValues(xbSystem, smlSystem);
addSystemValues(xbSystem, smlSystem);
} else if (sml instanceof ProcessModel) {
final ProcessModelType xbProcessModel = (ProcessModelType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_PROCESS_MODEL), ProcessModelType.type);
final ProcessModel smlProcessModel = (ProcessModel) sml;
addAbstractProcessValues(xbProcessModel, smlProcessModel);
addProcessModelValues(xbProcessModel, smlProcessModel);
} else if (sml instanceof org.n52.shetland.ogc.sensorML.Component) {
final ComponentType xbCompontent = (ComponentType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_COMPONENT), ComponentType.type);
final org.n52.shetland.ogc.sensorML.Component smlComponent = (org.n52.shetland.ogc.sensorML.Component) sml;
addAbstractProcessValues(xbCompontent, smlComponent);
addComponentValues(xbCompontent, smlComponent);
}
}
}
return sensorMLDoc;
}
use of org.geotoolkit.sml.xml.v101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method addChildProcedure.
private void addChildProcedure(ComponentList xbComponentList, String identifier) {
Component xbComponent = xbComponentList.addNewComponent();
xbComponent.setName(SensorMLConstants.ELEMENT_NAME_CHILD_PROCEDURES);
SystemType xbSystem = (SystemType) xbComponent.addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
addIdentifier(xbIdentifierList, "anyname", OGCConstants.URN_UNIQUE_IDENTIFIER, identifier);
}
Aggregations