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));
}
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));
}
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));
}
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);
}
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;
}
Aggregations