-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#218 Updated EVO, Updated referencing update
- Loading branch information
Showing
15 changed files
with
179 additions
and
17 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
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/org/sc/data/entity/mapper/TrailCodeMapper.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,19 @@ | ||
package org.sc.data.entity.mapper; | ||
|
||
import org.bson.Document; | ||
import org.sc.data.model.Trail; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class TrailCodeMapper implements Mapper<String> { | ||
|
||
@Override | ||
public String mapToObject(Document document) { | ||
return document.getString(Trail.CODE); | ||
} | ||
|
||
@Override | ||
public Document mapToDocument(String object) { | ||
throw new IllegalStateException(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package org.sc.service | ||
|
||
import org.sc.manager.PlaceManager | ||
import org.sc.manager.TrailManager | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class PlaceService @Autowired constructor(private val placeManager: PlaceManager) { | ||
|
||
class PlaceService @Autowired constructor(private val placeManager: PlaceManager, | ||
private val trailManager: TrailManager) { | ||
|
||
|
||
} |
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
72 changes: 72 additions & 0 deletions
72
backend/src/test/java/org/sc/integration/CrosswayIntegrationTest.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,72 @@ | ||
package org.sc.integration; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.sc.common.rest.PlaceDto; | ||
import org.sc.common.rest.TrailImportDto; | ||
import org.sc.common.rest.response.PlaceResponse; | ||
import org.sc.common.rest.response.TrailResponse; | ||
import org.sc.configuration.DataSource; | ||
import org.sc.controller.PlaceController; | ||
import org.sc.controller.TrailController; | ||
import org.sc.controller.admin.AdminPlaceController; | ||
import org.sc.controller.admin.AdminTrailController; | ||
import org.sc.controller.admin.AdminTrailImporterController; | ||
import org.sc.processor.TrailSimplifierLevel; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest | ||
@ActiveProfiles("test") | ||
public class CrosswayIntegrationTest extends ImportTrailIT { | ||
|
||
public static final String LEVEL = TrailSimplifierLevel.FULL.toString(); | ||
public static final int TWELVE_SECONDS = 12000; | ||
|
||
@Autowired | ||
private DataSource dataSource; | ||
|
||
@Autowired private AdminPlaceController adminPlaceController; | ||
@Autowired private PlaceController placeController; | ||
@Autowired private AdminTrailController adminTrailController; | ||
@Autowired private TrailController trailController; | ||
|
||
private PlaceResponse addedPlace; | ||
private TrailResponse importedTrail; | ||
|
||
@Before | ||
public void setUp() { | ||
IntegrationUtils.clearCollections(dataSource); | ||
importedTrail = adminTrailController.importTrail(TrailImportRestIntegrationTest.createThreePointsTrailImportWithNoCrossways(adminPlaceController)); | ||
|
||
addedPlace = adminPlaceController.create(getPlaceWithCrosswayTrail(Arrays.asList( | ||
importedTrail.getContent().stream().findFirst().get().getId() | ||
))); | ||
} | ||
|
||
@Test | ||
public void shouldCheckOneAutoUpdateCrosswayNameWithOneTrailCrossingPlace() { | ||
PlaceResponse placeResponse = placeController.get(addedPlace.getContent().get(0).getId()); | ||
final PlaceDto result = placeResponse.getContent().stream().findFirst().get(); | ||
|
||
assertThat(result.getName()).isEqualTo(PLACE_NAME); | ||
} | ||
|
||
|
||
private PlaceDto getPlaceWithCrosswayTrail(List<String> trailIdsCrossingPlace) { | ||
return new PlaceDto(null, PLACE_NAME, PLACE_EXPECTED_DESCRIPTION, | ||
TAGS, Collections.emptyList(), | ||
Collections.singletonList(INTERMEDIATE_COORDINATES_DTO), trailIdsCrossingPlace, | ||
true, null); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
db.getCollection("core.Place").updateMany({}, {$set : { "isDynamic": false}} ) | ||
db.getCollection("core.Place").updateMany({}, {$set : { "isDynamic": false}} ) | ||
db.getCollection("core.Trail").updateMany({}, {$set : { "locations.$[].isDynamic": false}} ) |