diff --git a/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java b/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java index aa01b0a..ca91420 100644 --- a/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java +++ b/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java @@ -251,6 +251,7 @@ public class StdTestObjectTypes { WMTS_TOT.setId(WMTS_ID); WMTS_TOT.setParent(WEB_SERVICE_TOT); WMTS_TOT.setDescription("A web service implementing the OGC Web Map Tile Service standard."); + WMTS_TOT.setUriDetectionExpression("\\/wmts\\?|service=wmts"); put(WMTS_ID, WMTS_TOT); } { @@ -262,6 +263,8 @@ public class StdTestObjectTypes { + "namespace-uri() = 'http://www.opengis.net/wmts/1.0'])", ExpressionType.XPATH); WMTS_1_0_TOT.setLabelExpression(owsLabelExpression, ExpressionType.XPATH); WMTS_1_0_TOT.setDescriptionExpression(owsDescriptionExpression, ExpressionType.XPATH); + WMTS_1_0_TOT.setDefaultPathAndQuery("?request=GetCapabilities&service=WMTS"); + WMTS_1_0_TOT.setUriDetectionExpression("(service=wmts.*version=1\\.1\\.)|(version=1\\.1\\..*service=wmts)"); put(WMTS_1_0_ID, WMTS_1_0_TOT); } { diff --git a/src/test/java/StdTestObjectTypeDetectorTest.java b/src/test/java/StdTestObjectTypeDetectorTest.java index 13936c0..3ca159d 100644 --- a/src/test/java/StdTestObjectTypeDetectorTest.java +++ b/src/test/java/StdTestObjectTypeDetectorTest.java @@ -263,5 +263,44 @@ public void test24_incompatibleTypes() throws URISyntaxException, IOException, T } fail("Exception expected"); } + + @Test + public void test25_wmtsNoParameter() throws URISyntaxException, IOException, TestObjectTypeNotDetected, + ObjectWithIdNotFoundException, IncompatibleTestObjectTypeException { + // Assert detected WMTS without parameters + try { + final DetectedTestObjectType detectedType = TestObjectTypeDetectorManager.detect( + Resource.create("test", + new URI("http://www.ign.es/wmts/pnoa-ma")), + TestObjectTypeDetectorManager.getTypes("ae35f7cd-86d9-475a-aa3a-e0bfbda2bb5f").keySet()); + + assertNotNull(detectedType); + assertEquals("ae35f7cd-86d9-475a-aa3a-e0bfbda2bb5f", detectedType.getId().toString()); + assertEquals("380b969c-215e-46f8-a4e9-16f002f7d6c3", detectedType.getParent().getId().toString()); + + }catch (IncompatibleTestObjectTypeException e) { + fail("Not an WMTS URL provided"); + } + + } + + @Test + public void test26_wmtsIncompatibleType() throws URISyntaxException, IOException, TestObjectTypeNotDetected, + ObjectWithIdNotFoundException, IncompatibleTestObjectTypeException { + // Expecting WMS 1.3.0 but provide WMTS 1.0 URL + try { + final DetectedTestObjectType detectedType = TestObjectTypeDetectorManager.detect( + Resource.create("test", + new URI("http://www.ign.es/wmts/pnoa-ma")), + // Expect WMS 1.3.0 + TestObjectTypeDetectorManager.getTypes("9981e87e-d642-43b3-ad5f-e77469075e74").keySet()); + + }catch (IncompatibleTestObjectTypeException e) { + assertEquals("ae35f7cd-86d9-475a-aa3a-e0bfbda2bb5f", + e.getDetectedTestObjectType().getId().getId()); + return; + } + fail("Exception expected"); + } }