Search in sources :

Example 1 with ProfileResolver

use of com.graphhopper.routing.ProfileResolver in project graphhopper by graphhopper.

the class LMProfileSelectorTest method assertLMProfileSelectionError.

private String assertLMProfileSelectionError(String expectedError, List<Profile> profiles, List<LMProfile> lmProfiles, String vehicle, String weighting, Boolean edgeBased, Integer uTurnCosts) {
    PMap hintsMap = createHintsMap(vehicle, weighting, edgeBased, uTurnCosts);
    try {
        new ProfileResolver(encodingManager, profiles, Collections.<CHProfile>emptyList(), lmProfiles).selectProfileLM(hintsMap);
        fail("There should have been an error");
        return "";
    } catch (IllegalArgumentException e) {
        assertTrue(e.getMessage().contains(expectedError), "There should have been an error message containing:\n'" + expectedError + "'\nbut was:\n'" + e.getMessage() + "'");
        return e.getMessage();
    }
}
Also used : CHProfile(com.graphhopper.config.CHProfile) ProfileResolver(com.graphhopper.routing.ProfileResolver) PMap(com.graphhopper.util.PMap)

Example 2 with ProfileResolver

use of com.graphhopper.routing.ProfileResolver in project graphhopper by graphhopper.

the class LMProfileSelectorTest method assertProfileFound.

private void assertProfileFound(Profile expectedProfile, List<Profile> profiles, List<LMProfile> lmProfiles, String vehicle, String weighting, Boolean edgeBased, Integer uTurnCosts) {
    PMap hintsMap = createHintsMap(vehicle, weighting, edgeBased, uTurnCosts);
    try {
        Profile selectedProfile = new ProfileResolver(encodingManager, profiles, Collections.<CHProfile>emptyList(), lmProfiles).selectProfileLM(hintsMap);
        assertEquals(expectedProfile, selectedProfile);
    } catch (IllegalArgumentException e) {
        fail("no profile found\nexpected: " + expectedProfile + "\nerror: " + e.getMessage());
    }
}
Also used : CHProfile(com.graphhopper.config.CHProfile) ProfileResolver(com.graphhopper.routing.ProfileResolver) PMap(com.graphhopper.util.PMap) CHProfile(com.graphhopper.config.CHProfile) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile)

Example 3 with ProfileResolver

use of com.graphhopper.routing.ProfileResolver in project graphhopper by graphhopper.

the class CHProfileSelectorTest method assertProfileFound.

private void assertProfileFound(Profile expectedProfile, List<Profile> profiles, List<CHProfile> chProfiles, String vehicle, String weighting, Boolean edgeBased, Integer uTurnCosts) {
    PMap hintsMap = createHintsMap(vehicle, weighting, edgeBased, uTurnCosts);
    try {
        Profile selectedProfile = new ProfileResolver(encodingManager, profiles, chProfiles, Collections.<LMProfile>emptyList()).selectProfileCH(hintsMap);
        assertEquals(expectedProfile, selectedProfile);
    } catch (IllegalArgumentException e) {
        fail("no profile found\nexpected: " + expectedProfile + "\nerror: " + e.getMessage());
    }
}
Also used : ProfileResolver(com.graphhopper.routing.ProfileResolver) PMap(com.graphhopper.util.PMap) LMProfile(com.graphhopper.config.LMProfile) CHProfile(com.graphhopper.config.CHProfile) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile)

Example 4 with ProfileResolver

use of com.graphhopper.routing.ProfileResolver in project graphhopper by graphhopper.

the class CHProfileSelectorTest method assertCHProfileSelectionError.

private String assertCHProfileSelectionError(String expectedError, List<Profile> profiles, List<CHProfile> chProfiles, String vehicle, String weighting, Boolean edgeBased, Integer uTurnCosts) {
    PMap hintsMap = createHintsMap(vehicle, weighting, edgeBased, uTurnCosts);
    try {
        new ProfileResolver(encodingManager, profiles, chProfiles, Collections.<LMProfile>emptyList()).selectProfileCH(hintsMap);
        fail("There should have been an error");
        return "";
    } catch (IllegalArgumentException e) {
        assertTrue(e.getMessage().contains(expectedError), "There should have been an error message containing:\n'" + expectedError + "'\nbut was:\n'" + e.getMessage() + "'");
        return e.getMessage();
    }
}
Also used : ProfileResolver(com.graphhopper.routing.ProfileResolver) PMap(com.graphhopper.util.PMap) LMProfile(com.graphhopper.config.LMProfile)

Aggregations

ProfileResolver (com.graphhopper.routing.ProfileResolver)4 PMap (com.graphhopper.util.PMap)4 CHProfile (com.graphhopper.config.CHProfile)3 LMProfile (com.graphhopper.config.LMProfile)3 Profile (com.graphhopper.config.Profile)2