Skip to content

Commit 9db252b

Browse files
author
Tristram Gräbener
committed
Frontend : gestion du max_duration
1 parent c690ad4 commit 9db252b

File tree

3 files changed

+77
-3
lines changed

3 files changed

+77
-3
lines changed

jmeter/api_tests.jmx

+75-1
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ eval('var resp = ' + prev.getResponseDataAsString());
13411341
<stringProp name="script">// On met le résultat dans une variable resp
13421342
eval(&apos;var resp = &apos; + prev.getResponseDataAsString());
13431343

1344-
if(!resp.ptref.stop_areas){
1344+
if(!resp.stop_areas){
13451345
AssertionResult.setFailureMessage(&quot;On a pas d&apos;attribut stop_areas&quot;) ;
13461346
AssertionResult.setFailure(true);
13471347
}</stringProp>
@@ -1437,6 +1437,80 @@ AssertionResult.setFailure(true);
14371437
</BSFAssertion>
14381438
<hashTree/>
14391439
</hashTree>
1440+
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Journeys with max duration" enabled="true">
1441+
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
1442+
<collectionProp name="Arguments.arguments">
1443+
<elementProp name="origin" elementType="HTTPArgument">
1444+
<boolProp name="HTTPArgument.always_encode">false</boolProp>
1445+
<stringProp name="Argument.value">stop_area:ABDU</stringProp>
1446+
<stringProp name="Argument.metadata">=</stringProp>
1447+
<boolProp name="HTTPArgument.use_equals">true</boolProp>
1448+
<stringProp name="Argument.name">origin</stringProp>
1449+
</elementProp>
1450+
<elementProp name="datetime" elementType="HTTPArgument">
1451+
<boolProp name="HTTPArgument.always_encode">false</boolProp>
1452+
<stringProp name="Argument.value">20121002T08000</stringProp>
1453+
<stringProp name="Argument.metadata">=</stringProp>
1454+
<boolProp name="HTTPArgument.use_equals">true</boolProp>
1455+
<stringProp name="Argument.name">datetime</stringProp>
1456+
</elementProp>
1457+
<elementProp name="destination" elementType="HTTPArgument">
1458+
<boolProp name="HTTPArgument.always_encode">false</boolProp>
1459+
<stringProp name="Argument.value">stop_area:COMM</stringProp>
1460+
<stringProp name="Argument.metadata">=</stringProp>
1461+
<boolProp name="HTTPArgument.use_equals">true</boolProp>
1462+
<stringProp name="Argument.name">destination</stringProp>
1463+
</elementProp>
1464+
<elementProp name="max_duration" elementType="HTTPArgument">
1465+
<boolProp name="HTTPArgument.always_encode">false</boolProp>
1466+
<stringProp name="Argument.value">1300</stringProp>
1467+
<stringProp name="Argument.metadata">=</stringProp>
1468+
<boolProp name="HTTPArgument.use_equals">true</boolProp>
1469+
<stringProp name="Argument.name">max_duration</stringProp>
1470+
</elementProp>
1471+
</collectionProp>
1472+
</elementProp>
1473+
<stringProp name="HTTPSampler.domain"></stringProp>
1474+
<stringProp name="HTTPSampler.port"></stringProp>
1475+
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
1476+
<stringProp name="HTTPSampler.response_timeout"></stringProp>
1477+
<stringProp name="HTTPSampler.protocol"></stringProp>
1478+
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
1479+
<stringProp name="HTTPSampler.path">/v0/moo/journeys.json</stringProp>
1480+
<stringProp name="HTTPSampler.method">GET</stringProp>
1481+
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
1482+
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
1483+
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
1484+
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
1485+
<boolProp name="HTTPSampler.monitor">false</boolProp>
1486+
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
1487+
</HTTPSamplerProxy>
1488+
<hashTree>
1489+
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Headers Assertion" enabled="true">
1490+
<collectionProp name="Asserion.test_strings">
1491+
<stringProp name="2066544187">Content-Type: application/json</stringProp>
1492+
<stringProp name="1477249802">200 OK</stringProp>
1493+
</collectionProp>
1494+
<stringProp name="Assertion.test_field">Assertion.response_headers</stringProp>
1495+
<boolProp name="Assertion.assume_success">false</boolProp>
1496+
<intProp name="Assertion.test_type">2</intProp>
1497+
</ResponseAssertion>
1498+
<hashTree/>
1499+
<BSFAssertion guiclass="TestBeanGUI" testclass="BSFAssertion" testname="JSON Tests" enabled="true">
1500+
<stringProp name="filename"></stringProp>
1501+
<stringProp name="parameters"></stringProp>
1502+
<stringProp name="script">// On met le résultat dans une variable resp
1503+
eval(&apos;var resp = &apos; + prev.getResponseDataAsString());
1504+
1505+
if(resp.response_type != &apos;NO_SOLUTION&apos;){
1506+
AssertionResult.setFailureMessage(&quot;On a pas le bon response_type&quot;) ;
1507+
AssertionResult.setFailure(true);
1508+
}
1509+
</stringProp>
1510+
<stringProp name="scriptLanguage">javascript</stringProp>
1511+
</BSFAssertion>
1512+
<hashTree/>
1513+
</hashTree>
14401514
</hashTree>
14411515
</hashTree>
14421516
</hashTree>

source/frontend/apis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Arguments:
5959
"destination" : Argument("Destination Point" , entrypoint(), True, False, order = 1),
6060
"datetime" : Argument("The time from which you want to arrive (or arrive before depending on the value of clockwise)", datetime_validator, True, False, order = 2),
6161
"clockwise" : Argument("true if you want to have a journey that starts after datetime, false if you a journey that arrives before datetime", boolean, False, False, True, order = 3),
62-
"max_duration" : Argument("Maximum duratioon of the isochrone", int,
62+
"max_duration" : Argument("Maximum duration of the journey in seconds", int,
6363
False, False, order=4, defaultValue = 36000),
6464
"forbidden_uris[]" : Argument("Forbidden uris", str, False, True, ""),
6565
"walking_speed" : Argument("Walking speed in m/s", float, False, False, 1.38),

source/navitia/worker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pbnavitia::Response Worker::journeys(const pbnavitia::JourneysRequest &request,
235235
if(api != pbnavitia::ISOCHRONE){
236236
return routing::make_response(*calculateur, origin, destination, datetimes,
237237
request.clockwise(), request.streetnetwork_params().walking_speed(), request.streetnetwork_params().walking_distance(), /*request.wheelchair()*/false,
238-
forbidden, *street_network_worker);
238+
forbidden, *street_network_worker, request.max_duration());
239239
} else {
240240
return navitia::routing::make_isochrone(*calculateur, origin, request.datetimes(0),
241241
request.clockwise(), request.streetnetwork_params().walking_speed(), request.streetnetwork_params().walking_distance(), /*request.wheelchair()*/false,

0 commit comments

Comments
 (0)