Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Nov 15, 2023
1 parent 2564de6 commit 671d9de
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.apache.baremaps.openstreetmap.model.State;

/**
* Utility class for reading OSM state files.
* This code has been adapted from pyosmium (BSD 2-Clause "Simplified" License).
* Utility class for reading OSM state files. This code has been adapted from pyosmium (BSD 2-Clause
* "Simplified" License).
*/
public class StateReader {

Expand Down Expand Up @@ -180,8 +180,4 @@ public static URL resolve(String replicationUrl, Long sequenceNumber, String ext
return URI.create(uri).toURL();
}

public static void main(String... args) throws MalformedURLException {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static void execute(DataMap<Long, Coordinate> coordinateMap,
replicationUrl = header.getReplicationUrl();
}

var stateReader = new StateReader("https://planet.osm.org/replication/hour", true);
var stateReader = new StateReader(replicationUrl, true);
var sequenceNumber = header.getReplicationSequenceNumber();

// If the replicationTimestamp is not provided, guess it from the replication timestamp.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you 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.openstreetmap.state;

import org.junit.Ignore;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

import java.time.LocalDateTime;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.Ignore;
import org.junit.jupiter.api.Test;

class StateReaderTest {

Check notice

Code scanning / CodeQL

Unused classes and interfaces Note test

Unused class: StateReaderTest is not referenced within this codebase. If not used as an external API it should be removed.

@Test
@Ignore
void getStateFromTimestamp() {
var reader = new StateReader();
var state = reader.getStateFromTimestamp(LocalDateTime.now().minusDays(10));
System.out.println(state.get().getSequenceNumber());
}
}
@Test
@Ignore
void getStateFromTimestamp() {
var reader = new StateReader();
var state = reader.getStateFromTimestamp(LocalDateTime.now().minusDays(10));
System.out.println(state.get().getSequenceNumber());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void data() throws Exception {
ImportOsmPbf.execute(SIMPLE_DATA_OSM_PBF, coordinateMap, referenceMap, headerRepository,
nodeRepository, wayRepository, relationRepository, 3857);

headerRepository.put(new Header(0l, LocalDateTime.of(2020, 1, 1, 0, 0, 0, 0),
headerRepository.put(new Header(1l, LocalDateTime.of(2020, 1, 1, 0, 0, 0, 0),
"file:///" + SIMPLE_DATA_DIR, "", ""));

// Check node importation
Expand Down
2 changes: 2 additions & 0 deletions baremaps-core/src/test/resources/simple/state.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
timestamp=2020-01-01T00\:00\:00Z
sequenceNumber=2

0 comments on commit 671d9de

Please sign in to comment.