From 56a498f0f0161c3b4a7b27cfc3047d9082f97a5d Mon Sep 17 00:00:00 2001 From: Carlos Palma Date: Tue, 11 Jun 2019 18:58:06 +0200 Subject: [PATCH 1/3] Added checks on WMTS TestObjectType to replicate WMS functionality on StdTestObjectTypes.java Signed-off-by: Carlos Palma --- .../de/interactive_instruments/etf/StdTestObjectTypes.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java b/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java index aa01b0a..f85e7e2 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."); + WMS_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); } { From f486656b1e13758c9754759dd277a5021f59097d Mon Sep 17 00:00:00 2001 From: Carlos Palma Date: Mon, 2 Sep 2019 12:34:53 +0200 Subject: [PATCH 2/3] Added test25_wmtsNoParameter() and test26_wmtsIncompatibleType() on StdTestObjectTypeDetectorTest - Service tested: http://www.ign.es/wmts/pnoa-ma Signed-off-by: Carlos Palma --- .../java/StdTestObjectTypeDetectorTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) 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"); + } } From 3cd4a7c0868b765ea8a85665f566727e30888e7b Mon Sep 17 00:00:00 2001 From: Carlos Palma Date: Wed, 9 Oct 2019 12:09:36 +0200 Subject: [PATCH 3/3] Fixed typo on line 254 for WMTS setUriDetectionExpression Signed-off-by: Carlos Palma --- .../java/de/interactive_instruments/etf/StdTestObjectTypes.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java b/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java index f85e7e2..ca91420 100644 --- a/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java +++ b/src/main/java/de/interactive_instruments/etf/StdTestObjectTypes.java @@ -251,7 +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."); - WMS_TOT.setUriDetectionExpression("\\/wmts\\?|service=wmts"); + WMTS_TOT.setUriDetectionExpression("\\/wmts\\?|service=wmts"); put(WMTS_ID, WMTS_TOT); } {