Search in sources :

Example 1 with InspireLanguageISO6392B

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

the class InspireEncoderTest method getMinimalInspireExtendedCapabilities.

/*
     * xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
     * "http://inspire.ec.europa.eu/schemas/inspire_dls/1.0 http://inspire.ec.europa.eu/schemas/inspire_dls/1.0/inspire_dls.xsd"
     */
// 
// @BeforeClass
// public static void init() {
// Map<String, String> prefixes = new HashMap<String, String>();
// prefixes.put(InspireConstants.NS_INSPIRE_COMMON, InspireConstants.NS_INSPIRE_COMMON_PREFIX);
// prefixes.put(InspireConstants.NS_INSPIRE_DLS, InspireConstants.NS_INSPIRE_DLS_PREFIX);
// xmlOptions.setSaveSuggestedPrefixes(prefixes);
// xmlOptions.setSaveImplicitNamespaces(prefixes);
// xmlOptions.setSaveAggressiveNamespaces();
// xmlOptions.setSavePrettyPrint();
// xmlOptions.setSaveNamespacesFirst();
// xmlOptions.setCharacterEncoding("UTF-8");
// }
// 
// @Test
// public void enocodeMinimalInspireExtendedCapabilities() throws UnsupportedEncoderInputException,
// OwsExceptionReport, SAXException, IOException {
// InspireXmlEncoder inspireEncoder = new InspireXmlEncoder();
// validate(inspireEncoder.encode(getMinimalInspireExtendedCapabilities()));
// }
// 
// @Test
// public void enocodeFullIsnpireExtendedCapabilities() throws UnsupportedEncoderInputException, OwsExceptionReport,
// SAXException, IOException {
// InspireXmlEncoder inspireEncoder = new InspireXmlEncoder();
// validate(inspireEncoder.encode(getFullInspireExtendedCapabilities()));
// }
// 
// @Test
// public void valid_iso8601() {
// // date
// String datePattern = "\\d{4}-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])";
// String date = "2013-09-26";
// Assert.assertThat(Pattern.matches(datePattern, date), Matchers.is(true));
// // time
// String timePattern = "(T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?)?";
// String time_HH_MM_SS_S = "T12:49:41.740";
// Assert.assertThat(Pattern.matches(timePattern, time_HH_MM_SS_S), Matchers.is(true));
// String time_HH_MM_SS = "T12:49:41";
// Assert.assertThat(Pattern.matches(timePattern, time_HH_MM_SS), Matchers.is(true));
// // offset
// String offsetPattern = "(Z|[+|-](2[0-3]|[0-1][0-9]):([0-5][0-9]))?";
// String offset_PLUS_HH_MM = "+02:00";
// Assert.assertThat(Pattern.matches(offsetPattern, offset_PLUS_HH_MM), Matchers.is(true));
// String offset_MINUS_HH_MM = "-02:00";
// Assert.assertThat(Pattern.matches(offsetPattern, offset_MINUS_HH_MM), Matchers.is(true));
// String offset_Z = "Z";
// Assert.assertThat(Pattern.matches(offsetPattern, offset_Z), Matchers.is(true));
// // date time
// String dtPattern = datePattern + timePattern;
// Assert.assertThat(Pattern.matches(dtPattern, date + time_HH_MM_SS_S), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtPattern, date + time_HH_MM_SS), Matchers.is(true));
// // date time offset
// String dtoPattern = dtPattern + offsetPattern;
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS_S + offset_PLUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS_S + offset_MINUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS_S + offset_Z), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS + offset_PLUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS + offset_MINUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS + offset_Z), Matchers.is(true));
// // valid patter for schema: \d{4}-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])(T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?)?(Z|[+|-](2[0-3]|[0-1][0-9]):([0-5][0-9]))?
// 
// //        String pattern =
// //                "\\d{4}-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])(T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?)?(Z|([+|-](2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9])?)?)?";
// //        Assert.assertThat(Pattern.matches(pattern, "2013-09-26T12:49:41.740+02:00"), Matchers.is(true));
// }
private MinimalInspireExtendedCapabilities getMinimalInspireExtendedCapabilities() {
    // --------------------
    InspireResourceLocator resourceLocator = new InspireResourceLocator("http://min.test.org/sos");
    resourceLocator.addMediaType(MediaTypes.APPLICATION_SOAP_XML);
    // --------------------
    InspireSupportedLanguages inspireSupportedLanguages = new InspireSupportedLanguages(InspireLanguageISO6392B.ENG);
    // --------------------
    InspireLanguageISO6392B responseLanguage = InspireLanguageISO6392B.ENG;
    // --------------------
    Set<InspireUniqueResourceIdentifier> spatialDataSetIdentifier = Sets.newHashSet();
    InspireUniqueResourceIdentifier iuri = new InspireUniqueResourceIdentifier("test");
    iuri.setNamespace("http://test.org");
    spatialDataSetIdentifier.add(iuri);
    // --------------------
    return new MinimalInspireExtendedCapabilities(resourceLocator, inspireSupportedLanguages, responseLanguage, spatialDataSetIdentifier, new InspireSupportedCRS("4326"));
}
Also used : InspireSupportedCRS(org.n52.shetland.inspire.InspireSupportedCRS) InspireUniqueResourceIdentifier(org.n52.shetland.inspire.InspireUniqueResourceIdentifier) InspireResourceLocator(org.n52.shetland.inspire.InspireResourceLocator) InspireLanguageISO6392B(org.n52.shetland.inspire.InspireLanguageISO6392B) InspireSupportedLanguages(org.n52.shetland.inspire.InspireSupportedLanguages) MinimalInspireExtendedCapabilities(org.n52.shetland.inspire.dls.MinimalInspireExtendedCapabilities)

Example 2 with InspireLanguageISO6392B

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

the class InspireEncoderTest method getFullInspireExtendedCapabilities.

private FullInspireExtendedCapabilities getFullInspireExtendedCapabilities() {
    InspireResourceLocator resourceLocator = new InspireResourceLocator("http://full.test.org/sos");
    resourceLocator.addMediaType(MediaTypes.APPLICATION_SOAP_XML);
    // -------------------
    InspireTemporalReference temporalReference = new InspireTemporalReference();
    temporalReference.setDateOfCreation(new InspireDateOfCreation(new DateTime()));
    temporalReference.setDateOfLastRevision(new InspireDateOfLastRevision(new DateTime()));
    temporalReference.addDateOfPublication(new InspireDateOfPublication(new DateTime()));
    temporalReference.addTemporalExtent(new TimeInstant(new DateTime()));
    temporalReference.addTemporalExtent(new TimePeriod(new DateTime(), new DateTime().plus(3456)));
    // -------------------
    InspireConformityCitation inspireConformityCitation = new InspireConformityCitation("Test", new InspireDateOfCreation(new DateTime()));
    InspireConformity conformity = new InspireConformity(inspireConformityCitation, InspireDegreeOfConformity.notEvaluated);
    // -------------------
    InspireMetadataPointOfContact inspireMetadataPointOfContact = new InspireMetadataPointOfContact("test", "test@test.te");
    // -------------------
    InspireOriginatingControlledVocabulary inspireOriginatingControlledVocabulary = new InspireOriginatingControlledVocabulary("Test", new InspireDateOfCreation(new DateTime()));
    InspireMandatoryKeyword inspireMandatoryKeyword = new InspireMandatoryKeyword(InspireMandatoryKeywordValue.humanServiceEditor, inspireOriginatingControlledVocabulary);
    // --------------------
    InspireSupportedLanguages inspireSupportedLanguages = new InspireSupportedLanguages(InspireLanguageISO6392B.ENG);
    // --------------------
    InspireLanguageISO6392B responseLanguage = InspireLanguageISO6392B.ENG;
    // --------------------
    InspireUniqueResourceIdentifier iuri = new InspireUniqueResourceIdentifier("test");
    iuri.setNamespace("http://test.org");
    // --------------------
    FullInspireExtendedCapabilities inspireExtendedCapabilities = new FullInspireExtendedCapabilities(resourceLocator, inspireSupportedLanguages, responseLanguage, iuri, new InspireSupportedCRS("4326"));
    inspireExtendedCapabilities.setResourceType(InspireServiceSpatialDataResourceType.service);
    inspireExtendedCapabilities.addKeyword(new InspireKeyword("test"));
    inspireExtendedCapabilities.addMandatoryKeyword(inspireMandatoryKeyword);
    // -------------------
    inspireExtendedCapabilities.setMetadataDate(new TimeInstant(new DateTime()));
    // -------------------
    inspireExtendedCapabilities.addMetadataPointOfContact(inspireMetadataPointOfContact);
    inspireExtendedCapabilities.addConformity(conformity);
    inspireExtendedCapabilities.addTemporalReference(temporalReference);
    return inspireExtendedCapabilities;
}
Also used : InspireOriginatingControlledVocabulary(org.n52.shetland.inspire.InspireOriginatingControlledVocabulary) InspireMetadataPointOfContact(org.n52.shetland.inspire.InspireMetadataPointOfContact) InspireUniqueResourceIdentifier(org.n52.shetland.inspire.InspireUniqueResourceIdentifier) TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) InspireTemporalReference(org.n52.shetland.inspire.InspireTemporalReference) InspireLanguageISO6392B(org.n52.shetland.inspire.InspireLanguageISO6392B) InspireConformityCitation(org.n52.shetland.inspire.InspireConformityCitation) InspireKeyword(org.n52.shetland.inspire.InspireKeyword) InspireConformity(org.n52.shetland.inspire.InspireConformity) DateTime(org.joda.time.DateTime) InspireSupportedCRS(org.n52.shetland.inspire.InspireSupportedCRS) InspireDateOfLastRevision(org.n52.shetland.inspire.InspireDateOfLastRevision) InspireMandatoryKeyword(org.n52.shetland.inspire.InspireMandatoryKeyword) InspireResourceLocator(org.n52.shetland.inspire.InspireResourceLocator) InspireDateOfPublication(org.n52.shetland.inspire.InspireDateOfPublication) InspireDateOfCreation(org.n52.shetland.inspire.InspireDateOfCreation) InspireSupportedLanguages(org.n52.shetland.inspire.InspireSupportedLanguages) FullInspireExtendedCapabilities(org.n52.shetland.inspire.dls.FullInspireExtendedCapabilities) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant)

Example 3 with InspireLanguageISO6392B

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

the class InspireXmlStreamWriter method writeSupportedLanguages.

/**
 * Write {@link InspireSupportedLanguages} to stream
 *
 * @param supportedLanguages
 *            {@link InspireSupportedLanguages} to write to stream
 * @param root
 *            indicator if this is a root element and namespaces should be
 *            added
 * @throws XMLStreamException
 *             If an error occurs when writing the object to stream
 */
private void writeSupportedLanguages(InspireSupportedLanguages supportedLanguages, boolean root) throws XMLStreamException {
    start(QN_SUPPORTED_LANGUAGES);
    writeInspireCommonNamespaces(root);
    writeDefaultLanguage(supportedLanguages.getDefaultLanguage());
    if (supportedLanguages.isSetSupportedLanguages()) {
        for (InspireLanguageISO6392B supportedLanguage : supportedLanguages.getSupportedLanguages()) {
            writeSupportedLanguage(supportedLanguage);
        }
    }
    end(QN_SUPPORTED_LANGUAGES);
}
Also used : InspireLanguageISO6392B(org.n52.shetland.inspire.InspireLanguageISO6392B)

Aggregations

InspireLanguageISO6392B (org.n52.shetland.inspire.InspireLanguageISO6392B)3 InspireResourceLocator (org.n52.shetland.inspire.InspireResourceLocator)2 InspireSupportedCRS (org.n52.shetland.inspire.InspireSupportedCRS)2 InspireSupportedLanguages (org.n52.shetland.inspire.InspireSupportedLanguages)2 InspireUniqueResourceIdentifier (org.n52.shetland.inspire.InspireUniqueResourceIdentifier)2 DateTime (org.joda.time.DateTime)1 InspireConformity (org.n52.shetland.inspire.InspireConformity)1 InspireConformityCitation (org.n52.shetland.inspire.InspireConformityCitation)1 InspireDateOfCreation (org.n52.shetland.inspire.InspireDateOfCreation)1 InspireDateOfLastRevision (org.n52.shetland.inspire.InspireDateOfLastRevision)1 InspireDateOfPublication (org.n52.shetland.inspire.InspireDateOfPublication)1 InspireKeyword (org.n52.shetland.inspire.InspireKeyword)1 InspireMandatoryKeyword (org.n52.shetland.inspire.InspireMandatoryKeyword)1 InspireMetadataPointOfContact (org.n52.shetland.inspire.InspireMetadataPointOfContact)1 InspireOriginatingControlledVocabulary (org.n52.shetland.inspire.InspireOriginatingControlledVocabulary)1 InspireTemporalReference (org.n52.shetland.inspire.InspireTemporalReference)1 FullInspireExtendedCapabilities (org.n52.shetland.inspire.dls.FullInspireExtendedCapabilities)1 MinimalInspireExtendedCapabilities (org.n52.shetland.inspire.dls.MinimalInspireExtendedCapabilities)1 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)1 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)1