Changeset 32822 in osm for applications/editors/josm/plugins/pt_assistant/test
- Timestamp:
- 2016-08-16T14:03:50+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant/test
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/test/data/stop-area-relations.osm
r32783 r32822 1 1 <?xml version='1.0' encoding='UTF-8'?> 2 2 <osm version='0.6' upload='true' generator='JOSM'> 3 <node id='- 60958' action='modify' visible='true' lat='12.12569675765' lon='-86.28455907163'>3 <node id='-55' action='modify' visible='true' lat='12.12569675765' lon='-86.28455907163'> 4 4 <tag k='bus' v='yes' /> 5 5 <tag k='public_transport' v='stop_position' /> 6 6 </node> 7 <node id='- 60960' action='modify' visible='true' lat='12.12574315765' lon='-86.28459437163'>7 <node id='-57' action='modify' visible='true' lat='12.12574315765' lon='-86.28459437163'> 8 8 <tag k='bus' v='yes' /> 9 9 <tag k='public_transport' v='platform' /> 10 10 </node> 11 <node id='- 60966' action='modify' visible='true' lat='12.12586275765' lon='-86.28635997163' />12 <node id='-6 0968' action='modify' visible='true' lat='12.12586605765' lon='-86.28641487163' />13 <node id='-6 0970' action='modify' visible='true' lat='12.12592805765' lon='-86.28729767163' />14 <node id='-6 0972' action='modify' visible='true' lat='12.12598865765' lon='-86.28844557163' />15 <node id='-6 0974' action='modify' visible='true' lat='12.12599975765' lon='-86.28875027163'>11 <node id='-59' action='modify' visible='true' lat='12.12586275765' lon='-86.28635997163' /> 12 <node id='-61' action='modify' visible='true' lat='12.12586605765' lon='-86.28641487163' /> 13 <node id='-63' action='modify' visible='true' lat='12.12592805765' lon='-86.28729767163' /> 14 <node id='-65' action='modify' visible='true' lat='12.12598865765' lon='-86.28844557163' /> 15 <node id='-67' action='modify' visible='true' lat='12.12599975765' lon='-86.28875027163'> 16 16 <tag k='highway' v='traffic_signals' /> 17 17 </node> 18 <node id='-6 0976' action='modify' visible='true' lat='12.12602745765' lon='-86.29081977163' />19 <node id='- 60978' action='modify' visible='true' lat='12.12603135765' lon='-86.29160537163' />20 <node id='- 60980' action='modify' visible='true' lat='12.12603245765' lon='-86.29184287163'>18 <node id='-69' action='modify' visible='true' lat='12.12602745765' lon='-86.29081977163' /> 19 <node id='-71' action='modify' visible='true' lat='12.12603135765' lon='-86.29160537163' /> 20 <node id='-73' action='modify' visible='true' lat='12.12603245765' lon='-86.29184287163'> 21 21 <tag k='highway' v='traffic_signals' /> 22 22 </node> 23 <node id='- 60997' action='modify' visible='true' lat='12.12605336295' lon='-86.29221374917'>23 <node id='-75' action='modify' visible='true' lat='12.12605336295' lon='-86.29221374917'> 24 24 <tag k='bus' v='yes' /> 25 25 <tag k='public_transport' v='stop_position' /> 26 26 </node> 27 <node id='- 61002' visible='true' lat='12.1261061435' lon='-86.2922353432'>27 <node id='-77' visible='true' lat='12.1261061435' lon='-86.2922353432'> 28 28 <tag k='bus' v='yes' /> 29 29 <tag k='public_transport' v='platform' /> 30 30 </node> 31 <way id='- 60982' action='modify' visible='true'>32 <nd ref='- 60958' />33 <nd ref='- 60966' />34 <nd ref='-6 0968' />35 <nd ref='-6 0970' />36 <nd ref='-6 0972' />37 <nd ref='-6 0974' />31 <way id='-79' action='modify' visible='true'> 32 <nd ref='-55' /> 33 <nd ref='-59' /> 34 <nd ref='-61' /> 35 <nd ref='-63' /> 36 <nd ref='-65' /> 37 <nd ref='-67' /> 38 38 <tag k='highway' v='primary' /> 39 39 <tag k='lanes' v='2' /> … … 43 43 <tag k='surface' v='asphalt' /> 44 44 </way> 45 <way id='- 63380' action='modify' visible='true'>46 <nd ref='-6 0974' />47 <nd ref='-6 0976' />48 <nd ref='- 60978' />49 <nd ref='- 60980' />50 <nd ref='- 60997' />45 <way id='-81' action='modify' visible='true'> 46 <nd ref='-67' /> 47 <nd ref='-69' /> 48 <nd ref='-71' /> 49 <nd ref='-73' /> 50 <nd ref='-75' /> 51 51 <tag k='highway' v='primary' /> 52 52 <tag k='lanes' v='2' /> … … 56 56 <tag k='surface' v='asphalt' /> 57 57 </way> 58 <relation id='- 60984' action='modify' visible='true'>59 <member type='node' ref='- 60958' role='stop' />60 <member type='node' ref='- 60960' role='platform' />58 <relation id='-83' action='modify' visible='true'> 59 <member type='node' ref='-55' role='stop' /> 60 <member type='node' ref='-57' role='platform' /> 61 61 <tag k='name' v='Rotonda El Periodista' /> 62 62 <tag k='public_transport' v='stop_area' /> … … 64 64 <tag k='type' v='public_transport' /> 65 65 </relation> 66 <relation id='- 60986' action='modify' visible='true'>67 <member type='node' ref='- 60958' role='stop' />68 <member type=' node' ref='-61002' role='platform' />69 <member type='way' ref='- 60982' role='' />70 <member type=' way' ref='-63380' role='' />66 <relation id='-85' action='modify' visible='true'> 67 <member type='node' ref='-55' role='stop' /> 68 <member type='way' ref='-79' role='' /> 69 <member type='way' ref='-81' role='' /> 70 <member type='node' ref='-75' role='stop' /> 71 71 <tag k='bus' v='yes' /> 72 72 <tag k='from' v='Cuesta el Plomo' /> … … 78 78 <tag k='type' v='route' /> 79 79 </relation> 80 <relation id='- 61332' action='modify' visible='true'>81 <member type='node' ref='- 60997' role='stop' />82 <member type='node' ref='- 61002' role='platform' />80 <relation id='-87' action='modify' visible='true'> 81 <member type='node' ref='-75' role='stop' /> 82 <member type='node' ref='-77' role='platform' /> 83 83 <tag k='name' v='Mercado Oriental' /> 84 84 <tag k='public_transport' v='stop_area' /> -
applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/StopCheckerTest.java
r32783 r32822 33 33 Assert.assertEquals(nodeChecker.getErrors().size(), 1); 34 34 Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(), 35 PTAssistantValidatorTest.ERROR_CODE_NO DE_PART_OF_STOP_AREA);35 PTAssistantValidatorTest.ERROR_CODE_NOT_PART_OF_STOP_AREA); 36 36 } 37 37 … … 39 39 40 40 @Test 41 public void stop PositionComparePlatformRelations() {41 public void stopAreaRelationsTest() { 42 42 43 43 // Check if stop positions belong the same routes as related platform(s) … … 46 46 DataSet ds = ImportUtils.importOsmFile(file, "testLayer"); 47 47 PTAssistantValidatorTest test = new PTAssistantValidatorTest(); 48 Node node= null;48 Relation stopArea = null; 49 49 50 for ( Node n: ds.getNodes()) {51 if ( n.hasTag("public_transport", "stop_position")) {52 node = n;50 for (Relation r : ds.getRelations()) { 51 if (r.hasTag("public_transport", "stop_area")) { 52 stopArea = r; 53 53 } 54 54 } 55 55 56 NodeChecker nodeChecker = new NodeChecker(node, test); 57 nodeChecker.performStopPositionComparePlatformRelations(); 58 Assert.assertEquals(nodeChecker.getErrors().size(), 1); 59 Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(), 60 PTAssistantValidatorTest.ERROR_CODE_STOP_POSITION_COMPARE_RELATIONS); 61 56 StopChecker stopChecker = new StopChecker(stopArea, test); 57 stopChecker.performStopAreaRelationsTest(); 58 Assert.assertEquals(stopChecker.getErrors().size(), 1); 59 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(), 60 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_COMPARE_RELATIONS); 62 61 } 63 62 … … 66 65 public void stopAreaStopPositionTest() { 67 66 68 // Check if stop area relation has one stop position. 67 // Check if stop area relation has at least one stop position. 69 68 70 69 File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_STOPS); … … 87 86 } 88 87 89 @Test90 public void stopAreaMultiStopPositionTest() {91 92 // Check if stop area relation has more than one stop position.93 94 File file = new File(AbstractTest.PATH_TO_STOP_AREA_MANY_STOPS);95 DataSet ds = ImportUtils.importOsmFile(file, "testLayer");96 PTAssistantValidatorTest test = new PTAssistantValidatorTest();97 Relation stopArea = null;98 99 for (Relation r : ds.getRelations()) {100 if (r.hasTag("public_transport", "stop_area")) {101 stopArea = r;102 }103 }104 105 StopChecker stopChecker = new StopChecker(stopArea, test);106 stopChecker.performStopAreaMultiStopPositionTest();107 Assert.assertEquals(stopChecker.getErrors().size(), 1);108 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),109 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_MANY_STOPS);110 111 }112 113 88 114 89 @Test 115 90 public void stopAreaPlatformTest() { 116 91 117 // Check if stop area relation has one platform. 92 // Check if stop area relation has at least one platform. 118 93 119 94 File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_PLATFORMS); … … 135 110 136 111 } 137 138 @Test139 public void stopAreaMultiPlatformTest() {140 141 // Check if stop area relation has more than one stop position.142 143 File file = new File(AbstractTest.PATH_TO_STOP_AREA_MANY_PLATFORMS);144 DataSet ds = ImportUtils.importOsmFile(file, "testLayer");145 PTAssistantValidatorTest test = new PTAssistantValidatorTest();146 Relation stopArea = null;147 148 for (Relation r : ds.getRelations()) {149 if (r.hasTag("public_transport", "stop_area")) {150 stopArea = r;151 }152 }153 154 StopChecker stopChecker = new StopChecker(stopArea, test);155 stopChecker.performStopAreaMultiPlatformTest();156 Assert.assertEquals(stopChecker.getErrors().size(), 1);157 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),158 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_MANY_PLATFORMS);159 160 }161 112 162 113 }
Note:
See TracChangeset
for help on using the changeset viewer.