-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve style source deserialization
- Loading branch information
Showing
6 changed files
with
304 additions
and
7 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
33 changes: 33 additions & 0 deletions
33
baremaps-core/src/test/java/org/apache/baremaps/config/ConfigReaderTest.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,33 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package org.apache.baremaps.config; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.io.IOException; | ||
import org.apache.baremaps.testing.TestFiles; | ||
import org.apache.baremaps.vectortile.style.Style; | ||
import org.junit.jupiter.api.Test; | ||
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
class ConfigReaderTest { | ||
Check notice Code scanning / CodeQL Unused classes and interfaces Note test
Unused class: ConfigReaderTest is not referenced within this codebase. If not used as an external API it should be removed.
|
||
|
||
@Test | ||
void readStyle() throws IOException { | ||
var config = new ConfigReader().read(TestFiles.STYLE_JS); | ||
var style = new ObjectMapper().readValue(config, Style.class); | ||
var source = style.getSources().get("mymap"); | ||
assertEquals("http://my.server.com/{z}/{y}/{x}.mvt", source.getTiles().get(0)); | ||
assertEquals(14, source.getMaxzoom()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
or implied. See the License for the specific language governing permissions and limitations under | ||
the License. | ||
**/ | ||
export default { | ||
"version": 8, | ||
"name": "MyMap", | ||
"center": [0, 0], | ||
"zoom": 10, | ||
"sources": { | ||
"mymap": { | ||
"type": "vector", | ||
"tiles": [ | ||
"http://my.server.com/{z}/{y}/{x}.mvt" | ||
], | ||
"maxzoom": 14, | ||
} | ||
}, | ||
}; |