summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-11-20 15:34:27 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-11-20 15:34:27 +0100
commit96c0158b7acada5ade93743e1286e35eed33a3cf (patch)
treefb63490231d0a8c0e77283a9bb2db7b7194d7fc7
parent5a0c0125a8e21f87fa667c5ee33e52597d6b51ef (diff)
Recognized invalid place/name error messages
-rw-r--r--lib/Travel/Status/DE/VRR.pm15
-rw-r--r--t/in/essen_hb_invalid.xml80
2 files changed, 91 insertions, 4 deletions
diff --git a/lib/Travel/Status/DE/VRR.pm b/lib/Travel/Status/DE/VRR.pm
index ed97712..4617cbf 100644
--- a/lib/Travel/Status/DE/VRR.pm
+++ b/lib/Travel/Status/DE/VRR.pm
@@ -170,23 +170,30 @@ sub check_for_ambiguous {
return;
}
- if ( $e_place->getAttribute('state') eq 'list' ) {
+ my $s_place = $e_place->getAttribute('state');
+ my $s_name = $e_name->getAttribute('state');
+
+ if ( $s_place eq 'list' ) {
$self->{errstr} = sprintf(
'Ambiguous place input: %s',
join( q{ | },
map { decode( 'UTF-8', $_->textContent ) }
@{ $e_place->findnodes($xp_place_elem) } )
);
- return;
}
- if ( $e_name->getAttribute('state') eq 'list' ) {
+ if ( $s_name eq 'list' ) {
$self->{errstr} = sprintf(
'Ambiguous name input: %s',
join( q{ | },
map { decode( 'UTF-8', $_->textContent ) }
@{ $e_name->findnodes($xp_name_elem) } )
);
- return;
+ }
+ if ( $s_place eq 'notidentified' ) {
+ $self->{errstr} = 'invalid place parameter';
+ }
+ if ( $s_name eq 'notidentified' ) {
+ $self->{errstr} = 'invalid name parameter';
}
return;
diff --git a/t/in/essen_hb_invalid.xml b/t/in/essen_hb_invalid.xml
new file mode 100644
index 0000000..de7d10a
--- /dev/null
+++ b/t/in/essen_hb_invalid.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<itdRequest version="9.16.27.53" language="de" lengthUnit="METER" sessionID="efa2.vrr.de_46148296" client="libwww-perl/6.03" clientIP="87.147.17.185" serverID="efa2.vrr.de_" virtDir="vrr" now="2011-11-20T15:31:57" nowWD="1">
+ <itdLayoutParams>
+ <itdLayoutParam name="mdvMap2_dm" value="" />
+ <itdLayoutParam name="mapState_dm" value="" />
+ <itdLayoutParam name="mdvMap_dm" value="3406199:401077:NAV3" />
+ <itdLayoutParam name="view" value="" />
+ <itdLayoutParam name="id_dm" value=":dm" />
+ <itdLayoutParam name="transpCompany" value="vrr" />
+ </itdLayoutParams>
+ <itdDepartureMonitorRequest requestID="1">
+ <itdOdv type="stop" usage="dm">
+ <itdOdvPlace state="identified" method="itp">
+ <odvPlaceElem omc="5113000" placeID="18" value="5113000:18" span="0" type="remote" mainPlace="1">Essen</odvPlaceElem>
+ <odvPlaceInput>E</odvPlaceInput>
+ </itdOdvPlace>
+ <itdOdvName state="notidentified" method="itp">
+ <itdMessage type="error" module="BROKER" code="-2000">stop invalid</itdMessage>
+ <odvNameElem>Hbfoaei</odvNameElem>
+ <odvNameInput>Hbfoaei</odvNameInput>
+ </itdOdvName>
+ </itdOdv>
+ <itdDateTime ttpFrom="20110901" ttpTo="20120531">
+ <itdDate weekday="1" year="2011" month="11" day="20" />
+ <itdTime hour="15" minute="32" />
+ </itdDateTime>
+ <itdDateRange>
+ <itdDate day="20" month="11" year="2011" weekday="1" />
+ <itdDate day="21" month="11" year="2011" weekday="2" />
+ <itdDate day="22" month="11" year="2011" weekday="3" />
+ <itdDate day="23" month="11" year="2011" weekday="4" />
+ <itdDate day="24" month="11" year="2011" weekday="5" />
+ <itdDate day="25" month="11" year="2011" weekday="6" />
+ <itdDate day="26" month="11" year="2011" weekday="7" />
+ <itdDate day="27" month="11" year="2011" weekday="1" />
+ <itdDate day="28" month="11" year="2011" weekday="2" />
+ <itdDate day="29" month="11" year="2011" weekday="3" />
+ <itdDate day="30" month="11" year="2011" weekday="4" />
+ <itdDate day="01" month="12" year="2011" weekday="5" />
+ <itdDate day="02" month="12" year="2011" weekday="6" />
+ <itdDate day="03" month="12" year="2011" weekday="7" />
+ <itdDate day="04" month="12" year="2011" weekday="1" />
+ </itdDateRange>
+ <itdTripOptions>
+ <itdPtOptions>
+ <excludedMeans>
+ <meansElem value="0" selected="0">Zug</meansElem>
+ <meansElem value="1" selected="0">S-Bahn</meansElem>
+ <meansElem value="2" selected="0">U-Bahn</meansElem>
+ <meansElem value="3" selected="0">Stadtbahn</meansElem>
+ <meansElem value="4" selected="0">Straßen-/Trambahn</meansElem>
+ <meansElem value="5" selected="0">Stadtbus</meansElem>
+ <meansElem value="6" selected="0">Regionalbus</meansElem>
+ <meansElem value="7" selected="0">Schnellbus</meansElem>
+ <meansElem value="8" selected="0">Seil-/Zahnradbahn</meansElem>
+ <meansElem value="9" selected="0">Schiff</meansElem>
+ <meansElem value="10" selected="0">AST/Rufbus</meansElem>
+ <meansElem value="11" selected="0">Sonstige</meansElem>
+ </excludedMeans>
+ </itdPtOptions>
+ <itdItOptions>
+ <itRouter logASCII="false" logSVG="false" />
+ <itPedestrian computeMonomodalTrip="false" computationType="PT_AND_IT" itIncidentData="false" useElevation="false" speedFactor="100" costFactor="0" distanceFactor="50" traveltimeFactor="50" noTunnel="false" noBridge="false" noFerry="false" maxTime="20" maxLength="2147483647" ignoreRestrictions="false" />
+ <itBicycle preferAsphaltTracks="false" preferGreenTracks="false" usePseudoRouting="false" useSignedRoute="false" cycleSpeed="20" prefHikePath="false" elevFac="50" bikeProf="UNKNOWN" computeMonomodalTrip="false" computationType="PT_AND_IT" itIncidentData="false" useElevation="false" speedFactor="100" costFactor="0" distanceFactor="50" traveltimeFactor="50" noTunnel="false" noBridge="false" noFerry="false" maxTime="15" maxLength="2147483647" ignoreRestrictions="false" />
+ <mitCar computeMonomodalTrip="false" computationType="PT_AND_IT" itIncidentData="false" useElevation="false" speedFactor="100" costFactor="0" distanceFactor="10" traveltimeFactor="90" noTunnel="false" noBridge="false" noFerry="false" maxTime="90" maxLength="2147483647" ignoreRestrictions="false" mitProfileData="false" mitIncidentData="false" mitOnlineData="false" noHighway="false" noTollRoad="false" />
+ <departureTransport>
+ <individualTransport meansCode="100" value="8" speed="normal" selected="1" />
+ <individualTransport meansCode="101" value="15" speed="normal" selected="0" />
+ <individualTransport meansCode="102" value="15" speed="normal" selected="0" />
+ <individualTransport meansCode="103" value="10" speed="normal" selected="0" />
+ <individualTransport meansCode="104" value="10" speed="normal" selected="0" />
+ <individualTransport meansCode="105" value="30" speed="normal" selected="0" />
+ <individualTransport meansCode="106" value="15" speed="normal" selected="0" />
+ <individualTransport meansCode="107" value="15" speed="normal" selected="0" />
+ </departureTransport>
+ </itdItOptions>
+ </itdTripOptions>
+ </itdDepartureMonitorRequest>
+</itdRequest>
+