Search in sources :

Example 11 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class InsertResultRequestEncoderTest method shouldEncodeInsertResultRequest.

@Test
public void shouldEncodeInsertResultRequest() throws EncodingException {
    String version = Sos2Constants.SERVICEVERSION;
    String service = SosConstants.SOS;
    String templateIdentifier = "test-template-identifier";
    String resultValues = "test-result-values";
    InsertResultRequest request = new InsertResultRequest(service, version);
    request.setTemplateIdentifier(templateIdentifier);
    request.setResultValues(resultValues);
    XmlObject encodedRequest = encoder.create(request);
    Assert.assertThat(encodedRequest, Matchers.instanceOf(InsertResultDocument.class));
    Assert.assertThat(((InsertResultDocument) encodedRequest).getInsertResult(), Matchers.notNullValue());
    InsertResultType xbRequest = ((InsertResultDocument) encodedRequest).getInsertResult();
    Assert.assertThat(xbRequest.getService(), Is.is(service));
    Assert.assertThat(xbRequest.getVersion(), Is.is(version));
    Assert.assertThat(xbRequest.getTemplate(), Is.is(templateIdentifier));
    Assert.assertThat(xbRequest.getResultValues(), Matchers.instanceOf(XmlString.class));
    Assert.assertThat(((XmlString) xbRequest.getResultValues()).getStringValue(), Is.is(resultValues));
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) XmlString(org.apache.xmlbeans.XmlString) XmlObject(org.apache.xmlbeans.XmlObject) XmlString(org.apache.xmlbeans.XmlString) InsertResultType(net.opengis.sos.x20.InsertResultType) InsertResultDocument(net.opengis.sos.x20.InsertResultDocument) Test(org.junit.Test)

Example 12 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class SamplingEncoderv20Test method setup.

@Before
public void setup() throws InvalidSridException, ParseException {
    EncoderRepository encoderRepository = new EncoderRepository();
    OmEncoderv20 omEncoderv20 = new OmEncoderv20();
    omEncoderv20.setXmlOptions(XmlOptions::new);
    omEncoderv20.setEncoderRepository(encoderRepository);
    GmlEncoderv321 gmlEncoderv321 = new GmlEncoderv321();
    gmlEncoderv321.setEncoderRepository(encoderRepository);
    gmlEncoderv321.setXmlOptions(XmlOptions::new);
    SensorMLEncoderv20 sensorMLEncoderv20 = new SensorMLEncoderv20();
    sensorMLEncoderv20.setXmlOptions(XmlOptions::new);
    sensorMLEncoderv20.setEncoderRepository(encoderRepository);
    SweCommonEncoderv20 sweCommonEncoderv20 = new SweCommonEncoderv20();
    sweCommonEncoderv20.setEncoderRepository(encoderRepository);
    sweCommonEncoderv20.setXmlOptions(XmlOptions::new);
    encoder = new SamplingEncoderv20();
    encoder.setEncoderRepository(encoderRepository);
    encoder.setXmlOptions(XmlOptions::new);
    encoderRepository.setEncoders(Arrays.asList(omEncoderv20, gmlEncoderv321, sensorMLEncoderv20, sweCommonEncoderv20, encoder));
    encoderRepository.init();
    featureOfInterest = new SamplingFeature(new CodeWithAuthority("test-feature"));
    featureOfInterest.setIdentifier("test-feature-identifier");
    featureOfInterest.setName(new CodeType("test-feature-name"));
    featureOfInterest.setFeatureType(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_POINT);
    featureOfInterest.setGeometry(JTSHelper.createGeometryFromWKT("POINT (30 10)", 4326));
}
Also used : XmlOptions(org.apache.xmlbeans.XmlOptions) CodeType(org.n52.shetland.ogc.gml.CodeType) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Before(org.junit.Before)

Example 13 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_set_identifier.

@Test
public void should_set_identifier() throws EncodingException {
    final SensorML sensorMl = new SensorML();
    final System system = new System();
    sensorMl.addMember(system);
    system.addIdentifier(new SmlIdentifier(TEST_NAME_1, OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1));
    final SystemType xbSystem = encodeSystem(sensorMl);
    assertThat(xbSystem.getIdentificationArray().length, is(1));
    final IdentifierList xbIdentifierList = xbSystem.getIdentificationArray()[0].getIdentifierList();
    assertThat(xbIdentifierList.sizeOfIdentifierArray(), is(1));
    final Identifier xbIdentifier = xbIdentifierList.getIdentifierArray(0);
    assertThat(xbIdentifier.getName(), is(TEST_NAME_1));
    assertThat(xbIdentifier.getTerm().getDefinition(), is(OGCConstants.URN_UNIQUE_IDENTIFIER));
    assertThat(xbIdentifier.getTerm().getValue(), is(TEST_ID_1));
}
Also used : SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Identifier(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier) SystemType(net.opengis.sensorML.x101.SystemType) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Test(org.junit.Test)

Example 14 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class EReportingHeaderEncoderTest method testValidity.

@Test
public void testValidity() throws XMLStreamException, OwsExceptionReport, SAXException, MalformedURLException, IOException, URISyntaxException, EncodingException {
    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")))))));
    validate(header);
}
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) PT_FreeText(org.n52.shetland.iso.gmd.PT_FreeText) URI(java.net.URI) Contact(org.n52.shetland.inspire.base2.Contact) Identifier(org.n52.shetland.inspire.base.Identifier) 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 15 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class InspireIDJSONDecoder method decodeJSON.

@Override
public Identifier decodeJSON(JsonNode node, boolean validate) throws DecodingException {
    Identifier inspireID = new Identifier(getLocalId(node), getNamespace(node));
    inspireID.setVersionId(parseNillableString(node.path(AQDJSONConstants.VERSION_ID)));
    return inspireID;
}
Also used : Identifier(org.n52.shetland.inspire.base.Identifier)

Aggregations

Test (org.junit.Test)8 CodeType (org.n52.shetland.ogc.gml.CodeType)5 XmlObject (org.apache.xmlbeans.XmlObject)4 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)4 SmlIdentifier (org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)4 Identifier (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier)3 Identifier (org.n52.shetland.inspire.base.Identifier)3 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)3 URI (java.net.URI)2 Identification (net.opengis.sensorML.x101.IdentificationDocument.Identification)2 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)2 XmlString (org.apache.xmlbeans.XmlString)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 AddressRepresentation (org.n52.shetland.inspire.ad.AddressRepresentation)2 Contact (org.n52.shetland.inspire.base2.Contact)2 RelatedParty (org.n52.shetland.inspire.base2.RelatedParty)2