Search in sources :

Example 6 with SystemType

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);
}
Also used : SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) SystemType(net.opengis.sensorML.x101.SystemType) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) ResponsibleParty(net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) Test(org.junit.jupiter.api.Test)

Example 7 with SystemType

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());
    }
}
Also used : SystemType(net.opengis.sensorML.x101.SystemType) ContactList(net.opengis.sensorML.x101.ContactListDocument.ContactList) SensorML(org.n52.shetland.ogc.sensorML.SensorML) Member(net.opengis.sensorML.x101.ContactListDocument.ContactList.Member) System(org.n52.shetland.ogc.sensorML.System) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Test(org.junit.jupiter.api.Test)

Example 8 with SystemType

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();
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) XmlObject(org.apache.xmlbeans.XmlObject) SystemType(net.opengis.sensorML.x101.SystemType)

Example 9 with SystemType

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;
}
Also used : ProcessModel(org.n52.shetland.ogc.sensorML.ProcessModel) ComponentType(net.opengis.sensorML.x101.ComponentType) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) QName(javax.xml.namespace.QName) SystemType(net.opengis.sensorML.x101.SystemType) System(org.n52.shetland.ogc.sensorML.System) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) ProcessModelType(net.opengis.sensorML.x101.ProcessModelType)

Example 10 with SystemType

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);
}
Also used : SystemType(net.opengis.sensorML.x101.SystemType) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)

Aggregations

SystemType (net.opengis.sensorML.x101.SystemType)24 Test (org.junit.jupiter.api.Test)18 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)15 SystemType (org.osate.aadl2.SystemType)14 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)13 ArrayList (java.util.ArrayList)12 System (org.n52.shetland.ogc.sensorML.System)11 EObject (org.eclipse.emf.ecore.EObject)9 SensorML (org.n52.shetland.ogc.sensorML.SensorML)9 AnnexSubclause (org.osate.aadl2.AnnexSubclause)8 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)6 PublicPackageSection (org.osate.aadl2.PublicPackageSection)6 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)5 HashSet (java.util.HashSet)5 SystemImplementation (org.osate.aadl2.SystemImplementation)5 SafetyReq (com.ge.research.osate.verdict.dsl.verdict.SafetyReq)4 Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)4 Verdict (com.ge.research.osate.verdict.dsl.verdict.Verdict)4 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)4 SmlPerson (org.n52.shetland.ogc.sensorML.SmlPerson)4