Search in sources :

Example 16 with CheckFlag

use of org.openstreetmap.atlas.checks.flag.CheckFlag in project atlas-checks by osmlab.

the class TagTest method testConfiguration.

/**
 * Private function used by all test cases to easily test the configuration instead of rewriting
 * the code constantly.
 *
 * @param config
 *            The {@link Configuration} is string form that is being test.
 * @param numberOfFlags
 *            The number of expected flags to be processed based on the provided configuration
 */
private void testConfiguration(final String config, final int numberOfFlags) {
    final Atlas atlas = setup.getAtlas();
    final Configuration configuration = ConfigurationResolver.inlineConfiguration(config);
    final List<CheckFlag> flags = Iterables.asList(new BaseTestCheck(configuration).flags(atlas));
    // will return the number of flags for the number of objects because no restrictions
    Assert.assertEquals(numberOfFlags, flags.size());
}
Also used : Atlas(org.openstreetmap.atlas.geography.atlas.Atlas) Configuration(org.openstreetmap.atlas.utilities.configuration.Configuration) CheckFlag(org.openstreetmap.atlas.checks.flag.CheckFlag) BaseTestCheck(org.openstreetmap.atlas.checks.base.checks.BaseTestCheck)

Example 17 with CheckFlag

use of org.openstreetmap.atlas.checks.flag.CheckFlag in project atlas-checks by osmlab.

the class CheckFlagGeoJsonProcessorTestRule method getCheckFlagEvent.

public CheckFlagEvent getCheckFlagEvent() {
    final CheckFlag flag = new CheckFlag("Test check flag");
    flag.addObject(Iterables.head(atlas.nodes()), "Flagged Node");
    flag.addObject(Iterables.head(atlas.edges()), "Flagged Edge");
    flag.addObject(Iterables.head(atlas.areas()), "Flagged Area");
    final CheckFlagEvent event = new CheckFlagEvent("sample-name", flag);
    event.getCheckFlag().addInstruction("First instruction");
    event.getCheckFlag().addInstruction("Second instruction");
    return event;
}
Also used : CheckFlag(org.openstreetmap.atlas.checks.flag.CheckFlag)

Aggregations

CheckFlag (org.openstreetmap.atlas.checks.flag.CheckFlag)17 Edge (org.openstreetmap.atlas.geography.atlas.items.Edge)6 HashSet (java.util.HashSet)4 List (java.util.List)4 Optional (java.util.Optional)4 Set (java.util.Set)4 Test (org.junit.Test)4 AtlasObject (org.openstreetmap.atlas.geography.atlas.items.AtlasObject)4 HighwayTag (org.openstreetmap.atlas.tags.HighwayTag)4 Configuration (org.openstreetmap.atlas.utilities.configuration.Configuration)4 Arrays (java.util.Arrays)3 BaseCheck (org.openstreetmap.atlas.checks.base.BaseCheck)3 Location (org.openstreetmap.atlas.geography.Location)3 Atlas (org.openstreetmap.atlas.geography.atlas.Atlas)3 Area (org.openstreetmap.atlas.geography.atlas.items.Area)3 Queue (java.util.Queue)2 Collectors (java.util.stream.Collectors)2 PierTestCheck (org.openstreetmap.atlas.checks.base.checks.PierTestCheck)2 PolyLine (org.openstreetmap.atlas.geography.PolyLine)2 Polygon (org.openstreetmap.atlas.geography.Polygon)2