Search in sources :

Example 6 with Contact

use of org.n52.shetland.inspire.base2.Contact in project arctic-sea by 52North.

the class ReportingHeaderReaderTest method testValidity.

@Test
public void testValidity() throws Exception {
    EReportingHeader header = new EReportingHeader().setInspireID(new Identifier("id", "namespace").setVersionId(Nillable.missing())).setChange(new EReportingChange("Changed because... you know")).setReportingPeriod(Referenceable.of(Nillable.present(new TimeInstant(DateTime.now())))).setReportingAuthority(new RelatedParty().setIndividualName(Nillable.missing()).setOrganisationName("Organisation").setPositionName("Postionti").addRole(new Reference().setHref(URI.create("http://hallo"))).addRole(Nillable.withheld()).setContact(new Contact().addTelephoneFacsimile("1234").addTelephoneFacsimile(Nillable.missing()).addTelephoneVoice("asdfasdf").setHoursOfService(new PT_FreeText().addTextGroup(new LocalisedCharacterString("asdfasdf"))).setWebsite(Nillable.unknown()).setElectronicMailAddress(Nillable.unknown()).setAddress(new AddressRepresentation().setPostCode("12341234").setAddressFeature(new Reference().setHref(URI.create("http://asdfasdf"))).addLocatorDesignator("localtor").addAddressArea(Nillable.withheld()).addAddressArea(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))).addAdminUnit(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))).addPostName(Nillable.withheld()).addPostName(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))).addThoroughfare(Nillable.withheld()).addThoroughfare(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))))));
    try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
        new EReportingHeaderEncoder(EncodingContext.of(EncoderFlags.ENCODER_REPOSITORY, new EncoderRepository()), baos, header).write();
        ByteArrayInputStream in = new ByteArrayInputStream(baos.toByteArray());
        EReportingHeader read = new ReportingHeaderReader().read(in);
        errors.checkThat(read.getChange(), is(equalTo(header.getChange())));
        errors.checkThat(read.getContent(), is(equalTo(header.getContent())));
        errors.checkThat(read.getDelete(), is(equalTo(header.getDelete())));
        errors.checkThat(read.getInspireID(), is(equalTo(header.getInspireID())));
        errors.checkThat(read.getReportingPeriod(), is(equalTo(header.getReportingPeriod())));
        errors.checkThat(read.getReportingAuthority(), is(equalTo(header.getReportingAuthority())));
        errors.checkThat(read.getReportingAuthority().getIndividualName(), is(header.getReportingAuthority().getIndividualName()));
        errors.checkThat(read.getReportingAuthority().getOrganisationName().get(), is(header.getReportingAuthority().getOrganisationName().get()));
        errors.checkThat(read.getReportingAuthority().getPositionName().get(), is(header.getReportingAuthority().getPositionName().get()));
        Contact c1 = read.getReportingAuthority().getContact().get();
        Contact c2 = header.getReportingAuthority().getContact().get();
        errors.checkThat(c1, is(c2));
        errors.checkThat(c1.getContactInstructions(), is(c2.getContactInstructions()));
        errors.checkThat(c1.getElectronicMailAddress(), is(c2.getElectronicMailAddress()));
        errors.checkThat(c1.getHoursOfService().get(), is(c2.getHoursOfService().get()));
        errors.checkThat(c1.getTelephoneFacsimile(), is(c2.getTelephoneFacsimile()));
        errors.checkThat(c1.getTelephoneVoice(), is(c2.getTelephoneVoice()));
        errors.checkThat(c1.getWebsite(), is(c2.getWebsite()));
        AddressRepresentation a1 = c1.getAddress().get();
        AddressRepresentation a2 = c2.getAddress().get();
        errors.checkThat(a1.getAddressAreas(), is(a2.getAddressAreas()));
        errors.checkThat(a1.getAddressFeature(), is(a2.getAddressFeature()));
        errors.checkThat(a1.getAdminUnits(), is(a2.getAdminUnits()));
        errors.checkThat(a1.getLocatorDesignators(), is(a2.getLocatorDesignators()));
        errors.checkThat(a1.getLocatorNames(), is(a2.getLocatorNames()));
        errors.checkThat(a1.getPostCode(), is(a2.getPostCode()));
        errors.checkThat(a1.getPostNames(), is(a2.getPostNames()));
        errors.checkThat(a1.getThoroughfares(), is(a2.getThoroughfares()));
    } catch (Exception e) {
        errors.addError(e);
    }
}
Also used : LocalisedCharacterString(org.n52.shetland.iso.gmd.LocalisedCharacterString) Spelling(org.n52.shetland.inspire.Spelling) Pronunciation(org.n52.shetland.inspire.Pronunciation) Reference(org.n52.shetland.w3c.xlink.Reference) EncoderRepository(org.n52.svalbard.encode.EncoderRepository) PT_FreeText(org.n52.shetland.iso.gmd.PT_FreeText) ByteArrayOutputStream(java.io.ByteArrayOutputStream) URI(java.net.URI) Contact(org.n52.shetland.inspire.base2.Contact) Identifier(org.n52.shetland.inspire.base.Identifier) ByteArrayInputStream(java.io.ByteArrayInputStream) ReportingHeaderReader(org.n52.svalbard.read.ReportingHeaderReader) EReportingHeader(org.n52.shetland.aqd.EReportingHeader) AddressRepresentation(org.n52.shetland.inspire.ad.AddressRepresentation) GeographicalName(org.n52.shetland.inspire.GeographicalName) RelatedParty(org.n52.shetland.inspire.base2.RelatedParty) CodeType(org.n52.shetland.ogc.gml.CodeType) EReportingChange(org.n52.shetland.aqd.EReportingChange) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Example 7 with Contact

use of org.n52.shetland.inspire.base2.Contact in project arctic-sea by 52North.

the class Iso19139GmdEncoder method encodeMDMetadata.

private XmlObject encodeMDMetadata(MDMetadata mdMetadata, EncodingContext context) throws EncodingException {
    if (mdMetadata.isSetSimpleAttrs()) {
        MDMetadataPropertyType mdmpt = MDMetadataPropertyType.Factory.newInstance(getXmlOptions());
        mdmpt.setHref(mdMetadata.getSimpleAttrs().getHref());
        if (mdMetadata.getSimpleAttrs().isSetTitle()) {
            mdmpt.setTitle(mdMetadata.getSimpleAttrs().getTitle());
        }
        if (mdMetadata.getSimpleAttrs().isSetRole()) {
            mdmpt.setRole(mdMetadata.getSimpleAttrs().getRole());
        }
        return mdmpt;
    }
    MDMetadataType mdmt = MDMetadataType.Factory.newInstance(getXmlOptions());
    encodeAbstractObject(mdmt, mdMetadata);
    // add contacts
    for (CiResponsibleParty contact : mdMetadata.getContact()) {
        mdmt.addNewContact().set(encodeResponsibleParty(contact, EncodingContext.of(XmlBeansEncodingFlags.PROPERTY_TYPE, true)));
    }
    // add dateStamp
    mdmt.addNewDateStamp().setDateTime(mdMetadata.getDateStamp().toCalendar(Locale.ROOT));
    // add identificationInfo
    for (AbstractMDIdentification identificationInfo : mdMetadata.getIdentificationInfo()) {
        if (identificationInfo.isSetSimpleAttrs()) {
            MDIdentificationPropertyType mdipt = mdmt.addNewIdentificationInfo();
            mdipt.setHref(identificationInfo.getSimpleAttrs().getHref());
            if (identificationInfo.getSimpleAttrs().isSetTitle()) {
                mdipt.setTitle(identificationInfo.getSimpleAttrs().getTitle());
            }
            if (identificationInfo.getSimpleAttrs().isSetRole()) {
                mdipt.setRole(identificationInfo.getSimpleAttrs().getRole());
            }
        } else {
            mdmt.addNewIdentificationInfo().set(encode(identificationInfo, EncodingContext.of(XmlBeansEncodingFlags.PROPERTY_TYPE)));
        // TODO substitution???
        }
    }
    // TODO all other optional elements if required
    if (context.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
        MDMetadataPropertyType mdmpt = MDMetadataPropertyType.Factory.newInstance(getXmlOptions());
        mdmpt.setMDMetadata(mdmt);
        return mdmpt;
    } else if (context.has(XmlBeansEncodingFlags.DOCUMENT)) {
        MDMetadataDocument mdmd = MDMetadataDocument.Factory.newInstance(getXmlOptions());
        mdmd.setMDMetadata(mdmt);
        return mdmd;
    }
    return mdmt;
}
Also used : CiResponsibleParty(org.n52.shetland.iso.gmd.CiResponsibleParty) AbstractMDIdentification(org.n52.shetland.iso.gmd.AbstractMDIdentification) MDMetadataType(org.isotc211.x2005.gmd.MDMetadataType) MDMetadataPropertyType(org.isotc211.x2005.gmd.MDMetadataPropertyType) MDIdentificationPropertyType(org.isotc211.x2005.gmd.MDIdentificationPropertyType) MDMetadataDocument(org.isotc211.x2005.gmd.MDMetadataDocument)

Example 8 with Contact

use of org.n52.shetland.inspire.base2.Contact in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_merge_and_encode_multiple_contacts.

@Test
public void should_merge_and_encode_multiple_contacts() throws EncodingException {
    final SensorML sensorML = new SensorML();
    final System system = new System();
    sensorML.addMember(system);
    final SmlPerson p1 = createPerson("1");
    final SmlResponsibleParty rp1 = createResponsibleParty("1");
    system.addContact(p1);
    system.addContact(rp1);
    final SensorMLDocument xbSensorML = SensorMLDocument.Factory.newInstance();
    final SystemType xbSystem = SystemType.Factory.newInstance();
    final ContactList xbContactList = xbSystem.addNewContact().addNewContactList();
    final Person xbP1 = xbContactList.addNewMember().addNewPerson();
    setPersonValues(p1, xbP1);
    final ResponsibleParty xbRP1 = xbContactList.addNewMember().addNewResponsibleParty();
    setResponsiblePartyValues(rp1, xbRP1);
    final XmlObject xbProcess = xbSensorML.addNewSensorML().addNewMember().addNewProcess().set(xbSystem);
    XmlHelper.substituteElement(xbProcess, xbSystem);
    xbSensorML.getSensorML().setVersion("1.0.1");
    sensorML.setXml(xbSensorML.xmlText());
    final SystemType xbEncodedSystem = encodeSystem(sensorML);
    assertThat(xbEncodedSystem.sizeOfContactArray(), is(1));
    assertThat(xbEncodedSystem.getContactArray(0).isSetContactList(), is(true));
    assertThat(xbEncodedSystem.getContactArray(0).getContactList().sizeOfMemberArray(), is(2));
    boolean personChecked = false, responsiblePartyChecked = false;
    for (final Member member : xbEncodedSystem.getContactArray(0).getContactList().getMemberArray()) {
        if (member.isSetPerson()) {
            checkPerson(p1, member.getPerson());
            personChecked = true;
        } else if (member.isSetResponsibleParty()) {
            checkResponsibleParty(rp1, member.getResponsibleParty());
            responsiblePartyChecked = true;
        }
    }
    if (!personChecked) {
        fail("sml:Person not found in contact/contactList");
    }
    if (!responsiblePartyChecked) {
        fail("sml:ResponsibleParty not found in contact/ContactList");
    }
}
Also used : SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SystemType(net.opengis.sensorML.x101.SystemType) XmlObject(org.apache.xmlbeans.XmlObject) ContactList(net.opengis.sensorML.x101.ContactListDocument.ContactList) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) ResponsibleParty(net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty) SensorML(org.n52.shetland.ogc.sensorML.SensorML) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Person(net.opengis.sensorML.x101.PersonDocument.Person) 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.Test)

Example 9 with Contact

use of org.n52.shetland.inspire.base2.Contact in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_encode_single_contact_person.

// @Test
// public void should_encode_features_of_interest() throws EncodingException {
// final SensorML sensorMl = new SensorML();
// final System system = new System();
// sensorMl.addMember(system);
// system.addFeatureOfInterest(TEST_ID_1);
// system.addFeatureOfInterest(TEST_ID_2);
// final SimpleDataRecordType xbSimpleDataRecord =
// encodeSimpleDataRecord(sensorMl, SensorMLConstants.ELEMENT_NAME_FEATURES_OF_INTEREST, 2);
// validateField(xbSimpleDataRecord.getFieldArray()[0], SensorMLConstants.FEATURE_OF_INTEREST_FIELD_NAME + 1,
// SensorMLConstants.FEATURE_OF_INTEREST_FIELD_DEFINITION, TEST_ID_1);
// validateField(xbSimpleDataRecord.getFieldArray()[1], SensorMLConstants.FEATURE_OF_INTEREST_FIELD_NAME + 2,
// SensorMLConstants.FEATURE_OF_INTEREST_FIELD_DEFINITION, TEST_ID_2);
// }
// 
// @Test
// public void should_encode_offerings() throws EncodingException {
// final SensorML sensorMl = new SensorML();
// final System system = new System();
// sensorMl.addMember(system);
// system.addOffering(new SosOffering(TEST_ID_1, TEST_NAME_1));
// system.addOffering(new SosOffering(TEST_ID_2, TEST_NAME_2));
// final SimpleDataRecordType xbSimpleDataRecord =
// encodeSimpleDataRecord(sensorMl, SensorMLConstants.ELEMENT_NAME_OFFERINGS, 2);
// validateField(xbSimpleDataRecord.getFieldArray()[0], TEST_NAME_1, SensorMLConstants.OFFERING_FIELD_DEFINITION,
// TEST_ID_1);
// validateField(xbSimpleDataRecord.getFieldArray()[1], TEST_NAME_2, SensorMLConstants.OFFERING_FIELD_DEFINITION,
// TEST_ID_2);
// }
// 
// @Test
// public void should_encode_parent_procedures() throws EncodingException {
// final SensorML sensorMl = new SensorML();
// final System system = new System();
// sensorMl.addMember(system);
// system.addParentProcedure(TEST_ID_1);
// system.addParentProcedure(TEST_ID_2);
// final SimpleDataRecordType xbSimpleDataRecord =
// encodeSimpleDataRecord(sensorMl, SensorMLConstants.ELEMENT_NAME_PARENT_PROCEDURES, 2);
// validateField(xbSimpleDataRecord.getFieldArray()[0], SensorMLConstants.PARENT_PROCEDURE_FIELD_NAME + 1,
// SensorMLConstants.PARENT_PROCEDURE_FIELD_DEFINITION, TEST_ID_1);
// validateField(xbSimpleDataRecord.getFieldArray()[1], SensorMLConstants.PARENT_PROCEDURE_FIELD_NAME + 2,
// SensorMLConstants.PARENT_PROCEDURE_FIELD_DEFINITION, TEST_ID_2);
// }
// 
// @Test
// public void should_encode_child_procedures() throws EncodingException {
// final SensorML sensorMl = new SensorML();
// final System system = new System();
// sensorMl.addMember(system);
// final System childProcedure = new System();
// childProcedure.setIdentifier(TEST_CHILD_1);
// system.addChildProcedure(childProcedure);
// childProcedure.addFeatureOfInterest(TEST_ID_1);
// final SystemType xbSystemType = encodeSystem(sensorMl);
// assertThat(xbSystemType.getComponents().getComponentList().sizeOfComponentArray(), is(1));
// final Component xbComponent = xbSystemType.getComponents().getComponentList().getComponentArray(0);
// assertThat(xbComponent.getProcess(), instanceOf(SystemType.class));
// final SystemType xbComponentSystem = (SystemType) xbComponent.getProcess();
// final SimpleDataRecordType xbSimpleDataRecord =
// encodeSimpleDataRecord(xbComponentSystem, SensorMLConstants.ELEMENT_NAME_FEATURES_OF_INTEREST, 1);
// validateField(xbSimpleDataRecord.getFieldArray(0), SensorMLConstants.FEATURE_OF_INTEREST_FIELD_NAME,
// SensorMLConstants.FEATURE_OF_INTEREST_FIELD_DEFINITION, TEST_ID_1);
// }
// 
// @Test
// @SuppressWarnings("unchecked")
// public void should_aggregate_child_outputs() throws EncodingException {
// final SweQuantity q1 = new SweQuantity();
// q1.setDefinition("def1");
// q1.setUom("uom1");
// final SmlIo<?> output1 = new SmlIo<SweQuantity>(q1);
// 
// final SweQuantity q2 = new SweQuantity();
// q2.setDefinition("def2");
// q2.setUom("uom2");
// final SmlIo<?> output2 = new SmlIo<SweQuantity>(q2);
// 
// final SweQuantity q3 = new SweQuantity();
// q3.setDefinition("def3");
// q3.setUom("uom3");
// final SmlIo<?> output3 = new SmlIo<SweQuantity>(q3);
// 
// final SensorML sensorMl = new SensorML();
// sensorMl.setIdentifier("sensorMl");
// final System system = new System();
// system.setIdentifier("system");
// sensorMl.addMember(system);
// system.getOutputs().add(output1);
// 
// final SensorML childSml = new SensorML();
// childSml.setIdentifier("childSml");
// final System childSystem = new System();
// childSystem.setIdentifier("childSystem");
// childSml.addMember(childSystem);
// system.addChildProcedure(childSml);
// childSystem.getOutputs().add(output2);
// 
// final SensorML grandchildSml = new SensorML();
// grandchildSml.setIdentifier("grandchildSml");
// final System grandchildSystem = new System();
// grandchildSystem.setIdentifier("grandchildSystem");
// grandchildSml.addMember(grandchildSystem);
// childSystem.addChildProcedure(grandchildSml);
// grandchildSystem.getOutputs().add(output3);
// 
// encodeSystem(sensorMl);
// 
// assertThat(system.getOutputs(), hasItems(output1, output2, output3));
// assertThat(childSystem.getOutputs(), hasItems(output2, output3));
// assertThat(grandchildSystem.getOutputs(), hasItem(output3));
// }
@Test
public void should_encode_single_contact_person() throws EncodingException {
    final SensorML sensorML = new SensorML();
    final System system = new System();
    sensorML.addMember(system);
    final SmlPerson contact = createPerson("");
    system.addContact(contact);
    final SystemType xbSystem = encodeSystem(sensorML);
    assertThat(xbSystem.sizeOfContactArray(), is(1));
    assertThat(xbSystem.getContactArray(0).getContactList().getMemberArray(0).isSetPerson(), is(true));
    checkPerson(contact, xbSystem.getContactArray(0).getContactList().getMemberArray(0).getPerson());
}
Also used : SystemType(net.opengis.sensorML.x101.SystemType) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Test(org.junit.Test)

Example 10 with Contact

use of org.n52.shetland.inspire.base2.Contact in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_decode_contact_from_sml.

@Test
public void should_decode_contact_from_sml() throws DecodingException {
    String role1 = "role1";
    String role2 = "role2";
    String orgName = "orgName";
    String individualName = "individualName";
    String posName = "posName";
    String contactInstructions = "contactInstructions";
    String hoursOfService = "hoursOfService";
    String adminArea = "adminArea";
    String city = "city";
    String country = "country";
    String email = "email";
    String postalCode = "postalCode";
    String deliveryPoint1 = "deliveryPoint1";
    String deliveryPoint2 = "deliveryPoint2";
    String onlineResource1 = "onlineResource1";
    String onlineResource2 = "onlineResource2";
    String phoneVoice1 = "phoneVoice1";
    String phoneVoice2 = "phoneVoice2";
    String phoneFax1 = "phoneFax1";
    String phoneFax2 = "phoneFax2";
    String affiliation = "affiliation";
    String name = "name";
    String phoneNumber = "phoneNumber";
    String surname = "surname";
    String userID = "userID";
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    Contact xbContact = xbSystem.addNewContact();
    ContactList xbContactList = xbContact.addNewContactList();
    // responsible party
    ContactList.Member xbMember1 = xbContactList.addNewMember();
    xbMember1.setRole(role1);
    ResponsibleParty xbRespPart = xbMember1.addNewResponsibleParty();
    xbRespPart.setOrganizationName(orgName);
    xbRespPart.setIndividualName(individualName);
    xbRespPart.setPositionName(posName);
    ContactInfo xbContactInfo = xbRespPart.addNewContactInfo();
    xbContactInfo.setContactInstructions(contactInstructions);
    xbContactInfo.setHoursOfService(hoursOfService);
    ContactInfo.Address xbAddress = xbContactInfo.addNewAddress();
    xbAddress.setAdministrativeArea(adminArea);
    xbAddress.setCity(city);
    xbAddress.setCountry(country);
    xbAddress.setElectronicMailAddress(email);
    xbAddress.setPostalCode(postalCode);
    xbAddress.addDeliveryPoint(deliveryPoint1);
    xbAddress.addDeliveryPoint(deliveryPoint2);
    xbContactInfo.addNewOnlineResource().setHref(onlineResource1);
    xbContactInfo.addNewOnlineResource().setHref(onlineResource2);
    ContactInfo.Phone phone = xbContactInfo.addNewPhone();
    phone.addVoice(phoneVoice1);
    phone.addVoice(phoneVoice2);
    phone.addFacsimile(phoneFax1);
    phone.addFacsimile(phoneFax2);
    // person
    ContactList.Member xbMember2 = xbContactList.addNewMember();
    xbMember2.setRole(role2);
    Person xbPerson = xbMember2.addNewPerson();
    xbPerson.setAffiliation(affiliation);
    xbPerson.setEmail(email);
    xbPerson.setName(name);
    xbPerson.setPhoneNumber(phoneNumber);
    xbPerson.setSurname(surname);
    xbPerson.setUserID(userID);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    assertThat(absProcess.getContact(), notNullValue());
    assertThat(absProcess.getContact().size(), is(1));
    assertThat(absProcess.getContact().get(0), instanceOf(SmlContactList.class));
    SmlContactList smlContactList = (SmlContactList) absProcess.getContact().get(0);
    assertThat(smlContactList.getMembers(), notNullValue());
    assertThat(smlContactList.getMembers().size(), is(2));
    assertThat(smlContactList.getMembers().get(0).getRole(), is(role1));
    assertThat(smlContactList.getMembers().get(0), instanceOf(SmlResponsibleParty.class));
    SmlResponsibleParty smlRespParty = (SmlResponsibleParty) smlContactList.getMembers().get(0);
    assertThat(smlRespParty.getAdministrativeArea(), is(adminArea));
    assertThat(smlRespParty.getCity(), is(city));
    assertThat(smlRespParty.getContactInstructions(), is(contactInstructions));
    assertThat(smlRespParty.getCountry(), is(country));
    assertThat(smlRespParty.getDeliveryPoint().size(), is(2));
    assertThat(smlRespParty.getDeliveryPoint().get(0), is(deliveryPoint1));
    assertThat(smlRespParty.getDeliveryPoint().get(1), is(deliveryPoint2));
    assertThat(smlRespParty.getEmail(), is(email));
    assertThat(smlRespParty.getHoursOfService(), is(hoursOfService));
    assertThat(smlRespParty.getIndividualName(), is(individualName));
    assertThat(smlRespParty.getOnlineResources().size(), is(2));
    assertThat(smlRespParty.getOnlineResources().get(0), is(onlineResource1));
    assertThat(smlRespParty.getOnlineResources().get(1), is(onlineResource2));
    assertThat(smlRespParty.getOrganizationName(), is(orgName));
    assertThat(smlRespParty.getPhoneFax().size(), is(2));
    assertThat(smlRespParty.getPhoneFax().get(0), is(phoneFax1));
    assertThat(smlRespParty.getPhoneFax().get(1), is(phoneFax2));
    assertThat(smlRespParty.getPhoneVoice().size(), is(2));
    assertThat(smlRespParty.getPhoneVoice().get(0), is(phoneVoice1));
    assertThat(smlRespParty.getPhoneVoice().get(1), is(phoneVoice2));
    assertThat(smlRespParty.getPositionName(), is(posName));
    assertThat(smlRespParty.getPostalCode(), is(postalCode));
    assertThat(smlContactList.getMembers().get(1).getRole(), is(role2));
    assertThat(smlContactList.getMembers().get(1), instanceOf(SmlPerson.class));
    SmlPerson smlPerson = (SmlPerson) smlContactList.getMembers().get(1);
    assertThat(smlPerson.getAffiliation(), is(affiliation));
    assertThat(smlPerson.getEmail(), is(email));
    assertThat(smlPerson.getName(), is(name));
    assertThat(smlPerson.getPhoneNumber(), is(phoneNumber));
    assertThat(smlPerson.getSurname(), is(surname));
    assertThat(smlPerson.getUserID(), is(userID));
}
Also used : SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) ContactList(net.opengis.sensorML.x101.ContactListDocument.ContactList) SmlContactList(org.n52.shetland.ogc.sensorML.SmlContactList) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) ResponsibleParty(net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty) Contact(net.opengis.sensorML.x101.ContactDocument.Contact) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SmlContactList(org.n52.shetland.ogc.sensorML.SmlContactList) ContactInfo(net.opengis.sensorML.x101.ContactInfoDocument.ContactInfo) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Person(net.opengis.sensorML.x101.PersonDocument.Person) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 Contact (org.n52.shetland.inspire.base2.Contact)4 SmlPerson (org.n52.shetland.ogc.sensorML.SmlPerson)4 SmlResponsibleParty (org.n52.shetland.ogc.sensorML.SmlResponsibleParty)4 ContactList (net.opengis.sensorML.x101.ContactListDocument.ContactList)3 Person (net.opengis.sensorML.x101.PersonDocument.Person)3 ResponsibleParty (net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty)3 SystemType (net.opengis.sensorML.x101.SystemType)3 AddressRepresentation (org.n52.shetland.inspire.ad.AddressRepresentation)3 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)3 URI (java.net.URI)2 Contact (net.opengis.sensorML.x101.ContactDocument.Contact)2 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)2 XmlObject (org.apache.xmlbeans.XmlObject)2 EReportingChange (org.n52.shetland.aqd.EReportingChange)2 EReportingHeader (org.n52.shetland.aqd.EReportingHeader)2 GeographicalName (org.n52.shetland.inspire.GeographicalName)2 Pronunciation (org.n52.shetland.inspire.Pronunciation)2 Spelling (org.n52.shetland.inspire.Spelling)2 Identifier (org.n52.shetland.inspire.base.Identifier)2