-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Declarative schema from configuration file (#160)
- Loading branch information
1 parent
74b7474
commit da12fef
Showing
45 changed files
with
2,007 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
planetiler-core/src/test/java/com/onthegomap/planetiler/expression/ExpressionTestUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.onthegomap.planetiler.expression; | ||
|
||
import static com.onthegomap.planetiler.TestUtils.newPoint; | ||
|
||
import com.onthegomap.planetiler.reader.SimpleFeature; | ||
import com.onthegomap.planetiler.reader.SourceFeature; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ExpressionTestUtil { | ||
static SourceFeature featureWithTags(String... tags) { | ||
Map<String, Object> map = new HashMap<>(); | ||
for (int i = 0; i < tags.length; i += 2) { | ||
map.put(tags[i], tags[i + 1]); | ||
} | ||
return SimpleFeature.create(newPoint(0, 0), map); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
planetiler-core/src/test/java/com/onthegomap/planetiler/geo/GeometryTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.onthegomap.planetiler.geo; | ||
|
||
import static java.util.Collections.emptyList; | ||
|
||
import com.onthegomap.planetiler.TestUtils; | ||
import com.onthegomap.planetiler.reader.SimpleFeature; | ||
import java.util.Map; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class GeometryTypeTest { | ||
|
||
@Test | ||
void testGeometryFactory() throws Exception { | ||
Map<String, Object> tags = Map.of("key1", "value1"); | ||
|
||
var line = | ||
SimpleFeature.createFakeOsmFeature(TestUtils.newLineString(0, 0, 1, 0, 1, 1), tags, "osm", null, 1, emptyList()); | ||
var point = | ||
SimpleFeature.createFakeOsmFeature(TestUtils.newPoint(0, 0), tags, "osm", null, 1, emptyList()); | ||
var poly = | ||
SimpleFeature.createFakeOsmFeature(TestUtils.newPolygon(0, 0, 1, 0, 1, 1, 0, 0), tags, "osm", null, 1, | ||
emptyList()); | ||
|
||
Assertions.assertTrue(GeometryType.LINE.featureTest().evaluate(line)); | ||
Assertions.assertFalse(GeometryType.LINE.featureTest().evaluate(point)); | ||
Assertions.assertFalse(GeometryType.LINE.featureTest().evaluate(poly)); | ||
|
||
Assertions.assertFalse(GeometryType.POINT.featureTest().evaluate(line)); | ||
Assertions.assertTrue(GeometryType.POINT.featureTest().evaluate(point)); | ||
Assertions.assertFalse(GeometryType.POINT.featureTest().evaluate(poly)); | ||
|
||
Assertions.assertFalse(GeometryType.POLYGON.featureTest().evaluate(line)); | ||
Assertions.assertFalse(GeometryType.POLYGON.featureTest().evaluate(point)); | ||
Assertions.assertTrue(GeometryType.POLYGON.featureTest().evaluate(poly)); | ||
|
||
Assertions.assertThrows(Exception.class, () -> GeometryType.UNKNOWN.featureTest().evaluate(point)); | ||
Assertions.assertThrows(Exception.class, () -> GeometryType.UNKNOWN.featureTest().evaluate(line)); | ||
Assertions.assertThrows(Exception.class, () -> GeometryType.UNKNOWN.featureTest().evaluate(poly)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.mbtiles |
Oops, something went wrong.