1414import java .nio .file .Path ;
1515import java .util .Date ;
1616import java .util .List ;
17+ import java .util .Map ;
1718
1819import static net .javacrumbs .jsonunit .assertj .JsonAssertions .assertThatJson ;
1920
@@ -31,6 +32,7 @@ class ApiIntegrationTest extends ApiBaseTester {
3132 @ BeforeAll
3233 void setUp (@ TempDir Path dataDirectory ) throws Exception {
3334 getProperties ().setSupportGeometries (true );
35+ getProperties ().setExtraTags (List .of ("ALL" ));
3436 getProperties ().setImportDate (TEST_DATE );
3537 setUpES (dataDirectory );
3638 Importer instance = makeImporter ();
@@ -60,6 +62,20 @@ void setUp(@TempDir Path dataDirectory) throws Exception {
6062 .geometry (makeDocGeometry ("LINESTRING (30 10, 10 30, 40 40)" ))
6163 .names (makeDocNames ("name" , "berlin" ))
6264 ));
65+ instance .add (List .of (new PhotonDoc ()
66+ .placeId ("5100" ).osmType ("N" ).osmId (105100 ).tagKey ("highway" ).tagValue ("bus_stop" )
67+ .categories (List .of ("osm.highway.bus_stop" ))
68+ .importance (0.3 ).addressType (AddressType .HOUSE )
69+ .centroid (makePoint (12.5 , -44.345 ))
70+ .names (makeDocNames ("name" , "MyBusStop" ))
71+ .extraTags (Map .of (
72+ "number" , 56.7 ,
73+ "boolean" , true ,
74+ "array" , List .of (1 , 2 , 3 ),
75+ "object" , Map .of ("foo" , "bar" ),
76+ "string" , "Foo"
77+ ))
78+ ));
6379
6480 instance .finish ();
6581 refresh ();
@@ -98,6 +114,22 @@ void testApi(String osmValue, String url) throws Exception {
98114 .containsEntry ("name" , "berlin" );
99115 }
100116
117+ @ Test
118+ void testComplexExtratags () throws Exception {
119+ assertThatJson (readURL ("/api?q=MyBusStop" )).isObject ()
120+ .node ("features" ).isArray ().hasSize (1 )
121+ .element (0 ).isObject ()
122+ .node ("properties" ).isObject ()
123+ .node ("extra" ).isObject ()
124+ .hasSize (5 )
125+ .containsEntry ("number" , 56.7 )
126+ .containsEntry ("boolean" , true )
127+ .containsEntry ("object" , Map .of ("foo" , "bar" ))
128+ .containsEntry ("string" , "Foo" )
129+ .node ("array" ).isArray ()
130+ .containsExactly (1 , 2 , 3 );
131+ }
132+
101133 @ Test
102134 void testApiStatus () throws Exception {
103135 assertThatJson (readURL ("/status" )).isObject ()
0 commit comments